/*
  AMBER DESIGN TOKENS — the only file in ui/ allowed to hold a literal colour,
  size, weight, line-height, spacing step, radius, line width, duration or
  elevation. Everything else refers to these by var(). test/ui/tokens.test.ts
  scans the rest of ui/ and fails on any literal.

  Governing idea: transmitted light. The interface is the dark surface of the
  appraisal table; the stone is the only saturated thing on the screen.

  Dark is the default and does NOT follow the operating system: it is the
  condition under which amber is judged. Light is chosen explicitly
  ([data-theme="light"]).

  ── Values added beyond the brief, for contrast (approved by the owner) ──
  Measured with the WCAG 2.x relative-luminance formula.
  --action-fill (dark)  #5FB39C   #0E1A17 on it = 7.14:1. The brief's
                                  #3E8C78 measured 4.43:1 with #0E1A17,
                                  below 4.5 for a 17px label, so #3E8C78
                                  stays for borders and focus only.
  --danger (dark)       #C25A4F   4.06:1 on --ground, 3.61:1 on --raised.
                                  Fails as text, so danger is NEVER text:
                                  ink-coloured words inside a danger
                                  outline (outline needs 3:1; 4.06 passes).
  --danger (light)      #A33F34   5.23:1 on --ground, 5.78:1 on --raised.
  --success (light)     #2F7349   4.73:1 on --ground, 5.23:1 on --raised.
  --on-action (light)   #F4F5F1   5.68:1 on #2F6B5B.
  --field-edge          = --ink-2 hairlines measure 1.43:1 (dark) and
                                  1.24:1 (light); a control boundary needs
                                  3:1. --ink-2 measures 7.73:1 / 5.67:1.
  --plate (dark)        #1A1A19   near-neutral mat around photographs only.
  --plate (light)       #D8D9D5   a light neutral grey in the light theme:
                                  a black mat on a pale page punched holes
                                  in it. The mat is the same for every lot
                                  within a theme.
  --photo-ground        #1A1A19   the ONE shooting background every lot is
                                  photographed on, in both themes
                                  (photoStandard in ui/data/demo.json; the
                                  suite measures each photograph's ground).
                                  It matches the dark mat, so in the default
                                  theme a photograph's ground and its mat are
                                  one dark, not two.
                                  DO NOT give the light theme (or any theme)
                                  its own shooting background, and DO NOT
                                  recolour a photograph to suit a theme. The
                                  ground is a physical fact in the photograph;
                                  one ground for every lot is what the
                                  footer's promise of comparison rests on. A
                                  per-theme ground means shooting every piece
                                  twice or editing its colours, and the footer
                                  forbids the second. Only the mat adapts.
                                  identical in both themes, so a stone's
                                  colour is judged against the same ground
                                  on every lot. The cognac ground would
                                  tint every comparison.

  BEAD NUMBERING is a fixed rule, not a style value: it is declared once as
  BEAD_NUMBERING in ui/src/components/strand.ts (confirmed by the owner,
  26 November 2026) and frozen per lot at publication. Bead 1 follows the
  zeewan on the right; counting rises on the right and descends on the left.
  The start mark and arrow are always drawn and may never be hidden.

  Patina note: #3E8C78 sits near 164° and amber near 35°, about 130° apart,
  not a strict complement. It is kept because it is cool and low in chroma,
  which is what makes the amber read as more amber.
*/

:root {
  color-scheme: dark;

  /* ── Colour: dark, the default ─────────────────────────────── */
  --ground: #241612;         /* cognac at depth */
  --raised: #30201A;
  --hairline: #46302A;
  --ink: #F4EDE4;            /* unbleached cotton thread */
  --ink-2: #BCA998;
  --patina: #3E8C78;         /* aged silver shahid: borders, focus */
  --patina-ink: #5FB39C;     /* accent-coloured TEXT only */
  --action-fill: #5FB39C;    /* primary button fill (contrast, see above) */
  --on-action: #0E1A17;
  --danger: #C25A4F;         /* outlines and icons only, never text */
  --success: #4C9B6A;        /* outlines and icons only, never text */
  --plate: #1A1A19;          /* photograph mat (dark theme) */
  --photo-ground: #1A1A19;   /* the shooting background standard, both themes */
  --field-edge: var(--ink-2);
  --focus: var(--patina);
  --elev-overlay: 0 0.75rem 2rem rgb(8 4 3 / 0.55);   /* the one elevation */

  /* ── Type families ──────────────────────────────────────────── */
  --font-display: "Amiri", "Noto Naskh Arabic", serif;
  --font-text: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", sans-serif;

  /* ── Type scale (px in comments; rem so the reader's own size setting wins) */
  --t-13: 0.8125rem;   /* 13 */
  --t-15: 0.9375rem;   /* 15 */
  --t-17: 1.0625rem;   /* 17 — body */
  --t-21: 1.3125rem;   /* 21 */
  --t-26: 1.625rem;    /* 26 */
  --t-33: 2.0625rem;   /* 33 */
  --t-42: 2.625rem;    /* 42 */
  --t-lead-title: clamp(var(--t-26), 1.1rem + 2.4vw, var(--t-42));
  /* The ledger: price and clock at 42 on wide screens, 26 on a 360 phone. */
  --t-ledger: clamp(var(--t-26), 1rem + 2.6vw, var(--t-42));

  --lh-display: 1.25;  /* Amiri headings, and large figures */
  --lh-text: 1.85;     /* Arabic body: the line that separates designed from translated */

  --w-regular: 400;    /* body; never 300 */
  --w-medium: 500;
  --w-bold: 700;

  /* ── Space ──────────────────────────────────────────────────── */
  --s-4: 0.25rem;
  --s-8: 0.5rem;
  --s-12: 0.75rem;
  --s-16: 1rem;
  --s-24: 1.5rem;
  --s-32: 2rem;
  --s-48: 3rem;
  --s-72: 4.5rem;
  --gutter: clamp(var(--s-16), 4vw, var(--s-48));

  /* ── Radius, by purpose ─────────────────────────────────────── */
  --r-control: 4px;
  --r-photo: 2px;      /* a print has near-square corners */
  --r-chip: 999px;
  --r-overlay: 8px;

  /* ── Lines ──────────────────────────────────────────────────── */
  --line: 1px;
  --line-strong: 2px;
  --line-double: 4px;  /* double border marks a bead that carries a note */
  --focus-width: 2px;
  --focus-offset: 2px;

  /* ── Sizes ──────────────────────────────────────────────────── */
  --tap: 2.75rem;            /* 44px minimum target */
  --tap-large: 3.5rem;       /* the commit button */
  --bid-field-ch: 9ch;       /* room for 500,000 and a little more */
  --bid-field-min-ch: 4ch;
  --beadmap-width: 20.5rem;  /* the strand drawing at 1:1, every bead a 46px target */
  --icon: 1.25rem;
  --thumb: 1.5rem;
  --track: 0.25rem;
  --content-max: 70rem;      /* 1120 */
  --measure: 68ch;
  --photo-ratio: 4 / 5;      /* one ratio for every lot: the hanging standard */
  --lead-photo-max: 40rem;
  --lead-text-min: 17rem;
  --panel-width: 26rem;      /* lot page text column: holds the ledger at 42 */
  --row-photo-max: 16rem;
  --thumb-photo: 7.5rem;     /* small frames, and the only size a drawing may take */
  --pair-min: 8.5rem;
  --card-min: 11rem;
  --card-min-fill: 16rem;   /* shop list: few pieces still fill the row (step 12 review) */
  --uv-photo-min: 9rem;
  --uv-photo-max: 14rem;
  --uv-text-min: 13rem;
  --overlay-max: 32rem;
  --z-overlay: 10;
  --sticky-top: var(--s-24);

  /* ── Drawn strokes (SVG user units at 1:1) ──────────────────── */
  --stroke-thread: 1.5;
  --stroke-part: 1.5;
  --stroke-bead: 1.25;
  --stroke-focus: 3;
  --dash-untested: 5 4;
  --scrim: rgb(8 4 3 / 0.62);

  /* ── Breakpoints. CSS cannot read var() inside @media, so each media
     query elsewhere repeats one of these literals and the token test
     asserts that every literal it finds is declared here. ─────── */
  --bp-wide: 60rem;

  /* ── Motion: spent in the bead viewer only ──────────────────── */
  --viewer-drag-px-per-frame: 7;   /* pointer travel per frame */
  --viewer-friction-ms: 520;       /* momentum decay time constant */
  --viewer-stop-frames-per-ms: 0.0006;
}

/* ── Colour: light, secondary — aged silver ───────────────────── */
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #E9EAE5;
  --raised: #F4F5F1;
  --hairline: #D2D4CC;
  --ink: #1E1915;
  --ink-2: #5E5A52;
  --patina: #2F6B5B;
  --patina-ink: #2F6B5B;
  --action-fill: #2F6B5B;
  --on-action: #F4F5F1;
  --danger: #A33F34;
  --success: #2F7349;
  --plate: #D8D9D5;
  --elev-overlay: 0 0.75rem 2rem rgb(30 25 21 / 0.22);
  --scrim: rgb(30 25 21 / 0.42);
}
