/* ============================================================
   MELA · DEMONSTRATIONS GALLERY — the "watch it" arm of Field Notes
   Five recorded instruments (cycle, purge, season, noise, tenure),
   ported from the build mock to the cinematic-parchment design system
   and re-skinned to match the homepage demonstration: subtle
   parchment-light surfaces, a single gold accent, no hard outline
   boxes. Everything is scoped under .demonstrations (the file loads
   only on /demonstrations/).

   Care Clause held: gold = the one emphasis, coral = attention mark,
   no red/blue; down-readings render like up; bands and cones never
   reach zero; AA text twins for copy, gold/coral as graphic marks.
   ============================================================ */

.demonstrations {
  --d-bark: var(--deep-bark);
  --d-ink: var(--bark);
  --d-muted: var(--label-ink);
  --d-gold: var(--gold);
  --d-gold-text: var(--gold-ink);
  --d-coral: var(--coral);
  --d-surface: var(--parchment-light);
  --d-hairline: color-mix(in srgb, var(--deep-bark) 16%, transparent);
  --d-grid: color-mix(in srgb, var(--deep-bark) 9%, transparent);
  --d-band: color-mix(in srgb, var(--deep-bark) 7%, transparent);
  font-family: var(--font-body);
  color: var(--d-ink);
}
.demonstrations .wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--space-3); }

/* ---------- hero ---------- */
.demonstrations .dg-hero { padding: var(--space-16) 0 var(--space-8); }
.demonstrations .pill {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--d-muted);
  background: var(--parchment-deep); border-radius: 999px; padding: 8px 16px;
}
.demonstrations .pill .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--d-gold); }
.demonstrations h1 {
  font-family: var(--font-display); font-weight: 400; font-variation-settings: 'opsz' 110;
  color: var(--d-bark); letter-spacing: -0.015em;
  font-size: clamp(2.75rem, 7vw, 5rem); line-height: 1.03; margin: var(--space-3) 0 var(--space-2); max-width: 15ch;
}
.demonstrations h1 em, .demonstrations h2 em { font-style: italic; color: var(--d-gold-text); }
.demonstrations .dek { color: var(--d-muted); font-size: var(--text-lg); line-height: 1.55; max-width: 58ch; margin: 0; }
/* ---------- tab bar (one demonstration at a time) ---------- */
.demonstrations .dg-tabs {
  display: flex; flex-wrap: wrap; gap: 4px 8px;
  margin: var(--space-5) auto 0; border-bottom: 1px solid var(--d-hairline);
}
.demonstrations .dg-tab {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--d-muted); background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 12px 14px; margin-bottom: -1px; cursor: pointer;
  transition: color 0.2s var(--ease-deliberate);
}
.demonstrations .dg-tab .n { color: var(--d-gold-text); margin-right: 7px; }
.demonstrations .dg-tab:hover { color: var(--d-ink); }
.demonstrations .dg-tab[aria-selected="true"] { color: var(--d-ink); border-bottom-color: var(--d-gold); }
.demonstrations .dg-tab:focus-visible { outline: 2px solid var(--d-gold-text); outline-offset: 2px; border-radius: 2px; }

/* ---------- instrument panels ---------- */
.demonstrations .demo { padding: var(--space-6) 0 var(--space-8); }
.demonstrations .demo[hidden] { display: none; }
.demonstrations .demo:focus { outline: none; }
.demonstrations .demo:focus-visible { outline: 2px solid var(--d-gold-text); outline-offset: 2px; border-radius: 2px; }
.demonstrations h2 {
  font-family: var(--font-display); font-weight: 400; font-variation-settings: 'opsz' 96;
  color: var(--d-bark); letter-spacing: -0.012em;
  font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.06; margin: var(--space-2) 0 var(--space-2); max-width: 20ch;
}
.demonstrations .demo .dek { margin-bottom: var(--space-5); }

.demonstrations .surface { background: var(--d-surface); border-radius: 16px; padding: var(--space-4) var(--space-4) var(--space-3); }
.demonstrations svg { display: block; width: 100%; height: auto; }

.demonstrations .rail { padding: 14px 2px 0; }
.demonstrations input[type=range] { appearance: none; -webkit-appearance: none; width: 100%; height: 30px; background: transparent; cursor: pointer; }
.demonstrations input[type=range]:focus-visible { outline: 2px solid var(--d-gold-text); outline-offset: 4px; border-radius: 2px; }
.demonstrations input[type=range]::-webkit-slider-runnable-track { height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--deep-bark) 20%, transparent); }
.demonstrations input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--d-bark); border: 3px solid var(--d-surface); box-shadow: 0 0 0 1px var(--d-hairline); margin-top: -8px; }
.demonstrations input[type=range]::-moz-range-track { height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--deep-bark) 20%, transparent); }
.demonstrations input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--d-bark); border: 3px solid var(--d-surface); }

.demonstrations .transport { display: flex; align-items: center; gap: 10px; padding-top: 10px; flex-wrap: wrap; }
.demonstrations .btn { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 500; color: var(--d-ink); background: var(--parchment); border: 1px solid var(--d-hairline); border-radius: 999px; padding: 9px 22px; cursor: pointer; transition: background 0.2s var(--ease-deliberate), color 0.2s; }
.demonstrations .btn:hover { background: var(--parchment-deep); }
.demonstrations .btn.ghost { border-color: transparent; color: var(--d-muted); background: transparent; }
.demonstrations .btn.ghost:hover { color: var(--d-ink); background: var(--parchment-deep); }
.demonstrations .btn:focus-visible { outline: 2px solid var(--d-gold-text); outline-offset: 2px; }
.demonstrations .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--d-muted); }

.demonstrations .read { display: flex; gap: 16px; align-items: baseline; padding: 20px 2px 6px; }
.demonstrations .read .who { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-gold-text); white-space: nowrap; }
.demonstrations .read p { font-size: var(--text-lg); line-height: 1.45; color: var(--d-ink); max-width: 62ch; margin: 0; }
.demonstrations .tagline { display: flex; justify-content: space-between; gap: 16px; padding: 14px 2px 0; flex-wrap: wrap; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--d-muted); }
.demonstrations .dm-floor { font-size: var(--text-sm); line-height: 1.5; color: var(--d-muted); margin: 14px 2px 0; max-width: 60ch; }
.demonstrations .notelink { margin-top: var(--space-3); font-size: var(--text-base); color: var(--d-muted); }
.demonstrations .notelink a { color: var(--d-gold-text); font-weight: 500; text-decoration: none; }
.demonstrations .notelink a:hover { text-decoration: underline; text-underline-offset: 3px; }

.demonstrations .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.demonstrations .panelhead { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--d-muted); padding: 0 2px 8px; margin: 0; }
.demonstrations .panelhead b { color: var(--d-ink); font-weight: 500; }
.demonstrations .stack > * + * { margin-top: 10px; }

/* tenure detents */
.demonstrations .detents { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--d-muted); padding: 2px 4px 0; }
.demonstrations .detents span.on { color: var(--d-ink); }

/* svg vocabulary */
.demonstrations .ax { font-family: var(--font-mono); font-size: 10.5px; fill: var(--d-muted); letter-spacing: 0.07em; }
.demonstrations .gl { stroke: var(--d-grid); stroke-width: 1; }
.demonstrations .bandfill { fill: var(--d-band); }
.demonstrations .tr { fill: none; stroke: var(--d-bark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.demonstrations .trB { fill: none; stroke: var(--d-coral); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.demonstrations .trH { fill: none; stroke: color-mix(in srgb, var(--d-bark) 55%, transparent); stroke-width: 1.8; }
.demonstrations .dotI { fill: var(--d-bark); }
.demonstrations .goldline { fill: none; stroke: var(--d-gold); stroke-width: 2.2; stroke-linecap: round; }
.demonstrations .goldmark { fill: var(--d-gold); }
.demonstrations .goldtick { stroke: var(--d-gold); stroke-width: 1.6; }
.demonstrations .cursor { stroke: var(--d-bark); stroke-width: 1; opacity: 0.5; }
.demonstrations .cdot { fill: var(--d-bark); stroke: var(--d-surface); stroke-width: 1.5; }
.demonstrations .conefill { fill: color-mix(in srgb, var(--deep-bark) 8%, transparent); }
.demonstrations .conemid { fill: none; stroke: var(--d-bark); stroke-width: 1.6; stroke-dasharray: 5 4; }
.demonstrations .lbl { font-family: var(--font-mono); font-size: 10.5px; fill: var(--d-gold-text); letter-spacing: 0.12em; }

.demonstrations .evid { display: none; padding: 18px 2px 4px; max-width: 520px; }
.demonstrations .evid.show { display: block; }
.demonstrations .evhead { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-muted); margin-bottom: 10px; }
.demonstrations .evrow { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; margin-top: 8px; font-size: 13.5px; color: var(--d-ink); }
.demonstrations .evtrack { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--deep-bark) 12%, transparent); overflow: hidden; }
.demonstrations .evfill { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--deep-bark) 82%, transparent); }
.demonstrations .evfill.dim { background: color-mix(in srgb, var(--deep-bark) 35%, transparent); }

.demonstrations .dg-foot { padding: var(--space-16) 0 var(--space-20); }
.demonstrations .dg-foot p { color: var(--d-muted); font-size: var(--text-base); max-width: 64ch; margin: 0; }
.demonstrations .dg-foot a { color: var(--d-gold-text); }

@media (max-width: 780px) {
  .demonstrations .dg-hero { padding: var(--space-12) 0 var(--space-6); }
  .demonstrations .demo { padding: var(--space-12) 0 var(--space-4); }
  .demonstrations .duo { grid-template-columns: 1fr; }
  .demonstrations .surface { padding: var(--space-3) 18px 16px; }
  .demonstrations .read p { font-size: var(--text-base); }
  .demonstrations .count { width: 100%; margin-left: 0; order: 3; }
}
@media (max-width: 560px) {
  .demonstrations .ax { font-size: 21px; }
  .demonstrations .tr, .demonstrations .trB { stroke-width: 3; }
  .demonstrations .trH { stroke-width: 2.6; }
  .demonstrations .goldline { stroke-width: 3.2; }
  .demonstrations .lbl { display: none; }
}
