/* ================================================================
   Base — Reset, typography, layout primitives, utilities
   ================================================================ */

/* ----- Font loads (Google Fonts) ----- */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600&family=Inter+Tight:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-relaxed);
  font-weight: 400;
  overflow-x: hidden;
}

img, svg, video, canvas, picture {
  display: block;
  max-width: 100%;
  height: auto;
}

img { background: var(--color-bg-alt); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }

ul, ol { padding: 0; margin: 0; list-style: none; }
p { margin: 0; text-wrap: pretty; }

::selection { background: var(--color-accent); color: var(--color-accent-contrast); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ----- Typography ----- */

.h-display,
.h-1, .h-2, .h-3, .h-4 {
  font-family: var(--font-display);
  font-weight: var(--site-display-weight, 420);
  line-height: var(--leading-tight);
  letter-spacing: var(--site-heading-tracking, -0.018em);
  color: var(--color-ink);
  text-wrap: balance;
  margin: 0;
}

.h-display { font-size: var(--step-6); letter-spacing: -0.028em; }
.h-1       { font-size: var(--step-5); }
.h-2       { font-size: var(--step-4); }
.h-3       { font-size: var(--step-3); }
.h-4       { font-size: var(--step-2); line-height: var(--leading-snug); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-size: var(--step-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-accent-ink);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.eyebrow.no-line::before { display: none; }

.lead {
  font-size: var(--step-2);
  line-height: var(--leading-snug);
  color: var(--color-ink-soft);
  font-weight: 400;
  letter-spacing: -0.006em;
  text-wrap: pretty;
  max-width: 56ch;
}

.body-lg { font-size: var(--step-1); line-height: var(--leading-relaxed); color: var(--color-ink-soft); }
.body    { font-size: var(--step-0); line-height: var(--leading-relaxed); color: var(--color-ink-soft); }
.body-sm { font-size: var(--step-sm); line-height: 1.55; color: var(--color-muted); }
.caption { font-size: var(--step-xs); line-height: 1.45; color: var(--color-muted); letter-spacing: 0.01em; }
.mono    { font-family: var(--font-mono); font-size: var(--step-xs); letter-spacing: 0.01em; }

.label-cap {
  font-family: var(--font-body);
  font-size: var(--step-fine);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-muted);
}

/* ----- Layout primitives ----- */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}
.container--sm { max-width: var(--container-sm); }
.container--md { max-width: var(--container-md); }
.container--lg { max-width: var(--container-lg); }
.container--2xl { max-width: var(--container-2xl); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--section-y-sm); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

.bg-alt  { background: var(--color-bg-alt); }
.bg-deep { background: var(--color-bg-deep); color: var(--color-bg); }
.bg-deep .h-1, .bg-deep .h-2, .bg-deep .h-3, .bg-deep .h-4 { color: inherit; }
.bg-deep .body, .bg-deep .body-lg { color: oklch(from currentColor l c h / 0.78); }

/* ----- Stacks / clusters ----- */
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-7); }
.stack-xl > * + * { margin-top: var(--s-9); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--s-6);
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

/* ----- Utilities ----- */
.hide-mobile { display: none !important; }
.hide-desktop { display: initial; }
@media (min-width: 840px) {
  .hide-mobile { display: inline-flex !important; }
  .hide-desktop { display: none !important; }
}

.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;
}

/* Skip link */
.skip-link {
  position: absolute; top: -100px; left: var(--s-4);
  background: var(--color-ink);
  color: var(--color-bg);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-2);
  z-index: var(--z-toast);
}
.skip-link:focus { top: var(--s-4); }

/* Horizontal rule */
.rule { border: 0; height: 1px; background: var(--color-line); margin: 0; }
.rule--soft { background: var(--color-line-soft); }

/* ----- Section headers (used in most sections) ----- */
.sec-head {
  display: grid;
  gap: var(--s-4);
  max-width: 72ch;
  margin-bottom: var(--s-9);
}
.sec-head__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.sec-head__meta .eyebrow { margin: 0; }

@media (min-width: 840px) {
  .sec-head--split {
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: var(--s-9);
    max-width: none;
  }
  .sec-head--split > :first-child { grid-column: 1; }
  .sec-head--split > :last-child { grid-column: 2; align-self: end; }
}

/* ----- Motion entrances (very restrained) ----- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 700ms var(--ease-out-firm), transform 700ms var(--ease-out-firm);
}
.reveal.is-in { opacity: 1; transform: translateY(0); }


/* ================================================================
   Respect prefers-reduced-motion (M8 audit fix)
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ================================================================
   Back-to-top button (M11 audit fix)
   ================================================================ */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.08);
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.back-to-top[hidden] { display: none; }
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--color-bg-alt);
  transform: translateY(-2px);
}
.back-to-top svg { width: 18px; height: 18px; }
@media (max-width: 720px) {
  .back-to-top { right: 12px; bottom: 76px; width: 40px; height: 40px; }
}


/* ================================================================
   Cookie consent banner (m4 audit fix)
   ================================================================ */
.cookie-banner {
  position: fixed;
  inset: auto 16px 16px 16px;
  z-index: 60;
  max-width: 720px;
  margin-inline: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--r-3);
  box-shadow: 0 16px 48px rgba(17, 17, 17, 0.18);
  padding: var(--s-5) var(--s-6);
  display: none;
  gap: var(--s-4);
  align-items: center;
  flex-wrap: wrap;
}
.cookie-banner.is-visible { display: flex; }
.cookie-banner__text {
  flex: 1 1 280px;
  font-size: var(--step-sm);
  color: var(--color-ink);
  line-height: 1.55;
}
.cookie-banner__text a {
  color: var(--color-accent-ink);
  text-decoration: underline;
  text-decoration-color: oklch(from var(--color-accent-ink) l c h / 0.4);
}
.cookie-banner__actions {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  align-items: center;
}
.cookie-banner__btn {
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: var(--step-xs);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.15s;
}
.cookie-banner__btn:hover { border-color: var(--color-accent); }
.cookie-banner__btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}
.cookie-banner__btn--primary:hover {
  background: oklch(from var(--color-accent) 60% c h);
}
@media (max-width: 600px) {
  .cookie-banner { inset: auto 8px 8px 8px; padding: var(--s-4); }
  .cookie-banner__text { flex-basis: 100%; }
  .cookie-banner__actions { width: 100%; justify-content: flex-end; }
}


/* ================================================================
   Visual breadcrumb (M10 audit fix)
   ================================================================ */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: var(--step-fine);
  letter-spacing: 0.06em;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 var(--s-4);
  text-transform: uppercase;
}
.breadcrumb a {
  color: var(--color-accent-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.breadcrumb a:hover { border-bottom-color: var(--color-accent-ink); }
.breadcrumb__sep { color: var(--color-line); }
.breadcrumb__current {
  color: var(--color-ink);
  font-weight: 500;
}
