/* =========================================================
   karmabadge.com -- v2
   Palette: #fdf2e4 #fff8ee #2d1b0e #5c3d1e #d4a843 #b87333
            #2d8c5a #ff5733 #f5c842
   Fonts:   Poiret One, Nunito, Caveat
   ========================================================= */

:root {
    --warm-ground: #fdf2e4;
    --card-surface: #fff8ee;
    --ink: #2d1b0e;
    --stroke: #5c3d1e;
    --gold: #d4a843;
    --copper: #b87333;
    --emerald: #2d8c5a;
    --pop: #ff5733;
    --glow: #f5c842;
    --grid-gap: 16px;
    --card-pad: 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--warm-ground);
    color: var(--ink);
    font-family: 'Nunito', system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
}

body::before {
    /* paper-grain background */
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(212,168,67,0.08), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(184,115,51,0.08), transparent 45%),
        repeating-linear-gradient(0deg, rgba(92,61,30,0.018) 0 1px, transparent 1px 3px);
}

/* ---------- TYPE ---------- */
h1, h2, h3, .hero-text-karma, .stamp-text {
    font-family: 'Poiret One', 'Nunito', serif;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--ink);
}

p { font-size: clamp(15px, 1.5vw, 18px); }
strong { font-weight: 700; }

.hand-note,
.section-eyebrow,
.rarity-tag,
.karma-points,
.scroll-indicator-label,
.path-step-num,
.footer-mini {
    font-family: 'Caveat', 'Nunito', cursive;
    font-weight: 400;
    color: var(--stroke);
}

/* ---------- HERO ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 4vh 6vw 6vh;
    overflow: hidden;
}

.hero-aura {
    position: absolute;
    width: 90vmin;
    height: 90vmin;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,200,66,0.35), rgba(245,200,66,0) 65%);
    filter: blur(40px);
    z-index: 0;
    animation: aura-pulse 6s ease-in-out infinite;
}

@keyframes aura-pulse {
    0%, 100% { transform: scale(1);   opacity: 0.65; }
    50%      { transform: scale(1.08); opacity: 1; }
}

.hero-stage {
    position: relative;
    display: grid;
    place-items: center;
    gap: 28px;
    z-index: 1;
}

.hero-badge {
    width: clamp(280px, 60vmin, 560px);
    height: clamp(280px, 60vmin, 560px);
    transform-origin: 50% 50%;
    animation: tick-rotate 8s steps(8, end) infinite;
}

@keyframes tick-rotate {
    0%, 11% { transform: rotate(0deg); }
    12%, 23% { transform: rotate(45deg); }
    24%, 35% { transform: rotate(90deg); }
    36%, 47% { transform: rotate(135deg); }
    48%, 59% { transform: rotate(180deg); }
    60%, 71% { transform: rotate(225deg); }
    72%, 83% { transform: rotate(270deg); }
    84%, 95% { transform: rotate(315deg); }
    96%, 100% { transform: rotate(360deg); }
}

.hero-ring,
.hero-ring-inner {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 14 6 8 4;
    filter: url(#sketch);
    stroke-dashoffset: 1500;
    animation: draw-ring 1.4s ease-out forwards;
}

.hero-ring-inner {
    stroke-width: 2.4;
    stroke-dasharray: 8 4;
    animation-delay: 0.4s;
}

@keyframes draw-ring {
    to { stroke-dashoffset: 0; }
}

.hero-core {
    fill: url(#warmGrad);
    opacity: 0;
    animation: core-fade 600ms ease-out 0.8s forwards;
    filter: drop-shadow(0 4px 12px rgba(184,115,51,0.4));
}

@keyframes core-fade {
    from { opacity: 0; transform: scale(0.9); transform-origin: 50% 50%; }
    to   { opacity: 1; transform: scale(1); }
}

.hero-rays {
    stroke: var(--stroke);
    stroke-width: 5;
    stroke-linecap: round;
    opacity: 0;
    animation: rays-in 600ms ease-out 1.2s forwards;
}

@keyframes rays-in {
    from { opacity: 0; transform: scale(0.9); transform-origin: 50% 50%; }
    to   { opacity: 0.85; transform: scale(1); }
}

.hero-text-karma {
    font-size: 68px;
    fill: var(--ink);
    letter-spacing: 6px;
    opacity: 0;
    transform-origin: 300px 290px;
    animation: bounce-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 1.4s forwards;
}

.hero-text-domain {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    fill: var(--stroke);
    opacity: 0;
    animation: fade-up 600ms ease-out 1.9s forwards;
}

@keyframes bounce-in {
    0%   { opacity: 0; transform: scale(0.0); }
    60%  { opacity: 1; transform: scale(1.12); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hero-tagline {
    display: flex;
    gap: clamp(20px, 4vw, 56px);
    flex-wrap: wrap;
    justify-content: center;
}

.hero-tagline-line {
    font-family: 'Poiret One', serif;
    font-size: clamp(18px, 2.2vw, 26px);
    color: var(--stroke);
    letter-spacing: 0.18em;
    text-transform: lowercase;
    opacity: 0;
    transform: translateY(12px);
    animation: fade-up 700ms ease-out forwards;
}
.hero-tagline-line:nth-child(1) { animation-delay: 2.2s; }
.hero-tagline-line:nth-child(2) { animation-delay: 2.4s; }
.hero-tagline-line:nth-child(3) { animation-delay: 2.6s; }

.scroll-indicator {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    animation: fade-up 600ms ease-out 3s forwards;
    z-index: 2;
}

.scroll-indicator svg {
    width: 36px;
    height: 48px;
    animation: bob 1.8s ease-in-out infinite;
}

.scroll-indicator svg path {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 3;
    stroke-linecap: round;
}

.scroll-indicator-label { font-size: 18px; }

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(8px); }
}

/* ---------- SECTIONS (shared) ---------- */
section {
    padding: clamp(60px, 10vh, 120px) clamp(20px, 6vw, 80px);
    position: relative;
}

.section-header {
    max-width: 880px;
    margin: 0 auto clamp(40px, 6vh, 64px);
    text-align: center;
}

.section-eyebrow {
    display: inline-block;
    font-size: 22px;
    margin-bottom: 8px;
    transform: rotate(-2deg);
}

.section-title {
    font-size: clamp(36px, 5.4vw, 64px);
    line-height: 1.1;
    margin-bottom: 12px;
}

.section-sub {
    color: var(--stroke);
    font-style: italic;
    max-width: 60ch;
    margin: 0 auto;
}

/* ---------- BADGE COLLECTION ---------- */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(180px, auto);
    gap: var(--grid-gap);
    max-width: 1200px;
    margin: 0 auto;
}

.badge {
    grid-column: var(--cell-col);
    grid-row: var(--cell-row);
    background: var(--card-surface);
    border-radius: 18px;
    padding: var(--card-pad);
    position: relative;
    overflow: hidden;
    transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 360ms ease;
    box-shadow:
        0 1px 0 rgba(92,61,30,0.18),
        0 6px 18px rgba(92,61,30,0.10);
    opacity: 0;
    filter: blur(8px);
    transform: translateY(12px);
}

.badge.in-view {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
    transition:
        opacity 500ms ease,
        filter 500ms ease,
        transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 360ms ease;
}

.badge::before {
    /* sketched border */
    content: "";
    position: absolute;
    inset: 6px;
    border: 2px dashed var(--stroke);
    border-radius: 14px;
    opacity: 0.55;
    pointer-events: none;
    filter: url(#sketch);
}

.badge::after {
    /* dopamine flash overlay */
    content: "";
    position: absolute;
    inset: 0;
    background: var(--pop);
    opacity: 0;
    pointer-events: none;
    border-radius: 18px;
}

.badge.flash::after {
    animation: flash-pop 360ms ease-out;
}

@keyframes flash-pop {
    0%   { opacity: 0; }
    25%  { opacity: 0.18; }
    100% { opacity: 0; }
}

.badge:hover {
    transform: translateY(-4px) rotate(-0.4deg);
    box-shadow:
        0 1px 0 rgba(92,61,30,0.18),
        0 14px 30px rgba(92,61,30,0.18);
}

.badge-face {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    position: relative;
    z-index: 1;
}

.badge-art {
    width: 100%;
    height: auto;
    max-height: 180px;
    align-self: center;
}

.badge-art.tall {
    max-height: 260px;
}

.b-ring {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 10 4 6 3;
    filter: url(#sketch);
}

.b-ring.inner {
    stroke-width: 1.6;
    stroke-dasharray: 4 3;
    opacity: 0.7;
}

.b-core {
    fill: url(#warmGrad);
    filter: drop-shadow(0 2px 6px rgba(184,115,51,0.3));
}

.b-icon {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.b-icon path,
.b-icon circle,
.b-icon line {
    stroke: var(--stroke);
    fill: rgba(45, 27, 14, 0.05);
}

.badge[data-rarity="legendary"] .b-core {
    fill: url(#warmGrad);
}

.badge[data-rarity="legendary"] .b-ring.outer {
    stroke: var(--gold);
    stroke-width: 4;
}

.badge[data-rarity="legendary"]::before {
    border-color: var(--gold);
    animation: legendary-glow 2.4s ease-in-out infinite;
}

@keyframes legendary-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,200,66,0); }
    50%      { box-shadow: 0 0 22px 6px rgba(245,200,66,0.45); }
}

.badge[data-rarity="rare"] .b-ring.outer {
    stroke: var(--emerald);
}

.badge[data-rarity="rare"] .karma-points { color: var(--emerald); }

.badge[data-rarity="uncommon"] .b-ring.outer { stroke: var(--copper); }

.badge[data-rarity="common"] .b-ring.outer  { stroke: var(--stroke); opacity: 0.85; }

.badge-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rarity-tag {
    display: inline-block;
    align-self: flex-start;
    padding: 0 8px;
    font-size: 16px;
    background: rgba(245,200,66,0.18);
    border-radius: 999px;
    transform: rotate(-1.2deg);
}

.badge[data-rarity="legendary"] .rarity-tag { background: rgba(255,87,51,0.18); color: var(--pop); }
.badge[data-rarity="rare"]      .rarity-tag { background: rgba(45,140,90,0.16);  color: var(--emerald); }

.badge-name {
    font-size: clamp(22px, 2.2vw, 30px);
    line-height: 1.15;
}

.badge-desc {
    font-size: 15px;
    color: rgba(45,27,14,0.85);
}

.karma-points {
    font-size: 20px;
    margin-top: 6px;
}

/* ---------- KARMA PATH ---------- */
.karma-path {
    background: linear-gradient(180deg, var(--warm-ground) 0%, #f7e6cc 100%);
}

.path-stage {
    max-width: 920px;
    margin: 0 auto;
}

.path-steps {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.path-step {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--card-surface);
    border-radius: 22px;
    box-shadow: 0 4px 14px rgba(92,61,30,0.08);
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

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

.path-step:nth-child(odd)  { justify-self: start; max-width: 70%; transform-origin: left center; }
.path-step:nth-child(odd) { transform: translateY(20px) rotate(-0.6deg); }
.path-step:nth-child(odd).in-view { transform: translateY(0) rotate(-0.6deg); }
.path-step:nth-child(5n+5),
.path-step:nth-child(7n+7) { justify-self: end; }

.path-step:nth-child(7) { /* step 4 (after arrows) */ }

.path-step[data-step="2"] { justify-self: end; max-width: 70%; transform: translateY(20px) rotate(0.5deg); }
.path-step[data-step="2"].in-view { transform: translateY(0) rotate(0.5deg); }
.path-step[data-step="3"] { max-width: 70%; }
.path-step[data-step="4"] { justify-self: end; max-width: 70%; transform: translateY(20px) rotate(0.7deg); }
.path-step[data-step="4"].in-view { transform: translateY(0) rotate(0.7deg); }

.path-step-circle {
    position: relative;
    display: grid;
    place-items: center;
}

.path-step-circle svg {
    width: 110px;
    height: 110px;
}

.ps-ring {
    fill: var(--gold);
    stroke: var(--stroke);
    stroke-width: 3;
    stroke-dasharray: 10 4;
    filter: url(#sketch);
}

.ps-icon {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.path-step-num {
    position: absolute;
    top: -10px;
    right: -8px;
    background: var(--pop);
    color: var(--card-surface);
    font-family: 'Caveat', cursive;
    font-size: 22px;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    transform: rotate(8deg);
    box-shadow: 0 2px 6px rgba(255,87,51,0.4);
}

.path-step-body h3 {
    font-size: clamp(22px, 2.4vw, 30px);
    margin-bottom: 4px;
}

.path-step-body p {
    color: var(--stroke);
}

.path-arrow {
    width: 180px;
    height: 110px;
    margin: -10px auto;
    display: block;
    align-self: center;
}

.path-arrow:nth-of-type(odd)  { transform: translateX(20%); }
.path-arrow:nth-of-type(even) { transform: translateX(-20%); }

.path-arrow path {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 3.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1100ms ease-out;
}

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

/* ---------- THE WALL ---------- */
.wall {
    background:
        radial-gradient(ellipse at center, var(--card-surface) 0%, var(--warm-ground) 70%);
}

.wall-mosaic {
    --tile: 44px;
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--tile));
    grid-auto-rows: var(--tile);
    gap: 10px;
    justify-content: center;
    max-width: 1100px;
    margin: 0 auto;
    perspective: 800px;
}

.wall-tile {
    width: var(--tile);
    height: var(--tile);
    border-radius: 50%;
    background: var(--card-surface);
    box-shadow:
        inset 0 0 0 2px var(--stroke),
        inset 0 0 0 4px var(--card-surface);
    display: grid;
    place-items: center;
    transition: filter 600ms ease, transform 600ms ease, opacity 600ms ease;
    will-change: filter, transform;
    position: relative;
}

.wall-tile::before {
    content: "";
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 1.5px var(--stroke);
}

.wall-tile.t-emerald::before  { background: var(--emerald); }
.wall-tile.t-copper::before   { background: var(--copper); }
.wall-tile.t-pop::before      { background: var(--pop); }
.wall-tile.t-gold::before     { background: var(--gold); }

.wall-foot {
    text-align: center;
    margin-top: 50px;
}

.hand-note {
    font-size: clamp(22px, 3vw, 34px);
    color: var(--stroke);
    transform: rotate(-1deg);
    display: inline-block;
}

/* ---------- FOOTER ---------- */
.site-footer {
    text-align: center;
    padding: 80px 24px 60px;
    background: var(--warm-ground);
    border-top: 2px dashed rgba(92,61,30,0.25);
}

.footer-stamp svg {
    width: 140px;
    height: 140px;
    margin-bottom: 16px;
    animation: tick-rotate 12s steps(8, end) infinite;
}

.stamp-ring {
    fill: none;
    stroke: var(--stroke);
    stroke-width: 3;
    stroke-dasharray: 10 4 6 3;
    filter: url(#sketch);
}
.stamp-ring.inner { stroke-width: 1.5; stroke-dasharray: 4 3; }

.stamp-text {
    font-size: 18px;
    fill: var(--ink);
    letter-spacing: 0.14em;
}

.footer-note {
    color: var(--stroke);
    font-size: 17px;
    margin-bottom: 6px;
}

.footer-mini {
    font-size: 18px;
    color: var(--stroke);
    transform: rotate(-1deg);
    display: inline-block;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 880px) {
    .badge-grid { grid-template-columns: repeat(2, 1fr); }
    .badge { grid-column: auto !important; grid-row: auto !important; }
    .badge[data-rarity="legendary"] { grid-column: span 2 !important; }

    .path-step,
    .path-step:nth-child(odd),
    .path-step[data-step="2"],
    .path-step[data-step="3"],
    .path-step[data-step="4"] {
        max-width: 100%;
        justify-self: stretch;
    }

    .path-arrow { transform: none !important; width: 120px; }
}

@media (max-width: 520px) {
    .badge-grid { grid-template-columns: 1fr; }
    .badge[data-rarity="legendary"] { grid-column: span 1 !important; }
    .hero-tagline { gap: 14px; }
    .path-step { grid-template-columns: 80px 1fr; }
    .path-step-circle svg { width: 80px; height: 80px; }
}
