/* Comparison demo pages. Built on ../styles.css (tokens, nav, tabs, media cards). */

.demo-page [hidden] { display: none !important; }

.demo-page { padding-top: 64px; }
.demo-page .nav-links a[aria-current="page"] { opacity: 1; }
.demo-page .nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px; background: var(--gold);
}

.demo-hero { padding: clamp(48px, 7vw, 92px) 0 clamp(24px, 3vw, 36px); text-align: center; }
.demo-hero h1 {
  margin: 14px auto 0; max-width: 900px;
  font-size: clamp(36px, 5.6vw, 68px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 820; text-wrap: balance;
}
.demo-hero h1 em { font-style: normal; color: var(--gold); }
.demo-hero .tabs { margin: 30px 0 0; }
.demo-hero .tab[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.demo-section { padding: clamp(40px, 6vw, 80px) 0; }
.demo-section.tint { background: var(--bg-tint); }
.demo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.demo-head h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 800; }
.demo-head p { margin: 0; color: var(--ink-2); font-size: 16px; }
.demo-head p b { color: var(--ink); }

/* Scoreboard */
.score { display: grid; gap: 12px; max-width: 920px; margin: 0 auto; }
.score-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 6px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.score-legend span { display: inline-flex; align-items: center; gap: 7px; }
.score-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.score-row { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 16px; }
.score-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.score-name small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.score-bar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.score-bar span {
  flex: var(--n) 1 0; display: grid; place-items: center; min-width: 0;
  background: var(--c); color: #fff; font-size: 14px; font-weight: 800;
}
.score-row.ours .score-name { color: var(--teal); }
.fall { --c: var(--coral); }
.jam { --c: var(--gold); }
.works { --c: var(--teal); }

/* Failure cards: one or two clips, then a short caption */
.cards { display: grid; gap: 18px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.two { grid-template-columns: repeat(2, 1fr); }
.demo-card {
  display: flex; flex-direction: column; margin: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card-media { display: grid; gap: 2px; background: var(--line); }
.card-media.split { grid-template-columns: 1fr 1fr; }
.clip { position: relative; aspect-ratio: 16 / 9; background: var(--stage); margin: 0; }
.clip video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clip-label {
  position: absolute; left: 10px; top: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: #26303a;
  font-size: 11.5px; font-weight: 750; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.clip-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #7b848d); }
.clip-label.bad { --dot: #d2553d; }
.clip-label.good { --dot: #2f8f80; }
.clip-label.plain { --dot: #7b848d; }
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.card-body h3 { font-size: 18px; letter-spacing: -0.02em; line-height: 1.2; }
.card-body p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.45; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.open-3d {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink); font-weight: 700; font-size: 12.5px; white-space: nowrap; transition: border-color 0.2s ease;
}
.open-3d:hover { border-color: var(--ink-3); }
.open-3d svg { width: 14px; height: 14px; }

/* Animation vs physics rows */
.versus { display: grid; gap: 22px; }
.versus-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0; }
.versus-row .card-media { border-radius: var(--radius) 0 0 var(--radius); }
.versus-row .card-body { justify-content: center; padding: 22px 24px; }

.demo-note { margin: 26px auto 0; max-width: 820px; text-align: center; color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.demo-next { display: flex; justify-content: center; margin-top: 30px; }

/* Interactive case page */
.case-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; padding: 20px 0 40px; }
/* align-self: start keeps the stages from stretching to the panel's height, which
   the 4:3 aspect ratio would turn into extra width. */
.case-stages { align-self: start; display: grid; gap: 2px; border-radius: var(--radius); overflow: hidden; background: var(--line); border: 1px solid var(--line); box-shadow: var(--shadow); }
.case-stages.split { grid-template-columns: 1fr 1fr; }
.case-stage { position: relative; aspect-ratio: 4 / 3; background: var(--stage); cursor: grab; touch-action: pan-y; }
.case-stages:not(.split) .case-stage { aspect-ratio: 16 / 10; }
.case-stage:active { cursor: grabbing; }
.case-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.case-stage .clip-label { pointer-events: none; }
.case-status { position: absolute; inset: 0; display: grid; place-items: center; color: #7b848d; font-size: 14px; font-weight: 600; pointer-events: none; }
.case-panel {
  align-self: start; display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.case-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.case-back:hover { color: var(--ink); }
.case-panel h1 { font-size: 24px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; }
.case-source { margin-top: -6px; color: var(--ink-3); font-size: 13px; font-weight: 650; }
.case-panel p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }
.case-phases { display: flex; flex-wrap: wrap; gap: 6px; }
.case-phases .tab { height: 36px; padding: 0 13px; font-size: 13.5px; }
.case-outcome { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 750; background: var(--surface-2); }
.case-outcome::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #7b848d); }
.case-outcome.good { --dot: var(--teal); }
.case-outcome.bad { --dot: var(--coral); }
.transport { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.transport button {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface);
}
.transport button svg { width: 15px; height: 15px; }
.transport input[type="range"] { width: 100%; accent-color: var(--gold); }
.case-time { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); min-width: 52px; text-align: right; }
.case-status-text { display: flex; flex-direction: column; gap: 14px; }
.case-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); }
.case-tools button { border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 700; cursor: pointer; }
.case-tools button:hover { color: var(--ink); }

@media (max-width: 1000px) {
  .cards.three { grid-template-columns: repeat(2, 1fr); }
  .versus-row { grid-template-columns: 1fr; }
  .versus-row .card-media { border-radius: var(--radius) var(--radius) 0 0; }
  .case-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .cards.three, .cards.two { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 1fr; gap: 6px; }
  .demo-page .nav-links a.nav-optional { display: none; }
  .case-stages.split { grid-template-columns: 1fr; }
}
