/* ============================================================================
   Frames of Me — Base / reset + element defaults (v2)
   Load order: tokens.css → base.css → components.css
   Themes the browser surfaces impeccable's craft-floor calls the cheapest
   signal a page was built: selection, caret, scrollbar, focus, tabular nums.
   ============================================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  tab-size: 4;
  /* custom scrollbar, from the palette (Firefox) */
  scrollbar-color: var(--c-line-2) transparent;
  scrollbar-width: thin;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-normal);
  color: var(--c-ink);
  background: var(--c-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11" 1; /* Geist: single-story a, cleaner */
  min-height: 100dvh;
  overflow-wrap: break-word;
}

/* ---- Headings: Geist, tight tracking that grows with size -------------- */
h1, h2, h3, h4, .display-1, .display-2 {
  font-weight: var(--fw-semibold);
  color: var(--c-ink);
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  text-wrap: balance;
}
.display-1 { font-size: var(--fs-display-1); line-height: var(--lh-display); letter-spacing: var(--tr-display); font-weight: var(--fw-semibold); }
.display-2 { font-size: var(--fs-display-2); line-height: var(--lh-display); letter-spacing: var(--tr-display); font-weight: var(--fw-semibold); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-lead); line-height: var(--lh-snug); letter-spacing: var(--tr-normal); }

p { line-height: var(--lh-body); text-wrap: pretty; }
.lead { font-size: var(--fs-lead); color: var(--c-ink-2); line-height: 1.5; letter-spacing: var(--tr-normal); }
small, .text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.muted { color: var(--c-ink-3); }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; letter-spacing: var(--tr-data); }
.tnum { font-feature-settings: "tnum" 1; } /* tabular numerals on data */

a {
  color: var(--c-accent-ink);
  text-decoration: none;
  text-underline-offset: 0.2em;        /* themed underline offset */
  text-decoration-thickness: 1px;
  transition: color var(--dur-1) var(--ease-std);
}
a:hover { text-decoration: underline; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
input, textarea { caret-color: var(--c-accent); }   /* themed caret */

ul, ol { padding: 0; list-style-position: inside; }
.list-reset { list-style: none; padding: 0; }

hr { border: 0; height: 1px; background: var(--c-line); margin: var(--s-5) 0; }

/* Themed text selection */
::selection { background: var(--c-accent-soft); color: var(--c-accent-ink); }

/* Themed WebKit scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-line-2); border-radius: 999px; border: 3px solid var(--c-canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--c-ink-4); }

/* Themed focus ring (accent), on every interactive element */
:focus-visible { outline: none; box-shadow: var(--ring-focus); border-radius: var(--r-sm); }

/* Reduced motion: keep meaning, drop spatial movement */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ---- Layout helpers ---------------------------------------------------- */
.page  { width: 100%; max-width: var(--maxw-page); margin-inline: auto; padding-inline: var(--s-5); }
.wide  { max-width: var(--maxw-wide); }
.prose { max-width: var(--maxw-prose); }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
.row   { display: flex; align-items: center; gap: var(--s-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.wrap  { flex-wrap: wrap; }
.grow  { flex: 1 1 auto; }
.center{ display: grid; place-items: center; }
.hidden{ display: none !important; }
.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; }
.safe-bottom { padding-bottom: max(var(--s-4), env(safe-area-inset-bottom)); }
.safe-top    { padding-top: max(var(--s-4), env(safe-area-inset-top)); }
.serif { font-family: var(--font-sans); } /* legacy alias → one family now */
