/* ACDC v6 · reset and base typography */

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

html {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading);
  font-feature-settings: 'cv11', 'ss03', 'calt';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  color: var(--ink);
  background: var(--bg);
}

body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); overflow: hidden; }

h1, h2, h3, h4, p, dl, dd, ol, ul, figure, blockquote { margin: 0; padding: 0; }
ol, ul { list-style: none; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.011em; text-wrap: balance; }
p { text-wrap: pretty; }

a { color: var(--ref); text-decoration: none; }
a:hover { color: var(--ref-hover); text-decoration: underline; text-underline-offset: 2px; }
/* A link inside running text is told apart by more than colour */
p a:not(.btn):not(.ref):not(.link-btn), .cell-sub a:not(.ref), .section-note a:not(.ref), .kv-source a:not(.ref) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
table { border-collapse: collapse; border-spacing: 0; width: 100%; }
th { text-align: left; font-weight: 500; }
img, svg { display: block; max-width: 100%; }
svg { flex: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
time, .num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

code, kbd, samp, .mono { font-family: var(--font-mono); font-size: 0.93em; font-feature-settings: 'zero', 'calt' 0; }

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  font-size: 10.5px; font-weight: 500; line-height: 1;
  color: var(--ink-3); background: var(--surface-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
}

::selection { background: color-mix(in srgb, var(--run-mark) 28%, transparent); }

/* Focus: always visible for keyboard, never for mouse */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

/* Scrollbars that stay out of the way */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  padding: 8px 12px; border-radius: var(--r-md);
  background: var(--ink); color: var(--bg); font-weight: 500;
  transform: translateY(-160%); transition: transform var(--fast) var(--ease);
}
.skip-link:focus { transform: none; color: var(--bg); text-decoration: none; }

/* Text helpers */
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.tip {
  position: fixed; z-index: 70; max-width: 280px; padding: 5px 8px; font-size: var(--text-xs); line-height: 1.35;
  color: var(--bg); background: var(--ink); border-radius: var(--r-sm); pointer-events: none; animation: fade-in var(--fast) var(--ease);
}
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.unmeasured { font-family: var(--font-mono); font-size: 0.9em; letter-spacing: 0.02em; color: var(--warn-ink); }

/* Layout helpers */
.row { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.stack-lg { display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }
.spacer { flex: 1 1 auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

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

@media print {
  body { overflow: visible; background: #fff; }
}
