/* ===== KARMABADGE.COM STYLES ===== */

/* --- Palette Reference ---
   Warm ground:      #fdf2e4
   Card surface:     #fff8ee
   Ink primary:      #2d1b0e
   Hand-drawn stroke:#5c3d1e
   Badge gold:       #d4a843
   Badge copper:     #b87333
   Badge emerald:    #2d8c5a
   Dopamine pop:     #ff5733
   Glow warm:        #f5c842
--- */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #fdf2e4;
    color: #2d1b0e;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, .badge-name, .section-heading, .step-title {
    font-family: 'Poiret One', cursive;
    font-weight: 400;
    letter-spacing: 0.04em;
}

.badge-points, .badge-category, .step-desc .micro {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 14px;
}

/* ===== HERO SECTION ===== */
.hero {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fdf2e4;
    position: relative;
}

.hero-badge-wrapper {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-badge-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: tickRotate 8s infinite linear;
    animation-play-state: paused;
}

.hero-badge-svg.rotating {
    animation-play-state: running;
}

/* Tick-tick rotation: pauses at each 90deg increment */
@keyframes tickRotate {
    0% { transform: rotate(0deg); }
    10.5% { transform: rotate(90deg); }
    12.5% { transform: rotate(90deg); }
    23% { transform: rotate(180deg); }
    25% { transform: rotate(180deg); }
    35.5% { transform: rotate(270deg); }
    37.5% { transform: rotate(270deg); }
    48% { transform: rotate(360deg); }
    50% { transform: rotate(360deg); }
    60.5% { transform: rotate(450deg); }
    62.5% { transform: rotate(450deg); }
    73% { transform: rotate(540deg); }
    75% { transform: rotate(540deg); }
    85.5% { transform: rotate(630deg); }
    87.5% { transform: rotate(630deg); }
    98% { transform: rotate(720deg); }
    100% { transform: rotate(720deg); }
}

.hero-circle-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    fill-opacity: 0;
    transition: fill-opacity 400ms ease;
}

.hero-circle-path.drawn {
    stroke-dashoffset: 0;
    fill-opacity: 1;
}

.hero-inner-circle {
    opacity: 0;
    transition: opacity 600ms ease 1.6s;
}

.hero-inner-circle.visible {
    opacity: 0.4;
}

.hero-text-overlay {
    position: relative;
    z-index: 2;
    text-align: center;
    pointer-events: none;
}

.hero-title {
    font-size: clamp(36px, 6vw, 72px);
    letter-spacing: 0.12em;
    color: #2d1b0e;
    opacity: 0;
    transform: scale(0);
    transition: opacity 500ms ease, transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-title.visible {
    opacity: 1;
    transform: scale(1);
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(14px, 2vw, 22px);
    color: #5c3d1e;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease 200ms, transform 500ms ease 200ms;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 500ms ease;
    animation: bobArrow 2s ease-in-out infinite;
}

.scroll-indicator.visible {
    opacity: 1;
}

@keyframes bobArrow {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

.scroll-arrow {
    display: block;
}

/* ===== BADGE COLLECTION SECTION ===== */
.badge-collection {
    padding: 80px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-heading {
    font-size: clamp(24px, 4vw, 48px);
    text-align: center;
    margin-bottom: 48px;
    color: #2d1b0e;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Card spans */
.span-1x1 {
    grid-column: span 1;
    grid-row: span 1;
}

.span-2x1 {
    grid-column: span 2;
    grid-row: span 1;
}

.span-1x2 {
    grid-column: span 1;
    grid-row: span 2;
}

/* Badge Card */
.badge-card {
    background-color: #fff8ee;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid #5c3d1e;
    border-style: dashed;
    opacity: 0;
    filter: blur(8px);
    transform: translateY(20px);
    transition: opacity 400ms ease, filter 400ms ease, transform 400ms ease;
}

.badge-card.entered {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

.badge-card.legendary {
    border-color: #d4a843;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(245, 200, 66, 0.3), 0 0 40px rgba(245, 200, 66, 0.1);
    animation: legendaryGlow 3s ease-in-out infinite alternate;
}

@keyframes legendaryGlow {
    0% { box-shadow: 0 0 20px rgba(245, 200, 66, 0.2), 0 0 40px rgba(245, 200, 66, 0.05); }
    100% { box-shadow: 0 0 30px rgba(245, 200, 66, 0.45), 0 0 60px rgba(245, 200, 66, 0.15); }
}

.badge-card.span-2x1 {
    flex-direction: row;
    text-align: left;
    gap: 20px;
}

.badge-card.span-1x2 .badge-icon-area {
    flex-shrink: 0;
}

/* Badge icon area */
.badge-icon-area {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.badge-card.span-2x1 .badge-icon-area {
    margin-bottom: 0;
    width: 120px;
    height: 120px;
}

.badge-icon-svg {
    width: 100%;
    height: 100%;
}

/* Badge info */
.badge-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badge-name {
    font-size: clamp(18px, 3vw, 28px);
    color: #2d1b0e;
}

.badge-desc {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(13px, 1.3vw, 16px);
    color: #5c3d1e;
    line-height: 1.5;
}

.badge-points {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: #2d8c5a;
    font-weight: 400;
    margin-top: 4px;
}

/* Dopamine flash overlay */
.dopamine-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ff5733;
    opacity: 0;
    pointer-events: none;
    border-radius: 12px;
    z-index: 10;
}

.dopamine-flash.flash {
    animation: dopamineFlash 100ms ease-out;
}

@keyframes dopamineFlash {
    0% { opacity: 0.1; }
    50% { opacity: 0.1; }
    100% { opacity: 0; }
}

/* Legendary outer wobble glow */
.legendary-outer {
    filter: drop-shadow(0 0 4px rgba(245, 200, 66, 0.5));
}

/* Badge copper accent border for hover */
.badge-card:hover {
    border-color: #b87333;
}

/* Glow warm highlight for legendary badge name */
.badge-card.legendary .badge-name {
    color: #b87333;
    text-shadow: 0 0 12px rgba(245, 200, 66, 0.3);
}

/* Section heading underline accent */
.section-heading {
    position: relative;
    display: inline-block;
}

.badge-collection .section-heading,
.karma-path .section-heading,
.the-wall .section-heading {
    display: block;
}

.section-heading::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background-color: #f5c842;
    margin: 12px auto 0;
    border-radius: 2px;
}

/* ===== KARMA PATH SECTION ===== */
.karma-path {
    padding: 80px 24px;
    max-width: 700px;
    margin: 0 auto;
}

.path-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.path-step {
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.path-step.visible {
    opacity: 1;
    transform: translateY(0);
}

.step-block {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #fff8ee;
    border: 2px dashed #5c3d1e;
    border-radius: 12px;
    padding: 20px 24px;
}

.step-icon {
    flex-shrink: 0;
}

.step-text {
    flex: 1;
}

.step-title {
    font-size: clamp(20px, 3vw, 32px);
    color: #2d1b0e;
    margin-bottom: 4px;
}

.step-desc {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(14px, 1.4vw, 17px);
    color: #5c3d1e;
    line-height: 1.55;
}

/* Path arrows */
.path-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
}

.arrow-svg {
    display: block;
}

.arrow-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 600ms ease;
}

.arrow-path.drawn {
    stroke-dashoffset: 0;
}

/* ===== THE WALL FOOTER ===== */
.the-wall {
    padding: 60px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.wall-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 20px;
}

.wall-mini-badge {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 300ms ease, transform 200ms ease;
}

.wall-mini-badge:hover {
    transform: scale(1.3);
    filter: blur(0) !important;
    z-index: 2;
}

.wall-mini-badge svg {
    width: 100%;
    height: 100%;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .span-2x1 {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .badge-grid {
        grid-template-columns: 1fr;
    }
    .span-2x1,
    .span-1x2 {
        grid-column: span 1;
        grid-row: span 1;
    }
    .badge-card.span-2x1 {
        flex-direction: column;
        text-align: center;
    }
    .badge-card.span-2x1 .badge-icon-area {
        margin-bottom: 12px;
    }
    .hero-badge-wrapper {
        width: 220px;
        height: 220px;
    }
    .step-block {
        flex-direction: column;
        text-align: center;
    }
}
