/* ============================================================================
   base.css — the fonts, the reset, and how type behaves.
   Brief 7.

   The four font files are ours, served from /assets/fonts. No request ever
   leaves this server for a font: an admin dashboard that asks Google for its
   typeface leaks who is looking at it and stops working offline.
   ========================================================================= */

/* ------------------------------------------------------------ Inter ------ */
/* One variable file per subset, 400–700. Latin first: it is the one almost
   every page needs, and listing it first means the browser stops there. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-400-700-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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-400-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* -------------------------------------------------- Instrument Serif ----- */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-400-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;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* Arabic — the country reference shows لبنان and السعودية. We do not ship an
   Arabic webfont (it would be another 200KB for a handful of words); the
   system's own Arabic face is used, named in --font-sans. */

/* -------------------------------------------------------------- Reset ---- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Every figure on this platform is tabular, everywhere, so a column of
     numbers lines up without anyone remembering to ask for it. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

img, svg, video { display: block; max-width: 100%; }

/* A default size for any icon dropped somewhere that has no rule of its own.
   An <svg> with only a viewBox has an intrinsic size of 300×150, and a flex
   parent stretches it to fill — which is how a magnifying glass ends up the
   size of the dialog it is in. Every component rule below is more specific
   than this, so it only ever catches the ones nobody thought about. */
svg { width: 16px; height: 16px; flex-shrink: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; border: none; background: none; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

/* ------------------------------------------------------------- Focus ---- */
/* Keyboard users get a ring. Mouse users do not, because a ring after every
   click looks broken. :focus-visible is exactly that distinction. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------- Selection ---- */
::selection { background: var(--gold-dim); color: var(--text); }

/* ------------------------------------------------------- Scrollbars ----- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-clip: padding-box; }

/* ---------------------------------------------------------- Typography -- */

h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; }

.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.01em; }

.display {
  font-family: var(--font-serif);
  font-size: var(--t-display);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.label {
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.muted   { color: var(--text-2); }
.faint   { color: var(--text-3); }
.mono    { font-family: var(--font-mono); font-size: 0.94em; letter-spacing: -0.01em; }
.num     { font-variant-numeric: tabular-nums; }
.nowrap  { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Read for meaning, not for decoration: gold text is only ever THE number. */
.gold { color: var(--gold); }

/* ---------------------------------------------------------- Utilities --- */

.row   { display: flex; align-items: center; gap: var(--s2); }
.row-3 { display: flex; align-items: center; gap: var(--s3); }
.col   { display: flex; flex-direction: column; }
.grow  { flex: 1; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.wrap  { flex-wrap: wrap; }
.center { display: flex; align-items: center; justify-content: center; }

.hidden { display: none !important; }

/* Present to a screen reader, invisible on screen. Used for the labels on
   icon-only buttons. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------- Somebody who asked for it - */
/* A person who has told their computer they get motion sick sees no motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* -------------------------------------------------------------- Print --- */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .drawer, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  .panel { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
}
