/* Layout: one fixed WebGL stage behind a scrolling story. "World" blocks are transparent windows onto the 3D;
   "curtain" sections are opaque paper or forest panels between worlds. Single brand look, not theme-switched. */
:root {
  --rung-tra: #2E4A34;       /* Rừng trà */
  --rung-tra-deep: #1C2E22;
  --la-non: #7A9B7A;         /* Lá non */
  --suong-may: #EAE4D9;      /* Sương mây */
  --giay: #E2DACB;           /* deeper paper for the journey band */
  --go-tra: #8B6F56;         /* Gỗ trà */
  --nang-som: #D9B89A;       /* Nắng sớm */
  --ink: #1E2A21;
  --ink-soft: #4C554A;
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Be Vietnam Pro", "Helvetica Neue", Arial, sans-serif;
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

/* Lenis smooth-scroll base rules (inlined from lenis.css) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--suong-may);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
figure { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.04; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: clamp(2.3rem, 7.2vw, 4.4rem); }
h2 em, h1 em { font-style: italic; font-weight: 500; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a:focus-visible { outline: 2px solid var(--nang-som); outline-offset: 3px; }
.wrap { max-width: 1200px; margin-inline: auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.eyebrow { font-size: 0.72rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--go-tra); }

/* Stage and overlays */
.webgl { position: fixed; inset: 0; width: 100%; height: 100lvh; display: block; z-index: 0; background: var(--suong-may); }
main, .site-footer { position: relative; z-index: 1; }
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0.08; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.2  0 0 0 0 0.15  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.loader {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: var(--suong-may); transition: opacity 0.9s var(--ease), visibility 0.9s;
}
.loader img { border-radius: 4px; animation: breathe 2.4s ease-in-out infinite; }
.loader-text { font-family: var(--font-display); font-style: italic; font-size: 1.25rem; color: var(--rung-tra); }
.loader-bar { width: 140px; height: 1px; background: rgba(46, 74, 52, 0.18); overflow: hidden; }
.loader-bar span { display: block; height: 100%; background: var(--rung-tra); transform: scaleX(0.1); transform-origin: left; transition: transform 0.6s var(--ease); }
.loader.is-done { opacity: 0; visibility: hidden; }
@keyframes breathe { 50% { transform: scale(0.94); opacity: 0.8; } }

/* Header */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) var(--gutter-r) 16px var(--gutter-l);
  color: var(--rung-tra); transition: color 0.4s;
}
.site-header.is-light { color: var(--suong-may); }
.site-header::before {
  content: ""; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.4s, background 0.4s;
  background: linear-gradient(rgba(234, 228, 217, 0.92), rgba(234, 228, 217, 0));
}
.site-header.is-scrolled::before { opacity: 1; }
.site-header.is-light::before { background: linear-gradient(rgba(20, 33, 24, 0.85), rgba(20, 33, 24, 0)); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { border-radius: 3px; }
.wordmark { display: inline-block; background: currentColor; -webkit-mask: var(--mask) center / contain no-repeat; mask: var(--mask) center / contain no-repeat; }
.wordmark-name { --mask: url(img/logo-name-mask.png); height: 19px; aspect-ratio: 893 / 219; }
.wordmark-full { --mask: url(img/logo-wordmark-mask.png); aspect-ratio: 893 / 307; }
.chapter-indicator { display: flex; align-items: baseline; gap: 10px; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; }
#chapter-num { font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.04em; font-variant-numeric: lining-nums; }

/* Word-by-word reveal (spans are added by script; without script the text simply shows) */
[data-split] .w { display: inline-block; transform: translateY(0.55em); opacity: 0; transition: transform 1s var(--ease), opacity 1s var(--ease); transition-delay: calc(var(--i) * 45ms); }
[data-split].is-in .w { transform: none; opacity: 1; }
[data-reveal] { transition: transform 1.1s var(--ease), opacity 1.1s var(--ease); }
.js [data-reveal]:not(.is-in) { opacity: 0; transform: translateY(28px); }

/* Hero */
.hero { position: relative; height: 100svh; min-height: 560px; display: grid; align-content: start; justify-items: center; padding-top: max(16svh, 96px); text-align: center; }
.hero-inner { display: grid; justify-items: center; gap: 22px; padding-inline: 20px; }
.hero-logo { line-height: 0; }
.hero-logo .wordmark-full { width: min(640px, 82vw); color: var(--rung-tra); filter: drop-shadow(0 2px 30px rgba(234, 228, 217, 0.6)); }
.js .hero-logo { clip-path: inset(0 0 100% 0); transition: clip-path 1.6s var(--ease) 0.2s; }
.is-ready .hero-logo { clip-path: inset(0 0 0 0); }
.hero-line { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(1.2rem, 3.6vw, 1.6rem); color: var(--rung-tra); }
.scroll-cue {
  position: absolute; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: grid; justify-items: center; gap: 10px; font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--suong-may);
  text-shadow: 0 1px 12px rgba(28, 46, 34, 0.5);
}
.scroll-cue::after { content: ""; width: 1px; height: 34px; background: currentColor; transform-origin: top; animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* Floating text panels over the 3D */
.panel {
  position: relative; display: grid; gap: 14px; max-width: 30rem;
  margin-left: var(--gutter-l); margin-right: var(--gutter-r); padding: 28px 28px 30px;
  background: rgba(240, 235, 226, 0.8); border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 2px;
  -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
}
.panel h2 { color: var(--rung-tra); }
.panel h2 em { color: var(--go-tra); }
.panel p:not(.eyebrow) { color: var(--ink-soft); }
.panel-dark { background: rgba(16, 27, 19, 0.5); border-color: rgba(234, 228, 217, 0.12); color: var(--suong-may); }
.panel-dark .eyebrow { color: var(--nang-som); }
.panel-dark h2, .panel-dark h2 em { color: var(--suong-may); }
.panel-dark h2 em { color: var(--nang-som); }
.panel-dark p:not(.eyebrow) { color: rgba(234, 228, 217, 0.82); }

.chapter-mountain { min-height: 165vh; padding-top: 70vh; }

/* tree and bud chapters: the text rides along the bottom edge so the 3D subject stays clear above it */
.chapter-tree, .chapter-bud { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 6vh; }
.chapter-tree { min-height: 180vh; }
.chapter-bud { min-height: 200vh; }
.chapter-tree .panel, .chapter-bud .panel { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.bud-labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity 0.6s var(--ease); }
.bud-labels.is-on { opacity: 1; }
.bud-label {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; margin: -6px 0 0 -6px; white-space: nowrap;
  font-size: 0.68rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rung-tra);
}
.bud-label::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--nang-som); box-shadow: 0 0 0 5px rgba(217, 184, 154, 0.3); flex: none; }
.bud-label { text-shadow: 0 0 10px rgba(244, 240, 232, 0.9); }

/* Curtains */
.curtain { position: relative; z-index: 2; }
.people { background: var(--suong-may); padding-block: 128px 140px; }
.curtain-head { display: grid; gap: 16px; max-width: 36rem; margin-bottom: 56px; }
.curtain-head h2 { color: var(--rung-tra); }
.curtain-head h2 em { color: var(--go-tra); }
.curtain-head p:not(.eyebrow) { color: var(--ink-soft); }
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ph { overflow: hidden; border-radius: 2px; background: var(--giay); will-change: transform; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-tall { grid-column: span 2; aspect-ratio: 4 / 5; }
.ph-wide { grid-column: span 2; aspect-ratio: 16 / 10; }
.ph-small, .ph-wide2 { aspect-ratio: 1; }

.craft { background: var(--giay); }
.craft-pin { position: relative; }
.craft-sticky { padding-block: 120px; display: grid; gap: 48px; }
.craft-head { display: grid; gap: 16px; }
.craft-head h2 { color: var(--rung-tra); }
.craft-head h2 em { color: var(--go-tra); }
.craft-track { list-style: none; margin: 0; padding: 0 var(--gutter-r) 0 var(--gutter-l); display: grid; gap: 40px; counter-reset: step; }
.craft-step { counter-increment: step; display: grid; gap: 12px; }
.craft-step figure { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 2px; }
.craft-step img { width: 100%; height: 100%; object-fit: cover; }
.craft-step h3 { font-size: 2rem; color: var(--rung-tra); display: flex; align-items: baseline; gap: 12px; }
.craft-step h3::before { content: "0" counter(step); font-family: var(--font-body); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.2em; color: var(--go-tra); }
.craft-step p { color: var(--ink-soft); }

/* Cold-brew chapter */
.chapter-bottle { height: 340vh; }
.bottle-sticky { position: sticky; top: 0; height: 100svh; display: flex; align-items: flex-end; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.brew-clock { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.clock-num { font-family: var(--font-display); font-weight: 600; font-size: clamp(3.6rem, 13vw, 5.6rem); line-height: 0.85; color: var(--nang-som); font-variant-numeric: lining-nums tabular-nums; min-width: 1.1em; text-align: right; }
.clock-unit { font-size: 0.85rem; letter-spacing: 0.06em; }
.brew-ready { font-size: 0.8rem; opacity: 0.35; transition: opacity 0.4s, color 0.4s; }
.brew-ready.is-on { opacity: 1; color: #B9D0B5; }

/* Values */
.values { background: var(--rung-tra-deep); color: var(--suong-may); padding-block: 140px; }
.values .eyebrow { color: var(--nang-som); }
.values-motto { font-size: clamp(3rem, 11vw, 8.5rem); line-height: 0.95; margin-top: 20px; max-width: 12ch; }
.values-motto em { color: var(--nang-som); }
.values-vi { margin-top: 24px; font-family: var(--font-display); font-style: italic; font-size: clamp(1.3rem, 3.4vw, 1.8rem); color: rgba(234, 228, 217, 0.8); }
.values-grid { display: grid; gap: 28px; margin-top: 72px; }
.value { display: grid; gap: 8px; padding-top: 20px; border-top: 1px solid rgba(217, 184, 154, 0.35); }
.value h3 { font-size: 1.8rem; color: var(--suong-may); }
.value p { color: rgba(234, 228, 217, 0.72); }

/* Finale over dusk mountains */
/* A staggered two-column collage so 3–4 photos share the screen: home moments above the text, days out below it */
.chapter-finale { position: relative; min-height: 232vh; padding-top: 118vh; }
.finale-photos { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fp { position: absolute; width: 42vw; max-width: 340px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; box-shadow: 0 30px 60px rgba(20, 30, 22, 0.35); will-change: transform; }
.fp-1 { left: 5vw; top: 8vh; width: 44vw; }
.fp-2 { right: 5vw; top: 20vh; width: 40vw; }
.fp-3 { left: 9vw; top: 40vh; width: 38vw; }
.fp-4 { right: 7vw; top: 52vh; }
.fp-5 { left: 4vw; top: 72vh; width: 44vw; }
.fp-6 { right: 6vw; top: 168vh; width: 40vw; }
.fp-7 { left: 6vw; top: 180vh; width: 44vw; }
.fp-8 { right: 8vw; top: 199vh; width: 38vw; }
.panel-finale { margin-inline: auto; text-align: left; }
.soon { font-size: 0.85rem; padding-top: 10px; border-top: 1px solid rgba(139, 111, 86, 0.3); }

.site-footer { background: var(--rung-tra-deep); color: var(--suong-may); padding-block: 88px calc(64px + env(safe-area-inset-bottom, 0px)); }
.footer-inner { display: grid; justify-items: center; gap: 18px; text-align: center; }
.footer-inner > img { border-radius: 4px; }
.site-footer .wordmark-full { width: min(260px, 70vw); }
.tagline { font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--nang-som); }
.demo-note { max-width: 40ch; font-size: 0.8rem; color: rgba(234, 228, 217, 0.6); }

@media (min-width: 820px) {
  .panel { margin-left: 8vw; padding: 36px 40px 40px; }
  .people-grid { grid-template-columns: 5fr 4fr 3fr; grid-template-areas: "tall wide wide" "tall small wide2"; gap: 20px; }
  .ph-tall { grid-area: tall; grid-column: auto; aspect-ratio: auto; }
  .ph-wide { grid-area: wide; grid-column: auto; }
  .ph-small { grid-area: small; }
  .ph-wide2 { grid-area: wide2; }
  .craft-sticky { position: sticky; top: 0; height: 100vh; padding-block: 96px 64px; align-content: center; overflow: hidden; }
  .craft-track { display: flex; gap: 32px; width: max-content; will-change: transform; }
  .craft-step { width: min(360px, 28vw); }
  .bottle-sticky { align-items: center; padding-bottom: 0; }
  .values-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
  .fp { width: 15vw; }
  .fp-1 { left: 6vw; top: 10vh; width: 16vw; }
  .fp-2 { right: 7vw; top: 18vh; width: 15vw; }
  .fp-3 { left: 27vw; top: 30vh; width: 12vw; }
  .fp-4 { right: 26vw; top: 44vh; width: 13vw; }
  .fp-5 { left: 8vw; top: 60vh; width: 15vw; }
  .fp-6 { right: 8vw; top: 145vh; width: 15vw; }
  .fp-7 { left: 9vw; top: 180vh; width: 15vw; }
  .fp-8 { right: 28vw; top: 176vh; width: 13vw; }
}

/* No WebGL: photo backdrops stand in for the 3D */
.no-webgl .webgl { display: none; }
.no-webgl .hero { background: linear-gradient(rgba(234, 228, 217, 0.45), rgba(234, 228, 217, 0.2)), url(img/photo-10.webp) center / cover; }
.no-webgl .chapter-mountain { background: linear-gradient(var(--suong-may), var(--giay)); }
.no-webgl [data-world="bud"] { background: url(img/photo-22.webp) center / cover; }
.no-webgl [data-world="bottle"] { background: var(--rung-tra-deep) url(img/photo-19.webp) center / cover; }
.no-webgl [data-world="mountain"][data-mode="dusk"] { background: url(img/photo-2.webp) center / cover; }

@media (prefers-reduced-motion: reduce) {
  [data-split] .w, [data-reveal] { transition: none; transform: none !important; opacity: 1 !important; }
  .scroll-cue::after, .loader img { animation: none; }
  .js .hero-logo { clip-path: none; transition: none; }
}
