/* =========================================================================
   SHOWCASE — the two interactive proofs. Values from tokens.css only.
   1. System overlay  — the design system, drawn on the live page.
   2. Skill-file demo — a PRD line assembling into an on-brand screen.
   ========================================================================= */

/* ---- 1 · System overlay ------------------------------------------------ */

.sys-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 36px; padding-inline: var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-full);
  background: transparent; color: var(--ink-secondary);
  font-family: var(--font-mono); font-size: var(--t-mono);
  letter-spacing: var(--tr-mono); text-transform: uppercase;
  cursor: pointer;
  transition: color var(--d-micro) var(--e-soft),
              border-color var(--d-micro) var(--e-soft),
              background var(--d-micro) var(--e-soft);
}
.sys-btn:hover { color: var(--ink); border-color: var(--ink-meta); }
.sys-btn__key {
  display: grid; place-items: center;
  min-width: 16px; height: 16px; padding-inline: 3px;
  border: 1px solid var(--border); border-radius: var(--r-1);
  font-size: 9px; line-height: 1; color: var(--ink-meta);
}
[data-system="on"] .sys-btn {
  color: var(--on-accent); background: var(--accent); border-color: var(--accent);
}
[data-system="on"] .sys-btn__key { border-color: var(--on-accent); color: var(--on-accent); }
@media (max-width: 860px) { .sys-btn { display: none; } }

.sys-overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  pointer-events: none; opacity: 0;
  transition: opacity var(--d-state) var(--e-soft);
}
[data-system="on"] .sys-overlay { opacity: 1; }

/* Column grid, locked to .shell geometry */
.sys-overlay__cols {
  width: 100%; max-width: var(--maxw); height: 100%;
  margin-inline: auto; padding-inline: var(--gutter);
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s-5);
}
.sys-overlay__cols i { background: var(--accent-soft); opacity: 0.4; }
/* 8px baseline rhythm */
.sys-overlay__base {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    to bottom, var(--accent-line) 0 1px, transparent 1px 8px);
  opacity: 0.18;
}

/* Live token readout — values are read from the running page, not typed. */
.sys-panel {
  position: fixed; z-index: var(--z-cursor);
  left: var(--gutter); bottom: var(--gutter);
  width: min(23rem, calc(100vw - var(--gutter) * 2));
  padding: var(--s-4);
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  font-family: var(--font-mono); font-size: var(--t-mono);
  opacity: 0; transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--d-state) var(--e-out),
              transform var(--d-state) var(--e-out);
}
[data-system="on"] .sys-panel { opacity: 1; transform: none; pointer-events: auto; }
.sys-panel__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--s-3); padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--accent-ink);
}
.sys-panel__head span:last-child { color: var(--ink-meta); }
.sys-panel__grp { margin-bottom: var(--s-3); }
.sys-panel__grp:last-child { margin-bottom: 0; }
.sys-panel__lbl {
  color: var(--ink-meta); letter-spacing: var(--tr-mono);
  text-transform: uppercase; margin-bottom: var(--s-2); display: block;
}
.sys-row {
  display: flex; justify-content: space-between; gap: var(--s-3);
  padding-block: 3px; color: var(--ink-secondary);
}
.sys-row b { color: var(--ink); font-weight: 500; }
.sys-swatches { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.sys-swatch {
  width: 26px; height: 26px; border-radius: var(--r-1);
  border: 1px solid var(--border-subtle);
}
.sys-scale { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.sys-scale i {
  display: block; width: 10px; background: var(--accent);
  border-radius: 1px 1px 0 0; opacity: 0.55;
}

/* Outline every component while the overlay is on */
[data-system="on"] .card,
[data-system="on"] .pillar,
[data-system="on"] .product,
[data-system="on"] .metric,
[data-system="on"] .chip,
[data-system="on"] .practice__row,
[data-system="on"] .tl__entry {
  outline: 1px dashed var(--accent-line); outline-offset: 2px;
}
[data-system="on"] .sec-head__title { outline: 1px solid var(--accent-line); }

@media (prefers-reduced-motion: reduce) {
  .sys-overlay, .sys-panel { transition: none; }
}

/* ---- 2 · Skill-file demo ---------------------------------------------- */

.demo {
  border: 1px solid var(--border); border-radius: var(--r-3);
  background: var(--bg-raised); overflow: hidden;
}
.demo__bar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: var(--t-mono);
  color: var(--ink-meta); letter-spacing: var(--tr-mono);
}
.demo__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.demo__grid { display: grid; }
@media (min-width: 780px) { .demo__grid { grid-template-columns: 15rem minmax(0, 1fr); } }

.demo__prompts {
  padding: var(--s-4); display: grid; gap: var(--s-2); align-content: start;
  border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 780px) {
  .demo__prompts { border-bottom: 0; border-right: 1px solid var(--border-subtle); }
}
.demo__hint {
  font-family: var(--font-mono); font-size: var(--t-mono);
  color: var(--ink-meta); letter-spacing: var(--tr-mono);
  text-transform: uppercase; margin-bottom: var(--s-1);
}
.demo__prompt {
  text-align: left; cursor: pointer;
  padding: var(--s-3); border-radius: var(--r-2);
  border: 1px solid var(--border-subtle); background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-ui); font-size: var(--t-small); line-height: 1.4;
  transition: border-color var(--d-micro) var(--e-soft),
              color var(--d-micro) var(--e-soft),
              background var(--d-micro) var(--e-soft);
}
.demo__prompt:hover { color: var(--ink); border-color: var(--ink-meta); }
.demo__prompt[aria-pressed="true"] {
  color: var(--ink); border-color: var(--accent);
  background: var(--accent-soft);
}
.demo__caret { color: var(--accent-ink); margin-right: 4px; }

.demo__stage {
  position: relative; padding: var(--s-4);
  min-height: 19rem; background: var(--bg);
}
.demo__idle {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--t-mono);
  color: var(--ink-meta); letter-spacing: var(--tr-mono);
  text-transform: uppercase; text-align: center; padding: var(--s-4);
}
.demo__screen { display: grid; gap: var(--s-3); }

/* Every part animates in on the site's own curve and stagger */
.demo__el { opacity: 0; transform: translateY(10px); }
.demo__screen--run .demo__el {
  animation: demoIn var(--d-enter) var(--e-out) forwards;
  animation-delay: calc(var(--i) * var(--stagger));
}
@keyframes demoIn { to { opacity: 1; transform: none; } }

.demo__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.demo__h { height: 13px; width: 42%; border-radius: var(--r-1); background: var(--ink); opacity: 0.85; }
.demo__sub { height: 8px; width: 22%; border-radius: var(--r-1); background: var(--ink-meta); opacity: 0.5; }
.demo__chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.demo__c {
  height: 22px; border-radius: var(--r-full);
  border: 1px solid var(--border); padding-inline: var(--s-3);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-meta); letter-spacing: var(--tr-mono);
}
.demo__c--on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.demo__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.demo__k {
  border: 1px solid var(--border-subtle); border-radius: var(--r-2);
  padding: var(--s-3); background: var(--bg-card);
}
.demo__k b {
  display: block; font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 500; letter-spacing: var(--tr-tight);
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.demo__k b.is-accent { color: var(--accent-ink); }
.demo__k span {
  display: block; margin-top: 2px;
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-meta); letter-spacing: var(--tr-mono);
}
.demo__rows {
  border: 1px solid var(--border-subtle); border-radius: var(--r-2);
  overflow: hidden; background: var(--bg-card);
}
.demo__r {
  display: grid; grid-template-columns: 1fr 3.5rem auto;
  gap: var(--s-3); align-items: center;
  padding: var(--s-3); border-bottom: 1px solid var(--border-subtle);
}
.demo__r:last-child { border-bottom: 0; }
.demo__r i { display: block; height: 7px; border-radius: var(--r-1); background: var(--ink-meta); opacity: 0.4; }
.demo__r u {
  text-decoration: none; justify-self: end; white-space: nowrap;
  font-family: var(--font-mono); font-size: 9px;
  padding: 2px var(--s-2); border-radius: var(--r-full);
  border: 1px solid var(--border); color: var(--ink-meta);
}
.demo__r u.is-flag { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.demo__bars { display: grid; gap: var(--s-2); }
.demo__bar-row { display: grid; grid-template-columns: 5rem 1fr; gap: var(--s-3); align-items: center; }
.demo__bar-row em {
  font-style: normal; font-family: var(--font-mono);
  font-size: 9px; color: var(--ink-meta); letter-spacing: var(--tr-mono);
}
.demo__track { height: 10px; border-radius: var(--r-1); background: var(--border-subtle); overflow: hidden; }
.demo__fill { height: 100%; background: var(--ink-meta); opacity: 0.55; border-radius: var(--r-1); }
.demo__fill.is-accent { background: var(--accent); opacity: 1; }
.demo__empty {
  display: grid; gap: var(--s-3); place-items: center; text-align: center;
  padding: var(--s-7) var(--s-4);
  border: 1px dashed var(--border); border-radius: var(--r-2);
}
.demo__empty i {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px dashed var(--accent-line); display: block;
}
.demo__empty span {
  font-family: var(--font-mono); font-size: var(--t-mono);
  color: var(--ink-meta); letter-spacing: var(--tr-mono); text-transform: uppercase;
}
.demo__note {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: var(--t-mono);
  color: var(--ink-meta); line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
  .demo__el { opacity: 1; transform: none; }
  .demo__screen--run .demo__el { animation: none; }
}

/* ---- Demo placement inside the practice row ---------------------------- */
.practice__row--demo { row-gap: var(--s-5); }
@media (min-width: 900px) {
  .practice__row--demo { grid-template-columns: 4rem minmax(0, 22ch) minmax(0, 1fr); }
  .practice__row--demo .demo { grid-column: 2 / -1; }
}
