/*
 * The review deck's own components, on top of `deck.css`.
 *
 * `deck.css` is the shared one: tokens, slides, cards, tables, tags, the SVG diagram classes and
 * the print rules. It is copied byte for byte from `pitch/`, so a change to the design system is
 * made there and copied here — not edited in two places.
 *
 * What this file adds is the interactive half, and every piece of it degrades. With JavaScript
 * blocked or broken: the stat figures are already in the HTML, every tab panel is visible rather
 * than hidden, the diagram's detail text is a list under the picture, and the bug cards are
 * `<details>` the browser opens by itself. A deck that goes blank in a meeting room because a
 * script failed is the one thing this cannot do.
 */

/* ---------------------------------------------------------------------------------------
 * Figures
 * ------------------------------------------------------------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 1rem;
  width: 100%;
}

.stat {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.stat__value {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.stat__label {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.stat__note {
  margin-top: 0.15rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  opacity: 0.85;
}

/* ---------------------------------------------------------------------------------------
 * Pills — the control for the tabbed panels and the security layers
 * ------------------------------------------------------------------------------------ */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.pill[aria-selected="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pill__index {
  opacity: 0.6;
  margin-inline-end: 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* A panel is shown unless the script has taken charge, which it signals on <html>. */
.panel[hidden] {
  display: block;
}

.js .panel[hidden] {
  display: none;
}

/* ---------------------------------------------------------------------------------------
 * Two-column: what the customer sees, beside what NAB receives
 * ------------------------------------------------------------------------------------ */

.split {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  align-items: start;
  width: 100%;
}

@media (max-width: 60rem) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------------------------------
 * The phone
 *
 * Not a picture of a phone — a column of bubbles with the app's own rules applied: the bot on the
 * start side, the customer on the end side, direction set per bubble from the text itself so an
 * Arabic line reads right-to-left inside a left-to-right deck.
 * ------------------------------------------------------------------------------------ */

.phone {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 19rem;
}

.phone__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.phone__thread {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.bubble {
  max-width: 86%;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  unicode-bidi: isolate;
  animation: bubble-in 220ms ease both;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble {
    animation: none;
  }
}

.bubble--bot {
  align-self: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-end-start-radius: 4px;
}

.bubble--customer {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-end-end-radius: 4px;
}

.bubble__note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.7rem;
  opacity: 0.75;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  font-size: 0.78rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: var(--surface-raised);
  color: var(--text-primary);
  unicode-bidi: isolate;
}

/* ---------------------------------------------------------------------------------------
 * Code
 * ------------------------------------------------------------------------------------ */

.code {
  margin: 0;
  background: var(--ink);
  color: #dbe4ff;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

.slide--dark .code {
  background: #020819;
  border: 1px solid var(--ink-border);
}

.code b {
  color: #ffd9b0;
  font-weight: 600;
}

.code i {
  color: #8ea8e8;
  font-style: normal;
}

.code em {
  color: #7bdcb5;
  font-style: normal;
}

/* ---------------------------------------------------------------------------------------
 * Defects — native <details>, so they open without script and print open
 * ------------------------------------------------------------------------------------ */

.bugs {
  display: grid;
  gap: 0.6rem;
  width: 100%;
}

.bug {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--danger);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.bug[open] {
  border-inline-start-color: var(--primary);
}

.bug > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  list-style: none;
}

.bug > summary::-webkit-details-marker {
  display: none;
}

.bug > summary::after {
  content: "+";
  margin-inline-start: auto;
  color: var(--text-muted);
  font-weight: 400;
}

.bug[open] > summary::after {
  content: "−";
}

.bug__where {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bug__body {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.bug__body p {
  font-size: 0.88rem;
  margin: 0;
}

.bug__body p > b {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  display: block;
}

/* ---------------------------------------------------------------------------------------
 * Diagram hotspots
 * ------------------------------------------------------------------------------------ */

.node {
  cursor: pointer;
}

.node rect {
  transition: filter 120ms ease;
}

.node:hover rect,
.node:focus-visible rect {
  filter: brightness(0.97);
}

.node[aria-selected="true"] rect {
  stroke-width: 3;
}

.node:focus-visible {
  outline: none;
}

.node:focus-visible rect {
  stroke: var(--accent-strong);
  stroke-width: 3;
}

.detail {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  min-height: 5.5rem;
}

.detail h3 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
}

.detail p {
  margin: 0;
  font-size: 0.9rem;
}

/* The same text as a list, for print and for a reader with no script. */
.js .detail-fallback {
  display: none;
}

/* ---------------------------------------------------------------------------------------
 * Small type
 * ------------------------------------------------------------------------------------ */

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  font-size: 0.88rem;
  margin: 0;
}

.kv dt {
  color: var(--text-muted);
}

.kv dd {
  margin: 0;
}

.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.linkrow a {
  color: var(--primary);
}

.note {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: var(--measure);
}

.two-col {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  width: 100%;
  align-items: start;
}

.replay {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  cursor: pointer;
}

@media print {
  .pill,
  .replay {
    display: none;
  }

  .js .panel[hidden] {
    display: block;
  }

  .js .detail-fallback {
    display: block;
  }
}
