/* ============================================================
   SGELA — SITE.  The same execution at page scale.

   Layers on tokens.css + components.css + surface.css, and reuses
   surface.css's primitives directly: .ap-stack / .ap-card for the
   stacks, .ap-dot for the pills, .ap-circ for the round controls.
   Only the things a page needs and a phone screen does not are
   defined here.

   THE TRANSLATION
     a screen is one colour      ->  a SECTION is one colour, full bleed
     one oversized screen title  ->  one oversized SECTION title
     cards stack and overlap     ->  same, in a column narrow enough
                                     that the overlap still reads
   ============================================================ */

/* ─────────── Full-bleed section ───────────
   Edge to edge. The colour is the section, not a card inside it. */
.sv-sec { padding-block: var(--space-6);
          scroll-margin-top: calc(var(--space-5) + env(safe-area-inset-top, 0px)); }
.sv-sec--indigo { background: var(--indigo); color: var(--on-indigo); }
.sv-sec--spark  { background: var(--spark);  color: var(--on-spark); }
.sv-sec--growth { background: var(--growth); color: var(--on-growth); }
.sv-sec--ink    { background: var(--ink);    color: var(--on-ink); }
.sv-sec--warm   { background: var(--paper-warm); }

/* On a filled section every foreground is the section's own, so the
   muted roles must stop being muted — grey on indigo is 2.1:1. */
.sv-sec--indigo .sg-caption, .sv-sec--spark .sg-caption,
.sv-sec--growth .sg-caption, .sv-sec--ink .sg-caption,
.sv-sec--indigo .sg-label,   .sv-sec--spark .sg-label,
.sv-sec--growth .sg-label,   .sv-sec--ink .sg-label,
.sv-sec--indigo .sv-kicker,  .sv-sec--spark .sv-kicker,
.sv-sec--growth .sv-kicker,  .sv-sec--ink .sv-kicker { color: inherit; }
/* Inside a filled CARD on a plain section, the card's own foreground wins. */
.ap-card .sv-kicker, .ap-card .sg-caption { color: inherit; }

/* --grey is 4.84:1 on --paper but only 4.34:1 on --paper-warm. It had to be
   corrected by hand twice; this makes the warm ground safe by default. */
.sv-sec--warm .sg-caption { color: var(--ink-soft); }
.sv-sec--warm .ap-card .sg-caption { color: inherit; }

.sv-wrap   { max-width: 1060px; margin: 0 auto; padding-inline: var(--space-2); }
/* The stage needs more room than a text column: the callouts live in the
   margin beside the mockups, and at 1060 they sat a third of the way over
   a phone screen, covering the thing they point at. */
.sv-wrap--wide { max-width: 1240px; }
.sv-narrow { max-width: 760px; }
.sv-col    { display: flex; flex-direction: column; gap: var(--space-3); }
.sv-col-2  { display: flex; flex-direction: column; gap: var(--space-2); }
.sv-row    { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ─────────── The section title ───────────
   The single biggest typographic move on the page. Varela Round
   ships one weight, so the size IS the emphasis. */
.sv-mega { font-family: var(--font-display); font-size: var(--text-mega);
           line-height: var(--lh-tight); letter-spacing: var(--track-caps);
           text-transform: uppercase; margin: 0; text-wrap: balance; }
 /* --ink-soft, not --grey: grey clears 4.5:1 on --paper (4.84) but
    only reaches 4.34:1 on --paper-warm, and half these sections are
    warm. Quiet comes from size and tracking, not from a lighter ink. */
.sv-kicker { font-family: var(--font-body); font-weight: 600;
             font-size: var(--text-label); letter-spacing: var(--track-caps);
             text-transform: uppercase; display: block; color: var(--ink-soft); }

/* ─────────── Stacks at page width ───────────
   The overlap only reads in a narrow-ish column; past about 760px
   a stacked card becomes a letterbox and the effect dies. */
.sv-stack { max-width: 760px; }
.sv-stack .ap-card { padding: var(--space-3); }
.sv-stack .ap-card--collapsed { padding-bottom: calc(var(--stack-peek) - var(--space-1)); }

/* Side by side once there is room — the stack is for phones and
   for the single-column sections. */
.sv-grid  { display: grid; gap: var(--space-2);
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.sv-grid .ap-card { padding: var(--space-3); }
.sv-grid .ap-card + .ap-card { margin-top: 0; }

/* ─────────── Nav ─────────── */
.sv-nav-shell { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
                padding: var(--space-2) var(--space-2) 0; }
.sv-nav { max-width: 1060px; margin: 0 auto; display: flex; align-items: center;
          gap: var(--space-3); background: var(--paper);
          border: var(--stroke); border-radius: var(--radius-pill);
          padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
          box-shadow: var(--drop-sm); }
.sv-nav__brand { margin-right: auto; display: flex; }
.sv-nav__brand img { height: 24px; width: auto; display: block; }
.sv-nav__links { display: flex; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.sv-nav__links a { font-size: var(--text-ui); color: var(--ink); text-decoration: none;
                   font-weight: 500; }
.sv-nav__links a:hover { text-decoration: underline; text-decoration-thickness: 2px;
                         text-underline-offset: 4px; }
@media (max-width: 820px) { .sv-nav__links { display: none; } }

/* ─────────── Brand chip ───────────
   sgela-logo.svg is drawn in --indigo and white, so on an indigo
   or ink ground half of it disappears. On any filled section the
   logo sits in a paper chip rather than directly on the colour.
   Retires the day there is a single-colour logo variant. */
.sv-brandchip { display: inline-flex; align-items: center; background: var(--paper);
                border: var(--stroke); border-radius: var(--radius-pill);
                padding: var(--space-1) var(--space-2); box-shadow: var(--drop-sm); }
.sv-brandchip img { height: 22px; width: auto; display: block; }

/* ─────────── Hero ─────────── */
.sv-hero { display: grid; gap: var(--space-3); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 860px) { .sv-hero { grid-template-columns: 1.1fr .9fr; } }

/* The photograph slot. Marked, never faked — see DESIGN.md. */
.sv-photo { aspect-ratio: 4/5; border-radius: var(--radius-xl);
            display: flex; flex-direction: column; align-items: center;
            justify-content: center; gap: var(--space-1); text-align: center;
            padding: var(--space-3);
            background:
              repeating-linear-gradient(45deg, var(--paper-warm) 0 14px,
                                        var(--paper-hatch) 14px 28px); }

/* ─────────── Pull quote, on a filled section ─────────── */
.sv-quote { border-left: 4px solid currentColor; padding-left: var(--space-2);
            font-size: var(--text-lead); line-height: var(--lh-body); margin: 0;
            font-family: var(--font-display); letter-spacing: var(--track-heading); }

/* ─────────── Footer ─────────── */
.sv-foot { border-top: var(--stroke); background: var(--paper);
           padding-block: var(--space-4);
           padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); }
.sv-foot .sv-wrap { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.sv-foot img { height: 26px; width: auto; }
.sv-foot .sg-caption { margin-right: auto; }

/* ============================================================
   STAGE, MOCKUPS AND CALLOUTS
   Art direction taken from the reference the founders chose: a
   focal visual with small labelled pills floating around its
   edges, and short callout cards scattered around a centred
   statement. The pills are our own .ap-dot — the reference tints
   each one a different pastel; ours carry the dot instead, which
   is the same job done in our palette.

   The focal visual is the APP ITSELF, rendered live in a phone
   frame rather than shipped as a screenshot: crisper at any
   density, nothing to re-export when a screen changes, and no
   image weight on a page our audience pays for by the megabyte.
   ============================================================ */

/* ─────────── Phone frame ───────────
   One definition, used by the platform gallery and the site.

   Built to read as hardware rather than a rounded rectangle: a thick
   outer body, a lighter band inside it where the metal would catch
   light, side buttons, and the screen inset from the body the way a
   real one is. No gradient and no blurred shadow — the device is
   drawn in the same language as everything else.

   FLEX, not percentage heights. The frame grows to its screen (a
   fixed height silently cut four of five mockups), which makes the
   view auto-height, which makes any `height: 100%` inside it resolve
   against nothing and leave dead space at the bottom. */
.sv-phone { width: 280px; flex: none; position: relative;
            display: flex; flex-direction: column;
            background: var(--ink-fixed);
            border-radius: 52px; padding: 11px;
            box-shadow: var(--drop-lg),
                        inset 0 0 0 1.5px rgba(255,255,255,.22),
                        inset 0 0 0 3.5px rgba(0,0,0,.55); }
.sv-phone--tall { min-height: 580px; }

/* Side buttons. Volume pair left, wake right, at the real ratios. */
.sv-phone::before, .sv-phone::after {
  content: ""; position: absolute; width: 3px; border-radius: 2px;
  background: var(--ink-fixed); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.sv-phone::before { left: -3px; top: 23%; height: 10%; }
.sv-phone::after  { right: -3px; top: 27%; height: 15%; }

.sv-phone__notch { position: absolute; top: 22px; left: 50%; translate: -50% 0;
                   width: 96px; height: 26px; border-radius: var(--radius-pill);
                   background: var(--ink-fixed); z-index: 4; }
.sv-phone__view { flex: 1; display: flex; flex-direction: column;
                  overflow: hidden; border-radius: 41px;
                  background: var(--paper); }
.sv-phone__view > * { flex: 1; }
.sv-phone .ap { padding-top: var(--space-5); }

/* ─────────── Stage ───────────
   Holds the mockups and, at desktop width, the callouts pinned
   around them. Below 900px the callouts stop floating and flow
   as an ordinary row — a pill pinned over a phone on a 360px
   screen covers the thing it is pointing at. */
.sv-stage { position: relative; display: flex; justify-content: center;
            align-items: flex-start; gap: var(--space-2); flex-wrap: wrap; }
.sv-stage__phones { display: flex; gap: var(--space-2); justify-content: center;
                    flex-wrap: wrap; }
.sv-stage__phones .sv-phone:nth-child(2) { margin-top: var(--space-4); }

.sv-callouts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
               margin-top: var(--space-2); }
.sv-callout { box-shadow: var(--drop-sm); border: var(--stroke-thin);
              border-color: var(--ink-fixed); }

@media (min-width: 900px) {
  .sv-stage { min-height: 620px; }
  .sv-callouts { display: contents; }
  .sv-callout { position: absolute; margin: 0; z-index: 3; }
  /* Staggered, never stacked in a straight column, and each one only
     just touching the frame it belongs to. */
  .sv-callout--1 { top: 7%;  left: 5%; }
  .sv-callout--2 { top: 19%; right: 5%; }
  .sv-callout--3 { top: 41%; left: 3%; }
  .sv-callout--4 { top: 55%; right: 4%; }
  .sv-callout--5 { top: 76%; left: 9%; }
  .sv-callout--6 { top: 86%; right: 7%; }
}

/* ─────────── Scattered callout cards ───────────
   The reference pairs a small photo with one line of text. The
   photo slot is marked until the library lands — see DESIGN.md. */
.sv-scatter { display: grid; gap: var(--space-2); justify-items: center;
              grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.sv-note { display: flex; align-items: center; gap: var(--space-2);
           background: var(--paper); color: var(--ink);
           border: var(--stroke-thin); border-color: var(--ink-fixed);
           border-radius: var(--radius-lg); padding: 10px var(--space-2) 10px 10px;
           box-shadow: var(--drop-sm); max-width: 380px; }
.sv-note__thumb { width: 52px; height: 52px; flex: none; border-radius: var(--radius-md);
                  background: repeating-linear-gradient(45deg,
                    var(--paper-warm) 0 7px, var(--paper-hatch) 7px 14px); }
.sv-note__t { font-size: var(--text-caption); line-height: 1.4; margin: 0; }
@media (min-width: 1000px) {
  .sv-scatter > :nth-child(3n+1) { transform: translateY(-14px); }
  .sv-scatter > :nth-child(3n)   { transform: translateY(14px); }
}

/* ─────────── Stat row ───────────
   Number above, label below, nothing boxed. */
.sv-stats { display: grid; gap: var(--space-3);
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            text-align: center; }
.sv-stats b { font-family: var(--font-display); font-size: var(--text-stat);
              line-height: var(--lh-tight); letter-spacing: var(--track-stat);
              display: block; font-weight: 400; }

/* ─────────── Audience tabs ─────────── */
.sv-tabrow { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.sv-tabrow button { font-family: var(--font-body); font-weight: 600;
                    font-size: var(--text-label); letter-spacing: var(--track-caps);
                    text-transform: uppercase; cursor: pointer;
                    background: var(--paper); color: var(--ink);
                    border: var(--stroke-thin); border-color: var(--ink-fixed);
                    border-radius: var(--radius-pill); padding: 9px var(--space-2);
                    appearance: none; }
.sv-tabrow button[aria-selected="true"] { background: var(--ink-fixed); color: var(--paper); }
.sv-tabrow button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sv-panel[hidden] { display: none; }

/* ─────────── Pair grid (use cases) ─────────── */
.sv-pairs { display: grid; gap: var(--space-3);
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sv-pair { border-top: var(--stroke); padding-top: var(--space-2); }

/* ============================================================
   NARRATIVE SECTIONS — added 2026-10-20

   Structure and motion borrowed from the awsmd reference the
   founders chose: devices in perspective rather than flat, a
   full-bleed mosaic of real screens, giant ghost type behind a
   section, and reveals driven by scroll position.

   NOT borrowed: its darkness. Every shipping page is pinned to
   light and the near-black fills were deliberately removed
   (decisions.md, 2026-10-15). These effects are built on paper.
   ============================================================ */

/* ─────────── Perspective ───────────
   A device shown flat-on reads as a diagram. Tilted, it reads as
   a thing someone is holding. The container owns the perspective
   so several devices share one vanishing point. */
.sv-stage3d { perspective: 1800px; perspective-origin: 50% 40%; }
.sv-tilt { transform: rotateY(var(--ry, -14deg)) rotateX(var(--rx, 5deg))
                      rotateZ(var(--rz, -4deg)); transform-style: preserve-3d;
           transition: transform var(--dur-entrance) var(--ease); }
.sv-tilt--right { --ry: 14deg; --rz: 4deg; }
.sv-tilt--flat  { --ry: 0deg; --rx: 0deg; --rz: 0deg; }
@media (hover: hover) {
  .sv-stage3d:hover .sv-tilt { --ry: -6deg; --rx: 2deg; --rz: -2deg; }
  .sv-stage3d:hover .sv-tilt--right { --ry: 6deg; --rz: 2deg; }
}

/* ─────────── Ghost type ───────────
   One oversized word sliding behind the content. It carries no
   information — it is texture — so it is aria-hidden and sits
   under everything at a contrast that cannot be mistaken for
   readable text. */
.sv-ghostwrap { position: relative; overflow: hidden; }
.sv-ghostwrap > *:not(.sv-ghost) { position: relative; z-index: 1; }
.sv-ghost { position: absolute; top: 50%; left: 0; translate: 0 -50%;
            display: flex; gap: 6rem; white-space: nowrap; pointer-events: none;
            font-family: var(--font-display); font-size: clamp(90px, 18vw, 230px);
            line-height: .8; letter-spacing: var(--track-caps);
            text-transform: uppercase; color: var(--ink); opacity: .05;
            animation: sv-drift 38s linear infinite; z-index: 0; }
@keyframes sv-drift { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ─────────── Mosaic ───────────
   The reference's screenshot wall: real screens, varied sizes,
   tight gutters, running full bleed. Columns drift at different
   speeds so the wall feels alive while scrolling. */
.sv-mosaic { display: grid; gap: var(--space-2); padding: 0 var(--space-2);
             grid-template-columns: repeat(2, 1fr); align-items: start; }
@media (min-width: 760px)  { .sv-mosaic { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .sv-mosaic { grid-template-columns: repeat(5, 1fr); } }
.sv-mosaic__col { display: flex; flex-direction: column; gap: var(--space-2); }
@media (min-width: 1100px) and (prefers-reduced-motion: no-preference) {
  .sv-mosaic__col:nth-child(2) { margin-top: var(--space-5); }
  .sv-mosaic__col:nth-child(4) { margin-top: var(--space-4); }
}
.sv-tile { border-radius: var(--radius-lg); overflow: hidden;
           border: var(--stroke-thin); border-color: var(--ink-fixed);
           box-shadow: var(--drop-sm); background: var(--paper); }
.sv-tile .ap { min-height: 0; padding: var(--space-2) 0 var(--space-2); }
.sv-tile--sm .ap { padding-block: var(--space-1); }

/* ─────────── Scroll reveal ───────────
   Opacity and a short rise, once, when the element first enters.
   Everything is visible by default: if the script never runs, or
   motion is reduced, the page reads normally. */
@media (prefers-reduced-motion: no-preference) {
  /* The entrance, in the system's own terms: one curve, --dur-entrance,
     siblings staggered by --stagger, four at most (DESIGN.md, Motion).
     This replaces a hand-set .7s with 80ms steps that predated the tokens.

     It also travels further and settles from 98%. 18px over .7s is slow
     enough to sit under the threshold where the eye reads movement at
     all: the tile was already there by the time you noticed it arriving.
     Less time and more distance is what makes it register. */
  .reveal { opacity: 0; transform: translateY(28px) scale(.98);
            transition: opacity var(--dur-entrance) var(--ease),
                        transform var(--dur-entrance) var(--ease); }
  .reveal[data-seen] { opacity: 1; transform: none; }
  .reveal--d1 { transition-delay: var(--stagger) }
  .reveal--d2 { transition-delay: calc(var(--stagger) * 2) }
  .reveal--d3 { transition-delay: calc(var(--stagger) * 3) }

  /* The mosaic cascades DOWN each column rather than using the delays
     placed tile by tile, so the order the tiles arrive in matches the
     order the eye reads them. Columns start together; each column deals
     its own tiles. Capped at four, per the stagger rule. */
  .sv-mosaic__col > .reveal:nth-child(1) { transition-delay: 0ms }
  .sv-mosaic__col > .reveal:nth-child(2) { transition-delay: var(--stagger) }
  .sv-mosaic__col > .reveal:nth-child(3) { transition-delay: calc(var(--stagger) * 2) }
  .sv-mosaic__col > .reveal:nth-child(4) { transition-delay: calc(var(--stagger) * 3) }
}

/* ─────────── Story beat ───────────
   A single sentence doing the work of a section. */
.sv-beat { font-family: var(--font-display); font-size: clamp(26px, 3.6vw, 46px);
           line-height: 1.12; letter-spacing: var(--track-heading);
           margin: 0; max-width: 20ch; text-wrap: balance; }
.sv-beat--wide { max-width: 28ch; }

/* Explicit, rather than relying on the global rule in tokens.css — that one
   serialises to longhand and could not be verified from the CSSOM, and a
   drifting 230px word is exactly what someone asking for less motion means. */
@media (prefers-reduced-motion: reduce) {
  .sv-ghost { animation: none; }
  .sv-tilt, .sv-stage3d:hover .sv-tilt { transition: none; }
}

/* ─────────── Real device ───────────
   A vendored device render (assets/devices/) layered OVER a live screen,
   rather than a frame drawn in CSS. Used where the impression matters most:
   the hero, the practice track and the APS screen. The mosaic keeps the CSS
   frame, because ten copies of an image is weight an audience paying for
   data would feel.

   The default is an unbranded Android, because that is what the audience
   actually holds and the copy below the fold says so. To go back to the
   iPhone, add .sv-device--ios on the wrapper and point the <img> at
   iphone-x-space-gray.svg.

   LAYER ORDER differs by frame, and the difference is the whole trick:
   the Android PNG has a real transparent screen cutout, so it sits ON TOP
   and its camera, earpiece and glass edge composite for free. The iPhone
   SVG's body path is opaque, so it has to sit BEHIND the screen with the
   notch redrawn over it.

   Every percentage below is measured from the asset's own alpha channel,
   not eyeballed, so the screen sits exactly in the glass.

   The screen is a FIXED aspect here, unlike .sv-phone which grows. A real
   device cannot stretch, so content has to fit the glass, and the audit
   checks that it does. */
/* NO FLAT SHADOW HERE, deliberately. The system's signature is a hard
   offset shadow with zero blur, which works because a coloured card and
   the ink beneath it are different colours. This device is almost black,
   so the same shadow renders as a second, misregistered copy of the phone
   sitting under it rather than as a shadow. The render carries its own
   lighting. Flat shadows stay on flat cards. */
.sv-device { --dev-w: 300; position: relative; flex: none;
             width: calc(var(--dev-w) * 1px);
             aspect-ratio: 353 / 750; }
.sv-device__screen { position: absolute; z-index: 1;
                     left: 4.249%; top: 2.133%; width: 90.652%; height: 94.8%;
                     overflow: hidden; border-radius: 5% / 2.3%;
                     background: var(--paper); }

/* THE SCREEN IS A FIXED LOGICAL VIEWPORT, SCALED TO THE GLASS.
   A real phone screen does not reflow when you look at it on a smaller
   monitor, and neither should this one. Without the scale the screen keeps
   the device's fixed aspect while its contents rewrap at every width, so a
   narrow viewport pushed the last answer card straight through the bottom
   of the glass. 272 x 604.4 is exactly the glass at --dev-w: 300, so the
   desktop rendering is untouched and every narrower width is the same
   picture, smaller. It also pins .ap's container queries to one width. */
.sv-device__screen > * { width: 272px; height: 604.4px; flex: none;
                         transform-origin: top left;
                         transform: scale(calc(var(--dev-w) / 300)); }
.sv-device__frame { position: absolute; inset: 0; width: 100%; height: 100%;
                    pointer-events: none; z-index: 2; }
/* Clears the punch-hole camera, which the frame draws over the screen. */
.sv-device .ap { padding-top: var(--space-5); }

/* iPhone fallback: opaque body path, so frame behind and notch on top. */
.sv-device--ios { aspect-ratio: 1296 / 2592; }
.sv-device--ios .sv-device__screen { left: 3.549%; top: 1.813%;
                                     width: 86.806%; height: 93.981%;
                                     border-radius: 7% / 3.4%; }
.sv-device--ios .sv-device__screen > * { width: 260.4px; height: 563.9px; }
.sv-device--ios .sv-device__frame { z-index: 0; }
.sv-device__notch { position: absolute; z-index: 3; top: 1.813%; left: 50%;
                    translate: -50% 0; width: 45%; height: 3.4%;
                    background: var(--ink-fixed);
                    border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 560px) {
  .sv-device { --dev-w: 260; }
  /* Three phones side by side on a 375px screen are three thumbnails.
     The hero shows one, at a size where its screen is actually readable.
     The other two are not loaded away, only hidden, so the mosaic further
     down still carries the full set. */
  .sv-stage__phones > .sv-device:not(:first-child) { display: none; }
  .sv-stage__phones { justify-content: center; }
  .sv-device { --dev-w: 300; }
  /* The callouts are placed for the three-phone stage, and a 300px phone
     in a 375px viewport leaves ~37px either side. There is nowhere for
     them to go, so they go. Every value they show is on the screens. */
  .sv-callouts { display: none; }
}
