/* incomprehensible.co.uk public site: "Blueprint" look.
   Engineering drawing on grid paper. Navy ink, safety-orange highlights. */

:root {
  --paper: #EEF2F6;
  --grid: #D5DFEA;
  --ink: #0B1F3A;
  --ink-soft: #4A5D78;
  --rule: #9DB0C8;
  --orange: #FF4F00;
  --orange-text: #B83A00;
  --tape: rgba(241, 231, 198, 0.88);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Archivo', system-ui, sans-serif;
}

* { 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: 24px 24px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
::selection { background: var(--orange); color: #fff; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px; }
a:hover { color: var(--orange-text); }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-soft); }

.page { max-width: 1240px; margin: 0 auto; padding: 24px; }
.sheet { border: 2px solid var(--ink); background: rgba(238, 242, 246, 0.86); }

/* top strip */
.top { display: flex; flex-wrap: wrap; align-items: stretch; border-bottom: 2px solid var(--ink); }
.brand { flex: 1 1 320px; padding: 18px 20px; text-decoration: none; font-weight: 900; font-stretch: 125%; font-size: 22px; letter-spacing: 0.02em; }
.brand span { color: var(--orange-text); }
.top nav { display: flex; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.top nav a { display: flex; align-items: center; padding: 0 18px; min-height: 56px; border-left: 1px solid var(--ink); text-decoration: none; }
.top nav a.restricted { background: var(--ink); color: #fff; }
.navmenu { position: relative; }
.navmenu summary { display: flex; align-items: center; padding: 0 18px; min-height: 56px; border-left: 1px solid var(--ink); cursor: pointer; list-style: none; }
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu summary::after { content: " ▾"; white-space: pre; }
.navmenu[open] summary::after { content: " ▴"; }
.navmenu-list { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 280px; max-width: min(320px, calc(100vw - 32px)); background: var(--paper, #fff); border: 1px solid var(--ink); }
.top nav .navmenu-list a { display: block; min-height: 44px; padding: 12px 14px; border-left: 0; border-bottom: 1px solid var(--ink); }
.top nav .navmenu-list a:last-child { border-bottom: 0; }
.top nav a.restricted:hover { background: var(--orange-text); }

/* sections */
.section { padding: 40px; border-bottom: 1px solid var(--ink); }
.section:last-child { border-bottom: 0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; margin-bottom: 20px; }
.section-head p { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
h2.title { margin: 0; font-weight: 800; font-stretch: 125%; font-size: 30px; text-transform: uppercase; }
h2.title .num { font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--orange-text); vertical-align: middle; margin-right: 0.6em; }
.lede { margin: -8px 0 28px; max-width: 760px; font-size: 16px; }

/* hero */
.hero { padding: 64px 40px 56px; }
.hero h1 { margin: 0; font-weight: 900; font-stretch: 125%; font-size: clamp(30px, 8.4vw, 108px); line-height: 0.88; letter-spacing: -0.01em; text-transform: uppercase; }
.hero h1 .dot { color: var(--orange); }
.hero p { margin: 36px 0 0; max-width: 760px; font-size: 21px; line-height: 1.5; }

/* recent thoughts table */
.table-wrap { overflow-x: auto; }
table.revs { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 16px; }
table.revs th { padding: 8px 12px; font-family: var(--mono); font-size: 12px; font-weight: 600; text-align: left; background: var(--ink); color: #fff; }
table.revs td { padding: 14px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.revs tr:last-child td { border-bottom: 0; }
table.revs .rev { font-family: var(--mono); color: var(--orange-text); }
table.revs .date, table.revs .type { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
table.revs a { font-weight: 700; }

/* inventions carousel */
.carousel-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.carousel-bar p { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.carousel-bar strong { color: var(--ink); }
.arrows { display: flex; gap: 8px; }
.arrows button { width: 48px; height: 48px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-family: var(--mono); font-size: 18px; cursor: pointer; }
.arrows button.next { background: var(--ink); color: #fff; }
.arrows button:focus-visible, .track:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.track { display: flex; gap: 28px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 24px 10px 28px; scrollbar-width: thin; scrollbar-color: var(--ink) transparent; }
.card { flex: 0 0 300px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; }
.print { margin: 0 0 6px; position: relative; background: #fff; padding: 8px 8px 0; box-shadow: 0 1px 2px rgba(11, 31, 58, 0.25), 0 10px 20px rgba(11, 31, 58, 0.18); }
.print .tape { position: absolute; top: -11px; width: 80px; height: 22px; background: var(--tape); }
.print img, .print .placeholder { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.print .placeholder { display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 12px; background: repeating-linear-gradient(45deg, var(--paper) 0 8px, #DDE5EE 8px 16px); font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.print figcaption { padding: 6px 2px 8px; font-family: var(--mono); font-size: 11px; }
.card-head { display: flex; align-items: center; gap: 10px; }
.balloon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); font-family: var(--mono); font-weight: 600; font-size: 14px; }
.card h3 { margin: 0; font-weight: 800; font-stretch: 112%; font-size: 22px; line-height: 1.1; }
.card p { margin: 0; font-size: 15px; line-height: 1.5; }
.card-foot { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 12px; }
.tag { border: 1px solid var(--ink); padding: 1px 8px; }
.tag.hot { background: var(--orange); border-color: var(--orange); padding: 2px 8px; font-weight: 600; }
.reserved { flex: 0 0 300px; scroll-snap-align: start; border: 2px dashed var(--rule); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.reserved .balloon { border-style: dashed; border-color: var(--ink-soft); }

/* news panels */
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 20px; }
.panel { border: 2px solid var(--ink); background: #fff; display: flex; flex-direction: column; }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; }
.stamp { border: 1px solid #fff; padding: 0 6px; }
.stamp.machine { background: var(--orange); border-color: var(--orange); color: var(--ink); font-weight: 600; }
.panel-body { padding: 18px 16px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.panel-body p { margin: 0; }
.panel .more { margin-top: auto; font-family: var(--mono); font-size: 13px; }
.ranked { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.ranked li { display: flex; gap: 12px; }
.ranked .n { flex: none; font-family: var(--mono); font-weight: 600; color: var(--orange-text); }
.ranked a, .headlines a { font-weight: 700; }
.ranked p, .headlines p { margin: 4px 0 0; font-size: 14px; }
.meta { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.headlines { margin: 0; padding: 0; list-style: none; }
.headlines li { padding: 12px 0; border-bottom: 1px solid var(--grid); }
.headlines li:first-child { padding-top: 0; }
.headlines li:last-child { border-bottom: 0; }
.gauge { margin-top: 8px; position: relative; height: 22px; border: 1px solid var(--ink); background: var(--paper); }
.gauge .fill { height: 100%; background: var(--ink); }
.gauge .line { position: absolute; top: -5px; bottom: -5px; left: 80%; width: 2px; background: var(--orange); }
.gauge-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-family: var(--mono); font-size: 12px; }
.watch { border-top: 1px solid var(--grid); padding-top: 14px; }
.watch h4 { margin: 0 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--orange-text); }
.watch ul { margin: 0; padding: 0 0 0 18px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

/* monthly stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 24px 40px; }
.stats h3 { margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-family: var(--mono); font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; }
.stats h3 span:last-child { color: var(--ink-soft); font-weight: 400; }
.stats ul, .stats ol { margin: 0; padding: 0; list-style: none; }
.stats li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.stats .row { display: flex; justify-content: space-between; gap: 12px; }
.stats .row b { font-weight: 700; }
.stats .row span { font-family: var(--mono); font-size: 13px; }
.bar { margin-top: 6px; height: 8px; border: 1px solid var(--ink); background: #fff; }
.bar div { height: 100%; background: var(--ink); }
.bar div.done { background: var(--orange); }
.stats li.ranked-band { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.stats li.ranked-band .balloon { width: 28px; height: 28px; font-size: 12px; }

.readers { margin-top: 32px; }
.readers h3 { margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-family: var(--mono); font-weight: 600; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.readers h3 span:last-child { color: var(--ink-soft); font-weight: 400; }
.readers-total { margin: 0 0 12px; font-weight: 800; font-stretch: 112%; font-size: 20px; }
.readers ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 0 40px; }
.readers li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.readers li b { flex: 0 0 150px; }
.tally { flex: 1; font-family: var(--mono); font-weight: 600; font-size: 18px; letter-spacing: 1px; color: var(--ink); }
.tally .gate { position: relative; margin-right: 10px; }
.tally .gate::after { content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 2px; background: var(--orange); transform: rotate(-20deg); }

/* system diagram */
.diagram { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.col { display: flex; flex-direction: column; gap: 8px; }
.col.narrow { flex: 1 1 220px; }
.col.wide { flex: 2 1 380px; }
.col > .label { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--orange-text); font-weight: 600; }
.box { border: 2px solid var(--ink); background: #fff; padding: 16px; position: relative; }
.box.small { padding: 12px 16px; }
.box.dark { background: var(--ink); color: #fff; font-weight: 800; font-size: 15px; }
.box .name { margin: 0; font-weight: 800; font-stretch: 112%; font-size: 18px; }
.box.small .name { font-size: 15px; font-stretch: 100%; }
.box p { margin: 4px 0 0; font-size: 14px; }
.box.small p { margin-top: 2px; font-size: 13px; }
.box ul { margin: 6px 0 0; padding: 0 0 0 18px; font-size: 14px; }
.box .flag { position: absolute; top: -11px; right: 12px; background: var(--orange); color: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 1px 8px; }
.box .note { margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.sources { flex: 1; font-family: var(--mono); font-size: 12px; line-height: 1.8; }
.arrow { flex: 0 0 auto; display: flex; align-items: center; font-family: var(--mono); font-size: 20px; }
.down { text-align: center; font-family: var(--mono); }

.empty { font-size: 14px; color: var(--ink-soft); font-style: italic; }

@media (max-width: 640px) {
  .page { padding: 12px; }
  .section, .hero { padding-left: 16px; padding-right: 16px; }
  .top nav a { padding: 0 12px; }
  .navmenu summary { padding: 0 12px; }
  .top nav { position: relative; }
  .navmenu { position: static; }
  .navmenu-list { left: 0; right: 0; min-width: 0; max-width: none; }
  .brand { font-size: 18px; }
  .card, .reserved { flex-basis: 260px; }
  .arrow { width: 100%; justify-content: center; transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  .track { scroll-behavior: auto; }
}

/* invention write-ups */
.writeup { max-width: 860px; }
.writeup .crumb { margin: 0 0 18px; font-size: 13px; color: var(--orange-text); }
.writeup h1 { margin: 0; font-weight: 900; font-stretch: 125%; font-size: clamp(32px, 6vw, 64px); line-height: 0.95; text-transform: uppercase; }
.writeup .standfirst { margin: 20px 0 32px; font-size: 21px; line-height: 1.45; max-width: 680px; }
.hero-print { max-width: 720px; margin: 8px 0 44px; transform: rotate(-1deg); }
.hero-print .tape { left: 42%; transform: rotate(-3deg); }
.hero-print img { aspect-ratio: auto; }
.writeup-body { font-size: 18px; line-height: 1.65; max-width: 680px; }
.writeup-body h2 { margin: 40px 0 8px; font-weight: 800; font-stretch: 112%; font-size: 24px; text-transform: uppercase; }
.review-notes { background: #fff; border-top: 2px dashed var(--orange); }
.review-notes h2 { margin: 0 0 12px; font-family: var(--mono); font-size: 13px; color: var(--orange-text); }
.review-notes pre { margin: 0; max-width: 860px; white-space: pre-wrap; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.writeup .revs { margin-bottom: 20px; }
.writeup-body h3 { margin: 28px 0 6px; font-weight: 800; font-size: 19px; }
.writeup-body p, .writeup-body ul, .writeup-body ol { margin: 0 0 16px; }
.writeup-body code { font-family: var(--mono); font-size: 0.85em; background: #fff; border: 1px solid var(--rule); padding: 0 4px; }
.writeup-body pre { overflow-x: auto; background: var(--ink); color: #fff; padding: 16px; }
.writeup-body pre code { background: none; border: 0; padding: 0; color: inherit; }
.writeup-body blockquote { margin: 24px 0; padding-left: 20px; border-left: 3px solid var(--orange); font-style: italic; }
.writeup-body img { max-width: 100%; height: auto; border: 8px solid #fff; box-shadow: 0 1px 2px rgba(11, 31, 58, 0.25), 0 10px 20px rgba(11, 31, 58, 0.18); }
