/* Throughscan design system — base
   Reset, typography, layout primitives, nav/footer, buttons, forms. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tl-paper);
  color: var(--tl-ink);
  font-family: var(--tl-font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--tl-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* focus — visible for keyboard users only */
:focus-visible { outline: 2px solid var(--tl-accent); outline-offset: 2px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }

.tl-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;
}
.tl-skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--tl-accent); color: var(--tl-on-accent);
  padding: var(--tl-2) var(--tl-4); border-radius: var(--tl-r-sm);
}
.tl-skip:focus { left: var(--tl-3); top: var(--tl-3); }

/* ---- typography ---- */
h1, h2, h3, h4 { margin: 0 0 var(--tl-3); font-weight: 600; line-height: 1.18; letter-spacing: -0.02em; color: var(--tl-ink); }
h1 { font-size: clamp(28px, 4.5vw, 42px); }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; letter-spacing: -0.01em; }
h4 { font-size: 15px; letter-spacing: 0; }
p  { margin: 0 0 var(--tl-4); }
.tl-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--tl-accent); margin: 0 0 var(--tl-3);
}
.tl-lead { font-size: 18px; color: var(--tl-ink-2); line-height: 1.6; }
.tl-muted { color: var(--tl-ink-2); }
.tl-hint { color: var(--tl-ink-3); font-size: 13px; }
.tl-mono { font-family: var(--tl-mono); }

/* ---- layout ---- */
.tl-wrap { max-width: var(--tl-maxw); margin: 0 auto; padding: 0 var(--tl-5); }
.tl-prose { max-width: var(--tl-maxw-prose); }
.tl-section { padding: var(--tl-8) 0; }
.tl-stack > * + * { margin-top: var(--tl-4); }
.tl-row { display: flex; align-items: center; gap: var(--tl-3); }
.tl-grid { display: grid; gap: var(--tl-4); }
.tl-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .tl-grid-3 { grid-template-columns: 1fr; } .tl-grid-2 { grid-template-columns: 1fr; } }

/* ---- header / nav ---- */
.tl-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--tl-paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--tl-line);
}
.tl-header__inner { display: flex; align-items: center; justify-content: space-between; height: var(--tl-header-h); }
.tl-brand { display: inline-flex; align-items: center; gap: 9px; font-family: "Space Grotesk", var(--tl-font); font-weight: 600; font-size: 20px; color: var(--tl-ink); letter-spacing: -0.03em; }
.tl-brand:hover { text-decoration: none; }
.tl-brand__mark { display: inline-flex; width: 18px; height: 18px; font-size: 18px; line-height: 0; }
.tl-brand .tl-brand__mark { width: 30px; height: 30px; font-size: 30px; }

/* bespoke inline-SVG icons (replace the Tabler webfont) */
.tl-i { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex: none; }

/* ---- hero: copy + product visual, so the layout isn't lopsided ---- */
.tl-hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: var(--tl-8); align-items: center; }
.tl-hero__copy { max-width: 600px; }
@media (max-width: 900px) { .tl-hero { grid-template-columns: 1fr; gap: var(--tl-6); } }
.tl-nav { display: flex; align-items: center; gap: var(--tl-5); }
.tl-nav a { color: var(--tl-ink-2); font-size: 14px; }
.tl-nav a:hover { color: var(--tl-ink); text-decoration: none; }
/* buttons in the nav keep their own text color (the nav-link rule would otherwise win on specificity) */
.tl-nav a.tl-btn { color: var(--tl-ink); }
.tl-nav a.tl-btn--primary, .tl-nav a.tl-btn--primary:hover { color: var(--tl-on-accent); }
@media (max-width: 720px) { .tl-nav a:not(.tl-btn) { display: none; } }

/* ---- footer ---- */
.tl-footer { border-top: 1px solid var(--tl-line); padding: var(--tl-7) 0; color: var(--tl-ink-2); font-size: 14px; margin-top: var(--tl-9); }
.tl-footer__inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--tl-4); }

/* ---- buttons ---- */
.tl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tl-2);
  font: inherit; font-size: 14px; font-weight: 500; line-height: 1;
  padding: 10px 16px; border-radius: var(--tl-r-md);
  border: 1px solid var(--tl-line-2); background: var(--tl-surface); color: var(--tl-ink);
  cursor: pointer; transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  text-decoration: none;
}
.tl-btn:hover { background: var(--tl-surface-2); border-color: var(--tl-ink-3); text-decoration: none; }
.tl-btn:active { transform: scale(0.985); }
.tl-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.tl-btn--primary { background: var(--tl-accent); border-color: var(--tl-accent); color: var(--tl-on-accent); }
.tl-btn--primary:hover { background: var(--tl-accent-2); border-color: var(--tl-accent-2); }
.tl-btn--ghost { background: transparent; border-color: transparent; }
.tl-btn--sm { padding: 7px 12px; font-size: 13px; }
.tl-btn--lg { padding: 13px 22px; font-size: 15px; }

/* ---- form controls ---- */
.tl-field { display: block; margin-bottom: var(--tl-4); }
.tl-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: var(--tl-2); color: var(--tl-ink); }
.tl-input, .tl-textarea, .tl-select {
  width: 100%; font: inherit; font-size: 14px; color: var(--tl-ink);
  background: var(--tl-surface); border: 1px solid var(--tl-line-2);
  border-radius: var(--tl-r-md); padding: 10px 12px;
}
.tl-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.tl-input:focus, .tl-textarea:focus, .tl-select:focus { outline: none; border-color: var(--tl-accent); box-shadow: 0 0 0 3px var(--tl-accent-wash); }

/* ---- misc ---- */
.tl-divider { height: 1px; background: var(--tl-line); border: 0; margin: var(--tl-6) 0; }
.tl-spin { width: 18px; height: 18px; border: 2px solid var(--tl-line-2); border-top-color: var(--tl-accent); border-radius: 50%; animation: tl-rot 0.7s linear infinite; }
@keyframes tl-rot { to { transform: rotate(360deg); } }

/* ---- print: a board-ready PDF from any report ---- */
@media print {
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 12px; }
  .tl-header, .tl-footer, .tl-skip, #runner, #status, .tl-report__actions, .tl-calc__controls { display: none !important; }
  .tl-wrap, .tl-section { padding: 0 !important; max-width: 100% !important; }
  .tl-card { box-shadow: none !important; border: 1px solid #e5e5e5; }
  .tl-report__section, .tl-card, .tl-callout, .tl-diff, .tl-table-wrap, .tl-bm, .tl-impact, .tl-kb, .tl-score { break-inside: avoid; page-break-inside: avoid; }
  .tl-report__title { font-size: 20px; }
  h1, h2, h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  details[open] > *, details > summary { display: revert; }
}
