/* ===========================================================
   LAYAN — page layout + section components
   Task 2: hero pin/scroll layout and placeholder sections II–V.
   Task 4 replaces the placeholders with chapter-cover / chapter-block.
   =========================================================== */

/* ---------- intro: hero + chapter II over one sticky background ----------
   .intro wraps the pin and the two sections that scroll over it. The pin
   sticks for the whole wrapper, so the background stays put while:
     #sec-i   (spacer, margin-top:-100svh → starts under the pin)
              0 → 100svh  title + nav dock (js/shell.js); the engraving starts
              filling with colour at once (js/hero-reveal.js)
     #sec-ii  the long text scrolls over the coloured picture
     #sec-iii the cream .sheet («Наши врачи») slides over the painting
              with its torn top edge.
   --run is the spacer height = the scroll budget of the colour reveal.
   Reduced motion: shorter spacer, the tinted frame crossfades in (no shader). */
.intro{position:relative;background:var(--cotton-fluff)}
.hero__pin{position:sticky;top:0;z-index:0;height:100svh;overflow:hidden;isolation:isolate}
.hero{--run:200svh;position:relative;height:var(--run);margin-top:-100svh;pointer-events:none}
/* chapter II sits above the sheet: its video card stays on top while the
   torn edge rises behind it (reference: the Sidekick card over the tear) */
.chapter{position:relative;z-index:2}
.sheet{position:relative;z-index:1}

/* content column: on ≥1024px the left 20% belongs to the fixed shell
   (css/shell.css). Backgrounds stay full-bleed; content starts at --content-l. */
main{--content-l:var(--pad-x)}
@media (min-width:1024px){
  main{--content-l:calc(var(--sidebar-w) + 2.5vw)}
}

@media (prefers-reduced-motion: reduce){
  .hero{--run:160svh}
}

/* ---------- placeholder sections (temporary, tasks 4–7) ---------- */
.ph{
  min-height:100svh;
  display:flex;flex-direction:column;justify-content:flex-end;
  padding:clamp(48px,8vh,96px) var(--pad-x);
  padding-left:var(--content-l);
  scroll-margin-top:0;
}
.ph--light{background:var(--cotton-fluff);color:var(--black)}
.ph--midnight{background:var(--burgundy-midnight);color:var(--cotton-fluff)}
.ph--dark{background:var(--black);color:var(--cotton-fluff)}
.ph__num{font-family:var(--font-display);font-size:var(--fs-h3);line-height:1;opacity:.55;margin-bottom:.4em}
.ph__ttl{font-family:var(--font-display);font-weight:400;font-size:var(--fs-hero);line-height:.95;letter-spacing:-.02em}
.ph__note{margin-top:1.5rem;max-width:44ch;font-size:var(--fs-small);opacity:.6}

@media (max-width:760px){
  .ph{padding-left:var(--gutter);padding-right:var(--gutter)}
}

/* ---------- hero reveal: engraving → coloured engraving (js/hero-reveal.js) ----------
   .bg-gl  WebGL canvas: the engraving fills with colour from the edges.
           Shown once the shader is up (#bg.is-gl).
   .bg-a   the faded engraving (first frame): always under everything.
   .bg-b   the tinted engraving (last frame): shader texture, and the
           no-WebGL / reduced-motion crossfade (--in scrubbed, or .intro.is-inside).
   (no wash under chapter II any more — client, 2026-11-03) */
#bg .bg-gl{display:none}
#bg.is-gl .bg-gl{display:block}
#bg .bg-b{--in:0;opacity:var(--in)}
#bg.is-gl .bg-a,#bg.is-gl .bg-b{visibility:hidden}
.intro.is-inside #bg .bg-b{--in:1}
@media (prefers-reduced-motion: reduce){
  #bg .bg-b{transition:opacity .8s ease}
}

/* ---------- chapter cover (reference: the "Sidekick" block) ----------
   No visible headline (client, 2026-10-24): the lede is the first thing to
   rise over the picture. It starts 12svh down and js/hero-reveal.js finishes
   the colour just before it enters (lede top 95%), so the text follows the
   colour closely (client, 2026-11-03). White copy, no wash. Lede sizes
   follow the reference at 1024 and 1440 wide (36 → 44px), as a linear vw
   fit. Faberge has one weight. */
.cover{
  padding:0 var(--pad-x) 0 var(--content-l);
  color:var(--white);       /* client 2026-11-03: white copy over the picture */
}
.cover__body{padding:12svh 0 clamp(220px,52svh,560px)}   /* bottom: the sheet rises --rise (26svh) + its torn edge into the chapter; without the video button the lede needs this room */
.cover__lede{
  max-width:min(100%,15.5em);
  font-family:var(--font-display);font-weight:400;
  font-size:clamp(26px,calc(1.755vw + 18.5px),60px);line-height:.96;letter-spacing:-.05em;
}
/* drop cap: Faberge italic (its calligraphic cut), 2.6× like the reference's script cap */
.cover__lede::first-letter{
  font-style:italic;font-size:2.6em;line-height:.7;letter-spacing:0;
  margin-right:.04em;vertical-align:-.12em;
}

/* ---------- the cream sheet (#sec-iii «Наши врачи»): paper-cut top edge ----------
   A static torn-paper edge (client, 2026-10-24: "like a paper cut, solid, no
   animation"): long gentle waves, a fine ragged line and a thin white rim,
   level across the page. The sheet starts --rise higher, so its edge passes
   behind chapter II's video card. .sheet__lip is the cream strip carrying the
   edge (::before); the sheet's own cream starts --lip lower (background-clip).
   torn-edge.svg: regenerate with a new seed rather than hand-editing. Reuse:
   any section can take .sheet + .sheet__lip to get the same cut. */
.sheet{
  --lip:38svh;--rise:26svh;
  position:relative;overflow-x:clip;
  margin-top:calc(-1 * var(--rise));
  padding-top:var(--lip);
  background:var(--cotton-fluff);background-clip:content-box;
  color:var(--black);
}
.sheet__lip{
  position:absolute;top:0;left:0;width:100%;height:calc(var(--lip) + 1px);
  background:var(--cotton-fluff);
  pointer-events:none;
}
.sheet__lip::before{
  content:"";position:absolute;left:0;right:0;bottom:calc(100% - 1px);
  height:clamp(56px,7vw,124px);
  background:url("../assets/img/ui/torn-edge.svg") center bottom/100% 100% no-repeat;
}
.sheet > :not(.sheet__lip){position:relative}   /* content above the lip */
@media (max-width:760px){
  .sheet{--rise:14svh}
}

/* phones / tablets (client 2026-11-04): a longer run so the engraving
   visibly fills with colour under the thumb, and the lede starts lower and
   has room to be read (its words fade in with the scroll, js/hero-reveal.js) */
@media (max-width:1023px) and (prefers-reduced-motion: no-preference){
  /* the box scrolls up with the page (js/hero-reveal.js) and the lede is
     the next thing under it, starting just below the fold, so the first
     screen shows only the box (client 2026-11-04). Below the text only
     the room the sheet's rise and torn edge need (--rise 14svh + ~56px). */
  .hero{--run:calc(100svh + 24px)}
  .cover__body{padding:0 0 calc(14svh + 110px)}
}

.nw{white-space:nowrap}   /* keep words together — Faberge has no width for U+00A0 */
