/* =========================================================
   Patterson Robey — base.css
   Design tokens + reset. Palette: black / white.
   ========================================================= */

:root {
  /* --- Color: black / white --- */
  --bg:           #000000;
  --surface:      #090909;
  --rule:         #2a2a2a;
  --ink:          #ffffff;
  --ink-muted:    #d8d8d8;
  --ink-faint:    #8f8f8f;
  --accent:       #ffffff;

  /* --- Typography --- */
  --font-display: "Newsreader", "Garamond", "Times New Roman", ui-serif, serif;
  --font-ui:      "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Type scale (fluid, restrained — only what's needed) */
  --text-xs:    clamp(11px, 0.72rem + 0.1vw, 12.5px);
  --text-sm:    clamp(13px, 0.82rem + 0.1vw, 14px);
  --text-base:  clamp(15px, 0.95rem + 0.1vw, 16px);
  --text-hero:  clamp(56px, 9vw + 1rem, 168px);

  /* Spacing (8pt rhythm) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;
  --s-10: 144px;

  /* Radii / motion */
  --radius-sm: 2px;
  --ease:      cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur-fast:  180ms;
  --dur:       420ms;
  --dur-slow:  900ms;

  /* Layout */
  --measure: 64ch;
  --page-pad-x: clamp(20px, 5vw, 56px);
  --page-pad-y: clamp(28px, 5vh, 56px);
}

[data-theme="dark"] {
  --bg:          #000000;
  --surface:     #090909;
  --rule:        #2a2a2a;
  --ink:         #ffffff;
  --ink-muted:   #d8d8d8;
  --ink-faint:   #8f8f8f;
  --accent:      #ffffff;
}

/* Respect system preference when user hasn't set one */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg:          #000000;
    --surface:     #090909;
    --rule:        #2a2a2a;
    --ink:         #ffffff;
    --ink-muted:   #d8d8d8;
    --ink-faint:   #8f8f8f;
    --accent:      #ffffff;
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, picture, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* --- Base typography & body --- */
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* --- Focus: visible, refined --- */
:focus { outline: none; }
:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: var(--s-2) var(--s-4);
  z-index: 100;
  font-size: var(--text-sm);
}
.skip-link:focus { left: var(--s-4); top: var(--s-4); }

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

/* --- Selection --- */
::selection { background: var(--ink); color: var(--bg); }

/* --- Reduced motion --- */
@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;
  }
}
