/* ===== BASE RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #1a1a1e;
    color: #e2e8f0;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ===== PROGRESS LINE ===== */
#progress-line {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 100vh;
    background: #b8b8c0;
    z-index: 1000;
}

#progress-fill {
    width: 100%;
    height: 0%;
    background: #e53e3e;
    transition: height 0.1s linear;
}

/* ===== SCENES ===== */
.scene {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.scene-1 { min-height: 100vh; }
.scene-2 { min-height: 150vh; }
.scene-3 { min-height: 100vh; }
.scene-4 { min-height: 100vh; }
.scene-5 { min-height: 100vh; }

/* ===== SPLIT GRID ===== */
.split-grid {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: inherit;
    transition: grid-template-columns 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.split-50-50 { grid-template-columns: 1fr 1fr; }
.split-35-65 { grid-template-columns: 35fr 65fr; }

.panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.panel-dark {
    background: linear-gradient(to bottom, #2a2a2e, #1a1a1e);
}

.panel-light {
    background: linear-gradient(to bottom, #e2e8f0, #f7fafc);
}

/* ===== SCENE 1 — THE SEED ===== */
.hero-text {
    font-family: 'Noto Serif KR', 'Cormorant Garamond', serif;
    font-size: clamp(5rem, 12vw, 10rem);
    font-weight: 700;
    color: #e8e8ec;
    letter-spacing: 0.02em;
    text-shadow:
        3px 0 0 #2a2a2e, -3px 0 0 #2a2a2e,
        0 3px 0 #2a2a2e, 0 -3px 0 #2a2a2e,
        2px 2px 0 #2a2a2e, -2px -2px 0 #2a2a2e,
        2px -2px 0 #2a2a2e, -2px 2px 0 #2a2a2e;
    -webkit-text-stroke: 2px #e8e8ec;
}

.seed-circle {
    opacity: 0;
    transition: opacity 1s ease;
}

.scene-1.growing .seed-circle,
.scene-1.grown .seed-circle {
    opacity: 1;
}

.seed-stroke {
    stroke-dasharray: 502;
    stroke-dashoffset: 502;
    animation: none;
}

.scene-1.growing .seed-stroke,
.scene-1.grown .seed-stroke {
    animation: draw-seed 3s ease forwards;
}

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

.scene-1.grown .seed-stroke {
    animation: draw-seed 3s ease forwards, crack-seed 1s 3s ease forwards;
}

@keyframes crack-seed {
    to {
        stroke-dasharray: 50 20 80 20 50 20 80 20;
        stroke: #e53e3e;
    }
}

/* ===== SCENE 2 — THE TRUNK ===== */
.halftone-bark {
    background:
        radial-gradient(circle, #4a4a52 1px, transparent 1px),
        linear-gradient(to bottom, #2a2a2e, #1a1a1e);
    background-size: 6px 6px, 100% 100%;
}

.scene-2 .panel-right {
    position: relative;
}

.trunk-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* #68856c chlorophyll, #6b6b72 stone-medium used as accents */
.trunk-line {
    stroke: #6b6b72;
    stroke-dasharray: 560;
    stroke-dashoffset: 560;
}

.scene-5 .forest-signature:hover {
    color: #68856c;
}

.branch-left, .branch-right {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.scene-2.growing .trunk-line {
    animation: draw-trunk 2s ease forwards;
}

.scene-2.growing .branch-left {
    animation: draw-branch 1.5s 1.5s ease forwards;
}

.scene-2.growing .branch-right {
    animation: draw-branch 1.5s 1.8s ease forwards;
}

.scene-2.grown .trunk-line {
    stroke-dashoffset: 0;
}

.scene-2.grown .branch-left,
.scene-2.grown .branch-right {
    stroke-dashoffset: 0;
}

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

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

.wood-char {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(6rem, 14vw, 12rem);
    font-weight: 700;
    color: #1a1a1e;
    letter-spacing: 0.02em;
    opacity: 0;
    z-index: 2;
    transition: opacity 1s ease 2s;
}

.scene-2.growing .wood-char,
.scene-2.grown .wood-char {
    opacity: 1;
}

/* ===== SPLIT DIVIDER BORDER ANIMATE ===== */
.split-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    transform: translateX(-50%);
    animation: border-color-cycle 12s steps(4) infinite;
    z-index: 10;
}

.split-50-50::after { left: 50%; }
.split-35-65::after { left: 35%; }

@keyframes border-color-cycle {
    0%   { background: #2a2a2e; }
    25%  { background: #718096; }
    50%  { background: #b8b8c0; }
    75%  { background: #e53e3e; }
    100% { background: #2a2a2e; }
}

/* ===== SCENE 3 — THE CANOPY ===== */
.scene-3 {
    background: linear-gradient(to bottom, #2a2a2e, #4a5568, #2a2a2e);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.scene-3::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #a0aec0 1.5px, transparent 1.5px);
    background-size: 10px 10px;
    opacity: 0.15;
    pointer-events: none;
    z-index: 1;
}

.canopy-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(160,174,192,0.15), transparent 70%);
    filter: blur(30px) saturate(0.8);
    will-change: transform, opacity;
    transform: translateZ(0);
}

@keyframes drift-x {
    0%, 100% { transform: translateX(-30px); }
    50%      { transform: translateX(30px); }
}

@keyframes drift-y {
    0%, 100% { transform: translateY(-20px); }
    50%      { transform: translateY(20px); }
}

.canopy-quote {
    position: relative;
    z-index: 5;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 300;
    color: #e2e8f0;
    text-align: center;
    max-width: 900px;
    padding: 0 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.scene-3.growing .canopy-quote,
.scene-3.grown .canopy-quote {
    opacity: 1;
    transform: translateY(0);
}

/* ===== SCENE 4 — THE SEASONS ===== */
.scene-4 {
    position: relative;
}

.seasons-grid {
    position: relative;
}

.seasons-grid::after {
    border-width: 6px;
}

.seasons-left {
    transition: background-color 2s ease;
    background-color: #c8d8c4;
}

.seasons-right {
    transition: background-color 2s ease;
    background-color: #e8ece4;
}

.seasons-left.spring { background-color: #c8d8c4; }
.seasons-right.spring { background-color: #e8ece4; }
.seasons-left.summer { background-color: #8a9a86; }
.seasons-right.summer { background-color: #b8c8b4; }
.seasons-left.autumn { background-color: #a09080; }
.seasons-right.autumn { background-color: #d4c0b0; }
.seasons-left.winter { background-color: #d8dce0; }
.seasons-right.winter { background-color: #f0f2f4; }

/* ===== RED LEAF ===== */
.red-leaf {
    position: absolute;
    width: 30px;
    height: 40px;
    background: #e53e3e;
    clip-path: polygon(50% 0%, 80% 40%, 65% 100%, 50% 85%, 35% 100%, 20% 40%);
    top: 40%;
    left: -40px;
    opacity: 0;
    will-change: transform, opacity;
    transform: translateZ(0);
    z-index: 20;
    pointer-events: none;
}

.scene-4.growing .red-leaf,
.scene-4.grown .red-leaf {
    opacity: 1;
    animation: leaf-drift 20s linear forwards;
}

@keyframes leaf-drift {
    0%   { left: -40px; transform: translateY(0) rotate(0deg); }
    25%  { transform: translateY(-30px) rotate(15deg); }
    50%  { transform: translateY(10px) rotate(-10deg); }
    75%  { transform: translateY(-20px) rotate(20deg); }
    100% { left: calc(100% + 40px); transform: translateY(0) rotate(5deg); }
}

/* ===== SCENE 5 — THE FOREST ===== */
.scene-5 {
    background: linear-gradient(to bottom, #1a1a1e, #2a2a2e);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.scene-5::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #b8b8c0 0.5px, transparent 0.5px);
    background-size: 14px 14px;
    opacity: 0.1;
    pointer-events: none;
    z-index: 1;
}

.forest-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2;
}

.forest-svg {
    width: 80%;
    max-width: 1000px;
    height: 70%;
}

.forest-svg line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2s ease;
}

.scene-5.growing .forest-svg line,
.scene-5.grown .forest-svg line {
    stroke-dashoffset: 0;
}

.forest-signature {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Source Serif 4', serif;
    font-size: 0.9rem;
    font-weight: 300;
    color: #718096;
    letter-spacing: 0.1em;
    z-index: 5;
}

/* ===== SCENE RINGS ===== */
.scene-ring {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) scale(0);
    opacity: 0;
    z-index: 50;
    transition: transform 0.8s ease, opacity 0.8s ease;
}

.scene.growing .scene-ring,
.scene.grown .scene-ring {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* ===== HALFTONE OVERLAY ===== */
.scene-1 .panel-right::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, #b8b8c0 0.5px, transparent 0.5px);
    background-size: 14px 14px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

/* ===== DORMANT STATE ===== */
.scene.dormant .canopy-quote,
.scene.dormant .wood-char,
.scene.dormant .seed-circle {
    opacity: 0;
}

.scene.dormant .scene-ring {
    transform: translateX(-50%) scale(0);
    opacity: 0;
}

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