/* Delaware Goods Company. Dark by default; light on request. Ink, paper, one blue, one brass for lit things.
   Rhythm: every vertical measure is a multiple of 4px (--u). Body 18/28. */
:root {
  --u: 0.25rem;
  --bg: #0f1315;
  --surface: #161c1f;
  --raised: #1d2529;
  --ink: #e9e5db;
  --muted: #a3adaa;
  --rule: #2b3539;
  --line: #69767a;
  --blue: #8db4da;
  --on-blue: #0f1315;
  --lit: #e6c067;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f4ed;
  --surface: #efeadd;
  --raised: #e7e1d1;
  --ink: #1c2124;
  --muted: #566063;
  --rule: #d6cfc0;
  --line: #77817f;
  --blue: #1f4a73;
  --on-blue: #f7f4ed;
  --lit: #8f650c;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--u) * 4); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.125rem/1.75rem var(--sans);
  font-variant-numeric: tabular-nums;
}
.wrap { width: min(100% - 32px, 68rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--blue); color: var(--on-blue); padding: 8px 16px; z-index: 5; }
.skip:focus { left: 8px; top: 8px; }

/* header: wordmark, page names, theme switch. A ruler closes it. */
header.site { padding: calc(var(--u) * 5) 0 0; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--u) * 3) calc(var(--u) * 8); }
.brand { display: block; color: var(--ink); line-height: 0; margin-right: auto; }
.brand svg { display: block; height: 40px; width: auto; }
.mark { fill: var(--ink); }
.w-serif { fill: var(--ink); font-family: var(--serif); font-weight: 600; }
.w-caps { fill: var(--blue); font-family: var(--sans); font-weight: 600; }
nav.site { display: flex; flex-wrap: wrap; gap: 0 calc(var(--u) * 6); font-size: 1rem; }
nav.site a { color: var(--ink); text-decoration: none; padding: calc(var(--u) * 3) 0; border-bottom: 2px solid transparent; }
nav.site a:hover { border-bottom-color: var(--ink); }
nav.site a[aria-current="page"] { border-bottom-color: var(--blue); }
.themes { display: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px; font-size: 0.9375rem; }
html.js .themes { display: inline-flex; }
.themes button {
  font: inherit; line-height: 1.25rem; color: var(--ink); background: none; border: 0; border-radius: 999px;
  padding: calc(var(--u) * 2) calc(var(--u) * 4); min-height: 36px; cursor: pointer;
}
.themes button[aria-pressed="true"] { background: var(--blue); color: var(--on-blue); font-weight: 600; }
.ruler { display: block; width: 100%; height: 12px; margin-top: calc(var(--u) * 3); color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .ruler { animation: unroll 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes unroll { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
}

main { padding: calc(var(--u) * 10) 0 calc(var(--u) * 14); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.2rem + 3.6vw, 3.5rem); line-height: 1.1; margin-bottom: calc(var(--u) * 6); max-width: 18em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); margin: calc(var(--u) * 16) 0 calc(var(--u) * 4); }
h3 { font-size: 1.5rem; margin-bottom: calc(var(--u) * 2); }
p, ul, ol { margin: 0 0 calc(var(--u) * 4); }
.measure, main > .wrap > p, main > .wrap > ul, main > .wrap > ol { max-width: 36rem; }
.lead { font-size: 1.375rem; line-height: 2rem; max-width: 36rem; }
.small { font-size: 0.9375rem; line-height: 1.5rem; color: var(--muted); }
.meta { font-size: 0.9375rem; line-height: 1.5rem; color: var(--muted); margin: 0; }
ol { padding-left: 1.4em; }
li { margin-bottom: calc(var(--u) * 1.5); }

a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.button, .btn {
  display: inline-block; font: 600 1rem/1.5rem var(--sans); text-align: center; text-decoration: none; cursor: pointer;
  padding: calc(var(--u) * 2.5) calc(var(--u) * 5); min-height: 44px;
  border: 2px solid var(--blue); border-radius: 4px; background: none; color: var(--blue);
}
.button, .btn.primary { background: var(--blue); color: var(--on-blue); }
.button:hover, .btn:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: none; border-color: var(--blue); color: var(--blue); }

/* hero: the type, and the monogram drawn with its construction */
.hero { display: grid; gap: calc(var(--u) * 8); align-items: center; }
.draft { display: none; width: 100%; max-width: 15rem; height: auto; justify-self: end; }
.draft .solid { fill: var(--ink); }
.draft .guide, .draft .dim { stroke: var(--line); }
.draft .label { fill: var(--muted); font: 9px/1 var(--sans); }
@media (min-width: 52rem) {
  .hero { grid-template-columns: minmax(0, 1fr) 15rem; }
  .draft { display: block; }
}
@media (prefers-reduced-motion: no-preference) {
  .draft .guide { animation: unroll 1400ms 300ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
}

/* a ruled definition list: who, what, help */
.facts { margin: calc(var(--u) * 10) 0 0; border-top: 1px solid var(--rule); max-width: 48rem; }
.facts div { display: grid; grid-template-columns: 6rem 1fr; gap: calc(var(--u) * 4); padding: calc(var(--u) * 4) 0; border-bottom: 1px solid var(--rule); }
.facts dt { font: 600 0.8125rem/1.75rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); }
.facts dd { margin: 0; }
@media (max-width: 34rem) { .facts div { grid-template-columns: 1fr; gap: 0; } }

.ruled { list-style: none; padding: 0; border-top: 1px solid var(--rule); max-width: 36rem; }
.ruled li { padding: calc(var(--u) * 3) 0; border-bottom: 1px solid var(--rule); margin: 0; }
.ruled p { margin: 0 0 4px; }
.kinds { max-width: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); column-gap: calc(var(--u) * 8); }
.kinds li { font: 1.25rem/1.75rem var(--serif); }
.catalog .price { color: var(--muted); font-size: 0.9375rem; }

/* the three small things */
.plate { display: grid; gap: calc(var(--u) * 6) calc(var(--u) * 12); padding: calc(var(--u) * 10) 0; border-top: 1px solid var(--rule); }
.plate:last-of-type { border-bottom: 1px solid var(--rule); }
@media (min-width: 60rem) { .plate { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); } }
.plate-no { font: 600 0.8125rem/1.5rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); margin: 0 0 calc(var(--u) * 2); }
.plate-no b { font: 600 2.5rem/1 var(--serif); letter-spacing: 0; color: var(--ink); display: block; margin-bottom: calc(var(--u) * 2); }
.plate p { max-width: 32rem; }
.stage { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: calc(var(--u) * 6); min-width: 0; }
.live { display: none; }
html.demos-on .live { display: block; }
html.demos-on .static { display: none; }
.static { margin: 0; color: var(--muted); }

.row-between { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: calc(var(--u) * 3); }
.actions { display: flex; flex-wrap: wrap; gap: calc(var(--u) * 3); margin-top: calc(var(--u) * 4); }
.actions.stack { flex-direction: column; align-items: stretch; margin-top: calc(var(--u) * 5); }
.status { min-height: 3rem; margin: calc(var(--u) * 3) 0 0; font-size: 1rem; line-height: 1.5rem; }

/* 01 lights */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: min(100%, 22rem); }
.cell {
  position: relative; aspect-ratio: 1; padding: 0; cursor: pointer; border-radius: 4px;
  background: var(--raised); border: 2px solid var(--line); min-width: 44px; min-height: 44px;
}
.cell::after { content: ""; position: absolute; inset: 27%; border-radius: 50%; border: 2px solid var(--line); }
.cell[aria-pressed="true"] { border-color: var(--lit); }
.cell[aria-pressed="true"]::after { background: var(--lit); border-color: var(--lit); }
.cell.hint { outline: 3px dashed var(--blue); outline-offset: 3px; }
.cell:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.board.won { opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) {
  .cell, .cell::after { transition: background-color 120ms, border-color 120ms; }
}

/* forms */
.controls { display: grid; gap: calc(var(--u) * 4); align-content: start; }
.field label { display: block; font-size: 0.9375rem; line-height: 1.5rem; color: var(--muted); margin-bottom: 2px; }
.field select, .field input {
  width: 100%; font: 1rem/1.5rem var(--sans); color: var(--ink); background: var(--raised);
  border: 1px solid var(--line); border-radius: 4px; padding: calc(var(--u) * 2.5) calc(var(--u) * 3); min-height: 44px;
}
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); margin: 0; }
.fieldset { display: grid; gap: calc(var(--u) * 4); }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: calc(var(--u) * 4); }
[hidden] { display: none !important; }

/* 02 maze */
.maze-grid { display: grid; gap: calc(var(--u) * 6); }
@media (min-width: 42rem) { .maze-grid { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); } }
.paper { background: #ffffff; border: 1px solid var(--line); align-self: start; max-width: 26rem; width: 100%; justify-self: center; }
.paper svg { display: block; width: 100%; height: auto; }
#print-sheet { display: none; }

/* 03 calculator */
.calc-grid { display: grid; gap: calc(var(--u) * 6); }
@media (min-width: 42rem) { .calc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.results { display: block; align-self: start; border-top: 1px solid var(--rule); padding-top: calc(var(--u) * 4); }
.big { font: 600 clamp(1.5rem, 1rem + 1.6vw, 2.125rem)/1.2 var(--serif); margin: 0 0 calc(var(--u) * 2); }
.cover { list-style: none; padding: 0; margin: calc(var(--u) * 4) 0 0; font-size: 1rem; line-height: 1.5rem; }
.cover li { padding: 4px 0 4px 1.5em; margin: 0; position: relative; }
.cover li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 10px; height: 10px; border: 2px solid var(--line); border-radius: 50%; }
.cover li.yes::before { background: var(--lit); border-color: var(--lit); }
.cover li.no { color: var(--muted); }

.sources { max-width: 48rem; margin-top: calc(var(--u) * 6); }
.sources li { font-size: 0.9375rem; line-height: 1.5rem; color: var(--muted); }

footer.site { border-top: 1px solid var(--rule); padding: calc(var(--u) * 6) 0 calc(var(--u) * 10); color: var(--muted); font-size: 0.9375rem; line-height: 1.5rem; }
footer.site p { margin: 0 0 6px; }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  :root, :root[data-theme="light"] { --bg: #fff; --surface: #fff; --raised: #fff; --ink: #000; --muted: #333; --rule: #999; --line: #666; --blue: #000; --lit: #000; }
  nav.site, .button, .themes, .ruler { display: none; }
  body { background: #fff; color: #000; }
  body.printing-maze > :not(#print-sheet) { display: none !important; }
  body.printing-maze #print-sheet { display: block; width: 100%; height: 100vh; overflow: hidden; }
  body.printing-maze #print-sheet svg { display: block; width: 100%; height: auto; }
}
