/* ============================================================================
   ContentWise UX Engine — demo landing system
   ----------------------------------------------------------------------------
   Shared across index.html, getting-started.html, documentation.html.

   Brand: Moviri Brand Core (palette, logos, backdrop element) and Moviri Web
   (roles, layers, type, motion), White theme with the ContentWise brand layer:
   Royal Blue brand ground, Orange as the one interactive accent, Raisin text
   on orange. Royal Blue is the launchpad's whole ground (index.html
   re-points the roles); the reading pages are white, or Raisin in dark.
   Orange marks focal points only — the primary destination, the current
   page, the hero accent word — and is never body text: on white it reads
   3.3:1, so small orange text uses --orange-text (6.6:1) instead.

   The backdrop element is the ContentWise triangle field from Brand Core, one
   per surface, anchored to a corner at 10% opacity. The PNGs carry full ink
   (Charcoal for light grounds, Anti-flash for dark); opacity is set here.
   ============================================================================ */

:root {
  /* Palette — Moviri Brand Core. Build with the roles below, not these. */
  --royal-blue:   #00187c;
  --french-blue:  #0059db;
  --orange:       #ff4c00;  /* fills and 24px+ display text only */
  --orange-deco:  #d33c00;  /* rules and markers, never text */
  --orange-text:  #a33a00;  /* orange text on light: 6.6:1 white, 6.1:1 gray-10 */
  --raisin:       #1d1f2d;
  --charcoal:     #474f63;
  --anti-flash:   #eeeeee;
  --gray-10:      #f3f4f6;
  --gray-20:      #d4d7de;
  --white:        #ffffff;

  /* Roles — Moviri Web, White theme + ContentWise brand layer */
  --background:          var(--white);
  --background-brand:    var(--royal-blue);
  --layer-01:            var(--gray-10);   /* cards and panels on the page, radius-lg */
  --layer-02:            var(--white);     /* content placed on layer-01, radius-md */
  --border-subtle:       var(--gray-20);
  --border-strong:       var(--charcoal);
  --text-primary:        var(--raisin);    /* 15.9:1 on white */
  --text-secondary:      var(--charcoal);  /* 8.0:1 on white, 7.3:1 on gray-10 */
  --text-on-color:       var(--white);     /* on the brand ground */
  --link:                var(--french-blue);
  --interactive:         var(--orange);
  --text-on-interactive: var(--raisin);    /* 4.9:1 on orange; white fails at 3.3:1 */
  --focus:               var(--french-blue);
  --header-bg:           rgba(255, 255, 255, 0.97);

  /* Type */
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Rhythm — 4/8 based */
  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;  --s4: 1rem;
  --s5: 1.5rem;   --s6: 2rem;     --s7: 3rem;     --s8: 4rem;

  /* Radii shrink one step per nested layer */
  --radius-lg:   32px;
  --radius-md:   24px;
  --radius-sm:   12px;
  --radius-pill: 999px;

  /* Moviri Web productive motion: state changes only, 70–150ms. */
  --ease: cubic-bezier(0.2, 0, 0.38, 0.9);
  --dur:  110ms;

  /* 45px logo row + 24px padding top/bottom, plus the notch inset the header
     absorbs — every sticky offset and page top-padding derives from this. */
  --header-h: calc(93px + env(safe-area-inset-top));
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

html {
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s5));
  color-scheme: light;
}

/* ── Dark theme ───────────────────────────────────────────────────────────
   Follows the visitor's system setting. Moviri Web's Gray 100 theme: Raisin
   ground, Charcoal layers, white text; the brand layer (Royal Blue ground,
   Orange accent, Raisin on orange) is the same in both themes. The block is
   written twice on purpose — once for prefers-color-scheme, once for the
   explicit [data-theme="dark"] override the head script sets from ?theme= —
   because a media query and an attribute cannot share one selector list.
   Orange text steps up to orange-1 #ffa757 (6.4:1 on charcoal-2): the
   light theme's #a33a00 is unreadable on these grounds. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background:     var(--raisin);
    --layer-01:       #2e3547;              /* charcoal-2 */
    --layer-02:       #3a4256;              /* charcoal-mid (Moviri Web, DERIVED) */
    --border-subtle:  var(--charcoal);
    --border-strong:  var(--anti-flash);
    --text-primary:   var(--white);
    --text-secondary: var(--anti-flash);    /* 10.6:1 on charcoal-2 */
    --link:           var(--anti-flash);
    --focus:          var(--white);
    --orange-text:    #ffa757;
    --header-bg:      rgba(29, 31, 45, 0.97);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background:     var(--raisin);
  --layer-01:       #2e3547;
  --layer-02:       #3a4256;
  --border-subtle:  var(--charcoal);
  --border-strong:  var(--anti-flash);
  --text-primary:   var(--white);
  --text-secondary: var(--anti-flash);
  --link:           var(--anti-flash);
  --focus:          var(--white);
  --orange-text:    #ffa757;
  --header-bg:      rgba(29, 31, 45, 0.97);
  color-scheme: dark;
}

html, body {
  background: var(--background);
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Everything interactive here is a link or a nav button — none of it wants
     double-tap zoom. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 89, 219, 0.12);
  /* Size the system-ui fallback to Montserrat's x-height while the woff2 is
     still in flight, so the swap does not reflow the page. */
  font-size-adjust: from-font;
}

/* Font Awesome glyphs are decorative here — every icon sits next to a text
   label, so they are hidden from assistive tech at the source. */
.fas, .fab, .far { speak: none; }

::selection { background: rgba(0, 89, 219, 0.18); color: var(--text-primary); }

/* Headings balance across their lines; running text avoids orphaned words.
   Both degrade to plain wrapping where unsupported. */
h1, h2, h3, .uxe-card-title { text-wrap: balance; }
p, .uxe-subtitle, .uxe-card-desc { text-wrap: pretty; }

/* ── Page shell ───────────────────────────────────────────────────────────── */

.uxe-page {
  position: relative;
  /* border-box so min-height counts the padding. As content-box the page was
     always 100dvh *plus* its vertical padding, which put a ~110px phantom
     scroll on every page even when the content fit. */
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  isolation: isolate;
  /* Lets the backdrop element bleed off the edges. `clip`, not `hidden`:
     hidden would make this a scroll container and break the sticky TOCs. */
  overflow: clip;
  padding:
    calc(var(--header-h) + var(--s7))
    calc(var(--s6) + env(safe-area-inset-right))
    calc(var(--s8) + env(safe-area-inset-bottom))
    calc(var(--s6) + env(safe-area-inset-left));
}

/* Backdrop element — the ContentWise triangle field, Charcoal ink at 10%,
   anchored to the top-right corner and bleeding off it. It scrolls with the
   page, so it stays up by the title and never sits under the long-form copy
   further down. One per surface: the launchpad turns it off, because its hero
   panel carries its own. */
.uxe-page::after {
  content: '';
  position: absolute;
  top: calc(var(--header-h) - 4rem);
  right: 0;
  width: min(36vw, 640px);
  aspect-ratio: 2430 / 2447;
  /* The PNG's dense edge is its left side: unrotated and anchored here, that
     edge stopped as a hard vertical cut beside the title. Turned 180deg it
     bleeds off the page's right edge and thins out towards the copy. */
  rotate: 180deg;
  background: url("assets/images/contentwise-triangles-on-light.png") no-repeat 100% 0 / contain;
  opacity: 0.1;
  z-index: -1;
  pointer-events: none;
}
/* Dark grounds take the Anti-flash ink. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .uxe-page::after {
    background-image: url("assets/images/contentwise-triangles-on-dark.png");
  }
}
:root[data-theme="dark"] .uxe-page::after {
  background-image: url("assets/images/contentwise-triangles-on-dark.png");
}
.uxe-page--bare::after { content: none; }

.uxe-inner {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

/* Reading-width column for the link-list subpages — at the full 1120px the
   card descriptions ran to ~100 characters per line. */
.uxe-inner--narrow { max-width: 840px; }


/* Visible only to assistive tech — used to append "(opens in a new tab)" to
   links that leave the demo environment. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — first tab stop on every page. An accent fill, so Raisin text. */
.uxe-skip {
  position: absolute;
  left: var(--s4);
  top: var(--s4);
  z-index: 100;
  translate: 0 -200%;
  padding: var(--s3) var(--s5);
  border-radius: var(--radius-pill);
  background: var(--interactive);
  color: var(--text-on-interactive);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: translate var(--dur) var(--ease);
}
.uxe-skip:focus { translate: 0 0; color: var(--text-on-interactive); }
/* The theme's `a:hover { color: #FA5D42 }` (0,1,1) outranks .uxe-skip (0,1,0)
   and would put orange text on the orange fill (1.1:1) under the pointer. */
.uxe-skip:hover,
.uxe-skip:focus:hover { color: var(--text-on-interactive); }

/* ── Header / navigation ──────────────────────────────────────────────────── */
/* The WordPress theme hides #header-structure .menu up to 1024px (inclusive:
   its block is max-width 1024px, so ours is too) and expects a
   .hamburger element that these static pages never had — so the nav simply
   vanished on mobile, stranding anyone on a subpage with no way back. These
   rules override that and provide a real disclosure menu. */

/* Below 1025px the theme turns the empty #preheader into a 50px block, a
   spacer for its own fixed header. .uxe-page already clears the header via
   --header-h, so the spacer only added 50px of scroll (the launchpad overran
   1024x768 by exactly that). */
#preheader { display: none !important; }

/* The theme ships #header with `padding: 30px 0 75px` — the expanded state of a
   scroll-collapse effect whose JS these static pages never included. The result
   was a 150px bar with 75px of dead space under the logo. Balanced here, and
   --header-h is kept in sync with the real height so sticky offsets, scroll
   anchoring and page padding all line up. */
#header.initial-header {
  z-index: 50;
  padding: calc(24px + env(safe-area-inset-top)) env(safe-area-inset-right) 24px env(safe-area-inset-left);
}

/* The theme's header wrapper is 1260px while the content column is 1120px, so
   the logo and nav sat ~70px outside the content edges. Share one measure. */
@media (min-width: 1025px) {
  #header .wrapper-padded-1260 { max-width: 1120px; }
}

/* The theme only sets a header background inside its mobile media query — on
   desktop .header-expanded is an empty rule, so scrolled content ran straight
   under the nav with nothing behind it. */
#header .header-expanded {
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border-subtle);
}

/* Colour lockup on the white bar. The theme sets the white one on both
   pseudo-elements (its scroll-collapse states); same specificity, later
   source, so this wins without touching the vendor file. */
#header-structure .logo:before,
#header-structure .logo:after {
  background-image: url("assets/images/contentwise-logo.svg");
}
/* On the dark bar the colour lockup's Raisin "by movìri" would vanish; the
   brand allows only the white lockup on dark grounds. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #header-structure .logo:before,
  :root:not([data-theme="light"]) #header-structure .logo:after {
    background-image: url("assets/images/contentwise-logo-white.svg");
  }
}
:root[data-theme="dark"] #header-structure .logo:before,
:root[data-theme="dark"] #header-structure .logo:after {
  background-image: url("assets/images/contentwise-logo-white.svg");
}

#header-structure .menu {
  display: block !important;
  width: auto !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  margin-left: auto;
}

/* Type comes from the theme's `navi-typo allupper`: Montserrat 12px/600,
   uppercase. Only the colour is set here. */
#header-structure .header-menu a:link,
#header-structure .header-menu a:visited {
  position: relative;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease);
}
#header-structure .header-menu a:hover { color: var(--text-primary); }

/* Active page marker. */
#header-structure .header-menu .is-current > a:link,
#header-structure .header-menu .is-current > a:visited { color: var(--text-primary); }
#header-structure .header-menu .is-current > a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  background: var(--interactive);
}

.uxe-navtoggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--layer-02);
  color: var(--text-primary);
  font-size: 1.05rem;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.uxe-navtoggle:hover { background: var(--layer-01); border-color: var(--border-strong); }

@media (max-width: 1024px) {
  :root { --header-h: calc(82px + env(safe-area-inset-top)); }

  #header.initial-header {
    padding: calc(16px + env(safe-area-inset-top)) env(safe-area-inset-right) 16px env(safe-area-inset-left);
  }

  .uxe-navtoggle { display: inline-flex; }

  #header-structure .menu {
    position: absolute;
    top: calc(100% + var(--s2));
    right: 0;
    width: min(320px, calc(100vw - var(--s6)));
    padding: var(--s2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--layer-02);
    box-shadow: 0 12px 40px rgba(29, 31, 45, 0.10);
    text-align: left !important;
  }
  /* Disclosure enters with a short fade/drop. `display` is transitioned as a
     discrete property so the exit can play before the menu leaves the tree;
     @starting-style supplies the from-state for the entry. */
  #header-structure .menu {
    translate: 0 0;
    transition: opacity 150ms var(--ease), translate 150ms var(--ease),
                display 150ms allow-discrete;
    /* !important because the base rule above pins opacity: 1 !important to
       beat the theme's mobile fade-out — a normal declaration here would lose
       the cascade and the menu would pop in without fading. */
    @starting-style { opacity: 0 !important; translate: 0 -6px; }
  }
  #header-structure .menu[hidden] {
    display: none !important;
    opacity: 0 !important;
    translate: 0 -6px;
  }

  .header-menu { width: 100%; }
  .header-menu li {
    display: block !important;
    margin: 0 !important;
    width: 100%;
  }
  #header-structure .header-menu a:link,
  #header-structure .header-menu a:visited {
    display: block;
    padding: var(--s3) var(--s4);   /* >= 44px tap target */
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
  }
  #header-structure .header-menu a:hover { background: var(--layer-01); }
  #header-structure .header-menu .is-current > a { background: var(--layer-01); box-shadow: inset 3px 0 0 var(--interactive); }
  #header-structure .header-menu .is-current > a::after { display: none; }
}

/* ── Typography ───────────────────────────────────────────────────────────── */

/* Eyebrow — the section kicker: small widely-tracked uppercase in the
   accent text colour, led by a 22x2 tick in currentColor. */
.uxe-eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange-text);
  margin-bottom: var(--s4);
}
.uxe-eyebrow::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 2px;
  margin-right: 10px;
  vertical-align: middle;
  background: currentColor;
}

/* The page's hero H1 — the one place weight 700 appears. */
.uxe-title {
  /* Cap raised so the display type keeps scaling on large monitors instead of
     freezing at 4.4rem the moment the viewport passes ~1170px. */
  font-size: clamp(2.6rem, 5.4vw, 6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-transform: none;
  text-wrap: balance;
  margin: 0 0 var(--s4);
}
/* Display size only: orange is 3.3:1 on white, legal for 24px+ type. */
.uxe-title-accent { color: var(--interactive); }

.uxe-subtitle {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 0 var(--s6);
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
/* A card is layer-01 on the page: Gray 10, the 32px signature radius, no
   shadow. Placed on a layer-01 panel it steps up to layer-02 (see the
   launchpad), white at 24px. Hover is a state change, not motion: the
   border firms up and the arrow turns from → to ↗. */

.uxe-card {
  /* border-box, so every min-height below is the card's real height. As
     content-box, 82px meant a 121px card once padding was added, and the
     launchpad overran a 1920x1080 window. */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--layer-01);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  min-height: 72px;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.uxe-card:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.uxe-card:hover .uxe-card-go { color: var(--orange-text); rotate: -45deg; }

.uxe-card-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--layer-02);
  color: var(--text-primary);
  font-size: 1rem;
}

/* Primary — the destination to start with. It carries the accent as a
   filled icon tile; the card itself stays neutral so the orange reads as one
   point, not a field. */
.uxe-card--primary .uxe-card-icon {
  background: var(--interactive);
  color: var(--text-on-interactive);
}

.uxe-card-body { flex: 1; min-width: 0; }

/* Card internals are spans (they sit inside an <a>), so they need block flow. */
.uxe-card-body,
.uxe-card-tag,
.uxe-card-title,
.uxe-card-desc { display: block; }

.uxe-card-tag {
  font-size: 0.75rem;   /* 12px: the label floor, legible in a screen-share */
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange-text);
  margin-bottom: var(--s1);
}
.uxe-card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.32;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.uxe-card-desc {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
}

.uxe-card-go {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease), rotate var(--dur) var(--ease);
}
.uxe-card-ext {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease);
}
.uxe-card:hover .uxe-card-ext { color: var(--orange-text); }

/* Tall variant — cards whose body runs to several lines (tutorials, research)
   top-align so the icon tracks the title rather than floating mid-paragraph. */
.uxe-card--tall { align-items: flex-start; min-height: 0; padding-block: var(--s5); }
.uxe-card--tall .uxe-card-icon { margin-top: 1px; }

.uxe-list { display: flex; flex-direction: column; gap: var(--s3); }

/* ── Section grouping ─────────────────────────────────────────────────────── */

.uxe-group { margin-bottom: var(--s7); }

/* Rendered as an <h2> so the link lists have real section structure; the
   explicit margin/transform reset keeps it clear of theme heading styles.
   A list label, so secondary — the accent stays with the page's eyebrow and
   the featured group. */
.uxe-group-label {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: 0 0 var(--s4);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.uxe-group--featured .uxe-group-label {
  color: var(--orange-text);
  border-bottom-color: var(--orange-deco);
}

/* ── Focus ────────────────────────────────────────────────────────────────── */
/* The theme sets `a { outline: none !important }` (style-20250812.css:238) plus
   `*:focus { outline: 0 }`, so a focus ring only lands if it is !important too.
   Not using :where() here either — it would zero the specificity. Solid 2px
   French Blue; white wherever the ground is the brand blue. */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus) !important;
  outline-offset: 3px !important;
}
.uxe-card:focus-visible,
.gs-toc a:focus-visible,
#header-structure .header-menu a:focus-visible {
  outline: 2px solid var(--focus) !important;
  outline-offset: 3px !important;
}

/* ── Video player ─────────────────────────────────────────────────────────
   Full-page <dialog> (index_files/video.js) that plays YouTube links marked
   [data-video] without leaving the page. Always on the Raisin ground, in
   both themes: a video reads best on near-black. The dialog fills the
   viewport itself, so the empty ground around the player is the dialog and
   video.js closes on a click there; Esc closes natively.
   --uxe-video-w sizes the bar, the frame and the hint alike: 16:9, as large
   as the height left after the padding, bar, hint and gaps (9rem) allows. */
.uxe-video {
  --uxe-video-w: min(100%, calc((100dvh - 9rem) * 16 / 9));
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding:
    calc(var(--s4) + env(safe-area-inset-top))
    calc(var(--s5) + env(safe-area-inset-right))
    calc(var(--s5) + env(safe-area-inset-bottom))
    calc(var(--s5) + env(safe-area-inset-left));
  box-sizing: border-box;
  border: 0;
  background: var(--raisin);
  color: var(--white);
  color-scheme: dark;
  overscroll-behavior: contain;
}
.uxe-video:modal { display: flex; flex-direction: column; gap: var(--s4); }
.uxe-video::backdrop { background: transparent; overflow: hidden; overscroll-behavior: contain; }

.uxe-video-bar {
  display: flex;
  align-items: center;
  gap: var(--s4);
  width: var(--uxe-video-w);
  margin-inline: auto;
}
.uxe-video-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--white);
  text-transform: none;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uxe-video-external:link,
.uxe-video-external:visited,
.uxe-video-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--anti-flash);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.uxe-video-external { padding: 0 var(--s4); }
.uxe-video-close { width: 44px; padding: 0; font-size: 1.1rem; }
.uxe-video-external:link:hover,
.uxe-video-external:visited:hover,
.uxe-video-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--white);
  color: var(--white);
}
.uxe-video a:focus-visible,
.uxe-video button:focus-visible { outline-color: var(--white) !important; }

/* The frame and the hint under it centre as one group: auto margin above
   the frame, auto margin below the hint. */
.uxe-video-frame {
  position: relative;
  width: var(--uxe-video-w);
  aspect-ratio: 16 / 9;
  margin: auto auto 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--raisin);
}
/* Laid over the poster, invisible until its load event (data-state=ready).
   Opacity rather than visibility, so the embed still loads and autoplays. */
.uxe-video-frame iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
}
.uxe-video-frame[data-state="ready"] iframe { opacity: 1; }
.uxe-video-frame[data-state="failed"] iframe { pointer-events: none; }

/* Poster: what the frame shows until YouTube arrives, and in place of it
   when YouTube never does. Drawn in CSS, no thumbnail request. */
.uxe-video-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
  padding: var(--s5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: inherit;
  text-align: center;
}
.uxe-video-poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  max-width: 40rem;
}
.uxe-video-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  color: var(--white);
  font-size: 1.5rem;
}
/* The triangle's visual centre sits left of its box; nudge it. */
.uxe-video-play i { translate: 0.12em 0; }
.uxe-video-frame[data-state="failed"] .uxe-video-play { display: none; }
.uxe-video-poster-title {
  margin: 0;
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--white);
  text-wrap: balance;
}
.uxe-video-status,
.uxe-video-hint {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #afb0b4;              /* Anti-flash at 70% on Raisin, 7.5:1 */
}
/* Failed: the message on one line, the way out on the next. */
.uxe-video-frame[data-state="failed"] .uxe-video-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  font-size: 1rem;
  color: var(--anti-flash);
  text-wrap: balance;
}
.uxe-video-hint {
  width: var(--uxe-video-w);
  min-height: 1.45em;          /* reserved, so showing it moves nothing */
  margin: calc(var(--s2) - var(--s4)) auto auto;
  visibility: hidden;
}
.uxe-video-hint.is-shown { visibility: visible; }
.uxe-video-link:link,
.uxe-video-link:visited {
  color: var(--white);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  transition: text-decoration-color var(--dur) var(--ease);
}
.uxe-video-link:link:hover,
.uxe-video-link:visited:hover { text-decoration-color: var(--white); }
.uxe-video-frame[data-state="failed"] .uxe-video-link { white-space: nowrap; }

@media (max-width: 767px) {
  .uxe-video { padding-inline: var(--s3); }
  /* Icon only on phones; the label stays for screen readers. */
  .uxe-video-external span:not(.sr-only) {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .uxe-video-external { width: 44px; padding: 0; }
  /* A phone's 16:9 frame is ~200px tall: a smaller poster so it fits. */
  .uxe-video-stage,
  .uxe-video-poster { gap: var(--s3); }
  .uxe-video-stage { padding: var(--s3); }
  .uxe-video-play { width: 3rem; height: 3rem; font-size: 1rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .uxe-video:modal {
    transition: opacity 150ms var(--ease), display 150ms allow-discrete, overlay 150ms allow-discrete;
    @starting-style { opacity: 0; }
  }
  .uxe-video-frame iframe { transition: opacity 150ms var(--ease); }
}

/* ── Motion ───────────────────────────────────────────────────────────────── */

/* Cross-document view transitions. The three pages share one header, so a
   navigation between them crossfades the content while the header holds
   still. Paired with the speculation rules in each <head>, which prerender
   the sibling pages on hover, the hop reads as one continuous surface.
   Opt-in only when the visitor has not asked for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
#header.initial-header { view-transition-name: uxe-header; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .uxe-page { padding: calc(var(--header-h) + var(--s5)) var(--s4) var(--s7); }
  .uxe-page::after { width: 90vw; right: 0; }
  .uxe-subtitle { font-size: 1rem; }
  .uxe-card { padding: var(--s4); gap: var(--s3); border-radius: var(--radius-md); }
}



/* ── Large desktop ────────────────────────────────────────────────────────
   Most visitors arrive on desktop, so the layout keeps growing past 1440
   instead of sitting as a small island in the middle of a 2560px monitor.
   The container widens in steps and the component scale comes up with it —
   widening the container alone just stretches the gaps and makes the cards
   look smaller. Reading measures (--narrow, prose) are capped separately so
   line length never follows the container. */

@media (min-width: 1600px) {
  :root { --header-h: calc(101px + env(safe-area-inset-top)); }

  #header.initial-header {
    padding: calc(28px + env(safe-area-inset-top)) env(safe-area-inset-right) 28px env(safe-area-inset-left);
  }

  /* The theme caps the header wrapper at 1260px. Left alone, the logo and nav
     stay in a narrow band while the content below runs to 1400/1640 — the two
     have to share an edge. */
  #header .wrapper-padded-1260 { max-width: 1400px; }
  #header-structure .header-menu a:link,
  #header-structure .header-menu a:visited { font-size: 0.82rem; }

  .uxe-inner { max-width: 1400px; }
  .uxe-inner--narrow { max-width: 1080px; }

  .uxe-subtitle { font-size: 1.2rem; }

  .uxe-card { padding: 1.15rem 1.4rem; gap: 1.15rem; min-height: 82px; }
  .uxe-card-icon { width: 46px; height: 46px; font-size: 1.12rem; }
  .uxe-card-title { font-size: 1.06rem; }
  .uxe-card-desc { font-size: 0.92rem; }
  .uxe-card-go { font-size: 0.9rem; }
  .uxe-group-label { font-size: 0.8rem; }

  /* Two up: fills the frame without letting descriptions run long. Grid items
     already stretch to the row, so no explicit height — setting height:100% on
     top of stretch overflowed the track and ran the next section's label into
     the cards above it. */
  .uxe-inner--narrow .uxe-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
  }
  /* Taller cards need proportionally more air between sections. */
  .uxe-inner--narrow .uxe-group { margin-bottom: 3.5rem; }

  /* A section with one entry spans the row rather than leaving a half-width
     orphan next to dead space. */
  .uxe-inner--narrow .uxe-list > .uxe-card:only-child { grid-column: 1 / -1; }
}

@media (min-width: 2000px) {
  #header .wrapper-padded-1260 { max-width: 1640px; }

  .uxe-inner { max-width: 1640px; }
  .uxe-inner--narrow { max-width: 1280px; }

  .uxe-subtitle { font-size: 1.25rem; }
  .uxe-card { padding: 1.3rem 1.6rem; min-height: 92px; }
  .uxe-card-icon { width: 52px; height: 52px; font-size: 1.25rem; }
  .uxe-card-title { font-size: 1.12rem; }
  .uxe-card-desc { font-size: 0.96rem; }
}

/* ── Short viewports (laptop screens) — LAST, so it wins ─────────────────────────────────────
   A 13" MacBook leaves roughly 790-850px of viewport once browser chrome is
   accounted for, and the launchpad ran ~205px past that — the last
   destination sat below the fold. The ceiling is 1000px rather than the
   ~850px those machines actually report, because a bookmarks bar, a
   downloads shelf or an extension banner each eat another 40-50px, and the
   layout should not flip back to the roomy version the moment one appears.
   Gated on width too, so it only affects the wide two-column desktop layout
   and leaves phones alone. */
@media (min-width: 980px) and (max-height: 1000px) {
  :root { --header-h: calc(69px + env(safe-area-inset-top)); }

  #header.initial-header {
    padding: calc(12px + env(safe-area-inset-top)) env(safe-area-inset-right) 12px env(safe-area-inset-left);
  }

  .uxe-page {
    padding-top: calc(var(--header-h) + 1.25rem);
    padding-bottom: 1.5rem;
  }

  .uxe-card {
    min-height: 0;
    padding: 0.65rem 1.25rem;
  }
  .uxe-card--tall { padding-block: 1rem; }
  .uxe-card-icon { width: 36px; height: 36px; font-size: 0.92rem; }
  .uxe-card-title { font-size: 0.94rem; }
  .uxe-card-desc { font-size: 0.875rem; }   /* 14px floor, as at every other tier */

  .uxe-group { margin-bottom: 2rem; }
}
