/*
 * Linda · Lumen Design System — Base Styles
 * ─────────────────────────────────────────────────────────────────────────────
 * Element resets and typographic defaults using design tokens.
 * No classes here. This file sets the baseline all components build on.
 *
 * Requires: tokens.css (load tokens.css first)
 *
 * Philosophy: Müller-Brockmann rhythm — body text leads at 1.6 with
 * consistent spacing. Headings use Newsreader (display); body uses Inter.
 * Mono elements use JetBrains Mono. No arbitrary sizes — everything pulls
 * from the token scale.
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── BOX MODEL ──────────────────────────────────────────────────────────────*/

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

/* ── ROOT ───────────────────────────────────────────────────────────────────*/

html {
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-body);    /* 16px — all rem units scale from here */
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Ensure the warm paper shows through on overscroll (iOS, macOS elastic scroll) */
  background-attachment: fixed;
}

body {
  min-height: 100vh;
  color: var(--color-ink);
}

/* ── HEADINGS ───────────────────────────────────────────────────────────────
   All headings use Newsreader. Vignelli: no more than three typefaces.
   Warm, editorial, unhurried. Tufte: headings should disappear when working —
   they scaffold reading, they don't compete with it.                          */

h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 400;              /* Newsreader at 400 has more character than bold */
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
}

h2 {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--color-ink);
}

h3 {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--color-ink);
}

h4 {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  font-weight: 500;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--color-ink);
}

h5 {
  font-family: var(--font-display);
  font-size: var(--text-h5);
  font-weight: 500;
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-snug);
  color: var(--color-ink);
}

h6 {
  font-family: var(--font-body);
  font-size: var(--text-ui);
  font-weight: 600;
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-ink-mute);
}

/* Headings inside sections may be italicized for editorial warmth */
h2 em, h3 em, h4 em {
  font-style: italic;
  color: var(--color-clover);
}

/* ── PARAGRAPHS ─────────────────────────────────────────────────────────────*/

p {
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: var(--color-ink-soft);
  max-width: 72ch; /* prevent excessively long measure — Müller-Brockmann */
}

p + p {
  margin-top: var(--space-4);
}

/* ── LINKS ──────────────────────────────────────────────────────────────────
   Ember on hover for marketing pages. In app-shell contexts components
   override these defaults.                                                    */

a {
  color: var(--color-ember);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color var(--motion-base);
}

a:hover {
  color: var(--color-ink);
}

a:focus-visible {
  outline: 2px solid var(--color-clover);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── CODE / PRE / KBD ───────────────────────────────────────────────────────
   Always JetBrains Mono. Slightly smaller than body to optically match
   cap-height. Background is paper-deep for subtle inline distinction.         */

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-paper-deep);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
  color: var(--color-ink-soft);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  line-height: var(--leading-relaxed);
  background: var(--color-paper-tint);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  overflow-x: auto;
  color: var(--color-ink-soft);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--color-paper-deep);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  color: var(--color-ink-soft);
}

/* ── TABLES ─────────────────────────────────────────────────────────────────
   Tufte: tables are data-presentation devices. No decoration, no grid lines
   except the header separator and row dividers. Column alignment carries
   information — right-align numbers.                                          */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui-sm);
  color: var(--color-ink-soft);
}

thead tr {
  border-bottom: 1px solid var(--color-rule);
}

thead th {
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-ink-mute);
  font-weight: 400;
  white-space: nowrap;
}

thead th.right { text-align: right; }

tbody tr {
  border-bottom: 1px solid var(--color-paper-tint);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--color-paper-deep);
}

tbody td {
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  vertical-align: middle;
}

tbody td.right {
  text-align: right;
}

tbody td.mono {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
}

/* ── LISTS ──────────────────────────────────────────────────────────────────*/

ul, ol {
  padding-left: var(--space-5);
  color: var(--color-ink-soft);
}

li {
  line-height: var(--leading-normal);
}

li + li {
  margin-top: var(--space-2);
}

/* ── BLOCKQUOTE ─────────────────────────────────────────────────────────────
   Used in the philosophy / Lumen's Luck sections. Newsreader italic, left
   border in clover-green.                                                     */

blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-h3);
  line-height: 1.35;
  color: var(--color-ink);
  margin: 0;
  padding-left: var(--space-5);
  border-left: 3px solid var(--color-clover);
  max-width: 60ch;
}

blockquote + cite {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-style: normal;
  color: var(--color-clover);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-top: var(--space-5);
}

/* ── HR ─────────────────────────────────────────────────────────────────────
   Hairline rule at --color-rule. No default margin — sections handle their
   own breathing room.                                                         */

hr {
  border: 0;
  border-top: 1px solid var(--color-rule);
}

/* ── BUTTON ─────────────────────────────────────────────────────────────────
   Base reset. Use .btn-primary / .btn-ghost / .btn-danger from components.css
   for styled variants. The base provides consistent cursor and font reset.    */

button {
  font-family: var(--font-body);
  font-size: var(--text-ui);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--color-clover);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── INPUT / SELECT / TEXTAREA ──────────────────────────────────────────────*/

input,
select,
textarea {
  font-family: var(--font-body);
  font-size: var(--text-ui-sm);
  color: var(--color-ink);
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  line-height: var(--leading-normal);
  transition: border-color var(--motion-base);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-clover);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-ink-mute);
}

/* ── IMAGES / MEDIA ─────────────────────────────────────────────────────────*/

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

/* ── STRONG / EM ────────────────────────────────────────────────────────────*/

strong {
  font-weight: 600;
  color: var(--color-ink);
}

em {
  font-style: italic;
}

/* ── SELECTION ──────────────────────────────────────────────────────────────*/

::selection {
  background: var(--color-clover-tint);
  color: var(--color-ink);
}

/* ── UTILITY CLASSES ────────────────────────────────────────────────────────
   A small set of broadly useful utilities. Not a utility-framework —
   components should be semantic. These exist for rapid structural layouts
   in the example page and one-off overrides.                                  */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.container--wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.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;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.text-mute {
  color: var(--color-ink-mute);
}

.text-clover {
  color: var(--color-clover);
}

.text-ember {
  color: var(--color-ember);
}

.text-danger {
  color: var(--color-danger);
}

.tabular {
  font-variant-numeric: tabular-nums;
}
