/* ============================================================
   Tideline — Base: reset, typography, layout primitives, a11y
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: var(--lh-tight);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 5vw, var(--fs-3xl)); }
h2 { font-size: clamp(1.6rem, 3.4vw, var(--fs-2xl)); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p, li { max-width: var(--measure); }
p + p { margin-top: var(--space-4); }

a { color: var(--link); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--primary-hover); }

img, svg, video { max-width: 100%; height: auto; display: block; }
strong, b { font-weight: 700; }
small { font-size: var(--fs-sm); }

ul, ol { padding-left: 1.25rem; }
li + li { margin-top: var(--space-2); }

/* ---- Focus: always visible, generous ---- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; left: 0; top: 0;
  transform: translateY(-120%);
  background: var(--primary); color: var(--primary-ink);
  padding: var(--space-3) var(--space-5);
  border-radius: 0 0 var(--r-md) 0;
  font-weight: 600; z-index: 200;
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); color: var(--primary-ink); }

/* ---- Layout primitives ---- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--space-5); }
.prose { max-width: var(--maxw-prose); margin-inline: auto; }
.prose h2 { margin-top: var(--space-7); margin-bottom: var(--space-3); }
.prose h3 { margin-top: var(--space-6); margin-bottom: var(--space-2); }
.prose p, .prose ul, .prose ol { margin-bottom: var(--space-4); color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4rem; }

.section { padding-block: clamp(var(--space-7), 8vw, var(--space-9)); }
.section--tight { padding-block: var(--space-7); }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid { display: grid; gap: var(--space-5); }
@media (min-width: 700px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.center { text-align: center; }
.muted { color: var(--text-muted); }
.eyebrow {
  font-family: var(--font-body); font-weight: 700; font-size: var(--fs-sm);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary);
}
.lead { font-size: clamp(1.1rem, 2.2vw, var(--fs-md)); color: var(--text-muted); line-height: 1.55; }

.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;
}

/* ---- Reduced motion: kill non-essential animation ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- Reveal-on-scroll (gentle; disabled w/ reduced motion) ---- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
