/* ============================================================
   RD-MORPH — the shared scroll word-morph (rd-morph.r706.js … r742).
   1. The words (both themes): not yet reached = thin, condensed, dim;
      reached = heavy, normal width, lit; highlighted = blue.
      --s (0 → 1) drives the colour; --a (the same progress in coarser
      steps) drives the font. (r706) While scrolling the script writes
      the resulting colour and font straight onto each word (the same
      formulas, kept in step with the ones below); --s / --a give the
      resting look, the measuring passes and the no-script look.
      Themes: .rdm-paper (Home "Why Choose", item 8 — dark ink on the
      off-white sheet) and .rdm-dark (the prototype's #pafShort —
      off-white on near-black). The script puts .rdm, .rdm-<theme>,
      .rdm-copy | .rdm-inline and, once Archivo has loaded, .rdm-af on
      the section.
   2. The dark statement section .rdm-short (items 10 and 12): the
      prototype's "In short" — a near-black section, blue-dot eyebrow,
      giant statement. Its text is the page's own paragraph (paf-a5 /
      gpa-a4), morphed in place; without JS it shows in its final look.
   3. (r706) Layer drawing, an option (?rdm=layer). (r708) The live probe of the continuous morph.
   (r742, rd5) The thin state is no longer condensed: font width 100% throughout (was 62% -> 100%); the script spreads the
   rest of a Latin word's room between its letters, so a word mid-morph reads with normal word spaces.
   html.rdm-slot (?rdmw=slot): r708's 62% to compare.
   Linked ?v=rd5.
   ============================================================ */

/* Archivo (variable: wdth 62–125, wght 100–900; Latin). Other scripts use the device's fonts. */
@font-face { font-family: "Archivo"; src: url(../fonts/archivo-variable.woff2) format("woff2-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

/* ---------- 1. the words ---------- */
/* copy mode: the aria-hidden word-by-word copy shows once the script has built it; the real heading and
   paragraph are then still read by screen readers and search engines */
.rdm .rdm-mw { display: none; }
.rdm.rdm-on .rdm-mw { display: block; }
.rdm.rdm-on.rdm-copy .rdm-st > h1, .rdm.rdm-on.rdm-copy .rdm-st > h2, .rdm.rdm-on.rdm-copy .rdm-st > h3,
.rdm.rdm-on.rdm-copy .rdm-st > p {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.rdm .rdm-ml { display: block; font-weight: 500; text-wrap: pretty; }
.rdm .rdm-mh { text-wrap: balance; }
.rdm .rdm-ltr, .rdm .rdm-rtl { unicode-bidi: isolate; }

/* one word. Its box keeps the width of its widest state (copy: a set width; inline: an end padding per
   font step, both set by the script), so the morph never moves another word or changes a line break. */
.rdm .rdm-w {
  --s: 1; --a: 1;
  white-space: nowrap;
  /* fallback font (Bricolage 500/600/700/800): the weight steps up with --a (0, 1/3, 2/3, 1) */
  font-weight: calc(500 + var(--a) * 300);
}
.rdm.rdm-copy .rdm-w { display: inline-block; vertical-align: baseline; }
/* inline mode: Chrome's text-wrap: pretty does not count an inline box's end padding at a line end (the
   padded word can run past the edge); plain wrapping does, so the line breaks hold through the morph */
.rdm.rdm-inline.rdm-on .rdm-st > p, .rdm.rdm-inline.rdm-on .rdm-st > h2 { text-wrap: wrap; }
/* with Archivo: the prototype's morph — thin → heavy (r742: at normal width throughout; r708 went from 62% condensed;
   keep in step with W0 in rd-morph.r742.js) */
.rdm.rdm-af .rdm-w {
  font-weight: calc(100 + var(--a) * 640);
  font-stretch: 100%;
}
html.rdm-slot .rdm.rdm-af .rdm-w { font-stretch: calc(62% + var(--a) * 38%); }
html.rdm-slot .rdm .rdm-flat .rdm-w { font-stretch: 100%; }
/* the device font's heavy face is narrower than its light one (some Arabic system fonts): one weight, colour morph only */
.rdm .rdm-flat .rdm-w { font-weight: 700; font-stretch: 100%; }
/* inline mode: a hair of padding on both edges of every word, always, so the browser never shapes a word together
   with the space next to it (it does when their fonts match and there is no padding, adding kerning that moves the
   following words by about half a pixel the moment a word reaches its final weight) */
.rdm.rdm-inline .rdm-w { padding-inline-start: .01px; padding-inline-end: .01px; }
/* measuring pass (script only): natural widths */
.rdm .rdm-measure .rdm-w { width: auto !important; padding-inline-end: .01px !important; }
/* inline mode: the invisible box the words are measured in (only during a fit), sealed off from the page's layout */
.rdm .rdm-meas { position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: hidden; visibility: hidden; contain: strict; pointer-events: none; }
.rdm .rdm-meas > div { display: block; white-space: nowrap; }
/* (r708) the continuous morph's live probe (rd-morph.r708.js): the same sealed, invisible box; its copies' text is generated
   content (data-t), never part of the page's text */
.rdm .rdm-probe { position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: hidden; visibility: hidden; contain: strict; pointer-events: none; }
.rdm .rdm-probe > div { display: block; white-space: nowrap; }
.rdm .rdm-probe span::before { content: attr(data-t); }

/* colours. paper (Home, item 8): grey → near-black, blue #1e5eff. The unlit grey was #bebcb6 (1.7:1 on the #f3f2ee sheet);
   r701: #86847e, 3.34:1, the same as the dark theme's, and every step on the way is darker (ink) or bluer (blue) — at least 3.34:1.
   dark (the PAF / GPA statements; prototype .mw): dim grey → off-white #f3f2ee, blue #3d8bff. The unlit grey is
   the prototype's #545452 lifted to #626260 so a word not yet reached still reads at 3.3:1 on #050505 (owner rule
   2026-11-10: dimmed, never below 3:1, never hidden); every step on the way is brighter */
.rdm-paper .rdm-w { color: rgb(calc(134 - var(--s) * 129), calc(132 - var(--s) * 127), calc(126 - var(--s) * 121)); }
.rdm-paper .rdm-w.hi, .rdm-paper .rdm-w .hi { color: rgb(calc(134 - var(--s) * 104), calc(132 - var(--s) * 38), calc(126 + var(--s) * 129)); }
.rdm-dark .rdm-w { color: rgb(calc(98 + var(--s) * 145), calc(98 + var(--s) * 144), calc(96 + var(--s) * 142)); }
.rdm-dark .rdm-w.hi, .rdm-dark .rdm-w .hi { color: rgb(calc(98 - var(--s) * 37), calc(98 + var(--s) * 41), calc(96 + var(--s) * 159)); }

@media (prefers-reduced-motion: reduce) {
  .rdm .rdm-w { --s: 1 !important; --a: 1 !important; }
}

/* ---------- 2. the dark statement section (PAF "In short", GPA "Skip dealership stress…") ---------- */
/* guide pages: the section sits in main.wrap.guide-wrap (a centred measure) — full width like the other pages */
.guide-wrap > .rdm-short { margin-inline: calc(50% - 50vw); }
.rdm-short {
  --rdm-k: #050505;
  --rdm-ink: #f3f2ee;
  --rdm-blue: #3d8bff;
  --rdm-line: rgba(243,242,238,.16);
  --rdm-wide: "Archivo", "Bricolage", "Bricolage Grotesque", system-ui, sans-serif;
  /* the statements are 35–60 words (the prototype's 26): a step smaller than its 31–74px on wide screens */
  --rdm-fs: clamp(29px, calc(15px + 3.5vw), 64px);
  --rdm-lh: 1.08;
  position: relative;
  background: var(--rdm-k);
  color: var(--rdm-ink);
  color-scheme: dark;
  border-top: 1px solid var(--rdm-line);
  padding-block: clamp(72px, 11svh, 128px) clamp(84px, 14svh, 150px);
}
.rdm-short .rdm-st {
  max-width: 1100px;
  font-family: var(--rdm-wide);
  font-size: var(--rdm-fs);
  line-height: var(--rdm-lh);
  letter-spacing: -.01em;
  color: var(--rdm-ink);
}
/* the real paragraph: the statement itself (inline mode) — without JS, in its final look */
.rdm-short .rdm-st > p {
  margin: 0; max-width: none;
  font: inherit; font-weight: 740; letter-spacing: inherit; line-height: inherit;
  color: var(--rdm-ink);
  text-wrap: pretty;
}
.rdm-short .rdm-st em.ac { font-style: normal; color: var(--rdm-blue); background: none; -webkit-text-fill-color: currentColor; }
/* links: blue, with a blue underline that stays while the words morph */
.rdm-short .rdm-st a {
  color: var(--rdm-blue);
  text-decoration: underline; text-decoration-thickness: max(2px, .05em); text-underline-offset: .14em;
  text-decoration-color: rgba(61,139,255,.75); text-decoration-skip-ink: auto;
}
.rdm-short .rdm-st .gl { color: var(--rdm-blue); white-space: nowrap; }   /* the glossary term stays with its "i" */
@media (hover: hover) {
  .rdm-short .rdm-st a:hover { text-decoration-color: var(--rdm-blue); text-decoration-thickness: max(3px, .07em); }
}

/* the eyebrow. PAF: the paragraph's own lead-in <b>In short:</b> (the dictionary's markup, in every language),
   set as the prototype's blue-dot label above the statement — the same element, still read first. It is
   placed out of flow (not a block inside the <p>, which would cost the paragraph its role for screen readers) */
.rdm-short .rdm-st > p:has(> b:first-child) { position: relative; padding-top: calc(15px * 1.3 + clamp(18px, 2.2vw, 26px)); }
.rdm-short .rdm-st > p > b:first-child {
  position: absolute; top: 0; inset-inline: 0 auto; max-width: 100%;
  display: flex; align-items: flex-start; gap: 10px;
  font: 600 15px/1.3 var(--rdm-wide); letter-spacing: .1em; text-transform: uppercase;
  color: var(--rdm-ink);
}
.rdm-short.rdm-af .rdm-st > p > b:first-child { font-stretch: 125%; }
.rdm-short .rdm-st > p > b:first-child::before {     /* centred on the first line */
  content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--rdm-blue);
  margin-top: calc((1.3em - 9px) / 2);
}

/* the glossary "i" inside the giant statement: in proportion with the words, a finger-sized hit area */
.rdm-short .rdm-st .gl-btn {
  position: relative; box-sizing: border-box;
  width: max(18px, calc(var(--rdm-fs) * .4)); height: max(18px, calc(var(--rdm-fs) * .4));
  margin-inline-start: .08em; margin-top: calc(var(--rdm-fs) * .12);
  font: 700 max(11px, calc(var(--rdm-fs) * .25))/1 var(--fb); font-stretch: normal; letter-spacing: 0;
  vertical-align: top;                                  /* inside the line box: the line spacing stays even */
  color: #050505; background: var(--rdm-blue); border-color: var(--rdm-blue);
}
.rdm-short .rdm-st .gl-btn::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
.rdm-short .rdm-st .gl-btn:hover, .rdm-short .rdm-st .gl.open .gl-btn { background: #6aa6ff; border-color: #6aa6ff; }
.rdm-short .rdm-st .gl-pop {                          /* the site's own popup card, at reading size */
  font-family: var(--fb); font-stretch: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5;
  text-transform: none; white-space: normal; color: var(--ink2, #c9d1dd);
}

/* focus: the blue, clear of the control */
.rdm-short a:focus-visible, .rdm-short button:focus-visible { outline: 2px solid var(--rdm-blue); outline-offset: 3px; border-radius: 2px; }
.rdm-short .rdm-st .gl-btn:focus-visible { outline-offset: 3px; border-radius: 50%; }

/* scripts that join letters or hang marks: no tracking, more line room */
:lang(ar) .rdm-short .rdm-st, :lang(pa) .rdm-short .rdm-st, :lang(zh) .rdm-short .rdm-st { letter-spacing: 0; }
:lang(ar) .rdm-short .rdm-st > p > b:first-child, :lang(pa) .rdm-short .rdm-st > p > b:first-child,
:lang(zh) .rdm-short .rdm-st > p > b:first-child { letter-spacing: .02em; }
:lang(ar) .rdm-short, :lang(pa) .rdm-short { --rdm-lh: 1.32; }
:lang(zh) .rdm-short { --rdm-lh: 1.24; }
@media (max-width: 760px) {
  .rdm-short .rdm-st > p:has(> b:first-child) { padding-top: calc(14px * 1.3 + 18px); }
  .rdm-short .rdm-st > p > b:first-child { font-size: 14px; }
}

/* ---------- 3. (r706) layer drawing — an option, ?rdm=layer (rd-morph.r706.js); never applies without the script ----------
   The real paragraph keeps its place, its words and its links, in its final font, with transparent glyphs (and link
   underline); an aria-hidden layer of one absolutely placed box per word draws the words, each box sealed off
   (size + layout containment) so a font step re-lays out only that box. */
.rdm .rdm-ov { position: absolute; left: 0; top: 0; width: 0; height: 0; margin: 0; padding: 0; border: 0;
  pointer-events: none; -webkit-user-select: none; user-select: none; }
.rdm .rdm-ov > .rdm-o { position: absolute; display: block; box-sizing: border-box; margin: 0; padding: 0;
  white-space: pre; text-align: start; contain: size layout; }
/* a word's pieces: the hair of padding the real ones have; line-height 0 so a piece's font step never moves the baseline
   (the box's own font, the word's final one, sets it, exactly where the paragraph's line has it) */
.rdm .rdm-ov > .rdm-o > span { padding-inline: .01px; line-height: 0; }
/* the layer's words are generated content (attr data-t): drawn, but never part of the page's text (innerText, copy,
   find in page, search engines); the layer is aria-hidden as well */
.rdm .rdm-ov > .rdm-o > span::before, .rdm .rdm-ov > .rdm-o[data-t]::before { content: attr(data-t); }
.rdm.rdm-lay .rdm-st .rdm-w, .rdm.rdm-lay .rdm-st .rdm-w::selection { color: transparent !important; -webkit-text-fill-color: transparent !important; }
.rdm.rdm-lay .rdm-st a { text-decoration-color: transparent !important; }
@media (hover: hover) {   /* a link's hover underline (section 2: .rdm-short .rdm-st a:hover), on its layer boxes */
  .rdm-short .rdm-ov .u.rdm-oh { text-decoration-color: var(--rdm-blue) !important; text-decoration-thickness: max(3px, .07em) !important; }
}

/* ---- Alignment pass (owner on his iPhone, 2026-11-14: "align anything that is misaligned or the space is not
   efficiently used"). Layout and spacing only. The dark statement had more room below it than above (14svh vs 11svh,
   ~118px of empty dark on a phone before the next section's own padding). It now takes the big-title sections' one
   rhythm: phones 8svh above / 7svh below, larger screens 10svh / 9svh. Its "In short:" label wraps in balanced lines.
   Linked ?v=rd6m. */
.rdm-short { padding-block: clamp(80px, 10svh, 128px) clamp(64px, 9svh, 112px); }
.rdm-short .rdm-st > p > b:first-child { text-wrap: balance; }
@media (max-width: 760px) {
  .rdm-short { padding-block: clamp(56px, 8svh, 76px) clamp(48px, 7svh, 64px); }
}
