/* ═══════════════════════════════════════════════════
   TOKENS & RESET
═══════════════════════════════════════════════════ */
:root {
    --cream:      #FAF6EE;
    --wheat:      #F6BA25;
    --wheat-dark: #D9961A;
    --green:      #4A7C59;
    --green-lt:   #7DB88A;
    --earth:      #8B5E3C;
    --ink:        #1E1A14;
    --ink-60:     rgba(30, 26, 20, 0.6);
    --ink-20:     rgba(30, 26, 20, 0.12);
    --white:      #FFFFFF;

    --r-sm:  12px;
    --r-md:  20px;
    --r-lg:  32px;
    --r-xl:  48px;

    --shadow-card: 0 8px 40px rgba(30, 26, 20, 0.10);
    --shadow-lift: 0 20px 60px rgba(30, 26, 20, 0.18);

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* Immersive state: lock scroll */
body.state-immersive {
    overflow: hidden;
}

body.state-content {
    overflow: auto;
}

/* ═══════════════════════════════════════════════════
   WEBGL WRAPPER  — the morphing hero
═══════════════════════════════════════════════════ */
#webgl-wrapper {
    position: relative;          /* contains all floating UI */
    width: 100vw;
    height: 100vh;               /* starts full-screen */
    overflow: hidden;
    flex-shrink: 0;
    /* Subtle border-radius when shrunken (GSAP will still work) */
    transition: border-radius 0.6s var(--ease-out-expo);
}

body.state-content #webgl-wrapper {
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    box-shadow: var(--shadow-lift);
}

#webgl-container {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════
   INTRO OVERLAY  (existing, preserved)
═══════════════════════════════════════════════════ */
#intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    will-change: opacity;
}

#intro-title {
    display: flex;
    gap: 24px;
    align-items: baseline;
    will-change: transform, opacity;
}

.intro-word {
    font-family: 'Fredoka One', cursive;
    color: var(--wheat);
    opacity: 0;
    transform: translateY(30px);
    display: inline-block;
    text-shadow: 3px 3px 0px rgba(0,0,0,0.1);
    will-change: transform, opacity;
}

#intro-my   { font-size: clamp(52px, 9vw, 110px); }
#intro-farm { font-size: clamp(64px, 12vw, 140px); }

/* ═══════════════════════════════════════════════════
   TOP NAV  (existing, preserved)
═══════════════════════════════════════════════════ */
#top-nav {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 10px 25px;
    border-radius: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transition: pointer-events 0s;
    transition: opacity 0.8s ease;
    white-space: nowrap;
}

#top-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

#top-nav ul {
    list-style: none;
    display: flex;
    gap: 4px;
}

#top-nav li {
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    padding: 7px 14px;
    border-radius: 20px;
    transition: background 0.25s ease, color 0.25s ease;
    letter-spacing: 0.02em;
}

#top-nav li:hover {
    background: var(--wheat);
    color: #fff;
}

/* ═══════════════════════════════════════════════════
   DAY / NIGHT BUTTON
═══════════════════════════════════════════════════ */
#day-night-btn {
    position: absolute;
    bottom: 90px;          /* above exit btn */
    right: 30px;
    z-index: 150;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#day-night-btn.visible { pointer-events: auto; opacity: 1; }
#day-night-btn:hover   { transform: scale(1.12); box-shadow: 0 6px 28px rgba(0,0,0,0.25); }
#day-night-btn:active  { transform: scale(0.95); }

/* ═══════════════════════════════════════════════════
   EXIT BUTTON  — immersive mode CTA
═══════════════════════════════════════════════════ */
#exit-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: 0.02em;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease-out-expo),
                box-shadow 0.3s ease,
                background 0.2s ease;
}

#exit-btn.visible { pointer-events: auto; opacity: 1; }

#exit-btn .btn-icon {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    transition: transform 0.3s ease;
}

#exit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(0,0,0,0.22);
    background: rgba(255,255,255,0.98);
}

#exit-btn:hover .btn-icon {
    transform: translateY(3px);
}

#exit-btn:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════
   ENTER OVERLAY  — shown on top of shrunken canvas
═══════════════════════════════════════════════════ */
#enter-overlay {
    position: absolute;
    inset: 0;
    z-index: 120;
    display: none;             /* GSAP sets display:flex */
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0) 40%,
        rgba(0,0,0,0.55) 100%
    );
    cursor: pointer;
    opacity: 0;
}

#enter-content {
    text-align: center;
    color: #fff;
    padding-bottom: 40px;
}

#enter-label {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(22px, 4vw, 38px);
    letter-spacing: 0.02em;
    text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

#enter-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#enter-arrow {
    font-size: 28px;
    margin-top: 14px;
    display: block;
    animation: bounce-up 1.6s ease-in-out infinite;
}

@keyframes bounce-up {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

/* ═══════════════════════════════════════════════════
   MUSIC BUTTON  — 左下角，与右下角 exit-btn 对称
═══════════════════════════════════════════════════ */
#music-btn {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: auto;           /* 明确取消 right，防止旧样式残留 */
    z-index: 150;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.8s ease;
}

#music-btn.visible { opacity: 1; pointer-events: auto; }
#music-btn:hover   { transform: scale(1.12); box-shadow: 0 6px 28px rgba(0,0,0,0.22); }
#music-btn:active  { transform: scale(0.95); }


#page-content {
    opacity: 0;               /* GSAP reveals it */
    pointer-events: none;
    will-change: opacity, transform;
}

body.state-content #page-content {
    pointer-events: auto;
}

/* ─── Section shared ─── */
.content-section {
    padding: clamp(64px, 10vw, 120px) clamp(20px, 6vw, 80px);
    opacity: 0; /* stagger-revealed by GSAP */
}

.section-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.eyebrow {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 14px;
}

.section-alt {
    background: var(--white);
}

/* ─── Section header ─── */
.section-header {
    margin-bottom: 56px;
}

.section-header h2 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.1;
    color: var(--ink);
}

.section-header h2 em,
h1 em, h2 em {
    font-style: italic;
    color: var(--wheat-dark);
}

/* ─── Hero layout ─── */
.layout-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

@media (max-width: 760px) {
    .layout-hero { grid-template-columns: 1fr; }
}

.display-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(48px, 8vw, 100px);
    line-height: 1.0;
    color: var(--ink);
    margin-bottom: 24px;
}

.lead {
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.7;
    color: var(--ink-60);
    max-width: 42ch;
}

/* Hero deco cards */
.hero-deco {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    height: 380px;
}

.deco-card {
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(52px, 8vw, 90px);
    box-shadow: var(--shadow-card);
    transition: transform 0.4s var(--ease-out-expo);
}

.deco-card:hover { transform: translateY(-6px) scale(1.04); }

.deco-card--1 {
    background: linear-gradient(135deg, #FFF6D6, #FFE08A);
    grid-row: 1 / 3;
    font-size: clamp(72px, 10vw, 120px);
}

.deco-card--2 { background: linear-gradient(135deg, #FFE8CC, #FFBE7A); }
.deco-card--3 { background: linear-gradient(135deg, #E8F5E3, #B8E0AA); }

/* ─── Features grid ─── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 20px;
}

@media (max-width: 900px) {
    .features-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .features-grid { grid-template-columns: 1fr; }
}

.feature-card {
    background: var(--cream);
    border-radius: var(--r-md);
    padding: 32px 28px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform 0.35s var(--ease-out-expo), box-shadow 0.35s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lift);
}

.feature-card--wide {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    background: linear-gradient(150deg, #FFF8E0 0%, #FFE68C 100%);
}

.feature-card--accent {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-lt) 100%);
    color: #fff;
}

.feature-card--accent h3,
.feature-card--accent p {
    color: #fff;
}

.fc-emoji {
    font-size: 40px;
    line-height: 1;
}

.feature-card--wide .fc-emoji { font-size: 64px; }

.fc-body h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--ink);
}

.fc-body p {
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink-60);
}

.fc-tag {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: var(--ink-20);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--ink-60);
}

.feature-card--accent .fc-tag {
    background: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
}

/* ─── Story layout ─── */
.layout-story {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

@media (max-width: 760px) {
    .layout-story {
        grid-template-columns: 1fr;
        gap: 48px;
    }
}

.story-visual {
    position: relative;
    background: linear-gradient(135deg, #FFFBE8 0%, #F0EDDF 100%);
    border-radius: var(--r-lg);
    padding: 48px 32px;
    box-shadow: var(--shadow-card);
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-badge {
    position: absolute;
    top: -16px;
    left: 32px;
    background: var(--wheat);
    color: #fff;
    padding: 8px 18px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(246,186,37,0.4);
}

.badge-number {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
}

.badge-text {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.story-art {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.art-row {
    display: flex;
    gap: 20px;
    font-size: 40px;
}

.art-row--mid { font-size: 52px; }

.story-text h2 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.15;
    margin-bottom: 24px;
    color: var(--ink);
}

.story-text p {
    font-size: 16px;
    line-height: 1.75;
    color: var(--ink-60);
    margin-bottom: 16px;
}

.cta-btn {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    background: var(--wheat);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(246,186,37,0.4);
    transition: transform 0.3s var(--ease-out-expo),
                box-shadow 0.3s ease,
                background 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(246,186,37,0.5);
    background: var(--wheat-dark);
}

.cta-btn:active { transform: translateY(0); }

/* ─── Footer ─── */
#site-footer {
    padding: 40px clamp(20px, 6vw, 80px);
    border-top: 1px solid var(--ink-20);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-logo {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    color: var(--wheat);
}

.footer-copy {
    font-size: 13px;
    color: var(--ink-60);
}