/**
 * base.css
 * Reset, Typography, Body, Container
 *
 * - Fontshare CDN: Cabinet Grotesk + Satoshi
 * - Modern CSS reset (box-sizing, margin, padding)
 * - Base element styles: body, headings, paragraphs, links, lists, images
 * - Container utility
 * - Focus styles (WCAG AA)
 * - Selection color
 */

/* ============================================================
   Fonts via Fontshare CDN
   Cabinet Grotesk (Display) + Satoshi (Body)
   ============================================================ */
@import url('https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@800,700,500,400&f[]=satoshi@700,500,400&display=swap');

/* ============================================================
   Modern CSS Reset
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent iOS font size inflation */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Respect 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;
  }
}

body {
  min-height: 100dvh;
  line-height: var(--leading-normal);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-1);
  background-color: var(--color-surface-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ============================================================
   Typography — Headings
   Cabinet Grotesk only from --text-xl (24px) upward
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--color-text-1);
}

h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); font-family: var(--font-body); font-weight: var(--font-weight-semibold); }
h5 { font-size: var(--text-base); font-family: var(--font-body); font-weight: var(--font-weight-semibold); }
h6 { font-size: var(--text-sm); font-family: var(--font-body); font-weight: var(--font-weight-semibold); }

p {
  max-width: 68ch;
  line-height: var(--leading-relaxed);
}

/* Remove max-width constraint when explicitly overridden */
p.p--wide { max-width: none; }

/* ============================================================
   Links
   ============================================================ */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

/* Navigation links — no underline by default */
a.nav-link {
  text-decoration: none;
}

/* ============================================================
   Lists
   ============================================================ */
ul, ol {
  list-style: none;
}

/* Content lists (inside .prose) get default markers */
.prose ul {
  list-style: disc;
  padding-left: var(--space-6);
}

.prose ol {
  list-style: decimal;
  padding-left: var(--space-6);
}

.prose li + li {
  margin-top: var(--space-2);
}

/* ============================================================
   Images & Media
   ============================================================ */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* ============================================================
   Form Elements — Base Reset
   ============================================================ */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

textarea {
  resize: vertical;
}

/* ============================================================
   Focus Styles (WCAG AA — visible for keyboard users)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   Selection Color
   ============================================================ */
::selection {
  background-color: var(--color-accent);
  color: oklch(1 0 0);
}

/* ============================================================
   Horizontal Rule
   ============================================================ */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* ============================================================
   Skip Link (Accessibility — hidden until focused)
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-accent);
  color: oklch(1 0 0);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ============================================================
   Container
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: clamp(var(--space-4), 5vw, var(--space-12));
}

.container--narrow {
  max-width: var(--content-narrow);
}

.container--wide {
  max-width: var(--content-wide);
}

/* ============================================================
   Prose — for legal / text-heavy pages
   ============================================================ */
.prose {
  max-width: 72ch;
  line-height: var(--leading-relaxed);
}

.prose h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
}

.prose h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.prose p + p {
  margin-top: var(--space-4);
}

.prose a {
  word-break: break-word;
}

/* ============================================================
   Visually hidden (screen reader only)
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
