/* ============================================================
   mybadge.page - Civic Neomorphism / Coastal Blend
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette: Coastal Blend */
    --sea-fog: #e8e4df;
    --wet-slate: #c5bfb6;
    --tidal-stone: #a89f94;
    --shell-white: #f7f5f2;
    --deep-current: #2c3e50;
    --kelp-gray: #6b7b8d;
    --patina-copper: #5d9b84;
    --sand-brass: #c4956a;
    --abyssal-teal: #1a6b5a;
    --shallow-aqua: #b8d8d0;
    --dune-blush: #dfd0c3;

    /* Neomorphic shadows */
    --neo-light: #f7f5f2;
    --neo-dark: #a89f94;

    /* Cursor light position */
    --light-x: 50%;
    --light-y: 50%;
    --light-delta-x: 0;
    --light-delta-y: 0;

    /* Dynamic shadow offsets */
    --shadow-offset-x: 8px;
    --shadow-offset-y: 8px;
    --shadow-highlight-x: -8px;
    --shadow-highlight-y: -8px;

    /* Terrace colors */
    --terrace-dark: #ddd8d2;
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.85;
    color: var(--deep-current);
    background-color: var(--sea-fog);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Background Layer: Gradient Mesh --- */
#gradient-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(184,216,208,0.4), transparent),
        radial-gradient(ellipse 50% 60% at 70% 60%, rgba(223,208,195,0.35), transparent),
        radial-gradient(ellipse 45% 55% at 50% 80%, rgba(93,155,132,0.15), transparent),
        radial-gradient(ellipse 70% 40% at 80% 20%, rgba(196,149,106,0.2), transparent);
    background-size: 200% 200%;
    animation: meshDrift1 45s ease-in-out infinite alternate,
               meshDrift2 37s ease-in-out infinite alternate-reverse,
               meshDrift3 51s ease-in-out infinite alternate;
}

@keyframes meshDrift1 {
    0% { background-position: 0% 0%, 100% 100%, 50% 50%, 80% 20%; }
    25% { background-position: 30% 20%, 70% 80%, 40% 60%, 60% 40%; }
    50% { background-position: 50% 50%, 50% 50%, 30% 70%, 40% 60%; }
    75% { background-position: 70% 30%, 30% 70%, 60% 40%, 20% 80%; }
    100% { background-position: 100% 100%, 0% 0%, 80% 20%, 10% 90%; }
}

@keyframes meshDrift2 {
    0% { background-position: 20% 80%, 80% 20%, 60% 40%, 30% 70%; }
    50% { background-position: 60% 40%, 40% 60%, 20% 80%, 70% 30%; }
    100% { background-position: 40% 20%, 60% 80%, 80% 20%, 50% 50%; }
}

@keyframes meshDrift3 {
    0% { background-position: 80% 20%, 20% 80%, 50% 50%, 60% 40%; }
    33% { background-position: 40% 60%, 60% 40%, 70% 30%, 30% 70%; }
    66% { background-position: 60% 80%, 40% 20%, 30% 70%, 80% 20%; }
    100% { background-position: 20% 40%, 80% 60%, 60% 40%, 40% 60%; }
}

/* --- Atmosphere Layer --- */
.atmosphere-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

/* Cursor-follow light */
#cursor-light {
    background: radial-gradient(
        300px circle at var(--light-x) var(--light-y),
        rgba(247, 245, 242, 0.25),
        transparent 70%
    );
    transition: opacity 0.3s ease;
    opacity: 0;
}

#cursor-light.active {
    opacity: 1;
}

/* --- Tidal Particles --- */
#tidal-particles {
    list-style: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0;
    filter: blur(1.5px);
}

.particle::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--shell-white);
}

.particle:nth-child(odd)::before {
    background: var(--shallow-aqua);
}

.particle:nth-child(1) { animation: tidalDrift1 10s ease-in-out infinite; animation-delay: 0s; top: 15%; left: 90%; }
.particle:nth-child(2) { animation: tidalDrift2 12s ease-in-out infinite; animation-delay: 0.4s; top: 25%; left: 85%; }
.particle:nth-child(3) { animation: tidalDrift1 9s ease-in-out infinite; animation-delay: 0.8s; top: 40%; left: 95%; }
.particle:nth-child(4) { animation: tidalDrift3 11s ease-in-out infinite; animation-delay: 1.2s; top: 55%; left: 80%; }
.particle:nth-child(5) { animation: tidalDrift2 10s ease-in-out infinite; animation-delay: 1.6s; top: 70%; left: 92%; }
.particle:nth-child(6) { animation: tidalDrift1 12s ease-in-out infinite; animation-delay: 2.0s; top: 10%; left: 75%; }
.particle:nth-child(7) { animation: tidalDrift3 9s ease-in-out infinite; animation-delay: 2.4s; top: 30%; left: 88%; }
.particle:nth-child(8) { animation: tidalDrift2 11s ease-in-out infinite; animation-delay: 2.8s; top: 50%; left: 70%; }
.particle:nth-child(9) { animation: tidalDrift1 10s ease-in-out infinite; animation-delay: 3.2s; top: 65%; left: 98%; }
.particle:nth-child(10) { animation: tidalDrift3 12s ease-in-out infinite; animation-delay: 3.6s; top: 80%; left: 82%; }
.particle:nth-child(11) { animation: tidalDrift2 9s ease-in-out infinite; animation-delay: 4.0s; top: 20%; left: 60%; }
.particle:nth-child(12) { animation: tidalDrift1 11s ease-in-out infinite; animation-delay: 4.4s; top: 35%; left: 78%; }
.particle:nth-child(13) { animation: tidalDrift3 10s ease-in-out infinite; animation-delay: 4.8s; top: 45%; left: 65%; }
.particle:nth-child(14) { animation: tidalDrift2 12s ease-in-out infinite; animation-delay: 5.2s; top: 60%; left: 55%; }
.particle:nth-child(15) { animation: tidalDrift1 9s ease-in-out infinite; animation-delay: 5.6s; top: 75%; left: 72%; }
.particle:nth-child(16) { animation: tidalDrift3 11s ease-in-out infinite; animation-delay: 6.0s; top: 85%; left: 90%; }
.particle:nth-child(17) { animation: tidalDrift2 10s ease-in-out infinite; animation-delay: 6.4s; top: 5%; left: 68%; }
.particle:nth-child(18) { animation: tidalDrift1 12s ease-in-out infinite; animation-delay: 6.8s; top: 90%; left: 50%; }
.particle:nth-child(19) { animation: tidalDrift3 9s ease-in-out infinite; animation-delay: 7.2s; top: 12%; left: 45%; }
.particle:nth-child(20) { animation: tidalDrift2 11s ease-in-out infinite; animation-delay: 7.6s; top: 48%; left: 40%; }
.particle:nth-child(21) { animation: tidalDrift1 10s ease-in-out infinite; animation-delay: 8.0s; top: 33%; left: 55%; }
.particle:nth-child(22) { animation: tidalDrift3 12s ease-in-out infinite; animation-delay: 8.4s; top: 72%; left: 35%; }
.particle:nth-child(23) { animation: tidalDrift2 9s ease-in-out infinite; animation-delay: 8.8s; top: 58%; left: 48%; }
.particle:nth-child(24) { animation: tidalDrift1 11s ease-in-out infinite; animation-delay: 9.2s; top: 22%; left: 30%; }
.particle:nth-child(25) { animation: tidalDrift3 10s ease-in-out infinite; animation-delay: 9.6s; top: 88%; left: 62%; }

@keyframes tidalDrift1 {
    0% { transform: translateX(0) translateY(0); opacity: 0; }
    15% { opacity: 0.6; }
    50% { transform: translateX(-120px) translateY(10px); opacity: 0.4; }
    85% { opacity: 0.5; }
    100% { transform: translateX(-240px) translateY(-5px); opacity: 0; }
}

@keyframes tidalDrift2 {
    0% { transform: translateX(0) translateY(0); opacity: 0; }
    20% { opacity: 0.5; }
    50% { transform: translateX(-150px) translateY(-15px); opacity: 0.3; }
    80% { opacity: 0.45; }
    100% { transform: translateX(-280px) translateY(8px); opacity: 0; }
}

@keyframes tidalDrift3 {
    0% { transform: translateX(0) translateY(0); opacity: 0; }
    10% { opacity: 0.55; }
    50% { transform: translateX(-100px) translateY(20px); opacity: 0.35; }
    90% { opacity: 0.4; }
    100% { transform: translateX(-200px) translateY(-10px); opacity: 0; }
}

/* --- Main Content (Surface Layer) --- */
#main-content {
    position: relative;
    z-index: 10;
}

/* --- Monument Sections --- */
.monument-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    position: relative;
    padding: 4rem 2rem;
}

.monument-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 600px;
}

/* --- Hero Section --- */
.hero-title {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(3.2rem, 10vw, 7.5rem);
    letter-spacing: 0.04em;
    color: var(--deep-current);
    text-shadow: -2px -2px 4px var(--neo-light), 2px 2px 4px var(--neo-dark);
    opacity: 0;
    transform: scale(0.95);
    animation: heroFadeIn 1.2s cubic-bezier(0.23, 1, 0.32, 1) 0.1s forwards;
}

.hero-tagline {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--kelp-gray);
    letter-spacing: 0.06em;
    margin-top: 1.5rem;
    opacity: 0;
    animation: taglineFadeIn 0.8s cubic-bezier(0.23, 1, 0.32, 1) 1.3s forwards;
}

@keyframes heroFadeIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes taglineFadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Horizon Dividers --- */
.horizon-divider {
    height: 200px;
    position: relative;
    z-index: 10;
}

.horizon-1 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(184, 216, 208, 0.15) 30%,
        rgba(223, 208, 195, 0.2) 70%,
        transparent 100%
    );
}

.horizon-2 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(223, 208, 195, 0.2) 30%,
        rgba(184, 216, 208, 0.15) 70%,
        transparent 100%
    );
}

.horizon-3 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(93, 155, 132, 0.1) 30%,
        rgba(196, 149, 106, 0.12) 70%,
        transparent 100%
    );
}

.horizon-4 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(196, 149, 106, 0.12) 30%,
        rgba(184, 216, 208, 0.15) 70%,
        transparent 100%
    );
}

.horizon-5 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(184, 216, 208, 0.18) 30%,
        rgba(93, 155, 132, 0.1) 70%,
        transparent 100%
    );
}

.horizon-6 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(197, 191, 182, 0.2) 30%,
        rgba(184, 216, 208, 0.15) 70%,
        transparent 100%
    );
}

.horizon-7 {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(223, 208, 195, 0.15) 30%,
        rgba(197, 191, 182, 0.2) 70%,
        transparent 100%
    );
}

/* --- Passage Sections --- */
.passage-section {
    position: relative;
    z-index: 10;
    padding: 6rem 2rem;
    display: flex;
    justify-content: center;
}

.passage-column {
    max-width: 560px;
    width: 100%;
}

.passage-column p {
    margin-bottom: 2.4em;
    color: var(--deep-current);
    font-weight: 300;
}

.passage-column p em,
.passage-column p strong {
    font-weight: 400;
}

.section-heading {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--deep-current);
    margin-bottom: 2rem;
    text-shadow: -1px -1px 3px var(--neo-light), 1px 1px 3px var(--neo-dark);
}

/* --- Pull Quotes --- */
.pull-quote {
    padding: 2rem 2.5rem;
    margin: 3rem 0;
    border-radius: 16px;
    background: var(--sea-fog);
    box-shadow: inset -4px -4px 10px var(--neo-light), inset 4px 4px 10px var(--neo-dark);
}

.pull-quote p {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    line-height: 1.6;
    color: var(--deep-current);
    margin-bottom: 0 !important;
}

/* --- Badge Elements --- */
.badge-element {
    width: clamp(260px, 40vw, 360px);
    aspect-ratio: 1 / 1.15;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-outer-rim {
    width: 100%;
    height: 100%;
    border-radius: 24px;
    border: 2px solid rgba(93, 155, 132, 0.4);
    box-shadow:
        var(--shadow-highlight-x, -8px) var(--shadow-highlight-y, -8px) 20px var(--neo-light),
        var(--shadow-offset-x, 8px) var(--shadow-offset-y, 8px) 20px var(--neo-dark);
    background: var(--sea-fog);
    padding: 8px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-outer-rim.pressed {
    box-shadow:
        inset -4px -4px 10px var(--neo-light),
        inset 4px 4px 10px var(--neo-dark);
    transform: translateY(2px);
}

.badge-first-terrace {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    background: var(--terrace-dark);
    box-shadow: inset -3px -3px 8px var(--neo-light), inset 3px 3px 8px rgba(168, 159, 148, 0.5);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-second-terrace {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    background: var(--sea-fog);
    box-shadow:
        -3px -3px 8px var(--neo-light),
        3px 3px 8px rgba(168, 159, 148, 0.4);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-central-field {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: radial-gradient(ellipse at 40% 35%, rgba(247, 245, 242, 0.6), var(--sea-fog) 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.5rem;
}

.badge-icon {
    width: 64px;
    height: 64px;
    color: var(--patina-copper);
}

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

.badge-label {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--deep-current);
    letter-spacing: 0.02em;
}

.badge-serial {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tidal-stone);
}

/* --- Reveal Animations --- */
.reveal-section {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1), transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.passage-section.reveal-section {
    transform: translateY(20px);
    transition-duration: 0.5s;
}

/* --- Footer --- */
#site-footer {
    position: relative;
    z-index: 10;
    padding: 4rem 2rem;
    background: var(--wet-slate);
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.footer-domain {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--deep-current);
    text-shadow: -1px -1px 2px var(--neo-light), 1px 1px 2px var(--neo-dark);
}

.footer-note {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--kelp-gray);
    letter-spacing: 0.04em;
}

/* --- Parallax Scroll Layer Effect --- */
#gradient-mesh {
    will-change: background-position;
}

/* --- Mobile Adaptations (< 768px) --- */
@media (max-width: 767px) {
    .monument-section {
        min-height: 80vh;
    }

    .passage-column {
        max-width: 90vw;
    }

    .passage-section {
        padding: 4rem 5vw;
    }

    /* Reduce neomorphic shadows to 60% */
    .badge-outer-rim {
        box-shadow:
            -5px -5px 12px var(--neo-light),
            5px 5px 12px var(--neo-dark);
    }

    .pull-quote {
        box-shadow: inset -2px -2px 6px var(--neo-light), inset 2px 2px 6px var(--neo-dark);
    }

    .hero-title {
        text-shadow: -1px -1px 3px var(--neo-light), 1px 1px 3px var(--neo-dark);
    }

    .section-heading {
        text-shadow: -1px -1px 2px var(--neo-light), 1px 1px 2px var(--neo-dark);
    }

    .horizon-divider {
        height: 120px;
    }

    .badge-element {
        width: clamp(220px, 60vw, 300px);
    }

    /* Simplify gradient mesh to 2 gradients */
    #gradient-mesh {
        background:
            radial-gradient(ellipse 60% 50% at 30% 40%, rgba(184,216,208,0.4), transparent),
            radial-gradient(ellipse 50% 60% at 70% 60%, rgba(223,208,195,0.35), transparent);
        background-size: 200% 200%;
    }

    /* Hide particles beyond 15 */
    .particle:nth-child(n+16) {
        display: none;
    }
}

/* --- Disable cursor light below 768px --- */
@media (max-width: 767px) {
    #cursor-light {
        display: none;
    }
}
