/* ==========================================================================
   Base — reset, elements, layout primitives, utilities.
   ========================================================================== */

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

/* The `hidden` attribute is a user-agent style, so any author rule that sets
   `display` on the same element — `.btn { display: inline-flex }`, for one —
   silently wins regardless of specificity, and `el.hidden = true` stops
   hiding anything. Reasserting it here as the one deliberate !important in
   the codebase is the standard fix, not a workaround for one component. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;      /* sticky header */
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: var(--display-axes);
  font-weight: 700;
  line-height: var(--lh-head);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 { font-size: var(--step-5); line-height: var(--lh-tight); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0; }

a { color: var(--court); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--brass); }

img, picture, video, svg { display: block; max-width: 100%; }
img { height: auto; background: var(--ivory-deep); }

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

table { border-collapse: collapse; width: 100%; }

::selection { background: var(--court); color: var(--ivory); }

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

/* ---------------------------------------------------------------- layout */
.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 4.5vw, 4rem); }
.section + .section { padding-top: 0; }

/* Hairline rules do all the dividing work — no boxes, no drop shadows. */
.rule { border: 0; border-top: 1px solid var(--divider); margin: 0; }

.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--flow, var(--sp-4)); }

/* ------------------------------------------------------------ typography */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--neutral);
  margin: 0;
}

.eyebrow--court { color: var(--court); }

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 86%, var(--ivory));
  max-width: 46ch;
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--sp-4); }
.prose p { color: color-mix(in srgb, var(--ink) 84%, var(--ivory)); }

.caption {
  font-family: var(--mono);
  font-size: var(--step--2);
  line-height: 1.5;
  color: var(--neutral);
  letter-spacing: 0.02em;
}

/* Loading / empty states keep the layout from jumping. Shared by every page
   that fetches its content client-side. */
.is-loading { color: var(--neutral); font-family: var(--mono); font-size: var(--step--2); }
.empty-state {
  padding: var(--sp-6) 0;
  border-top: 1px solid var(--divider);
  color: var(--neutral);
  font-size: 0.9375rem;
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 1;
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------ utilities */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  background: var(--court);
  color: var(--ivory);
  padding: 0.75rem 1.25rem;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip-link:focus { left: var(--gutter); top: 0.75rem; }

/* Sample-data badge. Present only while seeded demo rows are still in place. */
.chip-sample {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid color-mix(in srgb, var(--brass) 40%, var(--ivory));
  padding: 0.15em 0.5em;
  white-space: nowrap;
}

/* ------------------------------------------------------------- motion */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Spacing utilities — kept few on purpose. Inline style attributes are
   blocked by the Content-Security-Policy, so one-off spacing lives here. */
.stack--3 { --flow: var(--sp-3); }
.stack--4 { --flow: var(--sp-4); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
