/* Hallmark · macrostructure: Long Document · tone: technical, plain · anchor hue: ticket yellow (90)
 * theme: custom (vibe: "a printed standard with one yellow ticket") · paper oklch(97% 0.006 255)
 * accent oklch(86% 0.16 90) yellow · Bricolage Grotesque + Atkinson Hyperlegible Next + JetBrains Mono
 * axes: light / grotesk-sans / warm · pre-emit critique: P4 H4 E4 S5 R5 V4
 */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/atkinson-hyperlegible-next.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/atkinson-hyperlegible-next-italic.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --color-paper: oklch(97% 0.006 255);
  --color-ink: oklch(25% 0.06 262);
  --color-muted: oklch(48% 0.035 262);
  --color-rule: oklch(88% 0.012 255);
  --color-wash: oklch(93% 0.012 255);
  --color-accent: oklch(86% 0.16 90);
  --color-link: oklch(45% 0.19 264);
  --color-code-paper: oklch(25% 0.06 262);
  --color-code-ink: oklch(94% 0.012 255);
  --color-code-key: oklch(86% 0.16 90);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text-s: 0.9375rem;
  --text-base: 1.0625rem;
  --text-l: 1.25rem;
  --text-h3: 1.375rem;
  --text-h2: 2rem;
  --text-display: clamp(2.5rem, 7vw, 4rem);

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4.5rem;

  --measure: 66ch;
  --radius: 8px;
}

/* Dark: when the system asks for it and the visitor hasn't picked light, or when they picked dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-paper: oklch(20% 0.03 262);
    --color-ink: oklch(93% 0.012 255);
    --color-muted: oklch(73% 0.03 262);
    --color-rule: oklch(35% 0.03 262);
    --color-wash: oklch(29% 0.035 262);
    --color-accent: oklch(86% 0.16 90);
    --color-link: oklch(80% 0.12 264);
    --color-code-paper: oklch(15% 0.03 262);
    --color-code-ink: oklch(92% 0.012 255);
    --color-code-key: oklch(86% 0.16 90);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --color-paper: oklch(20% 0.03 262);
  --color-ink: oklch(93% 0.012 255);
  --color-muted: oklch(73% 0.03 262);
  --color-rule: oklch(35% 0.03 262);
  --color-wash: oklch(29% 0.035 262);
  --color-accent: oklch(86% 0.16 90);
  --color-link: oklch(80% 0.12 264);
  --color-code-paper: oklch(15% 0.03 262);
  --color-code-ink: oklch(92% 0.012 255);
  --color-code-key: oklch(86% 0.16 90);
  color-scheme: dark;
}
:root[data-theme='light'] {
  color-scheme: light;
}

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

html,
body {
  overflow-x: clip;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--space-md);
}
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
}

.page {
  max-width: 54rem;
  margin-inline: auto;
  padding: var(--space-lg) clamp(1rem, 5vw, 2rem) var(--space-xl);
}

/* The theme switch, in the top right corner of the whole page. On a phone there is no room beside the title, so it
   sits above it in the page's own column. */
.theme {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
}
@media (max-width: 40rem) {
  .theme {
    position: static;
    margin-bottom: var(--space-md);
  }
}
.theme[hidden] {
  display: none;
}
.theme button {
  font: inherit;
  font-size: var(--text-s);
  line-height: 1;
  color: var(--color-muted);
  background: transparent;
  border: 1px solid var(--color-rule);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}
.theme button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}
.theme button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}
.theme button:hover {
  color: var(--color-ink);
}
.theme button[aria-pressed='true'] {
  background: var(--color-wash);
  color: var(--color-ink);
  font-weight: 650;
}

a {
  color: var(--color-link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}
a:hover {
  text-decoration-thickness: 0.15em;
}
:focus-visible {
  outline: 3px solid var(--color-link);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-style: normal;
  line-height: 1.15;
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}
h1 {
  font-size: var(--text-display);
  font-weight: 750;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.35em;
}
h1 img {
  width: 0.85em;
  height: 0.85em;
  flex: none;
}
h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 4px solid var(--color-accent);
}
h3 {
  font-size: var(--text-h3);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-top: var(--space-lg);
}
h4 {
  font-size: var(--text-l);
  font-weight: 650;
  margin-top: var(--space-md);
}

p,
ul,
ol {
  margin: var(--space-sm) 0 0;
  max-width: var(--measure);
}
ul,
ol {
  padding-left: 1.25rem;
}
li + li {
  margin-top: var(--space-xs);
}

.summary {
  font-size: var(--text-l);
  line-height: 1.5;
  margin-top: var(--space-md);
}
.meta,
.aside {
  color: var(--color-muted);
  font-size: var(--text-s);
}
header nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin-top: var(--space-md);
  font-size: var(--text-base);
}
header nav a {
  white-space: nowrap;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
:not(pre) > code {
  background: var(--color-wash);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
pre {
  margin: var(--space-sm) 0 0;
  background: var(--color-code-paper);
  color: var(--color-code-ink);
  padding: var(--space-sm) 1.25rem;
  border-radius: var(--radius);
  line-height: 1.55;
  font-size: 0.8125rem;
  /* Long JSON lines wrap, so nothing is hidden off the side of a phone. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre .k {
  color: var(--color-code-key);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  margin-top: var(--space-sm);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--text-s);
  line-height: 1.45;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem var(--space-sm) 0.6rem 0;
  border-bottom: 1px solid var(--color-rule);
}
th {
  font-weight: 650;
  color: var(--color-muted);
  white-space: nowrap;
}
/* A tool or field name never breaks across lines, whichever column it is in. */
td code {
  white-space: nowrap;
}

footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: var(--text-s);
}

/* On a phone a wide table keeps readable columns and scrolls sideways inside its own box. */
.table-scroll table {
  min-width: 36rem;
}

/* The note under the adopters table ("Nobody yet...") is an aside, not part of the list. */
#adopters .table-scroll + p {
  color: var(--color-muted);
}

/* In a table of fields (the build marks them), the type column is short and easier to scan on one line. */
.fields td:nth-child(2) {
  white-space: nowrap;
}
