/* =====================================================================
   base.css — reset, typography, global elements and small utilities.
   ✏️ Safe to edit: font sizes/weights here. Colors come from tokens.css.
   ===================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--zone-7);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  /* Top half matches the surface, bottom half the abyss, so over-scrolling on phones looks right. */
  background: linear-gradient(to bottom, var(--zone-0) 50%, var(--zone-7) 50%);  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--c-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* :where() keeps this at zero specificity, so components can add their own padding */
:where(ul, ol)[role="list"] {
  list-style: none;
  padding: 0;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  font-size: var(--step-4);
}

h3 {
  font-size: var(--step-2);
}

p {
  text-wrap: pretty;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(100% - 2 * var(--gutter), var(--max-width));
  margin-inline: auto;
}

[hidden] {
  display: none !important;
}

/* Skip link: invisible until focused with the keyboard */
.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-skip);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--foam);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Static fallback (shown before/without JavaScript) ---------- */
.fallback {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--gutter);
  text-align: center;
  background: var(--zone-0);
  color: var(--foam);
}

.fallback h1 {
  font-size: var(--step-hero);
}

.fallback__warning {
  max-width: 36rem;
  margin-inline: auto;
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--violet);
  border-radius: var(--radius-md);
  background: var(--violet-soft);
}

/* ---------- Dev mode: TODO badges (only rendered on localhost) ---------- */
.todo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.1em 0.5em;
  border: 1.5px dashed var(--todo-ink);
  border-radius: 6px;
  background: var(--todo);
  color: var(--todo-ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-transform: none;
  vertical-align: middle;
}
