/* R13 tokens.css (1 November 2026, WP0): Direction A "Quiet Instrument". The one source for type roles, space, radii, colour roles, elevation and motion.
   Everything is scoped under html.r13 (index.html sets the class; ?r13=0 removes it before the CSS loads, so the old look is one query away).
   No @layer (the 50 older files are unlayered and would win); later r13 files (chrome, cards, scene, paper, type) use the prefix `html.r13 body`.
   Properties are split: WP6 (type.css) owns font / letter-spacing / line-height / text-transform / font-variant; WP1-4 never set those, they set box, colour, material, layout.
   Owner of this file: WP0 only. A builder who needs a new token adds it to its own file under `html.r13` with the prefix q- (never edits this one). */

/* ---------- 1. roles, space, radii, colour, elevation, motion (scene defaults) ---------- */
html.r13 { --ui-scale: 1; }                    /* 1.08 at (min-width:1300px) and (min-height:1000px); html.tv 1.7 (below) */
/* the scale-dependent tokens are declared again on the TV map card (html.r13.tv body #lv-map .info sets its own, smaller --ui-scale: cards.css) so they resolve against it */
html.r13, html.r13.tv body #lv-map .info {
  /* type roles: `font` shorthand values for WP6 (A.2). Use as `font: var(--ty-body)`; tracking is the paired --tr-* */
  --ty-display: 300 calc(56px * var(--ui-scale))/1.07 var(--sans);
  --ty-large:   400 calc(34px * var(--ui-scale))/1.18 var(--sans);
  --ty-title:   400 calc(24px * var(--ui-scale))/1.25 var(--sans);
  --ty-head:    600 calc(17px * var(--ui-scale))/1.3  var(--sans);
  --ty-body:    400 calc(15px * var(--ui-scale))/1.47 var(--sans);
  --ty-callout: 500 calc(15px * var(--ui-scale))/1.33 var(--sans);
  --ty-foot:    400 calc(13px * var(--ui-scale))/1.38 var(--sans);
  --ty-cap:     500 calc(12px * var(--ui-scale))/1.33 var(--sans);
  --ty-fig:     300 calc(40px * var(--ui-scale))/1.1  var(--num);   /* big figure; tabular lining numerals: font-variant-numeric: lining-nums tabular-nums (WP6) */
  --ty-fig-row: 400 calc(17px * var(--ui-scale))/1.3  var(--num);
  /* tracking per role (A.2); `letter-spacing` is not part of the font shorthand */
  --tr-display: -0.03em; --tr-large: -0.022em; --tr-title: -0.018em; --tr-head: -0.01em;
  --tr-body: 0; --tr-callout: 0; --tr-foot: 0; --tr-cap: 0.01em; --tr-fig: -0.02em; --tr-fig-row: 0;
  --q-ctl: calc(44px * var(--ui-scale)); --q-chip: calc(32px * var(--ui-scale)); --q-seg: calc(36px * var(--ui-scale)); --q-row: calc(44px * var(--ui-scale)); --q-row-sub: calc(56px * var(--ui-scale)); --q-icon: calc(20px * var(--ui-scale));   /* scale with type; never below 44 for a hit area */
}
html.r13 {

  /* space (A.3) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;
  --gutter: 32px; --rail: 132px;
  --edge-1: var(--gutter); --edge-2: calc(var(--gutter) + var(--rail));
  --top-row: 32px; --title-top: 96px;
  --orb-zone: 96px;                             /* the reserved bottom-right square; replaces the 7.6rem bottom band */

  /* component constants (extras to the plan: so no builder hard-codes the 44) */
  --q-card-pad: 20px; --q-card-w: clamp(300px, 26vw, 380px); --q-grab-w: 36px; --q-grab-h: 5px;

  /* radii (A.4) */
  --r-capsule: 999px; --r-card: 20px; --r-sheet: 28px; --r-inner: 12px; --r-min: 8px;

  /* colour roles: scene defaults (map and photo levels). The paper block at the end of this file re-points them */
  --surface: rgba(28, 28, 30, .6);             /* capsules over a scene (matches Apple-minimal 8791) */
  --surface-card: rgba(28, 28, 30, .96);        /* cards over a scene */
  --canvas-paper: #f5f5f3;                      /* neutral; replaces the cream #f1f1ef / #f7f4ee */
  --fg: #f5f5f7; --fg-2: rgba(245, 245, 247, .64); --fg-3: rgba(245, 245, 247, .44);   /* 100 / 64 / 44 (44 = disabled only) */
  --hairline: rgba(255, 255, 255, .08);
  --primary-bg: #f5f5f7; --primary-fg: #1d1d1f;
  --emph: #f3eee6;                              /* warm white: newest ring, Mirai's pin, the selected floor */
  /* status (the same on both grounds). NB: --ok / --hold / --sold also exist in css/tokens.css (#8fc4a0 / #dfb06a / #8b8b94); with r13 on, these win */
  --ok: #34c759cc; --hold: #ff9f0a; --sold: rgba(29, 29, 31, .4);
  /* one sequential data ramp, older/far to newer/near; replaces the 8 --layer-* hues for rings, eras, timelines */
  --ramp-1: #5d5a6e; --ramp-2: #7d7990; --ramp-3: #a19cb0; --ramp-4: #c9c4d2; --ramp-5: #f3eee6;

  /* elevation (A.6): level 1 card, level 2 floating capsule. --el-1 / --el-2 resolve per ground, so a builder writes box-shadow: var(--el-1) and is done */
  --el-1-scene: 0 18px 40px -20px rgba(0, 0, 0, .6);
  --el-2-scene: 0 6px 18px -10px rgba(0, 0, 0, .5);
  --el-1-paper: 0 0 0 1px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --el-2-paper: 0 0 0 1px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --el-1: var(--el-1-scene); --el-2: var(--el-2-scene);
  --scrim-edge: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0));   /* the one 160px left-edge scrim on photo levels (WP1 draws it); replaces per-glyph text-shadows */
  --scrim-sheet: rgba(0, 0, 0, .3);             /* behind a sheet: black 30%, no blur */
  --blur-sheet: 24px;                           /* the one live backdrop-filter, only while a sheet / the drawer is open */

  /* motion (A.7), the played values; tempo.js's 1.25x still applies on top. 5 durations, 4 curves */
  --d-press: 100ms; --d-fade: 200ms; --d-move: 300ms; --d-sheet: 440ms; --d-level: 600ms;
  --d-stagger: 20ms;                            /* at most 6 items */
  --e-in: cubic-bezier(.22, 1, .36, 1);         /* entering */
  --e-out: cubic-bezier(.4, 0, 1, 1);           /* leaving */
  --e-x: cubic-bezier(.65, 0, .35, 1);          /* crossfades */
  --e-calm: var(--mc-spring);                   /* moves: the critically damped spring (css/tokens.css); play it over its own duration */
}

/* ---------- 2. responsive scale and the TV ---------- */
@media (max-width: 1199px) { html.r13 { --gutter: 24px; } }                              /* A.3: gutter 24 under 1200 (the 1180 tablet) */
@media (min-width: 1300px) and (min-height: 1000px) { html.r13 { --ui-scale: 1.08; } }  /* 1366x1024 and larger tablets */
html.r13.tv { --ui-scale: 1.7; --gutter: calc(32px * var(--ui-scale)); --rail: calc(132px * var(--ui-scale)); --top-row: calc(32px * var(--ui-scale)); --title-top: calc(96px * var(--ui-scale)); --orb-zone: calc(96px * var(--ui-scale)); --q-card-w: clamp(420px, 26vw, 560px); }       /* replaces the rem growth for r13 components only (qa-fixes.css:189 grows rem on the TV: r13 components use px x --ui-scale, never rem) */

/* ---------- 3. aliases: the old token names speak the new system, so un-edited rules inherit it ---------- */
/* html.r13:root (0,2,1) beats css/tokens.css :root.tv (0,2,0), which would otherwise keep the TV's old 24/34 radii.
   Deviations from the plan's alias line, with the reason (see ws/R13-WP0-log.md):
   --r-ctl and --mf-r-md/-sm/-xs go to the inner radius (12/12/8/8): the 11 uses of --r-ctl are tiles *inside* cards (nested rule: inner = outer - padding), not controls.
   --mf-r-xl stays the sheet radius 28 (its 9 uses are the drawer, sheet, ask panel and brochure card), not 20. */
html.r13:root {
  --r-tag: var(--r-inner); --r-ctl: var(--r-inner); --r-card: 20px; --r-sheet: 28px; --r-pill: var(--r-capsule);
  --rad-s: var(--r-inner); --rad-m: var(--r-card); --rad-l: var(--r-card); --rad-xl: var(--r-sheet); --rad-pill: var(--r-capsule);
  --mf-r-xs: var(--r-min); --mf-r-sm: var(--r-min); --mf-r-md: var(--r-inner); --mf-r-lg: var(--r-card); --mf-r-xl: var(--r-sheet); --mf-r-pill: var(--r-capsule);
  /* durations: 200 / 300 / 440 / 600 (was 160 / 220 / 420 / 600; --dur-slow was 720) */
  --mf-t-press: var(--d-press); --mf-t-fast: var(--d-fade); --mf-t-base: var(--d-move); --mf-t-slow: var(--d-sheet); --mf-t-long: var(--d-level);
  --dur-press: var(--d-press); --dur-quick: var(--d-fade); --dur-base: var(--d-sheet); --dur-slow: var(--d-level);
}

/* ---------- 4. paper levels re-point the colour roles ---------- */
html.r13 body:is([data-level=home], [data-level=walk], [data-level=choose], [data-level=price], [data-level=summary]) {
  --surface: #fff; --surface-card: #fff;
  --fg: #1d1d1f; --fg-2: rgba(29, 29, 31, .62); --fg-3: rgba(29, 29, 31, .40);
  --hairline: rgba(0, 0, 0, .06);
  --primary-bg: #1d1d1f; --primary-fg: #fff; --emph: #1d1d1f;
  --el-1: var(--el-1-paper); --el-2: var(--el-2-paper);
}
