/* ══════════════════════════════════════════════════════════════════════
   hub.css: the one look every page under vatan.one/hub/ shares.

   The hub grew page by page, and by October 2026 it carried six palettes,
   four font stacks and as many ideas of what a phone is. This file is the
   single answer to all three. A page links it first and then keeps its own
   layout rules, but every colour, family and radius those rules use is
   one of the --hub-* names below, usually through a page-local alias
   (--ink, --text, --line ...) declared in that page's own :root.

   The values are the console's, from packages/tokens/src/tokens.css, so
   a deck and the product read as one company. That file is the system:
   when a value changes there it changes here, and
   tools/ci/hub-style.mjs fails the build when the two disagree or when
   a hub page stops linking this file.

   Themes work the way the console's do. Dark is the default, the reader's
   operating system can ask for light, and an explicit data-theme on
   <html> wins in both directions.
   ══════════════════════════════════════════════════════════════════════ */

@import url("https://api.fontshare.com/v2/css?f[]=switzer@400,500,600,700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Estedad:wght@300..800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  color-scheme: dark;

  /* Surfaces: page, card, the recessed well, and the lines between. */
  --hub-bg:          #08090a;
  --hub-raised:      #131619;
  --hub-line:        #282d31;
  --hub-line-strong: rgb(255 255 255 / 0.16);
  /* The overlay channel: what a hover or a recess tints toward. White on
     dark, near-black on light, so rgb(var(--hub-on) / .06) reads right in
     both themes. */
  --hub-on: 255 255 255;

  /* Text. Faint is for labels and metadata, never for a sentence. */
  --hub-text:  #e9e9e9;
  --hub-dim:   rgb(233 233 233 / 0.72);
  --hub-faint: rgb(233 233 233 / 0.56);

  /* The brand gold: the mark, an eyebrow, a key figure. Never a state. */
  --hub-mark: #f0b429;

  /* Categorical hues, for telling series, tracks or columns apart. */
  --hub-blue:   #818cf8;
  --hub-green:  #08bdba;
  --hub-amber:  #ff832b;
  --hub-pink:   #ff7eb6;
  --hub-purple: #d946ef;
  --hub-cyan:   #bae6ff;

  /* States, named for meaning. */
  --hub-ok:     rgb(66 190 101);
  --hub-warn:   rgb(255 183 132);
  --hub-info:   rgb(120 169 255);
  --hub-danger: rgb(255 107 94);

  /* How strongly a colour tints its own surface. */
  --hub-tint: 13%;

  /* The inverted pair, for the one primary button on a page. */
  --hub-invert-bg: #ffffff;
  --hub-invert-fg: #08090a;

  --hub-sans: "Switzer", "Estedad", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --hub-fa:   "Estedad", "Switzer", ui-sans-serif, system-ui, Tahoma, sans-serif;
  --hub-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --hub-radius-xs: 6px;
  --hub-radius-sm: 9px;
  --hub-radius-md: 13px;
  --hub-radius-lg: 16px;

  --hub-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --hub-bg:          #f3f4f6;
    --hub-raised:      #ffffff;
    --hub-line:        #cdd2d8;
    --hub-line-strong: rgb(8 9 10 / 0.22);
    --hub-on:          8 9 10;
    --hub-text:  #292929;
    --hub-dim:   rgb(41 41 41 / 0.84);
    --hub-faint: rgb(41 41 41 / 0.66);
    --hub-mark:  #6a5800;
    --hub-blue:   #4f46e5;
    --hub-green:  #007d79;
    --hub-amber:  #ba4e00;
    --hub-pink:   #d02670;
    --hub-purple: #a21caf;
    --hub-cyan:   #002d9c;
    --hub-ok:     rgb(14 96 39);
    --hub-warn:   rgb(138 94 0);
    --hub-info:   rgb(0 67 206);
    --hub-danger: rgb(162 25 31);
    --hub-tint: 15%;
    --hub-invert-bg: #1c1c1c;
    --hub-invert-fg: #ffffff;
  }
}
/* The same light values, for a page or a reader that asks for them. */
:root[data-theme="light"] {
  color-scheme: light;
  --hub-bg:          #f3f4f6;
  --hub-raised:      #ffffff;
  --hub-line:        #cdd2d8;
  --hub-line-strong: rgb(8 9 10 / 0.22);
  --hub-on:          8 9 10;
  --hub-text:  #292929;
  --hub-dim:   rgb(41 41 41 / 0.84);
  --hub-faint: rgb(41 41 41 / 0.66);
  --hub-mark:  #6a5800;
  --hub-blue:   #4f46e5;
  --hub-green:  #007d79;
  --hub-amber:  #ba4e00;
  --hub-pink:   #d02670;
  --hub-purple: #a21caf;
  --hub-cyan:   #002d9c;
  --hub-ok:     rgb(14 96 39);
  --hub-warn:   rgb(138 94 0);
  --hub-info:   rgb(0 67 206);
  --hub-danger: rgb(162 25 31);
  --hub-tint: 15%;
  --hub-invert-bg: #1c1c1c;
  --hub-invert-fg: #ffffff;
}

/* ── Base ─────────────────────────────────────────────────────────────
   Deliberately low in specificity: a page's own rules come after this
   file and win wherever they say something. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--hub-bg);
  color: var(--hub-text);
  font-family: var(--hub-sans);
  -webkit-font-smoothing: antialiased;
  /* A URL, a model id or a long Persian compound must wrap rather than
     push the page sideways on a phone. */
  overflow-wrap: break-word;
}
:lang(fa), [dir="rtl"] { font-family: var(--hub-fa); }
:lang(fa) [lang="en"], [dir="rtl"] [lang="en"] { font-family: var(--hub-sans); }
code, kbd, samp, pre { font-family: var(--hub-mono); }
img, svg, video, canvas { max-width: 100%; }
img, video { height: auto; }
pre { overflow-x: auto; }
::selection { background: color-mix(in srgb, var(--hub-mark) 32%, transparent); }
:focus-visible { outline: 2px solid var(--hub-blue); outline-offset: 2px; }

/* ── Wide content on a phone ──────────────────────────────────────────
   A table or a diagram wider than the screen scrolls inside itself; the
   page never scrolls sideways: wrap it in <div class="hub-scroll">. A
   table whose columns do not make sense side by side on a phone should
   stack instead, with .hub-stack (below). Neither is applied to every
   table by default, because a short table set to scroll shrinks to its
   content and stops filling the column. */
.hub-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* A table that becomes one card per row on a phone. Each <td> carries
   data-label="<its column heading>", which is printed beside it. */
@media (max-width: 680px) {
  table.hub-stack, table.hub-stack tbody, table.hub-stack tr, table.hub-stack td, table.hub-stack th { display: block; width: auto; }
  table.hub-stack thead { display: none; }
  table.hub-stack tr { padding: 10px 0; border-bottom: 1px solid var(--hub-line); }
  table.hub-stack td, table.hub-stack th { border: 0; padding: 3px 0; text-align: start; white-space: normal; }
  table.hub-stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--hub-faint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; }
}
