/* ==========================================================================
   SYNAPSE — Base: reset, elements, typography defaults, accessibility
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-6));
  color-scheme: dark;
}
[data-theme="light"] { color-scheme: light; }

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  font-feature-settings: "cv11", "ss01";
}

body.is-locked { overflow: hidden; }

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

svg { fill: currentColor; }

/* ---------- Headings ------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
  color: var(--text);
}

h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--fs-2xl); line-height: var(--lh-snug); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 {
  font-size: var(--fs-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-faint);
}

p { text-wrap: pretty; }
p, ul, ol, dl, figure, blockquote, pre, table { max-width: var(--measure); }

/* ---------- Links ---------------------------------------------------- */
a {
  color: var(--link);
  text-decoration-color: color-mix(in oklab, var(--link) 40%, transparent);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-2) var(--ease-out),
              text-decoration-color var(--dur-2) var(--ease-out);
}
a:hover { color: var(--text); text-decoration-color: currentColor; }

/* ---------- Lists --------------------------------------------------- */
ul, ol { padding-inline-start: 1.15em; }
li + li { margin-top: var(--s-2); }
li::marker { color: var(--primary); }

/* ---------- Forms --------------------------------------------------- */
input, textarea, select, button {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: 0; cursor: pointer; }
textarea { resize: vertical; }
::placeholder { color: var(--text-faint); opacity: 1; }

/* ---------- Code ---------------------------------------------------- */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-feature-settings: "zero", "ss02";
}
:not(pre) > code {
  padding: 0.15em 0.42em;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg-inset);
  color: var(--cyan-300);
  white-space: nowrap;
}
pre { overflow-x: auto; }

/* ---------- Tables -------------------------------------------------- */
table { border-collapse: collapse; width: 100%; }
th { text-align: start; font-weight: var(--weight-semibold); }

/* ---------- Quotes, rules, marks ----------------------------------- */
blockquote { margin: 0; }
hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong) 18%, var(--border-strong) 82%, transparent);
}
mark {
  background: var(--primary-soft);
  color: var(--text);
  padding: 0.05em 0.25em;
  border-radius: var(--r-xs);
}
strong { font-weight: var(--weight-semibold); color: var(--text); }
small { font-size: var(--fs-xs); }
abbr[title] { text-decoration: underline dotted; cursor: help; }

/* ---------- Selection & scrollbar ---------------------------------- */
::selection {
  background: color-mix(in oklab, var(--primary) 32%, transparent);
  color: var(--text);
}
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: var(--bg-sunken); }
  ::-webkit-scrollbar-thumb {
    background: var(--ink-700);
    border-radius: var(--r-pill);
    border: 3px solid var(--bg-sunken);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--ink-600); }
}
* { scrollbar-color: var(--ink-700) var(--bg-sunken); scrollbar-width: thin; }

/* ---------- Focus --------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ---------- Skip link ----------------------------------------------- */
.skip-link {
  position: fixed;
  inset-block-start: var(--s-3);
  inset-inline-start: var(--s-3);
  z-index: var(--z-toast);
  padding: var(--s-3) var(--s-5);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: var(--weight-semibold);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

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

/* ---------- Reduced motion ----------------------------------------- */
@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;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ---------- Print --------------------------------------------------- */
@media print {
  :root { --bg: #fff; --text: #000; --text-muted: #333; }
  .site-header, .site-footer, .cta-band, .cookie-bar, .to-top { display: none !important; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
}
