/* ============================================================
   sora.garden — a living digital herbarium suspended in mist
   Palette: Dawn in the Greenhouse
   Fonts: Josefin Sans (display), Quicksand (subtitle), Nunito (body)
============================================================ */

:root {
    /* DESIGN.md palette — exact hex */
    --rose-mist:       #FDE8E8;
    --lavender-haze:   #E8DAEF;
    --sky-breath:      #D5F5E3;
    --petal-gold:      #FEF9E7;
    --horizon-blue:    #D6EAF8;

    --charcoal-bark:   #2D3436;
    --stone-gray:      #636E72;
    --sage-stem:       #7DCEA0;
    --petal-blush:     #F1948A;
    --moss-dark:       #1E8449;
    --frost-white:     rgba(255, 255, 255, 0.35);

    /* Required hex tokens (DESIGN.md states these in palette list) */
    --canvas-white:    #FEFEFE;
    --rose-violet-mix: #F5E6F0;

    --font-display:    "Josefin Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
    --font-sub:        "Quicksand", "sora", "Inter", sans-serif;
    --font-body:       "Nunito", "Inter", "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
    width: 100%;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--charcoal-bark);
    line-height: 1.85;
    letter-spacing: 0.01em;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);

    /* Continuous full-document gradient — six pastel zones, gradual transitions */
    background:
        linear-gradient(
            180deg,
            #FDE8E8 0%,
            #FDE8E8 12%,
            #F5E6F0 18%,
            #E8DAEF 28%,
            #DEDEEF 36%,
            #E0E8E5 42%,
            #D5F5E3 54%,
            #E8F2D8 62%,
            #FEF9E7 72%,
            #ECF1ED 82%,
            #D6EAF8 92%,
            #D6EAF8 100%
        );
    background-attachment: fixed;
    min-height: 100vh;
}

/* @supports fallback for backdrop-filter */
@supports not ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
    .text-pane {
        background: rgba(255, 255, 255, 0.85) !important;
    }
}

/* ============================================================
   Flow curve background — sinuous wind currents
============================================================ */
.flow-curves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 600vh;
    z-index: 0;
    pointer-events: none;
    transform: translateZ(0);
}
.flow-path {
    will-change: transform;
    transform-origin: 50% 50%;
    animation: breathe 22s ease-in-out infinite;
}
.flow-path-2 { animation-duration: 26s; animation-delay: -3s; }
.flow-path-3 { animation-duration: 24s; animation-delay: -6s; }
.flow-path-4 { animation-duration: 28s; animation-delay: -9s; }
.flow-path-5 { animation-duration: 23s; animation-delay: -12s; }
.flow-path-6 { animation-duration: 27s; animation-delay: -15s; }

@keyframes breathe {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(20px, -10px, 0) scale(1.02); }
}

/* ============================================================
   Leaf-dot navigation — fixed right edge
============================================================ */
.leaf-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.leaf-dot {
    width: 14px;
    height: 14px;
    color: var(--sage-stem);
    opacity: 0.5;
    transition: all 0.4s ease;
    display: block;
    text-decoration: none;
    transform-origin: center;
}
.leaf-dot svg {
    width: 100%;
    height: 100%;
    display: block;
}
.leaf-dot.active {
    color: var(--moss-dark);
    opacity: 1;
    transform: scale(1.18);
    filter: drop-shadow(0 0 6px rgba(125, 206, 160, 0.55));
}
.leaf-dot:hover {
    opacity: 0.9;
    transform: scale(1.1);
}

/* ============================================================
   Garden — wraps all rooms
============================================================ */
.garden {
    position: relative;
    z-index: 1;
}

/* ============================================================
   Room — each occupies >= 100vh
============================================================ */
.room {
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12vh 6vw;
    color: var(--charcoal-bark);
}

/* Progressive width narrowing — telescoping perspective */
.room-1 .room-inner { max-width: 1280px; }
.room-2 .room-inner { max-width: 1180px; }
.room-3 .room-inner { max-width: 1100px; }
.room-4 .room-inner { max-width: 1040px; }
.room-5 .room-inner { max-width: 980px; }
.room-6 .room-inner { max-width: 1100px; }

.room-inner {
    width: 100%;
    position: relative;
    display: grid;
    gap: 6vh 6vw;
    align-items: center;
    z-index: 2;
}

/* alternating layouts */
.align-center {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
}
.align-left {
    grid-template-columns: 1fr 1fr;
}
.align-right {
    grid-template-columns: 1fr 1fr;
}
.align-left .text-column { order: 1; text-align: left; }
.align-left .botanical { order: 2; }
.align-right .text-column { order: 2; text-align: left; }
.align-right .botanical { order: 1; }

/* ============================================================
   Typography
============================================================ */
.room-label {
    display: inline-block;
    font-family: var(--font-sub);
    font-weight: 400;
    font-size: clamp(0.78rem, 1.1vw, 0.92rem);
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--moss-dark);
    margin-bottom: 1.1rem;
    opacity: 0.85;
}

.room-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
    color: var(--charcoal-bark);
    margin-bottom: 1rem;
}
.brand-title {
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 5.4rem);
    letter-spacing: 0.08em;
    text-transform: lowercase;
}

.room-title .latin {
    display: block;
    font-family: var(--font-sub);
    font-weight: 400;
    font-size: clamp(1.05rem, 1.9vw, 1.4rem);
    font-style: italic;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--stone-gray);
    margin-top: 0.6rem;
}

.room-subtitle {
    font-family: var(--font-sub);
    font-weight: 400;
    font-size: clamp(1.1rem, 2.2vw, 1.6rem);
    letter-spacing: 0.03em;
    color: var(--stone-gray);
    margin-bottom: 3.4vh;
}
.room-subtitle em {
    font-style: italic;
    color: var(--stone-gray);
}

/* Light-zone color flip on the gold/blue rooms keeps title legible */
.room-5 .room-title,
.room-6 .room-title { color: var(--charcoal-bark); }

/* ============================================================
   Frosted glass text panes
============================================================ */
.text-pane {
    background: rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: clamp(1.4rem, 3vw, 2.4rem) clamp(1.6rem, 3.4vw, 2.8rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    max-width: 540px;
    color: var(--charcoal-bark);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.text-pane.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.text-pane p {
    color: var(--charcoal-bark);
    opacity: 0.85;
    font-weight: 300;
    line-height: 1.85;
    letter-spacing: 0.01em;
}
.text-pane p + p { margin-top: 1.1rem; }
.text-pane.wide { max-width: 680px; }

.signoff {
    font-family: var(--font-sub);
    font-size: 0.92rem !important;
    color: var(--stone-gray) !important;
    letter-spacing: 0.06em;
    margin-top: 1.4rem !important;
}

/* ============================================================
   Botanical figure / SVG illustrations
============================================================ */
.botanical {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.botanical-svg {
    width: 100%;
    max-width: 520px;
    height: auto;
    color: var(--sage-stem);
    overflow: visible;
    filter: drop-shadow(0 6px 18px rgba(125, 206, 160, 0.18));
}

/* Width tuning per room — telescoping perspective */
.botanical-1 { max-width: 460px; }
.botanical-2 { max-width: 440px; }
.botanical-3 { max-width: 480px; }
.botanical-4 { max-width: 460px; }
.botanical-5 { max-width: 440px; }
.botanical-6 { max-width: 600px; }

/* Path-draw animation — strokes draw from invisible to full */
.draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.room.is-visible .draw {
    animation: draw-stroke 3.6s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}
.draw.fine {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}
.room.is-visible .draw.fine {
    animation: draw-stroke-fine 2.4s cubic-bezier(0.25, 0.1, 0.25, 1) 1.4s forwards;
}

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

/* Stagger via nth-child so multiple paths feel sequential */
.room.is-visible .draw:nth-of-type(1)  { animation-delay: 0.2s; }
.room.is-visible .draw:nth-of-type(2)  { animation-delay: 0.5s; }
.room.is-visible .draw:nth-of-type(3)  { animation-delay: 0.8s; }
.room.is-visible .draw:nth-of-type(4)  { animation-delay: 1.0s; }
.room.is-visible .draw:nth-of-type(5)  { animation-delay: 1.2s; }
.room.is-visible .draw:nth-of-type(6)  { animation-delay: 1.4s; }
.room.is-visible .draw:nth-of-type(7)  { animation-delay: 1.6s; }
.room.is-visible .draw:nth-of-type(8)  { animation-delay: 1.8s; }
.room.is-visible .draw:nth-of-type(9)  { animation-delay: 2.0s; }
.room.is-visible .draw:nth-of-type(10) { animation-delay: 2.2s; }

/* Flower group — petals + stamens fade in via group opacity */
.room-4.is-visible .flower {
    animation: flower-bloom 1.6s ease forwards;
}
.room-4 .flower {
    opacity: 0;
    transform-origin: center;
    transform-box: fill-box;
}
.room-4.is-visible .flower:nth-of-type(1) { animation-delay: 1.4s; }
.room-4.is-visible .flower:nth-of-type(2) { animation-delay: 1.8s; }
.room-4.is-visible .flower:nth-of-type(3) { animation-delay: 2.2s; }
@keyframes flower-bloom {
    0%   { opacity: 0; transform: scale(0.6); }
    100% { opacity: 1; transform: scale(1); }
}

/* Pod and seed groups */
.room-5 .pod { opacity: 0; transform: translateY(8px); }
.room-5.is-visible .pod {
    animation: pod-settle 1.4s ease forwards;
}
.room-5.is-visible .pod:nth-of-type(1) { animation-delay: 1.6s; }
.room-5.is-visible .pod:nth-of-type(2) { animation-delay: 2.0s; }
.room-5.is-visible .pod:nth-of-type(3) { animation-delay: 2.4s; }
@keyframes pod-settle {
    to { opacity: 1; transform: translateY(0); }
}

.room-6 .seed { opacity: 0; }
.room-6.is-visible .seed-flock .seed {
    animation: seed-drift 2.4s ease forwards;
}
.room-6.is-visible .seed-flock .seed:nth-child(1)  { animation-delay: 1.4s; }
.room-6.is-visible .seed-flock .seed:nth-child(2)  { animation-delay: 1.55s; }
.room-6.is-visible .seed-flock .seed:nth-child(3)  { animation-delay: 1.7s; }
.room-6.is-visible .seed-flock .seed:nth-child(4)  { animation-delay: 1.85s; }
.room-6.is-visible .seed-flock .seed:nth-child(5)  { animation-delay: 2.0s; }
.room-6.is-visible .seed-flock .seed:nth-child(6)  { animation-delay: 2.15s; }
.room-6.is-visible .seed-flock .seed:nth-child(7)  { animation-delay: 2.3s; }
.room-6.is-visible .seed-flock .seed:nth-child(8)  { animation-delay: 2.45s; }
.room-6.is-visible .seed-flock .seed:nth-child(9)  { animation-delay: 2.6s; }
.room-6.is-visible .seed-flock .seed:nth-child(10) { animation-delay: 2.75s; }
.room-6.is-visible .seed-flock .seed:nth-child(11) { animation-delay: 2.9s; }
.room-6.is-visible .seed-flock .seed:nth-child(12) { animation-delay: 3.05s; }
.room-6.is-visible .seed-flock .seed:nth-child(13) { animation-delay: 3.2s; }
.room-6.is-visible .seed-flock .seed:nth-child(14) { animation-delay: 3.35s; }
.room-6.is-visible .seed-flock .seed:nth-child(15) { animation-delay: 3.5s; }

@keyframes seed-drift {
    0% { opacity: 0; }
    100% { opacity: var(--seed-op, 1); }
}

/* ============================================================
   Text-column / fade entry
============================================================ */
.text-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}
.align-center .text-column,
.align-center > * {
    align-items: center;
}

.fade-up {
    opacity: 0;
    transform: translateY(30px);
}
.room.is-visible .fade-up {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1.1s ease 0.6s, transform 1.1s cubic-bezier(0.25, 0.1, 0.25, 1) 0.6s;
}

/* Title / subtitle / label fade-in within room reveal */
.room .room-label,
.room .room-title,
.room .room-subtitle {
    opacity: 0;
    transform: translateY(12px);
}
.room.is-visible .room-label  { animation: text-fade-in 1.2s ease 0.2s forwards; }
.room.is-visible .room-title  { animation: text-fade-in 1.2s ease 0.4s forwards; }
.room.is-visible .room-subtitle { animation: text-fade-in 1.2s ease 0.6s forwards; }

@keyframes text-fade-in {
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Micro-botanical decorative elements
============================================================ */
.micro-leaf {
    position: absolute;
    width: 22px;
    height: 22px;
    color: var(--sage-stem);
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.4s ease, transform 1.4s ease;
}
.micro-leaf svg { width: 100%; height: 100%; display: block; }
.room.is-visible .micro-leaf {
    opacity: 0.55;
}

.micro-leaf { --leaf-drift: 0px; }
.micro-leaf-tl { top: 8vh;  left: 6vw;  transform: translateY(var(--leaf-drift)) rotate(-18deg); }
.micro-leaf-tr { top: 10vh; right: 7vw; transform: translateY(var(--leaf-drift)) rotate(15deg); }
.micro-leaf-bl { bottom: 10vh; left: 8vw;  transform: translateY(var(--leaf-drift)) rotate(28deg); }
.micro-leaf-br { bottom: 8vh;  right: 6vw; transform: translateY(var(--leaf-drift)) rotate(-22deg); }

/* ============================================================
   Per-room accent colour overrides for SVG strokes
============================================================ */
.room-1 .botanical-svg { color: var(--sage-stem); }
.room-2 .botanical-svg { color: #6BB890; }
.room-3 .botanical-svg { color: var(--sage-stem); }
.room-4 .botanical-svg { color: #6BB890; }
.room-5 .botanical-svg { color: #5BA67E; }
.room-6 .botanical-svg { color: var(--moss-dark); }

/* ============================================================
   First-room load animation (page entry)
============================================================ */
.room-1 {
    animation: dawn-rise 2.2s ease 0.5s both;
}
@keyframes dawn-rise {
    0%   { background: radial-gradient(circle at 50% 50%, #FDE8E8 0%, #FDE8E8 100%); }
    100% { background: radial-gradient(circle at 50% 30%, #FFF0F0 0%, #FDE8E8 70%); }
}

/* ============================================================
   Responsive — below 768px
============================================================ */
@media (max-width: 768px) {
    .room {
        padding: 10vh 5vw;
    }
    .room-inner {
        max-width: 100% !important;
    }
    .align-left,
    .align-right {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .align-left .text-column,
    .align-right .text-column {
        order: 2;
        text-align: center;
        align-items: center;
    }
    .align-left .botanical,
    .align-right .botanical {
        order: 1;
    }
    .botanical-svg {
        max-width: 70vw !important;
    }
    .text-pane {
        max-width: 90vw;
    }
    .room-title {
        font-size: clamp(1.8rem, 6vw, 2.8rem);
    }
    .brand-title {
        font-size: clamp(2.4rem, 8vw, 3.6rem);
    }
    .leaf-nav {
        right: 50%;
        top: auto;
        bottom: 16px;
        transform: translateX(50%);
        flex-direction: row;
        gap: 14px;
        padding: 8px 14px;
    }
    .micro-leaf { display: none; }
}

@media (max-width: 480px) {
    .room {
        padding: 8vh 5vw;
    }
    .room-subtitle {
        font-size: 1rem;
    }
}

/* ============================================================
   Reduced motion
============================================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .draw {
        stroke-dashoffset: 0 !important;
    }
}
