/* ==========================================================================
   tokens.css — GROK AGENT
   Contract §2. Loads first. Owns: @font-face, custom properties, reset,
   base typographic defaults. Everything here is intentionally low
   specificity so site.css / panel.css / feed.css can override freely.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts (local files in ../fonts, no network, no CDN)
   font-display: swap so copy is never invisible while the woff loads.
   There is no bold-italic file; the browser synthesises that pair.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: et-book;
  src: url("../fonts/et-book-roman-line-figures.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: et-book;
  src: url("../fonts/et-book-bold-line-figures.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: et-book;
  src: url("../fonts/et-book-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens — dark graphite inversion of the donor palette
   -------------------------------------------------------------------------- */

:root {
  /* surfaces */
  --bg:         #141518;   /* page */
  --bg-raised:  #1B1D21;   /* panels, cards, chips */
  --bg-sunken:  #101114;   /* feed well, code-ish surfaces */

  /* text */
  --fg:         #E8E6E3;   /* body text, warm off-white like the blob */
  --fg-dim:     #9AA0A8;   /* secondary, captions, metric labels */
  --fg-faint:   #5F656D;   /* rules, disabled, tick labels */

  /* structure */
  --line:       #2A2E35;   /* hairlines, borders */

  /* accents — use sparingly: footnote numbers, live dots,
     "Emerging" ticks, links on hover */
  --accent:     #6FD3A0;
  --accent-dim: #2F6B4F;
  --warn:       #D8A657;   /* "awaiting approval" status only */
  --blob:       #F2F0EC;   /* mascot white: wordmark dot, donut fill */

  /* geometry */
  --radius:     6px;
  --maxw-essay: 720px;
  --maxw-page:  1400px;

  /* layout constants from contract §3, shared so every sheet agrees */
  --maxw-panel: 430px;
  --gap-col:    64px;
  --header-h:   56px;

  /* sticky-header translucency (--bg at 85%) for backdrop-filter surfaces */
  --bg-translucent: rgba(20, 21, 24, 0.85);

  /* type */
  --font-serif: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --track-label: 0.06em;   /* letter-spacing for small mono labels */

  color-scheme: dark;
  scrollbar-color: var(--line) var(--bg);
}

/* --------------------------------------------------------------------------
   3. Reset — deliberately tight.
   No universal margin wipe: an unlayered `* { margin: 0 }` outranks nothing
   but still steals spacing from every element nobody remembered to style,
   so margins are only reset where a stylesheet definitely re-sets them.
   -------------------------------------------------------------------------- */

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

html {
  font-size: 100%;                       /* keep 1rem = 16px for every sheet */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* anchor jumps must clear the 56px sticky header */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;   /* light-on-dark reads better thin */
  -moz-osx-font-smoothing: grayscale;
}

/* Headings inherit the serif and carry no default weight/size opinion here;
   site.css sets the scale. */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 400;
  font-size: inherit;
  line-height: 1.15;
}

p {
  margin: 1.4rem 0;
  text-wrap: pretty;
}

ol, ul {
  margin: 1.4rem 0;
  padding-left: 1.4em;
}

li + li {
  margin-top: 0.35rem;
}

figure, blockquote, dl, dd {
  margin: 0;
}

hr {
  display: block;
  height: 1px;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
  padding: 0;
}

/* Images: the blob is already correct on dark, never filter it here.
   No display:block — the brandmark and card avatars sit inline next to text. */
img {
  max-width: 100%;
  height: auto;
  filter: none;
}

/* Form + interactive elements should never fall back to system sans */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: inherit;
}

summary {
  cursor: pointer;
}

/* The intro panels and any other progressively-revealed block ship with the
   `hidden` attribute. A later `.intro-panel { display: block }` would beat a
   plain [hidden] rule, so this one is emphatic on purpose. */
[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   4. Base typography
   -------------------------------------------------------------------------- */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-skip-ink: auto;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 1.5px;
}

a:hover {
  color: var(--accent);
  text-decoration-thickness: from-font;
}

b, strong {
  font-weight: 700;
}

small {
  font-size: 0.8em;
}

sup, sub {
  font-size: 0.72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup { top: -0.5em; }
sub { bottom: -0.25em; }

/* Mono is the register for labels, metrics, timestamps and code.
   Uppercase and letter-spacing stay with the sheets that own those blocks. */
code, kbd, samp, pre, time {
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-variant-numeric: tabular-nums;
}

pre {
  margin: 1.4rem 0;
  overflow-x: auto;
}

/* Utility for one-off mono labels outside the panel/feed sheets. */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--accent-dim);
  color: var(--fg);
}

/* --------------------------------------------------------------------------
   5. Focus — must stay obvious against near-black
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Mouse users keep a clean surface; keyboard users keep the ring above. */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   6. Motion preference
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
