@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans+Condensed:wght@500;600&family=IBM+Plex+Sans:wght@400;500&display=swap');

:root {
  --paper:  #F2F4F1;
  --sheet:  #FCFDFB;
  --grid:   #E4E8E3;
  --rule:   #CBD2C9;
  --rule-2: #AEB8AD;
  --ink:    #1B2320;
  --muted:  #6C766F;

  --tread:      #2E6F8E;
  --tread-fill: #DCE9EF;
  --hft:        #8F6412;
  --hft-fill:   #F2E6CE;
  --flag:       #A33B33;
  --flag-fill:  #F4DFDC;
  --pick:       #3B6647;
  --pick-fill:  #DFEBE1;

  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

.wrap { max-width: 1220px; margin: 0 auto; padding: 0 24px 96px; }

/* ---- title block ---------------------------------------------------- */

.titleblock {
  border-bottom: 1px solid var(--rule-2);
  background: var(--sheet);
  margin-bottom: 44px;
}
.titleblock .wrap { padding-top: 0; padding-bottom: 0; }
.tb-row {
  display: flex; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.tb-cell {
  padding: 11px 20px 10px 0;
  margin-right: 20px;
  border-right: 1px solid var(--rule);
  white-space: nowrap;
}
.tb-cell:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.tb-cell b { font-weight: 500; color: var(--ink); }

/* ---- masthead ------------------------------------------------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
h1 {
  font-family: var(--cond);
  font-weight: 600;
  font-size: clamp(34px, 5.4vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  max-width: 20ch;
}
.standfirst {
  font-size: 18px;
  line-height: 1.62;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 40px;
}
.standfirst strong { color: var(--ink); font-weight: 500; }

/* ---- table ---------------------------------------------------------- */

.tablecard {
  background: var(--sheet);
  border: 1px solid var(--rule-2);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; table-layout: fixed; }

thead th { overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--rule-2);
  vertical-align: bottom;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background-color .18s ease;
}
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: #F7F9F5; }
tbody tr:focus-within { background: #F7F9F5; }

tbody td {
  padding: 18px 16px;
  vertical-align: top;
  font-size: 14.5px;
  line-height: 1.52;
}

.col-num   { width: 124px; }
.col-plan  { width: 20.5%; }
.col-pos   { width: 13.5%; }
.col-clear { width: 150px; }
.col-why   { width: 15%; }
.c-num { width: 124px; }
.c-num a {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.c-num a::after {
  content: "";
  position: absolute;
  inset: 0;
}
tbody tr:hover .c-num a { color: var(--tread); }
.c-num a:focus-visible { outline: none; }
tbody tr:focus-within { outline: 2px solid var(--tread); outline-offset: -2px; }

.tag {
  display: inline-block;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 5px;
  border: 1px solid currentColor;
  white-space: normal;
  line-height: 1.35;
}
.tag.pick    { color: var(--pick);  background: var(--pick-fill); }
.tag.fail    { color: var(--flag);  background: var(--flag-fill); }
.tag.caution { color: var(--hft);   background: var(--hft-fill); }
.tag.viable  { color: var(--muted); background: transparent; }

.c-plan { width: 268px; }
.c-pos  { width: 14%; }
.c-clear { width: 124px; }
.c-why  { width: 17%; }

.pos-main { display: block; font-weight: 500; }
.pos-note { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }

.clear-row {
  font-family: var(--mono);
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}
.clear-row + .clear-row { border-top: 1px dotted var(--rule-2); margin-top: 4px; padding-top: 5px; }
.clear-row span:first-child {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.clear-row.short span:last-child { color: var(--flag); font-weight: 500; }
.clear-row.best  span:last-child { color: var(--pick); font-weight: 500; }

/* ---- plan drawings -------------------------------------------------- */

svg.thumb { width: 100%; height: auto; display: block; margin-top: -4px; min-width: 0; }
svg.plan  { width: 100%; height: auto; display: block; }

.room  { fill: none; stroke: var(--ink); stroke-width: 1.0; }
.stair { fill: var(--paper); stroke: var(--rule-2); stroke-width: 0.6; }
.win   { fill: #F6D98E; stroke: var(--hft); stroke-width: 0.5; }
.wedge { fill: var(--ink); opacity: 0.07; }

.tread { fill: var(--tread-fill); stroke: var(--tread); stroke-width: 0.9; }
.hft   { fill: var(--hft-fill);   stroke: var(--hft);   stroke-width: 0.9; }

.zones { opacity: 0; transition: opacity .22s ease; }
.zones.on { opacity: 1; }
tbody tr:hover .zones, tbody tr:focus-within .zones { opacity: 1; }
.zone-run  { fill: var(--tread); opacity: 0.11; stroke: none; }
.zone-pull { fill: var(--hft);   opacity: 0.13; stroke: none; }
.zone-run.bad { fill: var(--flag); opacity: 0.2; }

.flagbox { fill: var(--flag); opacity: 0.75; stroke: none; }
.gapbox { stroke-width: 0.5; stroke-dasharray: 2 1.8; }
.gap-good { fill: #DCEBD8; stroke: #3B6647; }
.gap-ok   { fill: #FAEEDA; stroke: #8F6412; }
.gap-bad  { fill: #F7DEDB; stroke: #A33B33; }
.gp { font-size: 4.2px; fill: var(--ink); font-family: var(--mono); }
.env { fill: none; stroke: var(--muted); stroke-width: 0.6; stroke-dasharray: 3 2.2; }
.env.bad { stroke: var(--flag); stroke-width: 0.9; stroke-dasharray: 3 2; }
.dim  { stroke: var(--muted); stroke-width: 0.5; fill: none; }
.lead { stroke: var(--muted); stroke-width: 0.4; stroke-dasharray: 1.6 1.4; fill: none; }

text { font-family: var(--mono); }
.dm { font-size: 4px; fill: var(--muted); }
.fl { font-size: 4px; fill: var(--flag); }
.lb { font-size: 4.6px; fill: var(--ink); font-family: var(--cond); font-weight: 600; }
.ls { font-size: 4px; fill: var(--muted); }

/* ---- detail page ---------------------------------------------------- */

.back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 2px;
}
.back:hover { color: var(--ink); border-color: var(--ink); }

.plancard {
  background: var(--sheet);
  border: 1px solid var(--rule-2);
  padding: 20px 22px 12px;
  margin: 0 0 12px;
}
.plancaption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 44px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--rule-2);
  background: var(--sheet);
  margin: 0 0 44px;
}
.stat { padding: 16px 18px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat dt {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 4px;
}
.stat dt em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--rule-2);
  margin-left: 5px;
}
.stat dd {
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.02em;
}
.stat.short dd { color: var(--flag); }
.stat.best dd  { color: var(--pick); }

.prose { max-width: 68ch; }
.prose h2 {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 23px;
  letter-spacing: -0.005em;
  margin: 40px 0 10px;
}
.prose p { margin: 0 0 16px; }

.judgement {
  border-left: 3px solid var(--rule-2);
  padding: 2px 0 2px 20px;
  margin: 0 0 40px;
  max-width: 62ch;
  font-size: 18px;
  line-height: 1.6;
}
.judgement.pick    { border-color: var(--pick); }
.judgement.fail    { border-color: var(--flag); }
.judgement.caution { border-color: var(--hft); }

.pagenav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}
.pagenav a { color: var(--muted); text-decoration: none; }
.pagenav a:hover { color: var(--ink); }
.pagenav span { color: var(--rule-2); }

/* ---- checklist ------------------------------------------------------ */

.section-head {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 27px;
  margin: 64px 0 6px;
}
.section-sub { color: var(--muted); margin: 0 0 26px; max-width: 60ch; }

.checks.three { grid-template-columns: repeat(3, 1fr); }
.checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule-2); }
.check { background: var(--sheet); padding: 18px 20px; }
.check h3 {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 5px;
}
.check p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; }

.legend {
  display: flex; flex-wrap: wrap; gap: 22px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted); margin: 16px 0 0;
}
.swatch { display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px; border: 1px solid; }
.sw-t { background: var(--tread-fill); border-color: var(--tread); }
.sw-h { background: var(--hft-fill);   border-color: var(--hft); }
.sw-z { background: #DDE6EA; border-color: var(--rule-2); }
.sw-e { background: transparent; border-color: var(--muted); border-style: dashed; }
.sw-g { background: #DCEBD8; border-color: #3B6647; }
.sw-o { background: #FAEEDA; border-color: #8F6412; }
.sw-b { background: #F7DEDB; border-color: #A33B33; }

.refblock { display: grid; grid-template-columns: 400px 1fr; gap: 30px; align-items: center;
  border: 1px solid var(--rule-2); background: var(--sheet); padding: 22px 26px; }
.refdraw svg.envref { width: 100%; height: auto; display: block; }
.reflist { margin: 0; }
.reflist > div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0;
  border-bottom: 1px dotted var(--rule-2); }
.reflist > div:last-child { border-bottom: 0; }
.reflist dt { font-size: 14px; color: var(--muted); margin: 0; }
.reflist dd { margin: 0; font-family: var(--mono); font-size: 14px; text-align: right; }
.refnote { max-width: 74ch; color: var(--muted); font-size: 14.5px; margin: 16px 0 0; line-height: 1.62; }
.er   { font-size: 5px; fill: var(--ink); font-family: var(--mono); }
.er.s { font-size: 4.6px; fill: var(--muted); }
.er.b { font-size: 5.4px; font-family: var(--cond); font-weight: 600; }

footer.note {
  margin-top: 56px; padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--muted); max-width: 68ch;
}

a:focus-visible, tr a:focus-visible { outline: 2px solid var(--tread); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .zones { opacity: 1; }
}

@media (max-width: 860px) {
  .wrap { padding: 0 16px 72px; }
  .checks, .checks.three, .stats, .refblock { grid-template-columns: 1fr; }
  .refblock { gap: 20px; padding: 18px; }
  .refdraw { max-width: 400px; margin: 0 auto; }
  .stat { border-right: 0; border-bottom: 1px solid var(--rule); }
  .stat:last-child { border-bottom: 0; }
  .stat dt em { font-size: 11px; }

  table { display: block; table-layout: auto; width: 100%; }
  tbody { display: block; width: 100%; }
  colgroup, col, thead { display: none; }
  tbody tr { display: block; padding: 20px 16px; }
  tbody td { display: block; padding: 0; border: 0; width: auto; }
  .c-num  { display: flex; align-items: center; gap: 12px; width: auto; }
  .c-num br { display: none; }
  .c-num a { font-size: 22px; line-height: 1; }
  .c-num .tag { margin-top: 0; }
  .c-plan { width: 100%; min-width: 0; max-width: 360px; margin-top: 14px; }
  .c-plan svg.thumb { width: 100%; }
  .c-pos, .c-clear, .c-why { margin-top: 16px; width: auto; }
  .c-clear { display: flex; flex-wrap: wrap; gap: 6px 22px; }
  .c-clear .clear-row { border: 0 !important; margin: 0; padding: 0; display: block; }
  .c-clear .clear-row span:first-child { font-size: 11px; }
  .label-sm { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
  .tag { font-size: 11px; padding: 3px 5px; letter-spacing: 0.06em; }

  h1 { max-width: none; }
  .standfirst { font-size: 17px; }

  /* the annotated plans carry 4px-unit labels: give them room rather than shrink them */
  .plancard { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 10px; }
  .plancard svg.plan { min-width: 660px; }
  .plancaption::before { content: "Scroll the plan sideways to read the labels. "; }

  .back { padding: 10px 0; margin-bottom: 22px; }
  .pagenav { flex-direction: column; gap: 4px; }
  .pagenav a, .pagenav span { display: block; padding: 11px 0; }
}
@media (min-width: 861px) { .label-sm { display: none; } }
