/* shared/base.css
   Reset, page defaults, layout primitives, type, buttons, focus.
   Load after tokens.css and before page CSS. Pages should only add layout. */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--color-bg);
}
body {
  margin: 0;
  padding-top: var(--header-h);           /* room for the fixed header */
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body.home-page { padding-top: 0; }        /* hero sits under the header */
body.no-header { padding-top: 0; }
:where(img, svg, video) { max-width: 100%; height: auto; }
:where(picture) { display: contents; }   /* <picture> never affects layout; CSS targets the <img> */
:where(img) { font-style: italic; }               /* alt text reads as a caption if an image fails */
:where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(button) { cursor: pointer; }
:where(a) { color: var(--color-link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:where(p) { margin: 0 0 var(--space-4); }
:where(ul, ol) { padding-left: 1.2em; }
:where(hr) { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-6) 0; }

/* ---------- Focus (mint, system accent) ---------- */
:focus-visible {
  outline: 2px solid var(--brand-mint);
  outline-offset: 3px;
  border-radius: 4px;
}
.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--brand-mint); color: var(--color-on-orange);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 800; z-index: var(--z-toast);
}
.skip-link:focus { top: 8px; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: 800px; }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--space-9); }
.section--raised { background: var(--color-bg-raised); }
.stack > * + * { margin-top: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* Horizontal scroller for phones: snap, visible, no scrollbar noise */
.scroller {
  display: flex; gap: var(--space-4);
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: var(--space-2);
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; flex: 0 0 min(82%, 340px); }
@media (min-width: 768px) {
  .scroller { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; margin-inline: 0; padding-inline: 0; }
  .scroller > * { flex: initial; }
}

/* ---------- Type ---------- */
:where(h1, h2, h3, h4) { margin: 0 0 var(--space-4); overflow-wrap: anywhere; }
:where(h1), .display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  text-transform: uppercase;
  letter-spacing: 0;
  text-wrap: balance;
}
.display { font-size: var(--text-display); font-weight: 900; }
:where(h2), .h2 { font-size: var(--text-h2); font-weight: 700; line-height: var(--leading-snug); letter-spacing: -0.01em; text-wrap: balance; }
:where(h3), .h3 { font-size: var(--text-h3); font-weight: 700; line-height: 1.3; }
:where(h4), .h4 { font-size: var(--text-lg); font-weight: 700; line-height: 1.35; }
.lead { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 60ch; text-wrap: pretty; }
.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-sm); }
.eyebrow, .section-label {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand-orange); margin-bottom: var(--space-3);
}
.section-title { font-family: var(--font-display); font-weight: 800; font-size: var(--text-h1); line-height: var(--leading-tight); text-transform: uppercase; margin: 0 0 var(--space-4); text-wrap: balance; }
.section-subtitle { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 60ch; margin: 0; text-wrap: pretty; }
.section-header { margin-bottom: var(--space-7); }
.section-header--center { text-align: center; }
.section-header--center .section-subtitle { margin-inline: auto; }
/* One accent word per h1, never body text */
.gradient-accent, .gradient-text {
  color: var(--brand-orange);
  background: linear-gradient(100deg, var(--brand-orange) 0%, var(--brand-orange-hot) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-out);
}
a.card, .card--link { color: inherit; text-decoration: none; display: block; }
a.card:hover, .card--link:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-raised); transform: translateY(-2px); }
.card--flush { padding: 0; overflow: hidden; }
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
}
.divider { border: 0; border-top: 1px solid var(--color-border); }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text);
}
.badge--orange { background: var(--brand-orange); color: var(--color-on-orange); border-color: transparent; }

/* ---------- Buttons: one system ---------- */
.btn {
  --btn-h: 48px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--btn-h); padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-body); font-weight: 800; font-size: var(--text-sm); letter-spacing: 0.04em; text-transform: uppercase;
  line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn--primary { background: var(--brand-orange); color: var(--color-on-orange); }
.btn--primary:hover { background: var(--brand-orange-hot); box-shadow: var(--glow-orange); }

.btn--ghost { background: rgba(250, 246, 241, 0.06); color: var(--color-text); border-color: var(--color-border-strong); }
.btn--ghost:hover { background: rgba(250, 246, 241, 0.12); border-color: rgba(250, 246, 241, 0.3); }

.btn--ring { padding: 1px; background: var(--ring-gradient); color: var(--color-text); }
.btn--ring > span {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; min-height: calc(var(--btn-h) - 2px); padding: 0 var(--space-5);
  border-radius: inherit; background: var(--color-bg);
}
.btn--ring:hover { transform: scale(1.02); box-shadow: var(--glow-orange-soft); }

.btn--link { background: none; color: var(--brand-orange-hot); padding: 0; min-height: 0; text-transform: none; letter-spacing: 0; font-weight: 700; }
.btn--link:hover { text-decoration: underline; }

.btn--sm { --btn-h: 40px; padding-inline: var(--space-4); font-size: var(--text-xs); }
.btn--lg { --btn-h: 56px; padding-inline: var(--space-6); font-size: var(--text-md); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--btn-h); }

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-2) 50%, var(--color-surface) 75%);
  background-size: 200% 100%; animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Utilities ---------- */
.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.fade-up, .fade-up.visible { opacity: 1; transform: none; } /* scroll-reveal retired: content is visible on arrival */
body.no-scroll { overflow: hidden; }

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