/* base.css: reset, font wiring, element defaults.
   References tokens.css for every value. */

/* SELF-HOSTED FONT: DEPARTURE MONO
   (JetBrains Mono + IBM Plex Serif load via Google Fonts in baseof.html) */

@font-face {
  font-family: "Departure Mono";
  src: url("/fonts/departure-mono/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* MODERN RESET */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-prose);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "calt";
  position: relative;
}


img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* TYPOGRAPHY DEFAULTS */

/* Headings: Departure Mono at large sizes, JetBrains Mono below */
h1, h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);     /* Departure Mono ships Regular only; avoid synthetic bold on pixel grid */
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-normal);
  color: var(--fg-0);
}

h3, h4, h5, h6 {
  font-family: var(--font-mono);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--fg-0);
}

h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-headline); margin-top: var(--space-xl); margin-bottom: var(--space-md); }
h3 { font-size: var(--fs-title);    margin-top: var(--space-lg); margin-bottom: var(--space-sm); }
h4 {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-loose);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
  margin-top: var(--space-md);
  margin-bottom: var(--space-2xs);
}

p {
  max-width: var(--measure-prose);
  margin-bottom: var(--space-sm);
}

a {
  color: var(--accent-warm);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: oklch(70% 0.18 340 / 0.5);
  text-underline-offset: 0.2em;
  transition:
    color var(--duration-fast) var(--ease-out-quart),
    text-decoration-color var(--duration-fast) var(--ease-out-quart),
    text-shadow var(--duration-fast) var(--ease-out-quart);
}

a:hover {
  color: var(--accent-warm-soft);
  text-decoration-color: var(--accent-warm);
  text-shadow: var(--glow-warm-low);
}

a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
  text-decoration-color: var(--accent-warm);
}

strong, b { font-weight: var(--fw-semibold); color: var(--fg-0); }
em, i { font-style: italic; }

small { font-size: var(--fs-label); color: var(--fg-2); }

/* Lists */
ul, ol { padding-left: var(--space-md); margin-bottom: var(--space-sm); max-width: var(--measure-prose); }
li { margin-bottom: var(--space-2xs); }
li > ul, li > ol { margin-top: var(--space-2xs); margin-bottom: 0; }

/* Code (inline) */
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-1);
  color: var(--fg-0);
  padding: 0.12em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-0);
}

/* Code blocks: full styling lives in syntax.css; this is the container */
pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
  line-height: 1.55;
  background: var(--bg-1);
  color: var(--fg-0);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-0);
  overflow-x: auto;
  margin-bottom: var(--space-md);
  max-width: 100%;
}

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

/* Keyboard keys */
kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-1);
  border: 1px solid var(--border-0);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
  color: var(--fg-1);
}

/* Horizontal rule */
hr {
  border: 0;
  border-top: 1px solid var(--border-0);
  margin: var(--space-lg) 0;
  max-width: var(--measure-prose);
}

/* Blockquote: full border, never `border-left` stripe */
blockquote {
  border: 1px solid var(--border-0);
  background: var(--bg-1);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-md);
  margin: var(--space-md) 0;
  color: var(--fg-1);
  font-style: italic;
  max-width: var(--measure-prose);
}

blockquote p { margin-bottom: var(--space-2xs); }
blockquote p:last-child { margin-bottom: 0; }

/* Images & figures: center and scale responsively */
figure {
  margin: var(--space-md) auto;
  max-width: 100%;
  text-align: center;
}

figure img { margin: 0 auto; }

figcaption {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  color: var(--fg-2);
  margin-top: var(--space-2xs);
  text-align: center;
  letter-spacing: var(--tracking-wide);
}

/* Selection: accent surface, dark text */
::selection {
  background: var(--accent-warm);
  color: var(--bg-0);
  text-shadow: none;
}

/* Focus-visible baseline for any interactive element not specifically styled */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
