/* © 2026 William C. Chesher. All Rights Reserved.
   tag.css - tag's own look: pastel chalk on dark blacktop. Panels are chalk-edged; the boards (chalk.js) draw the rest.
   System fonts, no fetches. */

:root {
  --blacktop: #1d1d1f;
  --panel: rgba(14, 14, 16, 0.84);
  --chalk: #efebe3;
  --chalk-soft: #c9c4ba;
  --pink: #f3a7c2;
  --peach: #f6c19d;
  --butter: #f2df9c;
  --mint: #a9e0c3;
  --sky: #a9d2ec;
  --lavender: #c7b6e8;
  --ink: #1b1a17;
  --ink-soft: #4a4640;
  --good: #1f7a4d;
  --wait: #8a5a00;
  --bad: #b3261e;
  --bad-on-dark: #ffb3c4;
  /* a chalk line round a panel: a hand-drawn rectangle, broken by the grain (feTurbulence) and a little unsteady */
  --chalk-edge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cfilter id='c' x='-10%25' y='-10%25' width='120%25' height='120%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4' result='n'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='n' scale='2.4' result='d'/%3E%3CfeColorMatrix in='n' type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 3.4 -0.5' result='m'/%3E%3CfeComposite in='d' in2='m' operator='in'/%3E%3C/filter%3E%3Cpath d='M7 8 C20 6.5 40 7.6 53 7 M52.5 6 C53.4 20 52.6 40 53 53 M54 52.5 C40 53.4 20 52.4 7 53 M8 54 C6.6 40 7.5 20 7 7' fill='none' stroke='%23efebe3' stroke-opacity='0.9' stroke-width='3.4' stroke-linecap='round' filter='url(%23c)'/%3E%3C/svg%3E");
  --display: "Chalkboard SE", "Chalkboard", "Segoe Print", "Bradley Hand", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* the ground: dark blacktop. A grain drawn here first; chalk.js swaps in its own baked asphalt where a board runs. */
html {
  background-color: var(--blacktop);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.55 0 0 0 0 0.56 0 0 0 0.55 -0.12'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
}
html.chalk-ground { background-repeat: repeat; }
html.chalk-ground body::before { display: none; }   /* the baked asphalt carries its own light */

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--chalk);
}

/* the light falling off the blacktop's edges, fixed to the screen so a long page has no seam */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 88%);
}

a { color: var(--sky); }

:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 8px; top: 8px; background: var(--butter); color: var(--ink); padding: 8px 12px; z-index: 10; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- the boards (chalk.js) */

.chalk-board { position: relative; }
.chalk-canvas { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.chalk-host { position: relative; }
.chalk-mark { position: absolute; inset: -12px; pointer-events: none; z-index: 1; }
.chalk-pause {
  position: absolute; right: 8px; bottom: 8px; z-index: 2; font: 600 14px var(--body); color: var(--chalk);
  background: rgba(14, 14, 16, 0.85); border: 2px solid var(--chalk-soft); border-radius: 999px; padding: 6px 14px;
  min-height: 36px; cursor: pointer;
}
.chalk-pause[aria-pressed="true"] { background: var(--butter); color: var(--ink); border-color: var(--butter); }
/* a board's edge fades into the ground around it */
.feather .chalk-canvas {
  -webkit-mask-image: radial-gradient(ellipse at center, #000 62%, transparent 98%);
  mask-image: radial-gradient(ellipse at center, #000 62%, transparent 98%);
}

/* ---------------------------------------------------------------- the hero and the header */

header.top { padding: 18px 0 8px; }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mark { display: inline-block; text-decoration: none; line-height: 0; }
.mark svg { width: 96px; height: auto; display: block; }
.hero { text-align: center; padding: 12px 0 4px; }
.hero p.line {
  font-family: var(--display); font-size: clamp(18px, 2.4vw, 23px); margin: 4px auto 0; padding: 0 16px; max-width: 900px;
  color: var(--chalk); text-shadow: 0 1px 2px #000, 0 0 14px rgba(0, 0, 0, 0.8);
}
/* the mosaic hero (hero.js): the tablet set into the wall, its frame laid in tile; only a shadow round it here */
.mosaic-hero { display: block; width: min(680px, 100%); margin: 0 auto 6px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); line-height: 0; }
.mosaic-board { display: block; width: 100%; height: auto; aspect-ratio: 640 / 360; background: #4a4844; }

/* the instrument (instrument.js): a brushed aluminium plate screwed to the wall under the tablet. Neutral, black knobs
   with one white line each, mono legends; the one colour is the lever, the decisive action (Braun's rule). */
.instrument {
  width: min(680px, 100%); margin: 14px auto 0; padding: 14px 16px 12px; position: relative;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px;
  color: #2b2a28; text-align: center; border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, rgba(0, 0, 0, 0.03) 1px 3px),
    linear-gradient(180deg, #d9d6cf, #b9b5ad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 14px 30px rgba(0, 0, 0, 0.5);
}
.instrument::before, .instrument::after {
  content: ""; position: absolute; top: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f4f2ee, #8d8981 70%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.instrument::before { left: 7px; }
.instrument::after { right: 7px; }
.bank { border-top: 1px solid rgba(0, 0, 0, 0.18); padding-top: 4px; min-width: 0; }
.bank-title { font: 600 10px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #5b5852; margin-bottom: 4px; }
.bank-controls { display: flex; justify-content: space-around; align-items: flex-start; gap: 2px; }
.control { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.control-label { font: 600 10px/1.2 var(--mono); text-transform: lowercase; color: #2b2a28; margin-top: 6px; }
.readout { font: 10px/1.2 var(--mono); color: #6a665f; min-height: 12px; }
.knob {
  position: relative; width: 38px; height: 38px; margin: 18px 24px 4px; border-radius: 50%;
  touch-action: none; cursor: grab; outline-offset: 6px;
}
.knob.turning { cursor: grabbing; }
.knob-cap {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3a3937, #121110 72%);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.knob-mark { position: absolute; left: calc(50% - 1px); top: 4px; width: 2px; height: 11px; border-radius: 1px; background: #f4f2ee; }
.tick { position: absolute; left: calc(50% - 0.5px); top: -7px; width: 1px; height: 4px; background: #5b5852; transform-origin: 50% 26px; }
.stop {
  position: absolute; transform: translate(-50%, -50%); padding: 0 2px; border: 0; background: none; cursor: pointer;
  font: 9px/1 var(--mono); color: #6a665f; white-space: nowrap;
}
.stop.east { transform: translate(0, -50%); }
.stop.west { transform: translate(-100%, -50%); }
.stop.on { color: #121110; font-weight: 700; }
.selector .readout { visibility: hidden; }
.switch {
  width: 22px; height: 38px; margin-top: 12px; padding: 0; border: 0; border-radius: 4px; cursor: pointer; position: relative;
  background: linear-gradient(180deg, #121110, #2e2d2b); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.switch-throw {
  position: absolute; left: 3px; right: 3px; height: 15px; bottom: 3px; border-radius: 3px;
  background: linear-gradient(180deg, #f4f2ee, #bdb9b1); transition: bottom 120ms ease;
}
.switch[aria-checked="true"] .switch-throw { bottom: 20px; }
.lever {
  width: 30px; height: 50px; margin-top: 2px; padding: 0; border: 0; background: none; cursor: pointer; position: relative;
}
.lever::before {
  content: ""; position: absolute; left: 9px; right: 9px; bottom: 0; height: 12px; border-radius: 3px;
  background: linear-gradient(180deg, #2e2d2b, #121110);
}
.lever-arm {
  position: absolute; left: 13px; bottom: 6px; width: 4px; height: 38px; border-radius: 2px; background: #8d8981;
  transform-origin: 50% 100%; transform: rotate(-18deg);
}
.lever-arm::after {
  content: ""; position: absolute; left: -6px; top: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff86ab, var(--pink) 60%, #a3164a);
}
.lever.pulled .lever-arm { animation: pull 420ms ease; }
@keyframes pull { 40% { transform: rotate(18deg); } }
@media (prefers-reduced-motion: reduce) { .lever.pulled .lever-arm { animation: none; } .switch-throw { transition: none; } }
@media (max-width: 560px) { .instrument { grid-template-columns: minmax(0, 1fr); } }

nav.links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
nav.links a, nav.links button {
  font: 600 15px var(--body); color: var(--chalk); background: rgba(14, 14, 16, 0.7); border: 2px solid rgba(239, 235, 227, 0.4);
  border-radius: 999px; padding: 6px 14px; text-decoration: none; cursor: pointer;
}
nav.links a[aria-current="page"] { border-color: var(--butter); color: var(--butter); }

/* ---------------------------------------------------------------- panels on the blacktop, edged in chalk */

main { padding: 8px 0 40px; }

.sheet, .paste {
  position: relative;
  background: var(--panel) padding-box;
  color: var(--chalk);
  border: 14px solid transparent;
  border-image: var(--chalk-edge) 15 / 14px / 0 round;
  padding: 8px 10px;
  margin: 14px 0;
}
.sheet h1, .sheet h2, .paste h2, .paste h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 8px; font-weight: 700; }
.sheet h1 { font-size: clamp(28px, 4.5vw, 38px); }
.sheet h2 { font-size: 25px; }
.sheet p, .paste p { margin: 0 0 10px; }
.lean-left, .lean-right { transform: none; }

.wall-title {
  font-family: var(--display); font-weight: 700; font-size: clamp(30px, 5vw, 48px); line-height: 1.1; margin: 12px 0 4px;
  color: var(--chalk); text-shadow: 0 1px 2px #000, 0 0 18px rgba(0, 0, 0, 0.85);
}
.on-wall { color: var(--chalk); background: rgba(14, 14, 16, 0.7); padding: 10px 14px; border-radius: 6px; }
.on-wall .hint, .on-wall.hint { color: var(--chalk-soft); }
.lead { font-family: var(--display); font-size: clamp(20px, 3vw, 26px); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; align-items: start; }
.grid .paste { margin: 4px 0; }
.paste.locked { text-align: center; color: var(--chalk-soft); }

/* the mosaic: one tile a shown piece, drawn line by line. Decoration: the pieces below are the real list. */
.mosaic { height: clamp(240px, 40vw, 440px); margin: 14px 0; cursor: pointer; }
.present .mosaic { height: 72vh; }

.who { font-weight: 700; }
.meta { color: var(--chalk-soft); font-size: 14px; }
.state { display: inline-block; font: 700 13px var(--body); border-radius: 999px; padding: 2px 10px; margin: 0 6px 6px 0; }
.state.waiting, .state.processing { background: #fff1c2; color: var(--wait); }
.state.shown { background: #d9f2e4; color: var(--good); }
.state.hidden, .state.failed { background: #fbe0de; color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; padding: 0; list-style: none; }
.chip {
  font: 600 14px var(--mono); border: 2px solid rgba(239, 235, 227, 0.55); border-radius: 999px; padding: 2px 10px;
  background: transparent; color: var(--chalk);
}
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--butter); color: var(--ink); border-color: var(--butter); }
.filters .chip { background: rgba(14, 14, 16, 0.7); }
.filters .chip[aria-pressed="true"] { background: var(--butter); color: var(--ink); border-color: var(--butter); }

.media { width: 100%; max-height: 70vh; background: #000; border-radius: 3px; display: block; }
audio.media { background: transparent; }
img.media { object-fit: contain; }

.chapters { list-style: none; margin: 8px 0; padding: 0; }
.chapters li { margin: 4px 0; }
.chapters button { font: 600 14px var(--body); background: none; border: none; color: var(--sky); cursor: pointer; text-align: left; padding: 2px 0; }
.chapters .time { font-family: var(--mono); color: var(--chalk-soft); margin-right: 6px; }

.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.reactions button {
  font: 600 14px var(--body); border: 2px solid rgba(239, 235, 227, 0.55); background: transparent; color: var(--chalk);
  border-radius: 6px; padding: 3px 8px; cursor: pointer;
}
.reactions button[aria-pressed="true"] { background: var(--mint); color: var(--ink); border-color: var(--mint); }

.replies { border-top: 1px dashed rgba(239, 235, 227, 0.4); margin-top: 10px; padding-top: 8px; }
.replies p { margin: 4px 0; }

.answer-of { border-left: 5px solid var(--pink); margin: 10px 0 0; padding: 8px 12px; background: rgba(255, 255, 255, 0.05); }

/* ---------------------------------------------------------------- controls */

button, .button, input, select, textarea { font: inherit; }
.button, button.primary, button.quiet, button.danger {
  display: inline-block; font: 700 16px var(--body); border-radius: 6px; padding: 10px 18px; cursor: pointer;
  border: 2px solid var(--chalk); text-decoration: none; min-height: 44px;
}
.button, button.primary { background: var(--butter); color: var(--ink); border-color: var(--butter); }
button.quiet, .button.quiet { background: transparent; color: var(--chalk); border-color: rgba(239, 235, 227, 0.7); }
button.danger { background: transparent; color: var(--bad-on-dark); border-color: var(--bad-on-dark); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }

label { font-weight: 700; display: block; margin: 12px 0 4px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 12px 6px 0; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="datetime-local"],
select, textarea {
  width: 100%; max-width: 100%; padding: 10px 12px; border: 2px solid var(--chalk-soft); border-radius: 6px; background: #f7f4ee;
  color: var(--ink); min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--mint); }
.hint { font-size: 14px; color: var(--chalk-soft); margin: 4px 0 0; }
.count { font: 13px var(--mono); color: var(--chalk-soft); text-align: right; }

.notice { border: 2px solid var(--chalk); background: #fff8d6; color: var(--ink); padding: 12px 14px; border-radius: 6px; margin: 10px 0; }
.notice.strong { background: var(--butter); }
.notice a { color: #005f73; }
.error { border-color: var(--bad); background: #fde8e6; color: var(--bad); }
.ok { border-color: var(--good); background: #e2f5ea; color: var(--good); }
[role="status"]:empty, [role="alert"]:empty { display: none; }

.its { border-image: none; border: 3px solid var(--pink); border-radius: 8px; }
.its h2 { color: var(--pink); }

/* the recorder */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.tabs button {
  font: 700 15px var(--body); border: 2px solid rgba(239, 235, 227, 0.7); background: transparent; color: var(--chalk);
  border-radius: 6px 6px 0 0; padding: 8px 14px; cursor: pointer; min-height: 44px;
}
.tabs button[aria-selected="true"] { background: var(--butter); color: var(--ink); border-color: var(--butter); }
.clock { font: 700 28px var(--mono); }
.rec-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #ff6b8a; margin-right: 6px; vertical-align: middle; }
.preview { width: 100%; max-height: 50vh; background: #000; border-radius: 3px; }
.highlight-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.highlight-row .time { font: 600 14px var(--mono); }
.pip-body { margin: 0; padding: 10px; font-family: var(--body); background: var(--blacktop); color: var(--chalk); }
.pip-body .row { margin: 6px 0; }

/* admin */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid rgba(239, 235, 227, 0.22); vertical-align: top; }
th { font-family: var(--display); }
.tablewrap { overflow-x: auto; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-nav a {
  font: 700 15px var(--body); color: var(--chalk); background: rgba(14, 14, 16, 0.7); padding: 6px 14px; border-radius: 6px;
  text-decoration: none; border: 2px solid transparent;
}
.admin-nav a[aria-current="page"] { border-color: var(--butter); color: var(--butter); }

/* the projector */
.present .grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.present .paste { font-size: 20px; }
.spotlight { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 5; }
.spotlight .paste { max-width: 1100px; width: 100%; max-height: 92vh; overflow: auto; font-size: 22px; background-color: rgba(14, 14, 16, 0.97); }

footer.bottom { padding: 20px 0 30px; }
footer.bottom .wrap { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
footer.bottom a { color: var(--chalk); background: rgba(14, 14, 16, 0.7); padding: 4px 10px; border-radius: 4px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .sheet, .paste { padding: 6px; }
}

@media print {
  html, body { background: #fff; color: #000; }
  body::before { display: none; }
  .sheet, .paste { border: 1px solid #000; border-image: none; background: #fff; color: #000; }
  header.top, footer.bottom, .chalk-board, .chalk-mark, .chalk-pause, .hero-board, .mosaic, .mosaic-hero, .instrument { display: none; }
}

/* the layers: the rift's line, a place, the reel's caption, a piece a walk link found */
.rift-line {
  position: relative; height: 56px; margin: 18px 8px 8px; border-bottom: 4px solid var(--chalk);
  background: linear-gradient(90deg, rgba(243, 167, 194, 0.16), rgba(169, 210, 236, 0.16));
}
.rift-line .pole { position: absolute; bottom: -34px; font: 700 14px var(--mono); }
.rift-line .pole.left { left: 0; }
.rift-line .pole.right { right: 0; }
.rift-mark {
  position: absolute; bottom: -12px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: var(--butter); border: 3px solid var(--blacktop);
}
.rift-list { margin: 40px 0 0; }
.chip.place { border-style: dashed; }
.filters .label { color: var(--chalk); font-weight: 700; align-self: center; text-shadow: 0 1px 2px #000; }
.place-heading { grid-column: 1 / -1; font-size: clamp(24px, 3.5vw, 36px); }
.reel-caption { min-height: 1.5em; font-weight: 600; margin: 8px 0; }
.paste.found { outline: 4px solid var(--butter); outline-offset: 4px; }
.nudges button { border-style: dashed; }
input[type="range"] { width: 100%; accent-color: var(--mint); min-height: 44px; }

/* the walk: the codes, black on white, one per card, a card never split across two printed pages */
.walk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.walk-card { text-align: center; background: #fff padding-box; color: var(--ink); }
.walk-card a { color: #005f73; }
.walk-card svg.qr { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto 10px; }
.walk-card .link { word-break: break-all; font-family: var(--mono); font-size: 12px; }

@media print {
  .no-print, .skip, #status { display: none !important; }
  .walk .wall-title { color: #000; text-shadow: none; }
  .walk .on-wall { background: none; color: #000; text-shadow: none; }
  .walk-grid { grid-template-columns: repeat(2, 1fr); }
  .walk-card { break-inside: avoid; page-break-inside: avoid; }
}
