/* =====================================================================
   base.css — reset, elements, layout primitives, utilities
   Loaded AFTER tokens.css and the city variant. Contains no color
   literals: everything resolves through a token.
   ===================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset for the sticky header when jumping to an in-page anchor. */
  scroll-padding-top: 6rem;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--c-bg);
  background-image: var(--surface-texture);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--t-base);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* Room for the mobile fixed call bar so nothing is trapped underneath. */
  padding-bottom: env(safe-area-inset-bottom);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); line-height: var(--lh-snug); }
h4 { font-size: var(--t-h4); line-height: var(--lh-snug); }

p, ul, ol, dl, blockquote, table, figure { margin: 0 0 var(--s-4); }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: var(--s-2); }
li::marker { color: var(--c-accent); }

a {
  color: var(--c-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--c-link-hover); }

strong, b { font-weight: var(--fw-medium); }
small { font-size: var(--t-sm); }
hr { border: 0; border-top: var(--border); margin: var(--s-6) 0; }

table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { text-align: left; padding: var(--s-3); border-bottom: var(--border); vertical-align: top; }
th { font-family: var(--font-ui); font-weight: var(--fw-medium); }

/* ---- Focus ---------------------------------------------------------- */
/* Visible for keyboard users on every interactive element. Never remove. */
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

.skip-link {
  position: absolute; left: var(--s-3); top: -100%;
  z-index: 999;
  background: var(--c-bg);
  color: var(--c-link);
  padding: var(--s-3) var(--s-4);
  border: var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: var(--fw-medium);
}
.skip-link:focus { top: var(--s-3); }

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

.section { padding-block: var(--section-y); }
.section--alt { background: var(--c-bg-alt); }
.section--deep { background: var(--c-bg-deep); color: var(--c-text-invert); }
.section--deep h1, .section--deep h2, .section--deep h3 { color: inherit; }
.section--deep a { color: var(--c-text-invert); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }

/* Simple auto-fit grid. Set --min to change the column floor. */
.grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(var(--min, 260px), 1fr));
}
.grid--2 { --min: 320px; }
.grid--3 { --min: 260px; }
.grid--4 { --min: 200px; }

/* Two-column content + rail. Collapses to one column under 900px. */
.split {
  display: grid;
  gap: var(--s-7);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .split--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split--rail-first > :first-child { order: 2; }
  .split--rail-first > :last-child { order: 1; }
}

.stack > * + * { margin-top: var(--s-4); }
.stack--lg > * + * { margin-top: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* ---- Prose ---------------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose > h2 { margin-top: var(--s-7); }
.prose > h3 { margin-top: var(--s-6); }
.prose > :first-child { margin-top: 0; }
.lead { font-size: var(--t-lead); color: var(--c-text-muted); max-width: var(--measure); }

.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--c-accent);
  margin: 0 0 var(--s-2);
}
.section--deep .eyebrow { color: var(--brand-300); }

/* ---- Utilities ------------------------------------------------------ */
.u-center { text-align: center; }
.u-center .lead, .u-center .prose { margin-inline: auto; }
.u-muted { color: var(--c-text-muted); }
.u-nowrap { white-space: nowrap; }
.u-mt-0 { margin-top: 0; }
.u-mb-0 { margin-bottom: 0; }
.u-hide { display: none !important; }
@media (min-width: 860px) { .u-hide\@lg { display: none !important; } }
@media (max-width: 859px) { .u-hide\@sm { display: none !important; } }

/* Reveal-on-scroll. JS adds .is-in; without JS the element stays visible
   because the hidden state is only applied when <html> has .js. */
.js .reveal { opacity: 0; transform: translateY(12px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
}

/* ---- Print ---------------------------------------------------------- */
@media print {
  .site-header, .callbar, .site-footer nav, .btn { display: none !important; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; }
}
