/* ═══════════════════════════════════════════════════════════════
   DRAWING OFFICE — reset, type, layout primitives
   ═══════════════════════════════════════════════════════════════ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  min-height: 100vh;
  font-family: var(--f-ui);
  font-size: var(--t-md);
  font-weight: 400;
  line-height: 1.62;
  color: var(--p-100);
  background: var(--g-900);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1;
  overflow-x: hidden;
}

/* The drafting grid. Two frequencies — 8px fine, 96px major — fixed to
   the viewport so the page slides over it like tracing paper over a
   drawing board. It is the one texture in the whole design. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-fine) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-fine) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 8px 8px, 8px 8px, 96px 96px, 96px 96px;
  opacity: .55;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 0%, transparent 78%);
}
/* and one cool wash from the top, so the head of every page sits in light */
body::after {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 560px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(91,157,217,.07) 0%, transparent 100%);
}
body > * { position: relative; z-index: 1; }

@media print {
  body::before, body::after { display: none; }
}

img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
summary { cursor: pointer; }

/* ── focus: drafting blue, always visible ──────────────────── */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 1px;
}
:focus:not(:focus-visible) { outline: none; }

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

.skip {
  position: absolute; left: var(--s4); top: -5rem; z-index: 200;
  background: var(--ink); color: var(--g-950);
  padding: var(--s3) var(--s5);
  font-family: var(--f-data); font-size: var(--t-cap);
  text-transform: uppercase; letter-spacing: .14em; font-weight: 600;
  transition: top 180ms var(--ease);
}
.skip:focus { top: var(--s4); }

/* ── type ──────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 0, 'opsz' 40;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--p-100);
  text-wrap: balance;
}
h1 { font-size: var(--t-xxl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); font-variation-settings: 'SOFT' 0, 'WONK' 0, 'opsz' 20; letter-spacing: -0.005em; }
h4 { font-size: var(--t-md); font-family: var(--f-ui); font-weight: 600; letter-spacing: 0; line-height: 1.35; }

strong, b { font-weight: 600; color: var(--p-100); }
em, i { font-style: italic; }

/* Every figure the learner reads. Tabular so columns never jitter. */
.num, td.n, th.n, .data {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
  letter-spacing: -0.02em;
}

.kicker {
  font-family: var(--f-data);
  font-size: var(--t-cap);
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--p-300);
  font-weight: 500;
}
.kicker--b { display: block; margin-bottom: var(--s3); }

.dim  { color: var(--p-300); }
.crit { color: var(--critical); }
.slk  { color: var(--slack); }
.emp  { color: var(--employer); }
.con  { color: var(--contractor); }
.neu  { color: var(--neutral); }

/* ── layout primitives ─────────────────────────────────────── */
.wrap   { width: min(1280px, 100% - var(--s6)); margin-inline: auto; }
.wrap--n { width: min(920px, 100% - var(--s6)); margin-inline: auto; }
.prose  { max-width: var(--measure); }
.rule   { border: 0; border-top: var(--hair); margin: var(--s7) 0; }
.row    { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.stack > * + * { margin-top: var(--s4); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: var(--s7);
  align-items: start;
}
.split > * { min-width: 0; }

@media (max-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .wrap, .wrap--n { width: min(1280px, 100% - var(--s4)); }
}

/* ── prose rhythm ──────────────────────────────────────────── */
.prose > * + * { margin-top: var(--s4); }
.prose p { color: var(--p-200); }
.prose h3 { margin-top: var(--s6); }
.prose h4 { margin-top: var(--s5); color: var(--p-100); }
.prose ul, .prose ol { margin-left: var(--s5); }
.prose li { color: var(--p-200); margin-top: var(--s2); position: relative; }
.prose ul > li::before {
  content: '';
  position: absolute; left: calc(var(--s5) * -1 + 4px); top: .72em;
  width: 9px; height: 1px; background: var(--g-500);
}
.prose ol { counter-reset: n; }
.prose ol > li { counter-increment: n; }
.prose ol > li::before {
  content: counter(n, decimal-leading-zero);
  position: absolute; left: calc(var(--s5) * -1 - 4px); top: .1em;
  color: var(--ink); font-family: var(--f-data);
  font-size: var(--t-mm); letter-spacing: 0;
}
.prose a:not(.btn) {
  color: var(--p-100);
  border-bottom: 1px solid var(--ink-dim);
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.prose a:not(.btn):hover { color: var(--ink-soft); border-bottom-color: var(--ink); }
.prose code {
  font-family: var(--f-data); font-size: .875em;
  background: var(--g-750); border: 1px solid var(--g-700);
  padding: 1px 5px; border-radius: 2px; color: var(--p-100);
}

/* ── pills ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px var(--s3);
  border: 1px solid var(--g-600);
  border-radius: 999px;
  font-family: var(--f-data);
  font-size: var(--t-cap);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--p-300);
  white-space: nowrap;
  line-height: 1.7;
}
.pill--critical   { border-color: var(--critical-dim);   color: var(--critical);   background: var(--critical-wash); }
.pill--slack      { border-color: var(--slack-dim);      color: var(--slack);      background: var(--slack-wash); }
.pill--employer   { border-color: var(--employer-dim);   color: var(--employer);   background: var(--employer-wash); }
.pill--contractor { border-color: var(--contractor-dim); color: var(--contractor); background: var(--contractor-wash); }
.pill--neutral    { border-color: var(--neutral-dim);    color: var(--neutral);    background: var(--neutral-wash); }
.pill--ink        { border-color: var(--ink-dim);        color: var(--ink);        background: var(--ink-wash); }
.pill--solid      { background: var(--ink); border-color: var(--ink); color: var(--g-950); font-weight: 600; }

/* Little square swatch used inside legends. Shape carries meaning too:
   solid = a real bar, hatched = float, ring = a milestone. */
.sw { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.sw--hatch {
  background-image: repeating-linear-gradient(45deg,
    currentColor 0 2px, transparent 2px 4px);
  border: 1px solid currentColor;
}
.sw--ring { border-radius: 50%; border: 2px solid currentColor; background: none; }

/* ── buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s3) var(--s5);
  min-height: 44px;
  border: 1px solid var(--g-600);
  background: var(--g-800);
  color: var(--p-100);
  font-family: var(--f-data);
  font-size: var(--t-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  border-radius: var(--radius);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease),
              color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover:not(:disabled) { background: var(--g-750); border-color: var(--g-500); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--g-950); font-weight: 600; }
.btn--primary:hover:not(:disabled) { background: var(--ink-soft); border-color: var(--ink-soft); }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 34px; padding: var(--s2) var(--s3); font-size: var(--t-mm); }
.btn--wide { width: 100%; }
.btn--ok { border-color: var(--slack-dim); color: var(--slack); }
.btn--ok:hover:not(:disabled) { background: var(--slack-wash); border-color: var(--slack); }

/* ── surfaces ──────────────────────────────────────────────── */
.panel {
  background: var(--g-800);
  border: var(--hair);
  border-radius: var(--radius);
  padding: var(--s5);
}
.panel--deep  { background: var(--g-850); }
.panel--flush { padding: 0; overflow: hidden; }

/* The corner tick — a drafting registration mark. Applied to feature
   panels so they read as a sheet pinned to the board. */
.sheet { position: relative; }
.sheet::before, .sheet::after {
  content: ''; position: absolute; width: 9px; height: 9px;
  border: 1px solid var(--g-500); pointer-events: none;
}
.sheet::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.sheet::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* ── tables ────────────────────────────────────────────────── */
.table { font-size: var(--t-sm); }
.table th, .table td {
  padding: var(--s2) var(--s3);
  text-align: left;
  border-bottom: var(--hair);
  vertical-align: top;
}
.table thead th {
  font-family: var(--f-data); font-size: var(--t-mm);
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--p-300); font-weight: 500;
  border-bottom: 1px solid var(--g-600);
  white-space: nowrap;
  position: sticky; top: 0; background: var(--g-800); z-index: 1;
}
.table td.n, .table th.n {
  text-align: right; font-family: var(--f-data);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--g-750); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-total td { border-top: 1px solid var(--g-500); font-weight: 600; color: var(--p-100); }
.table caption {
  caption-side: bottom; text-align: left; padding-top: var(--s3);
  font-size: var(--t-xs); color: var(--p-300); font-family: var(--f-data);
}

/* ── entry motion: one orchestrated reveal per view ────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawIn { to { stroke-dashoffset: 0; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.stagger > * {
  animation: rise 520ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* ── message / empty states ────────────────────────────────── */
.msg {
  border: 1px dashed var(--g-600);
  border-radius: var(--radius);
  padding: var(--s7) var(--s5);
  text-align: center;
  background: var(--g-850);
}
.msg h2 { margin-bottom: var(--s3); }
.msg p { color: var(--p-300); max-width: 56ch; margin-inline: auto; }
.msg .btn { margin-top: var(--s5); }
