/* =========================================================
   Spliid Design System — colors_and_type.css
   Tokens only. No component styles.
   ========================================================= */

/* --------- Webfonts --------- */
/* Inter (default, shipped). Diatype (preferred, requires licence — drop .woff2s in fonts/ and uncomment) */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/Inter-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/Inter-Medium.woff2") format("woff2");
}
/* Inter 700 is intentionally not loaded. The spec reserves 700 as "likely unused";
   if a genuine use case emerges, add the @font-face back and name the use case in
   spliid-design-system.md §4. */

/* IBM Plex Mono — for small labels, dates, metadata */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
}

/* Uncomment when licensing ABC Diatype is complete
@font-face {
  font-family: "ABC Diatype";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/ABCDiatype-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "ABC Diatype";
  font-style: normal;
  font-weight: 500;
  src: url("fonts/ABCDiatype-Medium.woff2") format("woff2");
}
*/

:root {
  /* ==========  COLOR  ========== */
  --ink: #1A1814;
  --ink-70: rgba(26, 24, 20, 0.70);
  --ink-50: rgba(26, 24, 20, 0.50);
  --ink-10: rgba(26, 24, 20, 0.10);
  --ink-04: rgba(26, 24, 20, 0.04);

  --paper: #F9F7F2;
  --paper-raised: #FDFCF8;

  --accent: #3A5A45;
  --accent-ink: #2A4233;

  /* Semantic aliases */
  --fg-1: var(--ink);
  --fg-2: var(--ink-70);
  --fg-3: var(--ink-50);
  --bg-1: var(--paper);
  --bg-2: var(--paper-raised);
  --hairline: var(--ink-10);
  --link: var(--ink);
  --link-underline: var(--accent);

  /* ==========  TYPE  ========== */
  --font-sans: "ABC Diatype", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-bold: 700;

  /* Base / type scale (desktop) */
  --fs-base: 17px;
  --fs-h1: clamp(2.25rem, 1.4rem + 2.2vw, 3.25rem);  /* 36→52px */
  --fs-h2: 1.75rem;   /* 28px */
  --fs-h3: 1.25rem;   /* 20px */
  --fs-body: 1rem;    /* 17px (base) */
  --fs-lead: 1.125rem;/* 19px — frame paragraph */
  --fs-small: 0.875rem; /* 14px */
  --fs-mono-label: 0.8125rem; /* 13px */
  --fs-quote: 1.75rem; /* 28px desktop */

  /* Line heights */
  --lh-display: 1.15;
  --lh-h2: 1.25;
  --lh-h3: 1.3;
  --lh-body: 1.55;
  --lh-quote: 1.3;
  --lh-small: 1.5;

  /* Tracking */
  --ls-h1: -0.01em;
  --ls-h2: -0.005em;
  --ls-mono-label: 0.06em;

  /* ==========  SPACING (24px rhythm)  ========== */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;
  --s-section: 112px; /* canonical gap between page sections */

  /* ==========  LAYOUT  ========== */
  --w-text: 720px;    /* body measure */
  --w-hero: 960px;    /* hero block */
  --w-page: 1120px;   /* nav, footer, outer */
  --w-quote: 560px;   /* pull-quote measure */

  /* ==========  RADII  ========== */
  --r-0: 0;
  --r-1: 2px;  /* buttons, inputs */
  --r-2: 4px;  /* cards — barely there */

  /* ==========  BORDERS  ========== */
  --border-hair: 1px solid var(--hairline);

  /* ==========  SHADOWS  ========== */
  /* Intentionally none. If used, whitespace instead. */
  --shadow-none: none;

  /* ==========  MOTION  ========== */
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-med: 240ms;
  --dur-slow: 400ms;
}

@media (max-width: 640px) {
  :root {
    --s-section: 80px;
    --fs-quote: 1.375rem; /* 22px */
  }
}

/* =========================================================
   Base element defaults — so the tokens apply without wiring
   each component from scratch.
   ========================================================= */

html {
  font-size: var(--fs-base);
  background: var(--bg-1);
  color: var(--fg-1);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  background: var(--bg-1);
  color: var(--fg-1);
}

h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-medium); margin: 0; }
h1 { font-size: var(--fs-h1); line-height: var(--lh-display); letter-spacing: var(--ls-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }

p { margin: 0 0 var(--s-5); }
p.lead { font-size: var(--fs-lead); }

small, .small { font-size: var(--fs-small); color: var(--fg-2); }
.label-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-label);
  letter-spacing: var(--ls-mono-label);
  text-transform: uppercase;
  color: var(--fg-2);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover { text-decoration-color: var(--link-underline); }

blockquote.pull {
  font-size: var(--fs-quote);
  line-height: var(--lh-quote);
  font-weight: var(--fw-regular);
  max-width: var(--w-quote);
  margin: var(--s-9) 0;
  padding: 0;
  border: 0;
  color: var(--fg-1);
}
blockquote.pull cite {
  display: block;
  margin-top: var(--s-5);
  font-size: var(--fs-small);
  font-style: normal;
  color: var(--fg-2);
}
blockquote.pull cite::before {
  content: "— ";
  color: var(--accent);
}

hr.rule {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--s-9) 0 var(--s-8);
}

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

/* =========================================================
   External link marker (§16)
   Trailing ↗ in accent colour, external links only.
   ========================================================= */

a[href^="http"]:not([href*="spliid.co"])::after {
  content: "↗";
  color: var(--accent);
  margin-left: 0.1em;
  font-weight: var(--fw-regular);
  text-decoration: none;
  display: inline-block;
}

nav a[href^="http"]::after,
footer a[href^="http"]::after { content: none; }

/* =========================================================
   Focus (§17)
   Keyboard-only ring using the accent. Never on mouse users.
   ========================================================= */

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

/* =========================================================
   Skip-to-content (§17)
   Visually hidden until focused.
   ========================================================= */

.skip-link {
  position: absolute;
  left: var(--s-5);
  top: calc(var(--s-5) * -4);
  background: var(--ink);
  color: var(--paper);
  padding: var(--s-3) var(--s-4);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
  z-index: 1000;
}
.skip-link:focus { top: var(--s-5); }

/* =========================================================
   Forms (§12)
   Minimal: input, textarea, label, help, error.
   ========================================================= */

.field { display: flex; flex-direction: column; gap: var(--s-2); margin: 0 0 var(--s-5); }
.field__label {
  font-size: var(--fs-small);
  color: var(--fg-2);
  font-weight: var(--fw-regular);
}
.field__help {
  font-size: var(--fs-small);
  color: var(--fg-3);
}
.field__error {
  font-size: var(--fs-small);
  color: var(--fg-1);
}
.field__error::before { content: "— "; color: var(--accent); }

.input, .textarea {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--fg-1);
  background: var(--bg-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  padding: var(--s-3) var(--s-4);
  min-height: 44px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.input:focus, .textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] { border-color: var(--accent); }
.input:disabled, .textarea:disabled {
  color: var(--fg-3);
  background: var(--ink-04);
  cursor: not-allowed;
}
.textarea { min-height: calc(44px * 2); resize: vertical; }

/* =========================================================
   Tables + figures (§14)
   ========================================================= */

.fig { margin: var(--s-8) 0; }
.fig img, .fig svg { display: block; max-width: 100%; height: auto; }
.fig figcaption {
  margin-top: var(--s-3);
  font-size: var(--fs-small);
  color: var(--fg-2);
  max-width: var(--w-text);
}
.fig figcaption .label-mono {
  display: inline-block;
  margin-right: var(--s-3);
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body);
  margin: var(--s-7) 0;
}
.tbl thead th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--fs-mono-label);
  letter-spacing: var(--ls-mono-label);
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: var(--fw-regular);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.tbl tbody td {
  padding: var(--s-3) var(--s-4);
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}
.tbl code {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

/* =========================================================
   Essay body (§15)
   Raised cap, footnotes, inline blockquote.
   ========================================================= */

.essay-body__lead .raisedcap {
  font-size: 2.4em;
  line-height: 1;
  font-weight: var(--fw-medium);
  padding-right: 0.04em;
  vertical-align: -0.08em;
}

.essay-body sup a,
.essay-body a sup {
  text-decoration: none;
  color: var(--fg-1);
  font-size: 0.75em;
}
.essay-body sup a:hover { text-decoration-color: var(--link-underline); }

.footnotes {
  margin: var(--s-8) 0 var(--s-7);
  padding: 0 0 0 var(--s-5);
  font-size: 0.9375rem;
  color: var(--fg-2);
}
.footnotes li { margin: 0 0 var(--s-4); padding-left: var(--s-2); }
.footnotes li a[href^="#fnref"] {
  margin-left: var(--s-2);
  color: var(--accent);
  text-decoration: none;
}

blockquote.inline {
  margin: var(--s-6) 0 var(--s-6) var(--s-5);
  padding-left: var(--s-4);
  border-left: 1px solid var(--hairline);
  color: var(--fg-2);
  font-size: var(--fs-body);
}
blockquote.inline p:last-child { margin-bottom: 0; }

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--fg-1);
}
pre {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  background: var(--bg-2);
  border-left: 1px solid var(--hairline);
  padding: var(--s-4);
  margin: var(--s-6) 0;
  overflow-x: auto;
}
pre code { font-size: inherit; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
