/*
 * <m-opening> — the report's opening (assets/js/components/m-opening.js), from
 * the Sun lab (sun-lab/opening.html: Sun sky, Fog title). The colours are the
 * embryo explorer's Sun look and stay the same in both themes.
 *   --tk     0 → 1 into the title (fog, blur)      --title  the title's words
 *   --cue    the scroll cue                          --note   the illustration note (with the stats only)
 * Type: Geist and Geist Mono for words, GT Alpina for the big numbers (was Doto; as in the
 * explorer), Newsreader for the title.
 */
@font-face { font-family: "Geist"; src: url("../../fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../../fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Doto"; src: url("../../fonts/doto.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

html.op-locked { overflow: hidden; }

m-opening {
  --op-t1: #2c0a02; --op-t2: #63240a; --op-t1-rgb: 44, 10, 2; --op-line: #fff2c7;
  --op-text: "Geist", system-ui, sans-serif; --op-label: "Geist Mono", ui-monospace, monospace; --op-num: "GT Alpina Standard", Georgia, serif;
  /* the fog: a warm, near-orange haze, clear in the middle */
  --fog-rgb: 255, 172, 98; --fog-blur: 16; --fog-sat: .88; --fog-mid: .32; --fog-edge: .5; --fog-wash: .14;
  display: block; position: relative;
  width: var(--page-w, 100vw); margin-left: calc(50% - var(--page-w, 100vw) / 2);
  margin-top: calc(-1 * (var(--nav-h) + var(--frame, 40px)));
  margin-bottom: -100svh;                      /* the next section slides up over the last screen */
  color: var(--op-t1); font-family: var(--op-text); -webkit-font-smoothing: antialiased;
}
m-opening:not(:defined) { height: 100svh; background: #fd8a2f; }
m-opening:not(:defined) > * { display: none; }
/* The sections between the opening and chapter 1 (m-opening.js marks them .op-over) sit over the fixed sky, with no page
   colour of their own. The first one is a card in the middle; the sky blends to the page colour under them. */
.op-over { position: relative; z-index: 1; }
.chapter.op-over { border-top: 0; }   /* no page rule between the sections over the sky */
/* grey text over the orange sky needs a darker, warmer grey (5:1 there); the card keeps the page's grey */
.op-over { --muted: #5c3a2a; }
.op-over > .overview { --muted: #76625a; }
.op-over > .overview {
  background: var(--bg); border-radius: 0; box-sizing: border-box;   /* square corners */
  margin: 14vh auto 0;
  padding: clamp(44px, 5vw, 64px) clamp(24px, 5vw, 56px) clamp(32px, 4vw, 44px);
  box-shadow: 0 30px 90px rgba(90, 30, 0, .2);
}
/* the scroll cue, under the card, over the sky */
.op-over > .ov-cue { position: relative; margin: 7vh auto 16vh; }
@media (width < 1000px) { .op-over > .overview { width: auto; margin-inline: 16px; } }
/* phones: the card runs edge to edge, like the chart cards (17 Nov, round 2), with a smaller padding */
@media (width <= 600px) {
  .op-over > .overview { width: 100vw; max-width: none; margin: 10vh calc(50% - 50vw) 0; padding: 40px 22px 30px; box-shadow: 0 20px 60px rgba(90, 30, 0, .16); }
  .op-over > .ov-cue { margin: 6vh auto 12vh; }
}

/* six steps (what we studied + five findings) and the title: about 1.2 screens of scrolling per step */
.op { --tk: 0; --title: 0; --cue: 0; --note: 0; --white: 0; --brand: 1; position: relative; height: 1100svh; }

/* the Plum DataLabs logo: on the count and the first step, then it leaves. One colour (the opening's ink), because
   the brand red is weak on the orange sky; the shapes are masks of the brand files. */
.op-brand { position: absolute; z-index: 8; left: 7vw; top: clamp(20px, 5vh, 48px); display: flex; align-items: center; gap: 10px; margin: 0; opacity: var(--brand); pointer-events: none; }
.op-brand i { display: block; background: var(--op-t1); }
.op-brand .mk { width: 34px; height: 34px; -webkit-mask: url("../../images/brand/plum-mark.svg") center / contain no-repeat; mask: url("../../images/brand/plum-mark.svg") center / contain no-repeat; }
.op-brand .wd { height: 31px; aspect-ratio: 281 / 76; -webkit-mask: url("../../images/brand/datalabs-wordmark.webp") center / contain no-repeat; mask: url("../../images/brand/datalabs-wordmark.webp") center / contain no-repeat; }
@media (max-aspect-ratio: 4 / 5) { .op-brand { top: 20px; } .op-brand .mk { width: 28px; height: 28px; } .op-brand .wd { height: 26px; } }
.op-stage {
  position: fixed; inset: 0; height: 100svh; overflow: hidden;
  /* shown only if WebGL is not there: the Sun sky, approximated */
  background: linear-gradient(40deg, #fe411f 0%, #fd8a2f 30%, #fea53d 62%, #fecc62 100%);
}
.op.covered .op-stage { visibility: hidden; }     /* under the next section */
.op-sky, .op-body { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.op-body { filter: blur(calc(var(--tk) * var(--fog-blur) * 1px)) saturate(calc(1 + var(--tk) * (var(--fog-sat) - 1))); }
.op-fog {
  position: absolute; inset: 0; pointer-events: none; opacity: var(--tk);
  background:
    radial-gradient(ellipse 60% 55% at 50% 52%, rgba(var(--fog-rgb), 0) 0%, rgba(var(--fog-rgb), var(--fog-mid)) 70%, rgba(var(--fog-rgb), var(--fog-edge)) 100%),
    rgba(var(--fog-rgb), var(--fog-wash));
}

/* ---- loading ---------------------------------------------------------------- */
.op-load { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; transition: opacity 1.4s ease .2s; }
.op.loaded .op-load { opacity: 0; pointer-events: none; }
.op-load-line {
  --f: 0; width: min(46vw, 560px); height: 1px; margin-bottom: 26px;
  background: linear-gradient(90deg, var(--op-line) calc(var(--f) * 100%), rgba(var(--op-t1-rgb), .18) 0);
  box-shadow: 0 0 18px 2px rgba(255, 242, 199, calc(var(--f) * .7));
}
.op-count { margin: 0; font-family: var(--op-num); font-size: clamp(64px, 9vw, 120px); font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
.op-load-label { margin: 14px 0 0; font-family: var(--op-label); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--op-t2); }

/* ---- the five numbers ---------------------------------------------------------- */
.op-story { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.op-stat { position: absolute; opacity: 0; will-change: opacity, transform; }
.op-stat.left { left: 7vw; top: 50%; translate: 0 -50%; max-width: 30rem; }
.op-stat.right { left: 64vw; right: 5vw; top: 50%; translate: 0 -50%; max-width: 30rem; }
.op-stat.cs { left: 58vw; }
.op-stat .kicker { margin: 0 0 14px; font-family: var(--op-label); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--op-t2); }
.op-stat .num { display: flex; align-items: baseline; gap: .18em; margin: 0 0 18px; line-height: .8; }
.op-stat .num .d { font-family: var(--op-num); font-weight: 400; font-size: clamp(120px, 15vw, 240px); letter-spacing: -.02em; }
.op-stat .num .u { font-family: var(--op-label); font-size: clamp(18px, 1.6vw, 26px); color: var(--op-t2); }
.op-stat .num .u.w { font-size: clamp(30px, 3vw, 48px); color: var(--op-t1); }
.op-stat .num.gap { gap: .32em; }
.op-stat.left .num .d { font-size: clamp(150px, 20vw, 300px); }
.op-stat .lead { margin: 0; font-size: clamp(24px, 2.3vw, 36px); font-weight: 500; line-height: 1.18; letter-spacing: -.015em; max-width: 22ch; }
.op-stat .meta { margin: 14px 0 0; font-family: var(--op-label); font-size: 13px; line-height: 1.45; color: var(--op-t2); max-width: 38ch; }
/* the intro: what we studied (no big number), then a turn into the findings */
.op-stat.intro .lead { font-size: clamp(28px, 2.9vw, 46px); line-height: 1.14; max-width: 19ch; }
.op-stat.intro .turn { margin: 24px 0 0; font-family: var(--op-label); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--op-t2); }
.op-note { position: absolute; left: 4vw; right: 4vw; bottom: 3vh; margin: 0; max-width: 62rem; font-family: var(--op-label); font-size: 11px; line-height: 1.5; color: rgba(var(--op-t1-rgb), .62); opacity: var(--note); }

/* beat 2: the 0–100 gauge beside the body; the scan line is its pointer */
.op-gauge { --now: 0; position: absolute; z-index: 3; width: 1px; background: rgba(var(--op-t1-rgb), .45); opacity: 0; }
.op-gauge b { font-weight: 400; }
.op-gauge .tick, .op-gauge .mark, .op-gauge .now { position: absolute; left: 0; height: 1px; }
.op-gauge .tick { top: calc(var(--v) * 1%); width: 10px; background: rgba(var(--op-t1-rgb), .55); }
.op-gauge .tick b, .op-gauge .mark b { position: absolute; left: 16px; top: -7px; font: 400 11px/1 var(--op-label); color: var(--op-t2); white-space: nowrap; }
.op-gauge .band { position: absolute; left: -5px; width: 11px; top: calc(var(--a) * 1%); height: calc((var(--b) - var(--a)) * 1%); background: rgba(var(--op-t1-rgb), .28); border-radius: 2px; }
.op-gauge .band b { position: absolute; left: 22px; top: 50%; translate: 0 -50%; font: 500 11px/1 var(--op-label); color: var(--op-t1); white-space: nowrap; }
.op-gauge .mark { top: calc(var(--v) * 1%); width: 16px; background: rgba(var(--op-t1-rgb), .7); }
.op-gauge .now { top: calc(var(--now) * 100%); width: 34px; left: -12px; height: 2px; background: var(--op-line); box-shadow: 0 0 12px 2px rgba(255, 242, 199, .9); }
.op-gauge .now b { position: absolute; left: 30px; top: -9px; font: 600 15px/1 var(--op-label); color: var(--op-t1); transition: transform .3s ease; }
.op-gauge.landed .now b { transform: scale(1.2); transform-origin: left center; }
.op-gauge .g-cap { position: absolute; left: 16px; bottom: -26px; font: 400 11px/1 var(--op-label); color: var(--op-t2); white-space: nowrap; }

/* ---- the title, behind the fog ---------------------------------------------------- */
.op-title { position: absolute; inset: 0; z-index: 4; pointer-events: none; display: grid; place-content: center; justify-items: center; text-align: center; gap: 22px; opacity: var(--title); }
.op-title p, .op-title h1 { margin: 0; }
.op-kicker { font-family: var(--op-label); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--op-t2); }
.op-title h1 { font-family: var(--font-display, "Newsreader"), Georgia, serif; font-weight: 300; line-height: .92; color: var(--op-t1); }
.op-title h1 span { display: block; }
.op-title .t1 { font-size: clamp(76px, 13vw, 224px); letter-spacing: -.02em; }
.op-title .t2 { font-size: clamp(30px, 3.6vw, 60px); font-style: italic; font-weight: 300; }

/* the scroll cue: a minimal mouse and "Scroll down", at the bottom */
.op-cue {
  position: absolute; left: 50%; bottom: 4.5vh; z-index: 5; margin: 0; translate: -50% 0;
  display: grid; justify-items: center; gap: 10px;
  font-family: var(--op-label); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--op-t1);
  opacity: var(--cue);
}
.op-mouse { width: 18px; height: 28px; border: 1.5px solid rgba(var(--op-t1-rgb), .7); border-radius: 10px; position: relative; }
.op-mouse i { position: absolute; left: 50%; top: 6px; width: 2px; height: 6px; margin-left: -1px; border-radius: 2px; background: var(--op-t1); animation: op-wheel 1.8s ease-in-out infinite; }
@keyframes op-wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(8px); opacity: 0; } 100% { transform: translateY(0); opacity: 0; } }

/* the blend to the page colour, over the whole stage */
.op-white { position: absolute; inset: 0; z-index: 7; pointer-events: none; background: var(--bg); opacity: var(--white); }

/* a static opening (no WebGL, or the model did not load): the sky and the title, one screen, in the flow */
m-opening:has(.op.static) { margin-bottom: 0; }
.op.static { height: 100svh; }
.op.static .op-stage { position: relative; }
.op.static .op-title { opacity: 1; }
.op.static .op-cue { opacity: 1; }

/* ---- tall screens ------------------------------------------------------------------ */
@media (max-aspect-ratio: 4 / 5) {
  /* the numbers sit at the bottom, clear of the illustration note under them; m-opening.js fits the body above them */
  .op-stat.left, .op-stat.right, .op-stat.cs { left: 7vw; right: 7vw; top: auto; bottom: calc(3vh + 54px); translate: none; max-width: none; }
  .op-stat .num .d { font-size: 22vw; }
  .op-stat.left .num .d { font-size: 26vw; }
  .op-note { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .op-load { transition: none; }
  .op-mouse i { animation: none; }
}

/* the app inset on the title screen: a small card at the lower right, shown with the title (m-opening .app-on) */
.op-app {
  position: absolute; right: clamp(16px, 3vw, 40px); bottom: clamp(16px, 4vh, 40px); z-index: 5;
  display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 16px; row-gap: 6px; align-content: center;
  max-width: 400px; padding: 14px 18px 14px 14px; box-sizing: border-box;
  color: var(--op-t1); text-decoration: none; text-align: left;
  background: rgba(255, 248, 236, .62); border: 1px solid rgba(var(--op-t1-rgb), .18);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: var(--title); pointer-events: none; transition: background .2s;
}
.op.app-on .op-app { pointer-events: auto; }
.op-app:hover { background: rgba(255, 248, 236, .82); }
.op-app:focus-visible { outline: 2px solid var(--op-t1); outline-offset: 3px; }
/* the week-24 model on the Sun sky, as in the conclusion's app card: a still of that card's stage
   (assets/images/app/week24-inset-*.webp), in the card's left column */
.op-app-pic { grid-column: 1; grid-row: 1 / span 3; align-self: stretch; width: 96px; height: 100%; min-height: 132px; object-fit: cover; object-position: 50% 30%; display: block; }
.op-app > :not(.op-app-pic) { grid-column: 2; }
.op-app-k { align-self: end; }
.op-app-d { align-self: start; }
.op-app-k { font: 500 11px var(--op-label); letter-spacing: .16em; text-transform: uppercase; color: var(--op-t2); }
.op-app b { font: 400 20px/1.2 var(--font-display, Georgia), serif; text-wrap: balance; }
.op-app-d { font: 13px/1.45 var(--op-text); color: rgba(var(--op-t1-rgb), .82); }
/* phones: a slim bar above the scroll cue */
@media (max-aspect-ratio: 4 / 5) {
  .op-app { left: 16px; right: 16px; max-width: none; bottom: calc(4.5vh + 64px); padding: 10px 14px 10px 10px; grid-template-columns: 52px minmax(0, 1fr); column-gap: 12px; row-gap: 3px; }
  .op-app-pic { width: 52px; min-height: 0; height: 64px; grid-row: 1 / span 2; }
  .op-app b { font-size: 17px; }
  .op-app-d { display: none; }
}

/* tall screens (phones): each step keeps its number and its title, so the model has the room (review 17 Nov).
   The title is the same on every screen (18 Nov); only the .meta line is left out here. */
@media (max-aspect-ratio: 4 / 5) {
  .op-stat .meta { display: none; }
  .op-stat .lead { font-size: 19px; line-height: 1.3; max-width: 26ch; }
  .op-stat.intro .lead { font-size: 22px; }
  .op-stat .kicker { margin-bottom: 8px; }
  .op-stat .num { margin-bottom: 10px; }
  .op-stat .num .d { font-size: 19vw; }
}
