/* ============================================================
   components.css — reusable UI built on the tokens in tokens.css.
   Buttons, form fields, links, labels, and their interaction
   states. Link this AFTER tokens.css.

   Every value points at a token. States covered per component:
   default · hover · focus-visible · active · disabled.

   The .is-hover / .is-focus / .is-active helper classes mirror
   the real state styles so the design-system guide can show every
   state at rest, without you having to hover each one.
   ============================================================ */

/* ── FOCUS (global) ──────────────────────────────────────────
   Every interactive element on the site gets a visible keyboard
   focus ring, not just the components below. :focus-visible, so
   it only appears for keyboard users and never on a mouse click.

   Two rings, because no single token reads on both surfaces.
   The accent carries the dark cards and panels (9.6:1 on the
   ink) where an ink ring would vanish into the background; the
   ink carries the cream page (14:1) where the accent alone is
   far too pale to see. Whatever the ring lands on, one of the
   two is clearly visible.

   :where() holds the specificity at zero, so any component can
   still override it. No border-radius is set — the outline
   follows whatever the element already has, which matters on
   the 15px cards. */
:where(a, button, summary, [tabindex]):focus-visible,
.btn:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible,
.is-focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--text);
}

/* ── BUTTONS ─────────────────────────────────────────────────
   Base: tracked uppercase Geist, card-radius, token spacing. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  padding: var(--sp-5) var(--sp-8);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    color 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.25s ease,
    transform 0.12s ease;
}
.btn:active,
.is-active.btn {
  transform: translateY(1px);
}
.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — dark, turns accent on hover (the site's card idiom) */
.btn--primary {
  background: var(--surface-dark);
  color: var(--text-on-dark);
}
.btn--primary:hover,
.is-hover.btn--primary {
  background: var(--accent);
  color: var(--text);
}

/* Secondary — hairline outline, fills on hover */
.btn--secondary {
  background: none;
  color: var(--text);
  border-color: var(--line);
}
.btn--secondary:hover,
.is-hover.btn--secondary {
  background: var(--surface-dark);
  color: var(--text-on-dark);
  border-color: var(--surface-dark);
}

/* Text — no chrome. Hover keeps the text dark (accent as text on
   light fails contrast); the accent shows as an underline cue. */
.btn--text {
  padding-left: 0;
  padding-right: 0;
  color: var(--text);
}
.btn--text:hover,
.is-hover.btn--text {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
}

/* Small size */
.btn--sm {
  font-size: var(--fs-2xs);
  padding: var(--sp-3) var(--sp-6);
}

/* ── FORM FIELDS ─────────────────────────────────────────────
   .field wraps a label + control in a vertical stack. */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.field-label {
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--fs-2xs);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input,
.textarea,
.select {
  width: 100%;
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--fs-sm);
  font-weight: 300;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-6);
  transition: border-color 0.2s ease;
}
.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--text-muted);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--text);
}
.input:disabled,
.textarea:disabled,
.select:disabled,
.field.is-disabled .input,
.field.is-disabled .textarea {
  background: var(--surface-alt);
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── INLINE LINK ─────────────────────────────────────────────
   Underlined, accent on hover. */
.link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
/* Hover keeps text at --text (accent as text on light fails
   contrast); only the underline turns accent. */
.link:hover,
.is-hover.link {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
}
/* Focus hugs the text with a dark outline (13.9:1 on cream) and
   keeps the underline, so it reads as focus and stays clearly
   apart from the hover state. Distinct from the button box. */
.link:focus-visible,
.is-focus.link {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 2px;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

/* ── VISUALLY HIDDEN ─────────────────────────────────────────
   Removed from view but still read by screen readers and still
   part of the document outline. For a page whose heading is
   carried by the design rather than by a line of type — the Work
   grid, for instance, which needs an h1 it has no room to show.
   Not display:none, which would hide it from assistive tech too. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── LABEL / KICKER ──────────────────────────────────────────
   The tracked uppercase micro-label used across the site. */
.ui-label {
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--fs-2xs);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ui-kicker {
  font-family: "Geist", system-ui, sans-serif;
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── LAYOUT GRID ─────────────────────────────────────────────
   The 12-column grid from tokens.css. .grid-wrap centres the
   content and caps its width; .grid lays a 12-column track with
   the --gap gutter. Place children with grid-column (e.g.
   grid-column: 1 / 4 for the left rail, 4 / -1 for content).
   Collapses to a single column on narrow screens. */
.grid-wrap {
  max-width: var(--grid-max);
  margin-inline: auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--grid-gutter);
}
@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .grid > * {
    grid-column: 1 / -1 !important;
  }
}
