/* ===========================================================
   LAYAN — screen I (hero intro), ported from assets/html pages/home.html
   Loading: golden-section construction draws in → box strokes
   → text rises (the painting is visible throughout; the old
   burn-through veil was removed on client request).
   Since task 2 the hero is the pinned first screen of a scrollable
   page: every layer is position:absolute inside .hero__pin (sticky,
   100svh) — see sections.css for the pin/scroll layout and
   js/scroll.js for the scroll-driven bits. Press R to replay.

   Geometry (all from one unit  c , φ = 1.618):
     corner cell   a × c   (a = φc)        golden rect
     centre cell   bw × d  (bw = φ²c, d = φc)
     box           bw × (2c + d)
   Everything — grid, circles, diagonals — is generated in JS
   from the box's real pixel rect, so it lines up at any size.
   =========================================================== */

:root{
  --c: min(13.02vh, 30vw);               /* the golden unit  */
  --a: calc(var(--c) * 1.618);
  --bw: calc(var(--c) * 2.618);
  --bh: calc(var(--c) * 3.618);
  --line: rgba(255,255,255,.12);
  --line-soft: rgba(255,255,255,.09);
  --box-line: rgba(255,255,255,.62);
}

.hero__pin{color:var(--white);font-family:var(--font-text)}

/* ---------- layer 0 : background ----------
   Gradient = no-media fallback. Any <img>/<video>/<canvas> inside covers
   the pin (task 10 swaps the poster for the scroll-scrubbed frame canvas).
   ::after is the legibility tint: brand black/midnight, never pure #000. */
#bg{
  position:absolute;inset:0;z-index:0;overflow:hidden;
  background:var(--cotton-fluff);        /* the engraving's paper (2026-11-03; the black hero is in archive/hero-splash/) */
}
#bg picture,#bg img,#bg video,#bg canvas{
  position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 58%;
}
#bg picture{transform-origin:50% 60%;will-change:transform}   /* scrubbed zoom, js/scroll.js */

/* ---------- layer 2 : construction ---------- */
#cons{position:absolute;inset:0;width:100%;height:100%;z-index:40;pointer-events:none}
#cons path{fill:none;stroke:var(--line);stroke-width:1}
#cons path.soft{stroke:var(--line-soft)}

/* ---------- layer 3 : content ---------- */
.stage{position:absolute;inset:0;z-index:50}

/* centre box — sized from the golden unit */
.box{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:var(--bw);height:var(--bh);
  padding:calc(var(--c) * .165);
  display:flex;flex-direction:column;
}
.box i{position:absolute;background:var(--box-line);display:block}
.box .bt{top:0;left:0;height:1px;width:100%;transform:scaleX(0);transform-origin:left}
.box .br{top:0;right:0;width:1px;height:100%;transform:scaleY(0);transform-origin:top}
.box .bb{bottom:0;left:0;height:1px;width:100%;transform:scaleX(0);transform-origin:right}
.box .bl{bottom:0;left:0;width:1px;height:100%;transform:scaleY(0);transform-origin:bottom}
.drawn .bt,.drawn .bb{transform:scaleX(1);transition:transform .62s var(--ease-draw)}
.drawn .br,.drawn .bl{transform:scaleY(1);transition:transform .62s var(--ease-draw)}
.drawn .br{transition-delay:.30s}
.drawn .bb{transition-delay:.44s}
.drawn .bl{transition-delay:.58s}

/* title */
.ttl{font-family:var(--font-text);font-weight:700;font-size:calc(var(--c) * .285);line-height:.92;letter-spacing:-.02em;color:var(--white)}
.ttl .ln{display:block;overflow:hidden;line-height:.92}
.ttl .ln b{display:block;font-weight:700;transform:translateY(105%);line-height:.92}
.ttl .ln .it{font-family:var(--font-display);font-style:italic;font-weight:400;font-size:1.06em}
.reveal .ttl .ln b{transform:none;transition:transform .78s var(--ease-rise)}
.reveal .ttl .ln:nth-child(2) b{transition-delay:.07s}
.reveal .ttl .ln:nth-child(3) b{transition-delay:.14s}

/* tagline (.tag-hold is the wrapper js/shell.js fades on scroll, so the
   intro's class-driven opacity on .tag stays untouched) */
.tag-hold{margin-top:auto}
.tag{
  font-family:var(--font-display);font-size:calc(var(--c) * .118);
  line-height:1.2;color:rgba(255,255,255,.9);opacity:0;transform:translateY(8px);
}
.reveal .tag{opacity:1;transform:none;transition:opacity .7s ease .26s,transform .7s var(--ease-out) .26s}

/* section list */
.nav{margin-top:calc(var(--c) * .17);display:flex;flex-direction:column}
.nav a{
  display:flex;align-items:baseline;justify-content:space-between;gap:12px;
  text-decoration:none;color:var(--white);
  font-weight:700;font-size:calc(var(--c) * .128);line-height:1.08;letter-spacing:-.01em;
  opacity:0;transform:translateY(6px);position:relative;
  transition:opacity .55s ease,transform .55s var(--ease-out),padding-left .35s var(--ease-out);
}
.reveal .nav a{opacity:1;transform:none}
.reveal .nav a:nth-child(1){transition-delay:.34s}
.reveal .nav a:nth-child(2){transition-delay:.40s}
.reveal .nav a:nth-child(3){transition-delay:.46s}
.reveal .nav a:nth-child(4){transition-delay:.52s}
.reveal .nav a:nth-child(5){transition-delay:.58s}
.reveal .nav a:nth-child(6){transition-delay:.64s}
.nav a .rn{
  font-family:var(--font-display);font-weight:400;font-size:calc(var(--c) * .09);
  color:rgba(255,255,255,.82);letter-spacing:.02em;transition:color .35s ease;
}
.nav a::after{
  content:"";position:absolute;left:0;right:0;bottom:1px;height:1px;
  background:rgba(255,255,255,.5);transform:scaleX(0);transform-origin:left;
  transition:transform .42s var(--ease-out);
}
/* hover only while the list sits in the box: once js/shell.js starts flying
   the spans out, the <a> (and its rule) stay behind mid-page */
html:not(.shell-flying) .nav a:hover{padding-left:8px}
/* the pieces js/shell.js flies into the sidebar scale from their top-left */
.box .ttl,.nav .nm,.nav .rn{transform-origin:0 0}
html:not(.shell-flying) .nav a:hover::after{transform:scaleX(1)}

@media (max-width:760px){
  /* phone: the box fills the width with the 16px gutter (as the reference);
     type scales up a step because the box is now wider than φ²c */
  .box{width:calc(100% - 2 * var(--gutter));padding:calc(var(--c) * .19)}
  .ttl{font-size:calc(var(--c) * .34)}
  .tag{font-size:calc(var(--c) * .135)}
  .nav a{font-size:calc(var(--c) * .15)}
  .nav a .rn{font-size:calc(var(--c) * .1)}
}

/* ---------- hero on the engraving (client, 2026-11-03) ----------
   The hero sits on the faded burgundy-ink engraving. The construction and
   box strokes are Burgundy. The title, tagline, nav and the shell over I–II
   (logo, side title/nav: data-theme="hero") start Burgundy on the cream
   paper and turn White as the colour comes in (client, 2026-11-03, round 5).
   --hi (0 → 1) is set on <html> by js/hero-reveal.js from the reveal
   progress; reduced motion flips it with .intro.is-inside.
   Same selectors as above, later in the file. */
:root{
  --hi: 0;
  --hero-fg: color-mix(in srgb, var(--white) calc(var(--hi) * 100%), var(--burgundy));
  --line: rgba(81,0,0,.30);
  --line-soft: rgba(81,0,0,.18);
  --box-line: rgba(81,0,0,.72);
}
.hero__pin{color:var(--hero-fg)}
.ttl{color:var(--hero-fg)}
.tag{color:color-mix(in srgb, var(--hero-fg) 92%, transparent)}
.nav a{color:var(--hero-fg)}
.nav a .rn{color:color-mix(in srgb, var(--hero-fg) 82%, transparent)}
.nav a::after{background:color-mix(in srgb, var(--hero-fg) 50%, transparent)}

/* ---------- phones / tablets (<1024px, client 2026-11-04) ----------
   Reference: the Shopify Editions phone hero. Everything over screens I–II
   is White from the start (no Burgundy → White fade; there is no side nav
   to hand over to): title, tagline, nav, logo, box and construction. The
   construction is the reference's hairline (white 50 %, ~½px), and a soft
   warm-Black scrim over the picture keeps the white legible on the bare
   engraving; it thins as the colour comes in (--hi). Sizes ≤760px follow
   the reference at 393px wide: nav 18px, tagline 16px (17px wraps the Russian line). As the page scrolls
   the box moves up with it (the construction stays) and chapter II's text
   follows under it (js/hero-reveal.js, css/sections.css). */
@media (max-width:1023px){
  :root{
    --hero-fg: var(--white);
    --line: rgba(255,255,255,.25);      /* white hairline at 25 % (client 2026-11-04) */
    --line-soft: rgba(255,255,255,.175);
    --box-line: rgba(249,243,229,.92);
  }
  #cons path{stroke-width:.6}
  #bg::after{
    content:"";position:absolute;inset:0;pointer-events:none;
    background:linear-gradient(180deg, rgba(30,16,15,.26) 0%, rgba(30,16,15,.15) 45%, rgba(30,16,15,.24) 100%);   /* soft warm Black (client: the burgundy one was worse) */
    opacity:calc(1 - var(--hi, 0) * .45);
  }
  .stage{will-change:transform}
}
@media (max-width:760px){
  .ttl{font-size:calc(var(--c) * .36)}
  .tag{font-size:16px;line-height:1.08;letter-spacing:-.01em}
  .nav{margin-top:calc(var(--c) * .15)}
  .nav a{font-size:18px;line-height:1.02;letter-spacing:-.02em}
  .nav a .rn{font-size:15px}
}
