/* =============================================================================
   Fraley V2 - base: fonts, reset, typography, links, focus, layout primitives
   ============================================================================= */

/* ---- self-hosted IBM Plex Mono instrumentation (SIL OFL 1.1) ---- */
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  background: var(--c-bg-0);
  color: var(--c-text-1);
  font-family: var(--f-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
svg { overflow: visible; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; }
dl, dd { margin: 0; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--c-line-1); margin: var(--s-6) 0; }
small { font-size: var(--t-small); }
strong, b { font-weight: 700; color: var(--c-text-1); }
em { font-style: normal; color: var(--c-text-1); }
sup { line-height: 0; font-size: 0.7em; }
::selection { background: var(--c-accent-line); color: #fff; }

/* ---- headings ---- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  font-family: var(--f-sans);
  font-weight: 700;
  color: var(--c-text-1);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-snug);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); letter-spacing: -0.012em; }
h4 { font-size: var(--t-h4); letter-spacing: 0; }
.display { font-size: var(--t-display); line-height: var(--lh-tight); font-weight: 800; letter-spacing: -0.028em; }

/* ---- editorial statement / lede ---- */
.lede {
  font-family: var(--f-serif);
  font-size: var(--t-lede);
  line-height: 1.45;
  color: var(--c-text-2);
  font-weight: 400;
  text-wrap: pretty;
}
.lede strong { font-weight: 700; color: var(--c-text-1); }

/* ---- instrumentation labels ---- */
.mono { font-family: var(--f-mono); font-feature-settings: 'tnum' 1, 'zero' 1; }
.label, .eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--c-text-3);
  line-height: 1.4;
}
.eyebrow { display: inline-flex; align-items: center; gap: 0.6em; }
.eyebrow--accent { color: var(--c-accent); }
.eyebrow::before { content: ''; width: 1.25rem; height: 1px; background: currentColor; opacity: 0.7; flex: none; }
.eyebrow--bare::before { display: none; }
.muted { color: var(--c-text-3); }
.secondary { color: var(--c-text-2); }
.small { font-size: var(--t-small); }
.xs { font-size: var(--t-xs); }

/* ---- links ---- */
a { color: var(--c-accent); text-decoration: none; text-underline-offset: 0.18em; text-decoration-thickness: 1px; transition: color var(--dur) var(--ease); }
a:hover { color: var(--c-accent-bright); text-decoration: underline; }
.prose a { text-decoration: underline; text-decoration-color: var(--c-accent-line); }
.prose a:hover { text-decoration-color: currentColor; }
a[target="_blank"] .ext { display: inline-block; width: 0.8em; height: 0.8em; margin-left: 0.25em; vertical-align: -0.05em; }

/* ---- focus: visible, high-contrast, consistent ---- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; border-radius: var(--r-1); }
.fv2-btn:focus-visible { outline-offset: 3px; }
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  padding: 0.6rem 1rem; background: var(--c-accent); color: var(--c-accent-ink);
  font-family: var(--f-mono); font-size: var(--t-xs); border-radius: var(--r-2); font-weight: 500;
}
.skip-link:focus { top: 1rem; text-decoration: none; }
.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; }

/* ---- layout primitives ---- */
.container { width: 100%; max-width: calc(var(--w-max) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.container--wide { max-width: calc(var(--w-wide) + 2 * var(--gutter)); }
.container--read { max-width: calc(var(--w-read) + 2 * var(--gutter)); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-5); }
@media (max-width: 900px) { .grid { gap: var(--s-4); } }
.stack > * + * { margin-top: var(--s-5); }
.stack--tight > * + * { margin-top: var(--s-3); }
.stack--loose > * + * { margin-top: var(--s-7); }
.section { padding-block: var(--section-y); position: relative; }
.section--band { background: var(--c-bg-1); border-top: 1px solid var(--c-line-1); border-bottom: 1px solid var(--c-line-1); }
.section--flush-top { padding-top: 0; }
.section + .section:not(.section--band) { border-top: 1px solid var(--c-line-1); }
main { display: block; }

/* ---- prose (long-form reading) ---- */
.prose { max-width: var(--w-read); color: var(--c-text-2); }
.prose p { text-wrap: pretty; }
.prose > p:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1.1em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--c-text-3); }
.prose strong { color: var(--c-text-1); }
.prose h3, .prose h4 { margin-top: 1.6em; }
.prose--lg { font-size: 1.125rem; }

/* ---- tables (base) ---- */
table { border-collapse: collapse; width: 100%; font-size: var(--t-small); }
th, td { text-align: left; vertical-align: top; padding: 0.75rem 1rem; border-bottom: 1px solid var(--c-line-1); }
th { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--c-text-3); font-weight: 500; }
caption { text-align: left; caption-side: top; padding: 0 0 0.75rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--c-line-1); border-radius: var(--r-2); background: var(--c-bg-2); }
.table-wrap table { min-width: 34rem; }
.table-wrap th, .table-wrap td { padding: 0.85rem 1.1rem; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }

/* ---- motion ---- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
