/* karmabadge.com — Dopamine-Neon City */

:root {
    --void-base: #0D0221;
    --neon-magenta: #FF2EAA;
    --neon-cyan: #00F0FF;
    --dopamine-yellow: #FFD700;
    --shake-red: #FF3B4A;
    --organic-green: #39FF85;
    --surface-mist: #1A1038;
    --text-whisper: #D4C5F9;
    --pure-signal: #F8F5FF;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    color: var(--text-whisper);
    background: var(--void-base);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ---- Rain overlay ---- */
.rain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    overflow: hidden;
}

.rain-layer {
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        95deg,
        transparent,
        transparent 99.5%,
        rgba(0, 240, 255, 0.06) 99.5%,
        rgba(0, 240, 255, 0.06) 100%
    );
    background-size: 80px 100%;
    animation: rainFall 1.2s linear infinite;
}

.rl-1 {
    opacity: 0.5;
    animation-duration: 0.8s;
}

.rl-2 {
    opacity: 0.3;
    animation-duration: 1.4s;
    animation-delay: -0.3s;
    background-size: 120px 100%;
}

@keyframes rainFall {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ---- Navigation pill ---- */
.nav-pill {
    position: fixed;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8000;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 1.6rem;
    height: 48px;
    background: rgba(26, 16, 56, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 999px;
    border: 1px solid var(--neon-magenta);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.nav-pill.visible {
    opacity: 1;
}

.nav-wordmark {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--neon-magenta);
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-link {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-whisper);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--neon-cyan);
}

/* ---- Parallax sections ---- */
.parallax-section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* ---- City silhouette layers ---- */
.city-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.city-far {
    height: 30%;
    background:
        linear-gradient(to top, var(--void-base) 0%, transparent 100%),
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 60px,
            var(--void-base) 60px,
            var(--void-base) 62px
        );
    opacity: 0.4;
    box-shadow:
        inset 120px -80px 0 0 var(--void-base),
        inset -150px -60px 0 0 var(--void-base);
}

.city-far::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 10% 30%, var(--dopamine-yellow) 50%, transparent 50%),
        radial-gradient(1px 1px at 25% 45%, var(--dopamine-yellow) 50%, transparent 50%),
        radial-gradient(1px 1px at 40% 25%, var(--dopamine-yellow) 50%, transparent 50%),
        radial-gradient(1px 1px at 55% 55%, var(--dopamine-yellow) 50%, transparent 50%),
        radial-gradient(1px 1px at 70% 35%, var(--dopamine-yellow) 50%, transparent 50%),
        radial-gradient(1px 1px at 85% 40%, var(--dopamine-yellow) 50%, transparent 50%);
    opacity: 0.3;
}

.city-mid {
    height: 45%;
    background: linear-gradient(to top, var(--surface-mist) 0%, transparent 70%);
    clip-path: polygon(
        0% 100%, 0% 60%, 5% 55%, 5% 40%, 8% 40%, 8% 50%, 12% 50%, 12% 35%,
        15% 35%, 15% 55%, 20% 55%, 20% 30%, 23% 30%, 23% 45%, 28% 45%,
        28% 25%, 31% 25%, 31% 50%, 36% 50%, 36% 40%, 40% 40%, 40% 20%,
        43% 20%, 43% 45%, 48% 45%, 48% 35%, 52% 35%, 52% 50%, 56% 50%,
        56% 28%, 59% 28%, 59% 42%, 64% 42%, 64% 32%, 68% 32%, 68% 48%,
        72% 48%, 72% 22%, 75% 22%, 75% 38%, 80% 38%, 80% 52%, 85% 52%,
        85% 30%, 88% 30%, 88% 45%, 92% 45%, 92% 55%, 96% 55%, 96% 38%,
        100% 38%, 100% 100%
    );
    opacity: 0.6;
}

.city-mid::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, transparent 19%, var(--neon-magenta) 19.5%, transparent 20%),
        linear-gradient(to right, transparent 43%, var(--neon-cyan) 43.5%, transparent 44%),
        linear-gradient(to right, transparent 71%, var(--neon-magenta) 71.5%, transparent 72%);
    opacity: 0.15;
}

.city-near {
    height: 25%;
    background: #2A1855;
    clip-path: polygon(
        0% 100%, 0% 70%, 3% 65%, 3% 50%, 7% 50%, 7% 60%, 10% 60%, 10% 45%,
        14% 45%, 14% 65%, 18% 65%, 18% 55%, 22% 55%, 22% 40%, 25% 40%,
        25% 60%, 100% 60%, 100% 100%
    );
    opacity: 0.8;
}

.city-near::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-cyan));
    filter: drop-shadow(0 0 6px var(--neon-cyan));
    opacity: 0.4;
}

/* ---- Skyline section ---- */
.section-skyline {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 80%, #1A1038 0%, var(--void-base) 70%);
}

.skyline-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    color: var(--pure-signal);
    letter-spacing: -0.01em;
    line-height: 1.05;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.site-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--neon-cyan);
    margin-bottom: 3rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

.site-subtitle.visible {
    opacity: 1;
}

/* ---- Hero badge blob ---- */
.hero-badge-blob {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 3rem;
    background: radial-gradient(circle, var(--surface-mist) 0%, var(--void-base) 100%);
    border: 1px solid var(--neon-magenta);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blobMorph 10s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 46, 170, 0.15);
    opacity: 0;
    transition: opacity 1s ease 0.8s;
}

.hero-badge-blob.visible {
    opacity: 1;
}

@keyframes blobMorph {
    0%   { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    33%  { border-radius: 70% 30% 50% 50% / 50% 70% 30% 50%; }
    66%  { border-radius: 50% 50% 30% 70% / 70% 50% 50% 30%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

.badge-icon {
    font-size: 2.5rem;
    color: var(--dopamine-yellow);
    filter: drop-shadow(0 0 8px var(--dopamine-yellow));
}

.badge-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--pure-signal);
    letter-spacing: -0.01em;
}

.badge-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--text-whisper);
    opacity: 0.7;
}

/* ---- Badge Gallery ---- */
.section-gallery {
    min-height: 200vh;
    padding: 8rem 2rem;
    background: var(--void-base);
}

.gallery-field {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem 3rem;
}

.badge-blob {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 2rem 2.5rem;
    background: radial-gradient(circle, var(--surface-mist) 0%, var(--void-base) 100%);
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
    opacity: 0;
    transform: translateY(2rem) scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.badge-blob.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.badge-blob:hover {
    border-color: var(--neon-magenta);
    box-shadow: 0 0 30px rgba(255, 46, 170, 0.2);
}

/* Staggered blob shapes */
.bb-1 { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; animation: blobMorph 8s ease-in-out infinite; }
.bb-2 { border-radius: 70% 30% 50% 50% / 50% 70% 30% 50%; animation: blobMorph 9.5s ease-in-out infinite; animation-delay: -2s; }
.bb-3 { border-radius: 50% 50% 30% 70% / 70% 50% 50% 30%; animation: blobMorph 11s ease-in-out infinite; animation-delay: -4s; }
.bb-4 { border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%; animation: blobMorph 12.5s ease-in-out infinite; animation-delay: -1s; }
.bb-5 { border-radius: 60% 40% 40% 60% / 40% 60% 40% 60%; animation: blobMorph 8.5s ease-in-out infinite; animation-delay: -3s; }
.bb-6 { border-radius: 35% 65% 55% 45% / 55% 45% 65% 35%; animation: blobMorph 10s ease-in-out infinite; animation-delay: -5s; }

/* Stagger offset for non-grid feel */
.bb-1 { margin-top: 0; }
.bb-2 { margin-top: 3rem; }
.bb-3 { margin-top: -1rem; }
.bb-4 { margin-top: 2rem; }
.bb-5 { margin-top: -2rem; }
.bb-6 { margin-top: 4rem; }

/* Neon border colors per domain */
.bb-1 { border-color: var(--neon-magenta); }
.bb-2 { border-color: var(--organic-green); }
.bb-3 { border-color: var(--neon-cyan); }
.bb-4 { border-color: var(--dopamine-yellow); }
.bb-5 { border-color: var(--neon-magenta); }
.bb-6 { border-color: var(--neon-cyan); }

/* ---- Section headings ---- */
.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: var(--pure-signal);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(1.5rem);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Mechanism Floor ---- */
.section-mechanism {
    min-height: 200vh;
    padding: 6rem 2rem;
    background: var(--void-base);
}

.mechanism-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: start;
}

.code-block {
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(1.5rem);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.code-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--neon-cyan);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--neon-cyan);
}

.step-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--neon-cyan), transparent);
    filter: drop-shadow(0 0 4px var(--neon-cyan));
}

.code-content {
    background: var(--void-base);
    border-left: 3px solid var(--neon-cyan);
    padding: 1.2rem 1.5rem;
    margin-bottom: 0.8rem;
    border-radius: 0 4px 4px 0;
    overflow-x: auto;
}

.code-content code {
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: var(--neon-cyan);
    line-height: 1.6;
    white-space: pre;
}

.code-annotation {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--text-whisper);
    line-height: 1.5;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(0, 240, 255, 0.15);
}

/* Mechanism visualization */
.mechanism-viz {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-top: 5rem;
    position: sticky;
    top: 4rem;
}

.karma-flow-node {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.karma-flow-node.revealed {
    opacity: 1;
    transform: scale(1);
}

.kn-source {
    background: radial-gradient(circle, var(--neon-cyan), transparent);
    border: 1px solid var(--neon-cyan);
}

.kn-badge {
    background: radial-gradient(circle, var(--neon-magenta), transparent);
    border: 1px solid var(--neon-magenta);
}

.kn-city {
    background: radial-gradient(circle, var(--dopamine-yellow), transparent);
    border: 1px solid var(--dopamine-yellow);
}

.kn-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pure-signal);
}

.karma-flow-line {
    width: 40px;
    height: 80px;
}

.flow-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    filter: drop-shadow(0 0 4px currentColor);
    transition: stroke-dashoffset 1.2s ease;
}

.karma-flow-line.drawn .flow-path {
    stroke-dashoffset: 0;
}

/* ---- Shake Zone ---- */
.section-shake {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: radial-gradient(ellipse at 50% 50%, #1A1038 0%, var(--void-base) 70%);
}

.shake-intro {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--text-whisper);
    text-align: center;
    max-width: 600px;
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.shake-intro.revealed {
    opacity: 1;
    transform: translateY(0);
}

.shake-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.shake-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 2.5rem;
    background: radial-gradient(circle, var(--surface-mist) 0%, var(--void-base) 100%);
    border: 1px solid var(--neon-cyan);
    border-radius: 40% 60% 55% 45% / 50% 45% 55% 50%;
    animation: blobMorph 9s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Shake animation */
@keyframes karmaShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake-badge.shaking {
    animation: karmaShake 0.5s ease-in-out, blobMorph 9s ease-in-out infinite;
    border-color: var(--shake-red) !important;
    box-shadow: 0 0 20px rgba(255, 59, 74, 0.3);
}

.shake-badge.floating {
    transform: translateY(-8px);
    border-color: var(--organic-green) !important;
    box-shadow: 0 0 30px rgba(57, 255, 133, 0.2);
}

/* ---- City Floor ---- */
.section-city-floor {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: var(--void-base);
}

.city-grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 500px;
    margin-bottom: 3rem;
    transform: perspective(600px) rotateX(15deg);
}

.city-block {
    position: relative;
    padding: 2rem;
    background: var(--surface-mist);
    border: 1px solid rgba(0, 240, 255, 0.15);
    text-align: center;
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.city-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.block-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 2s ease;
}

.city-block.revealed .block-glow {
    opacity: 1;
}

.cb-kindness .block-glow { background: radial-gradient(circle, rgba(0, 240, 255, 0.1) 0%, transparent 70%); }
.cb-expertise .block-glow { background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%); }
.cb-mentorship .block-glow { background: radial-gradient(circle, rgba(255, 46, 170, 0.1) 0%, transparent 70%); }
.cb-creation .block-glow { background: radial-gradient(circle, rgba(57, 255, 133, 0.1) 0%, transparent 70%); }

.block-label {
    position: relative;
    z-index: 1;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--pure-signal);
}

.city-floor-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: var(--text-whisper);
    text-align: center;
    max-width: 600px;
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.city-floor-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.site-footer {
    text-align: center;
}

.footer-wordmark {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-whisper);
    opacity: 0.5;
}

/* ---- Nav shake on hover ---- */
.nav-pill:hover,
.nav-link:hover {
    animation: karmaShake 0.25s ease-in-out;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .gallery-field {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .bb-1, .bb-2, .bb-3, .bb-4, .bb-5, .bb-6 {
        margin-top: 0;
    }

    .mechanism-grid {
        grid-template-columns: 1fr;
    }

    .mechanism-viz {
        position: static;
        padding-top: 2rem;
    }

    .shake-row {
        flex-direction: column;
        align-items: center;
    }

    .nav-links {
        display: none;
    }

    .city-grid-view {
        transform: none;
    }

    .city-mid,
    .city-near {
        display: none;
    }
}

/* ---- Tablet ---- */
@media (min-width: 768px) and (max-width: 1023px) {
    .gallery-field {
        grid-template-columns: repeat(2, 1fr);
    }

    .mechanism-grid {
        grid-template-columns: 1fr;
    }

    .mechanism-viz {
        position: static;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .rain-overlay {
        display: none;
    }

    .site-title,
    .site-subtitle,
    .hero-badge-blob,
    .section-heading,
    .code-block,
    .shake-intro,
    .city-floor-text,
    .inversion-text {
        opacity: 1;
        transform: none;
    }

    .badge-blob {
        opacity: 1;
        transform: none;
    }

    .karma-flow-node {
        opacity: 1;
        transform: none;
    }

    .city-block {
        opacity: 1;
        transform: none;
    }

    .flow-path {
        stroke-dashoffset: 0;
    }
}
