/* jds/theme.joivy.css — THE JOIVY DESIGN SYSTEM, AS A THEME LAYER
   (deploy-azure.md §2c rule 4, decided by Stefano on 2026-09-22).

   WHAT THIS IS. The Joivy design system (Storybook: Figtree for text,
   Unbounded for display, teal #015961 and yellow #FFE84C as the base colours;
   npm package @joivy/jds, React + Tailwind) applied to JARVIS's pages without
   rewriting them. Every page already paints itself from a handful of custom
   properties (console.html :root, _tokens.css, stay.html; tv/_theme.css until AG-06);
   this file is loaded AFTER a page's own styles and re-points those
   properties, plus the few wordmark and heading rules that carry the display
   face. The markup, the layout, the components and every accessibility rule
   the pages enforce are untouched.

   WHERE IT RUNS. Nowhere on Netlify. Every page links /jds/theme.css, which in
   this repository is an EMPTY file, so the live site does not change by one
   pixel. ops/azure/build-public.sh copies THIS file over theme.css when it
   builds the static site for Azure: the shadow build carries the Joivy look
   from day one, and platform, datastore and look change in a single cutover
   (deploy-azure.md §2c). To preview locally: cp this file over theme.css and
   do not commit.

   WHAT DOES NOT CHANGE, ON PURPOSE. The four status inks and their tints
   (--hi, --md, --ok, --info) are the console's own: chosen and pinned for AA
   on every ground by tests/console-contrast.test.js, and a brand change is
   not a reason to re-argue red, amber and green. Joivy yellow replaces the
   apricot accent only where the accent sits on a dark ground or is a fill.

   CONTRAST. Colours from the reference tokens file (1 Dec 2026). The
   sidebar is flat teal-600 #015961 like J-People; its text is white at .9
   and the active item the yellow chip with dark text. Every text token below
   clears WCAG AA 4.5:1 on every light ground the console paints, and the
   sidebar's text clears it on teal-600: pinned by tests/jds-theme.test.js
   with the same arithmetic as console-contrast.

   FONTS. Unbounded is SELF-HOSTED (jds/fonts/unbounded-latin.woff2, latin
   subset, variable weight, SIL Open Font License): the guest portal must not
   send a guest's IP to Google (IAM-28, stay-portal-hardening test) and the
   CSP allows fonts from 'self' only. Figtree stays as each page loads it. */

@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('/jds/fonts/unbounded-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ── Joivy base: the reference tokens (ClaudeAI/…/skill-jtom/asset/
     joivy-design-tokens.css, the file J-People and the JTOM prototypes use;
     aligned 1 Dec 2026, Stefano: "i colori non mi sembrano allineati") ── */
  --jds-teal:        #015961;   /* teal-600: primary, sidebar ground, links, active states */
  --jds-teal-deep:   #013F46;   /* teal-800: hover of primary, sign-in gate */
  --jds-teal-ink:    #013136;   /* teal-900: the darkest teal, text on light */
  --jds-teal-mid:    #347A81;   /* teal-500: chart series and a second brand tone (walls) */
  --jds-teal-wash:   #E6F1F2;   /* teal-100: selected rows, soft brand tint */
  --jds-yellow:      #FFE84C;   /* accent on DARK grounds only: 6.48:1 on teal, 9.79:1 on deep; 1.1:1 on white */
  --jds-yellow-ink:  #7A5A00;   /* the yellow burnt down for text on light: 6.38:1 on white, ≥5.36:1 on every tint */
  --jds-display:     'Unbounded', 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --jds-body:        'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* ── @joivy/jds 3.0.1, style.css (read 30 Nov 2026; UX night run) ────
     Radii, shadows, field and state colours exactly as the package
     declares them (rem converted at 16px). Where the console keeps its own
     value instead, design_design-tokens.md v2 says why. */
  --jds-radius-xs:   4px;       /* radius-xs  0.25rem: small fields, small badges */
  --jds-radius-sm:   6px;       /* radius-sm  0.375rem: fields, badges, alerts and toasts */
  --jds-radius-md:   8px;       /* radius-md  0.5rem: buttons, cards, tables */
  --jds-radius-lg:   12px;      /* radius-lg  0.75rem: dialogs, large buttons */
  --jds-radius-xl:   16px;      /* radius-xl  1rem */
  --jds-shadow-sm:   0px 1px 2px 0px rgba(0,0,0,.05);
  --jds-shadow-md:   0px 4px 16px -8px rgba(0,0,0,.1), 0px 3px 12px -4px rgba(0,0,0,.1), 0px 2px 3px -2px rgba(0,0,51,.06);
  --jds-shadow-2xl:  0px 16px 36px -20px rgba(0,6,46,.2), 0px 16px 64px 0px rgba(0,0,85,.02);
  --jds-border:      #D6DEE4;   /* jds-c-border = slate-300 */
  --jds-field-border:#6B7280;   /* jds-c-field-border = gray-500: 4.83:1 on white, over the 3:1 UX-35 asks of a field edge */
  --jds-field-hover: #015159;   /* jds-c-field-hover = teal-700 */
  --jds-field-active:#015961;   /* jds-c-field-active = teal-600 */
  --jds-state-hover: rgba(0,0,0,.05);         /* jds-c-state-hover = black alpha 1, laid over any fill */
  --jds-state-active: rgba(0,0,0,.10);        /* jds-c-state-active = black alpha 2 */
  --jds-state-accent-hover: rgba(1,89,98,.05);  /* jds-c-state-accent-hover = teal alpha 1: outline and ghost buttons */
  --jds-state-accent-active: rgba(1,89,98,.10);
  --jds-state-destructive-hover: rgba(218,47,40,.05);  /* jds-c-state-destructive-hover = red alpha 1 */
  --jds-state-disable: #F6F8F9; /* jds-c-state-disable = slate-100 */
  --jds-overlay:     rgba(0,0,0,.6);           /* jds-c-misc-overlay = black alpha 8 */

  /* ── console.html / _tokens.css (the staff surfaces) ──────────────── */
  --forest:      var(--jds-teal);
  --forest-2:    var(--jds-teal-deep);
  --forest-ink:  var(--jds-teal-ink);
  --paper:       #F6F8F9;  --panel: #FFFFFF;  --panel-2: #EFF3F4;  --panel-3: #F7F9FA;  --paper-2: #F2F8F8;   /* bg-muted, white, slate-100, slate-50, teal-50 */
  --line:        var(--jds-border);  --line-soft: #E1E7E9;  --line-2: #C2CDD1;  --line-strong: #C2CDD1;   /* border, slate-200, slate-300 */
  --sel:         var(--jds-teal-wash);
  --track:       #E1E7E9;  /* slate-200 */
  --ink:         #111214;  /* text */
  --ink-2:       #1F2A2E;  /* slate-800 */
  --muted:       #535C62;  /* text-muted */
  --muted-2:     #59636A;  /* a step lighter than --muted, still AA on every tint (jds-theme.test) */
  --accent:      var(--jds-yellow);   /* sidebar links, the sign-in button, chart fills: dark grounds and fills only */
  --shadow:      var(--jds-shadow-sm);
  --font:        var(--jds-body);
  --field-line:  var(--jds-field-border);
  --r:           var(--jds-radius-md);
  --r-xs: var(--jds-radius-xs);  --r-sm: var(--jds-radius-sm);  --r-md: var(--jds-radius-md);
  --r-lg: var(--jds-radius-lg);  --r-xl: var(--jds-radius-xl);

  /* ── tv/_theme.css: retired with the wall screens (AG-06, 13 Nov 2026) ─ */

  /* ── stay.html (guest portal), escalations.html, accessibility.html ─ */
  --brand:       var(--jds-teal);
  --brand-2:     var(--jds-teal-deep);
  --brand-ink:   var(--jds-teal-ink);
  --cream:       #F6F8F9;
  --bg:          #F6F8F9;
}

/* ── The display face on the wordmarks and page titles ─────────────────
   Unbounded is wide: the letterspacing the wordmarks carried for Figtree
   caps comes down, the weight comes down to the system's 600. */
.brand .wm, .wm, .gcard h1,
.hero .brand, .top .brand, header .brand, .logo,
.header-brand,
h1:not(.gcard h1) {
  font-family: var(--jds-display);
  font-weight: 600;
  letter-spacing: .02em;
}
h1:not(.gcard h1) { font-weight: 500; }

/* ── Console sidebar: flat teal-600 as in J-People and the reference tokens.
   On it the console's translucent whites (.62–.82) fall under AA (white at
   .62 is 4.14:1), so the sidebar's text is raised to .9 here; the active
   item is the Joivy yellow chip with dark text, as in J-People. ─────────── */
.side { background: var(--jds-teal); }
/* One simple selector each, never a compound one inside :is(): :is() weighs as
   its heaviest member, and .nitem .n.zero in the list once made every item
   weigh 0,4,0 and beat the yellow chip below, leaving white on yellow at
   1.24:1 (Stefano, 4 Dec 2026). */
.side .nitem, .side .sidefoot, .side .nhead, .side .autocard .d, .side .brand .sub { color: rgba(255,255,255,.9); }
.side .nitem.sub, .side .nitem.note, .side .nitem.pstatic, .side .nhead .tot, .side .nitem .n.zero { color: rgba(255,255,255,.9); }
.side .nitem.on, .side .nitem.on.sub, .side .nitem.on.note { background: var(--jds-yellow); color: var(--ink); }
.side .nitem.on .n.zero { color: var(--ink); }
.gate { background: linear-gradient(180deg, var(--jds-teal-deep) 0%, var(--jds-teal-ink) 100%); }
.hero { background: linear-gradient(178deg, var(--jds-teal) 0%, var(--jds-teal-deep) 100%); background-color: var(--jds-teal); }

/* Primary actions and links: teal, hover deep. Focus rings follow --forest. */
.btn.pri { background: var(--jds-teal); }
.btn.pri:hover { background: var(--jds-teal-deep); }
.btn.pri[disabled] { background: var(--track); color: var(--muted); }

/* Joivy yellow as the focus colour on dark grounds is already the console's
   own choice (--focus-hi); nothing to change. */

/* ── Components, the way Storybook (@joivy/jds 3.0.1) draws them ────────
   UX night run, 30 Nov 2026. Console only: every rule is scoped to a page
   with the console sidebar, and the scope sits in :where() so each rule
   weighs exactly what the console's own rule weighs. Loaded after the
   console's styles, it wins over the base rule and still loses to every
   variant (.btn.pri, .toast.bad, .pill.hi …), so nothing the console
   decided per state is undone. Shape, weight and hover/press states only:
   no text, no layout, no behaviour. */

/* Buttons (jds Button): font-medium, radius md, a translucent state layer
   on hover and press over whatever fill the variant has. */
:where(body:has(.side)) .btn { border-radius: var(--jds-radius-md); font-weight: 500; transition: background-color .2s, box-shadow .2s; }
:where(body:has(.side)) .btn:not([disabled]):hover { box-shadow: inset 0 0 0 999px var(--jds-state-hover); }
:where(body:has(.side)) .btn:not([disabled]):active { box-shadow: inset 0 0 0 999px var(--jds-state-active); }
:where(body:has(.side)) .btn.sec:not([disabled]):hover { background: var(--panel); box-shadow: inset 0 0 0 999px var(--jds-state-accent-hover); }
:where(body:has(.side)) .btn.warn:not([disabled]):hover { background: var(--panel); box-shadow: inset 0 0 0 999px var(--jds-state-destructive-hover); }

/* Fields (jds TextField / Select / TextArea): gray-500 edge, teal-700 on
   hover, teal-600 while typing, slate-100 when disabled. The focus RING
   stays the console's 2px teal outline: the package's blue-400 ring is
   2.5:1 on white, under the 3:1 WCAG 1.4.11 asks of a focus indicator. */
:where(body:has(.side)) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea):hover:not(:disabled) { border-color: var(--jds-field-hover); }
:where(body:has(.side)) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea):focus { border-color: var(--jds-field-active); }
:where(body:has(.side)) :is(input, select, textarea):disabled { background: var(--jds-state-disable); cursor: not-allowed; }
:where(body:has(.side)) :is(input[type=checkbox], input[type=radio], input[type=range]) { accent-color: var(--jds-teal); }

/* Cards (jds Card): border, radius md, flat; the radius and the soft shadow
   come through --r-md and --shadow above. */

/* Tabs (jds Tabs): foreground text in font-medium, a 2px teal underline
   on the active one. */
:where(body:has(.side)) .tab { font-weight: 500; color: var(--ink-2); }
:where(body:has(.side)) .tab:hover { color: var(--forest); }

/* Badges and pills (jds Badge): radius sm, medium weight. The console's
   tinted status pills keep their colours (AA-pinned by console-contrast). */
:where(body:has(.side)) .pill { border-radius: var(--jds-radius-sm); font-weight: 600; padding: 2px 8px; }

/* Navigation: the sidebar items take the button radius and the same
   state layer; the active item keeps the console's light chip. */
:where(body:has(.side)) .nitem { border-radius: var(--jds-radius-md); }

/* Tables (jds Table): a slate-100 header row in sentence case and
   font-medium instead of the small spaced capitals; jds border colour. */
:where(body:has(.side)) th { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--jds-state-disable); border-bottom-color: var(--jds-border); }

/* Dialogs (jds Dialog): black 60% overlay, radius lg, shadow-2xl, a bold
   title. */
:where(body:has(.side)) .modal { background: var(--jds-overlay); }
:where(body:has(.side)) .mbox { border-radius: var(--jds-radius-lg); box-shadow: var(--jds-shadow-2xl); }
:where(body:has(.side)) .mbox h3 { font-size: 18px; font-weight: 700; }

/* Toasts (jds Toaster, drawn as an Alert): radius sm, shadow md. The fill
   stays the deep teal ink (and the error ink on .bad): white on it is far
   above AA, and a grey neutral toast would read as disabled. */
:where(body:has(.side)) .toast { border-radius: var(--jds-radius-sm); box-shadow: var(--jds-shadow-md); padding: 12px 16px; }
