/* Landing journey (Home only) — extracted from the Opus hero build.
   Canopy video + WebGL komorebi light; scroll descends through the forest,
   three shafts land on the three pillars, then daylight. Shares tokens with styles.css. */
:root {
  --base: #0F1F17;
  --base-deep: #07100B;
  --accent: #F4C95D;
  --daylight: #edf1ea;       /* = --bg in styles.css, so the wash hands off seamlessly */
  --paper: #F6F4EE;
  --paper-2: rgba(242, 240, 234, .86);
  --paper-3: rgba(242, 240, 234, .66);
  --gutter: clamp(16px, 3vw, 44px);
  --header-h: 64px;
  --bar-h: 44px;
  --font-head: var(--font);
  --font-body: var(--font);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
:root:lang(ja) { --font-head: "Noto Sans JP", "Pretendard Variable", Pretendard, system-ui, sans-serif; }

body[data-page="home"] { background: var(--base); color: var(--paper); overflow-x: clip; }
body[data-page="home"] .bar { position: fixed; inset: 0 0 auto; background: none; color: var(--ink); padding-top: max(var(--pad), env(safe-area-inset-top)); }
.daylight { background: var(--bg); color: var(--ink); }
body[data-page="home"] #foot { display: flow-root; background: var(--bg); }

/* Line breaking: KO keeps words whole, JA breaks on phrases where supported */
:lang(ko) h1, :lang(ko) h2, :lang(ko) h3, :lang(ko) p { word-break: keep-all; overflow-wrap: break-word; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) p { word-break: normal; line-break: strict; overflow-wrap: anywhere; }
@supports (word-break: auto-phrase) {
  :lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) p { word-break: auto-phrase; overflow-wrap: normal; }
}
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

.mono {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* =========================================================================
   JOURNEY — a tall scroll track with a pinned (sticky) stage.
   Scroll progress (0→1) drives: hero out → descent through canopy →
   light shafts fall onto the pillars → daylight.
   ========================================================================= */
.journey { position: relative; height: 100svh; }
.js .journey { height: calc(var(--journey-length, 5.2) * 100svh); }

.stage {
  position: sticky; top: 0;
  height: 100svh; width: 100%;
  overflow: hidden;
  background: var(--base);
  isolation: isolate;
}
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > img, .layer > video {
  width: 100%; height: 100%; display: block;
  object-fit: cover;
}

/* Canopy (looking up). Lifts and fades as we descend. */
.media-canopy {
  opacity: var(--canopy, 1);
  transform: translate3d(0, calc((1 - var(--canopy, 1)) * -7%), 0) scale(calc(1.02 + (1 - var(--canopy, 1)) * .2));
  transform-origin: 50% 20%;
  will-change: transform, opacity;
}
/* Forest interior (light shafts). Rises into place. */
.media-forest {
  opacity: var(--forest, 0);
  transform: translate3d(0, calc((1 - var(--forest, 0)) * 8%), 0) scale(calc(1.12 - var(--forest, 0) * .07));
  will-change: transform, opacity;
}
.media-forest > img { object-position: 50% 60%; }

/* Dark green grade over all photography */
.grade {
  background:
    linear-gradient(180deg, rgba(15, 31, 23, .50) 0%, rgba(15, 31, 23, .62) 55%, rgba(10, 22, 16, .82) 100%);
}
.tint { background: #2B4A35; mix-blend-mode: color; opacity: .42; }

/* The light shader. Screen blend: black = no change, gold = light. */
.fx-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none;
  mix-blend-mode: screen;
}
.fx-static .fx-canvas { display: none; }

/* Static fallback light (no-WebGL/low-power): soft CSS gradients + CSS shafts */
.static-light, .static-rays { display: none; mix-blend-mode: screen; }
.fx-static .static-light {
  display: block;
  background:
    radial-gradient(38% 30% at 72% 18%, rgba(244, 201, 93, .30), transparent 70%),
    radial-gradient(26% 22% at 30% 36%, rgba(244, 201, 93, .16), transparent 70%),
    radial-gradient(30% 20% at 58% 62%, rgba(244, 201, 93, .12), transparent 70%);
  opacity: calc(.4 + var(--canopy, 1) * .6);
}
.fx-static .static-rays {
  display: block;
  background: repeating-linear-gradient(112deg,
      transparent 0 70px, rgba(244, 201, 93, .10) 70px 96px,
      transparent 96px 150px, rgba(244, 201, 93, .06) 150px 162px, transparent 162px 240px);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--sheet, 0) * 120% - 30%), transparent calc(var(--sheet, 0) * 120%));
  mask-image: linear-gradient(to bottom, #000 calc(var(--sheet, 0) * 120% - 30%), transparent calc(var(--sheet, 0) * 120%));
  opacity: var(--sheetAmt, 0);
}

/* Film grain (tile generated in JS) */
.grain {
  inset: -50%;
  background-image: var(--grain-img, none);
  background-size: 180px 180px;
  opacity: var(--grain-amt, .07);
  mix-blend-mode: overlay;
  animation: grain 1.1s steps(6) infinite;
}
@keyframes grain {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-4%, 3%, 0); }
  40%  { transform: translate3d(3%, -5%, 0); }
  60%  { transform: translate3d(-6%, -2%, 0); }
  80%  { transform: translate3d(5%, 4%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Scrims keep text at WCAG AA over the moving light */
.scrim-hero {
  background:
    radial-gradient(140% 95% at 0% 100%, rgba(7, 15, 11, .86) 0%, rgba(7, 15, 11, .55) 38%, rgba(7, 15, 11, 0) 70%),
    linear-gradient(to bottom, rgba(7, 15, 11, .5), rgba(7, 15, 11, 0) 22%);
  opacity: calc(1 - var(--heroOut, 0) * .7);
}
.scrim-chapter {
  background:
    linear-gradient(to bottom, rgba(7, 15, 11, .72) 0%, rgba(7, 15, 11, 0) 46%),
    linear-gradient(to top, rgba(7, 15, 11, .84) 0%, rgba(7, 15, 11, .5) 26%, rgba(7, 15, 11, 0) 52%);
  opacity: var(--chapterVis, 0);
}
/* Daylight wash at the end of the journey — matches the next section */
.daylight-wash { background: var(--daylight); opacity: var(--day, 0); }

/* ---------- Hero copy ---------- */
.hero {
  position: absolute; z-index: 5;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--bar-h) + clamp(40px, 9vh, 110px));
  max-width: 1180px;
  opacity: calc(1 - var(--heroOut, 0));
  transform: translate3d(0, calc(var(--heroOut, 0) * -56px), 0);
}
.hero h1 {
  margin: 0;
  font: 800 clamp(2.5rem, 1rem + 6.4vw, 7.4rem)/.95 var(--font-head);
  letter-spacing: -.04em;
  color: var(--paper);
}
:lang(ja) .hero h1 {
  font-size: clamp(2.1rem, .8rem + 5.3vw, 6.2rem);
  line-height: 1.02;
  letter-spacing: -.03em;
}
.hero p {
  margin: clamp(18px, 2.4vh, 28px) 0 clamp(22px, 3vh, 34px);
  max-width: 31em;
  font: 400 clamp(15px, .55vw + 11px, 19px)/1.62 var(--font-body);
  color: var(--paper-2);
}

.cta {
  display: inline-flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 7px 0 24px;
  border-radius: 999px;
  background: var(--daylight); color: var(--base);
  font: 800 15px/1 var(--font-head); letter-spacing: -.01em;
  text-decoration: none;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 10px 40px -10px rgba(244, 201, 93, .55); }
.cta-dot {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--base);
}
.cta-dot svg { width: 16px; height: 16px; transition: transform .4s var(--ease); }
.cta:hover .cta-dot svg { transform: translateX(2px); }
.cta--dark { background: var(--ink); color: var(--daylight); }

/* ---------- Bottom bar ---------- */
.lp-bar {
  position: absolute; z-index: 5;
  left: var(--gutter); right: var(--gutter); bottom: max(18px, env(safe-area-inset-bottom));
  min-height: var(--bar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px;
  color: var(--paper-2);
  opacity: calc(1 - var(--barOut, 0));
}
.clocks { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); white-space: nowrap; }
.clock time { color: var(--paper); font-variant-numeric: tabular-nums; margin-left: .6em; }
.tz-tag {
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid rgba(242, 240, 234, .26);
  font-size: 10px; color: var(--paper-2);
}
.scroll-cue { justify-self: end; display: flex; align-items: center; gap: 12px; }
.scroll-line { position: relative; width: 1px; height: 38px; background: rgba(242, 240, 234, .22); overflow: hidden; }
/* a drop of light falls down the line — foreshadows the descent */
.scroll-line::after {
  content: ""; position: absolute; left: 0; top: -45%;
  width: 1px; height: 45%;
  background: linear-gradient(to bottom, transparent, var(--accent));
  animation: drip 2.4s cubic-bezier(.6, 0, .2, 1) infinite;
}
@keyframes drip { to { top: 100%; } }

/* ---------- Chapter: where the light lands ---------- */
.chapter {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: calc(var(--header-h) + clamp(12px, 5vh, 64px)) var(--gutter) clamp(20px, 5.5vh, 64px);
  opacity: var(--chapterVis, 0);
  transform: translate3d(0, calc((1 - var(--chapterIn, 0)) * 28px), 0);
  pointer-events: none;
}
.chapter.is-hidden, .hero.is-hidden, .lp-bar.is-hidden { visibility: hidden; }
.eyebrow { color: var(--accent); display: flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.chapter h2 {
  margin: 14px 0 0;
  max-width: 11em;
  font: 800 clamp(2rem, .7rem + 4.4vw, 5.2rem)/.98 var(--font-head);
  letter-spacing: -.035em;
  color: var(--paper);
}
:lang(ja) .chapter h2 { line-height: 1.06; letter-spacing: -.025em; max-width: 13em; }

.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3.4vw, 56px);
  pointer-events: auto;
}
/* Open column on the forest floor: the top rule is where the shaft lands.
   --lx must match where landing.js aims the shaft (centre on desktop). */
.card {
  --lit: 0; --lx: 50%;
  position: relative;
  padding-top: clamp(24px, 4vh, 44px);
  border-top: 1px solid rgba(242, 240, 234, .2);
}
.card::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px;
  background: radial-gradient(closest-side, var(--accent), rgba(244, 201, 93, 0)) no-repeat;
  background-size: calc(30% + var(--lit) * 110%) 100%;
  background-position: var(--lx) 0;
  opacity: var(--lit);
  transition: background-size .5s var(--ease);
}
.card:hover::before, .card:focus-within::before { background-size: 220% 100%; }
/* the column wakes as its shaft lands: text rises from dim to full */
.card h3, .card-proof { opacity: calc(.5 + var(--lit) * .5); transition: opacity .3s var(--ease); }
.card:hover h3, .card:hover .card-proof, .card:focus-within h3, .card:focus-within .card-proof { opacity: 1; }
.card h3 {
  margin: 0 0 clamp(16px, 3vh, 30px);
  font: 800 clamp(1.25rem, .85rem + 1.1vw, 2rem)/1.15 var(--font-head);
  letter-spacing: -.03em;
  color: var(--paper);
}
.card-link { color: var(--paper); text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: -8px -12px; border-radius: 14px; }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-arrow {
  display: inline-block; vertical-align: -.08em;
  width: .72em; height: .72em; margin-left: .3em;
  color: var(--accent);
  transition: transform .4s var(--ease);
}
.card:hover .card-arrow, .card-link:focus-visible .card-arrow { transform: translateX(4px); }
.card-proof {
  position: relative; z-index: 1;
  display: grid; gap: 4px;
  color: var(--paper-2); text-decoration: none;
}
.card-who { font: 400 clamp(13.5px, .25vw + 12px, 15.5px)/1.55 var(--font-body); text-wrap: pretty; }
.card-result {
  font: 700 clamp(14.5px, .3vw + 12.5px, 17px)/1.45 var(--font-head);
  color: var(--paper);
  text-decoration: underline;
  text-decoration-color: rgba(244, 201, 93, .45);
  text-decoration-thickness: 1px;
  text-underline-offset: .3em;
  transition: text-decoration-color .3s var(--ease);
}
.card-proof:hover .card-result, .card-proof:focus-visible .card-result { text-decoration-color: var(--accent); }
.card-proof:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
:lang(ko) .card-proof { word-break: keep-all; }
:lang(ja) .card-proof { line-break: strict; }
@supports (word-break: auto-phrase) { :lang(ja) .card-proof { word-break: auto-phrase; } }

/* ---------- responsive ---------- */
@media (max-width: 759px) {
  :root { --bar-h: 64px; }
  .lp-bar { grid-template-columns: 1fr auto; row-gap: 12px; }
  .clocks { grid-column: 1 / -1; grid-row: 1; justify-content: space-between; gap: 10px; }
  .lp-bar > .lp-copy { grid-row: 2; }
  .scroll-cue { grid-row: 2; }
  .scroll-line { height: 26px; }
  .cards { grid-template-columns: 1fr; gap: clamp(14px, 2.6vh, 24px); }
  .card { padding-top: 12px; }
  /* stacked: landing.js staggers the shafts to 20% / 50% / 80% across */
  .card:nth-child(1) { --lx: 20%; } .card:nth-child(3) { --lx: 80%; }
  .card h3 { margin: 0 0 6px; }
  .chapter { gap: 16px; }
}
@media (max-width: 380px) {
  .clocks .tz-tag { display: none; }
}
/* very short landscape phones: drop card body copy */
@media (max-height: 560px) and (max-width: 1000px) {
  .card p, .card-who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-line::after { animation: none; }
  .scroll-line::after { top: 30%; }
  .cta, .cta-dot svg, .card::before, .card-arrow, .card-result { transition: none; }
}
