:root {
  color-scheme: light;
  --page: #faf6ec;
  --surface: #fcfcfb;
  --ink: #141210;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;
  --s2: #eb6834;
  --band: rgba(42, 120, 214, 0.16);
  --seq-0: #cde2fb; --seq-1: #9ec5f4; --seq-2: #6da7ec; --seq-3: #3987e5; --seq-4: #256abf; --seq-5: #184f95; --seq-6: #0d366b;
  --accent: #141210;
  --empty: #efede6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
    --s1: #3987e5; --s2: #d95926; --band: rgba(57, 135, 229, 0.22);
    --seq-0: #104281; --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #b7d3f6;
    --accent: #f0efec; --empty: #232321;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
  --s1: #3987e5; --s2: #d95926; --band: rgba(57, 135, 229, 0.22);
  --seq-0: #104281; --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #b7d3f6;
  --accent: #f0efec; --empty: #232321;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; }

/* The Frisconian's masthead, drawn in type so it holds in dark mode; the whole band links to the paper. */
.masthead {
  display: block; text-align: center; text-decoration: none; color: var(--ink);
  padding: 28px 0 14px; border-bottom: 4px double var(--ink);
}
.masthead span { display: block; }
.mh-over { font-family: Georgia, serif; font-size: 12px; letter-spacing: .28em; text-transform: uppercase; }
.mh-name {
  font-family: Didot, "Bodoni 72", "Bodoni MT", "Bodoni Moda", Georgia, serif; font-weight: 400;
  font-size: clamp(40px, 9vw, 76px); line-height: 1.05; margin: 4px 0 6px; letter-spacing: .01em;
}
.mh-tag { font-family: Georgia, serif; font-size: clamp(12px, 2.6vw, 15px); letter-spacing: .04em; color: var(--ink-2); }
.masthead:hover .mh-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 8px; }
.byline { margin: 14px 0 0; font-size: 15px; color: var(--ink-2); }
.byline a { color: var(--ink); text-underline-offset: 3px; white-space: nowrap; }

header.top { padding: 28px 0 24px; border-bottom: 1px solid var(--grid); }
.kicker { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: clamp(32px, 6vw, 52px); line-height: 1.05; margin: 0 0 12px; letter-spacing: -0.01em; }
.dek { font-size: 18px; color: var(--ink-2); max-width: 680px; margin: 0; }
.dek strong { color: var(--ink); }

/* ---------- ask ---------- */
.ask { margin: 28px 0 8px; background: var(--surface); border: 1px solid var(--ring); border-radius: 14px; padding: 20px; }
.ask label { display: block; font-weight: 600; margin-bottom: 8px; }
.ask .row { display: flex; gap: 10px; align-items: flex-end; }
.ask textarea {
  flex: 1; min-height: 56px; max-height: 220px; resize: vertical; font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--axis); border-radius: 10px; padding: 12px 14px;
}
.ask textarea:focus { outline: 2px solid var(--s1); outline-offset: 1px; }
button { font: inherit; cursor: pointer; }
.btn { background: var(--accent); color: var(--page); border: 0; border-radius: 10px; padding: 12px 18px; font-weight: 600; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: progress; }
.hints { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hint { background: transparent; border: 1px solid var(--axis); color: var(--ink-2); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.hint:hover { border-color: var(--ink-2); color: var(--ink); }

.thread { margin-top: 16px; display: grid; gap: 14px; }
.msg { border-radius: 12px; padding: 14px 16px; }
.msg.you { background: var(--page); color: var(--ink-2); justify-self: end; max-width: 85%; }
.msg.bot { background: transparent; border-left: 3px solid var(--s1); padding-left: 16px; border-radius: 0; }
.msg.bot p { margin: 0 0 10px; }
.msg .meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.event-card { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.event-card b { color: var(--ink); }
.findings { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.findings li { margin-bottom: 6px; }
details.receipts summary { cursor: pointer; font-size: 14px; color: var(--muted); }
.typing { color: var(--muted); font-style: italic; }

/* ---------- filters ---------- */
.filters {
  position: sticky; top: 0; z-index: 5; background: var(--page);
  display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; margin-top: 20px; border-bottom: 1px solid var(--grid);
}
.filters select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--axis);
  border-radius: 8px; padding: 6px 28px 6px 10px; max-width: 100%;
}
.filters select.on { border-color: var(--ink); font-weight: 600; }
.filters .reset { background: none; border: 0; color: var(--ink-2); text-decoration: underline; font-size: 14px; padding: 6px; }
.scope { font-size: 14px; color: var(--muted); margin: 10px 0 0; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 20px 0; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-size: 30px; font-weight: 650; line-height: 1.1; }
.tile .l { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 18px 18px 12px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h2 { font-size: 17px; margin: 0 0 2px; font-weight: 650; }
.card .sub { font-size: 14px; color: var(--ink-2); margin: 0 0 12px; }
.chart { width: 100%; min-height: 60px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--ink-2); font-size: 12px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.chart text.val { fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.click { cursor: pointer; }
.chart .mark { transition: opacity .12s; }
.chart g.row:hover .mark { opacity: .8; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.empty { color: var(--muted); font-size: 14px; padding: 18px 0; }
details.table { margin-top: 8px; }
details.table summary { font-size: 13px; color: var(--muted); cursor: pointer; }
details.table table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; font-variant-numeric: tabular-nums; }
details.table th, details.table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--grid); }
details.table td + td, details.table th + th { text-align: right; }

#tip {
  position: fixed; pointer-events: none; z-index: 20; background: var(--ink); color: var(--page);
  font-size: 13px; line-height: 1.4; padding: 8px 10px; border-radius: 8px; max-width: 260px; opacity: 0; transition: opacity .08s;
}
#tip b { font-weight: 650; }

/* ---------- about ---------- */
/* ---------- host kit: OpenStudio and the co-host offer ---------- */
.kit-nav { margin: 8px 0 0; font-size: 15px; color: var(--ink-2); }
.kit-nav a { color: var(--ink); text-underline-offset: 3px; }
.kit { margin: 40px 0 0; border-top: 4px double var(--ink); padding-top: 24px; scroll-margin-top: 170px; }
.kit-kicker { font-family: Georgia, serif; font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.kit h2 { font-family: Georgia, serif; font-size: clamp(26px, 4.5vw, 34px); line-height: 1.15; margin: 0 0 12px; }
.kit h3 { font-size: 17px; margin: 0 0 8px; font-weight: 650; }
.kit-lede { font-size: 17px; color: var(--ink-2); max-width: 720px; margin: 0 0 16px; }
.kit-lede a, .kit li a { color: var(--ink); text-underline-offset: 3px; }
.kit-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px 32px; margin: 8px 0 16px; }
.kit ul, .kit ol { padding-left: 20px; margin: 0; }
.kit li { color: var(--ink-2); font-size: 15px; margin: 0 0 8px; }
.kit li b { color: var(--ink); }
.kit-list { max-width: 720px; margin: 0 0 16px !important; }
.kit-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 8px 0 0; }
.kit-cta .btn { text-decoration: none; display: inline-block; }
.kit-link { color: var(--ink); text-underline-offset: 3px; font-weight: 600; }

.about { margin: 40px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 28px; border-top: 1px solid var(--grid); padding-top: 28px; }
.about h2 { font-family: Georgia, serif; font-size: 22px; margin: 0 0 8px; }
.about p, .about li { color: var(--ink-2); font-size: 15px; }
.about ul { padding-left: 18px; }
.sub-cta { display: inline-block; color: var(--ink); font-weight: 600; margin-bottom: 8px; }
footer { border-top: 1px solid var(--grid); padding: 20px 0 40px; font-size: 14px; color: var(--muted); }

@media (max-width: 560px) {
  .ask .row { flex-direction: column; align-items: stretch; }
  .tile .v { font-size: 24px; }
  .filters { position: static; }
}

/* the OpenStudio screenshot: a light photo on either theme, so it gets its own frame */
.os-shot { display: block; margin: 8px 0 6px; border-radius: 12px; overflow: hidden; border: 1px solid var(--ring);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08); }
.os-shot img { display: block; width: 100%; height: auto; transition: transform .25s ease; }
.os-shot:hover img { transform: scale(1.01); }
.os-cap { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.os-cap a { color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .os-shot img { transition: none; } .os-shot:hover img { transform: none; } }
