/* ============================================================================
   base.css — structural styles for the scroll-snap deck engine.
   Theme-agnostic: every colour/font references a token from theme-*.css.
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #1a0f2e;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- scroll-snap container: CSS handles the snap, GSAP handles transitions ----
   `mandatory` gives firm slide-to-slide snapping. We omit `scroll-snap-stop:
   always`, and per the Scroll Snap spec a snap area LARGER than the scrollport
   relaxes mandatory snapping — so slides taller than the viewport (tagged
   `.slide--tall` by the engine) are free-scrolled to read, while normal slides
   still snap firmly. */
.deck {
  height: 100vh;
  /* every slide sizes against this frame (cqw/cqh, @container deck), never the
     viewport — so the same slide renders identically in a scaled editor canvas
     or a homepage thumbnail (`.slide-frame`). Never use vw/vh inside a slide. */
  container: deck / size;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.deck::-webkit-scrollbar {
  display: none;
}
.deck:focus {
  outline: none;
}

/* fixed-size static frame for a single slide (editor canvas, thumbnails).
   Rendered at its real size (1600×900) and scaled with a transform; a tall
   slide overflows the frame downwards. */
.slide-frame {
  container: deck / size;
  position: relative;
  width: 1600px;
  height: 900px;
  overflow: visible;
  transform-origin: 0 0;
}
.slide-frame .slide {
  scroll-snap-align: none;
}

/* ---- slide shell ---- */
.slide {
  position: relative;
  min-height: 100cqh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--slide-pad-y) + 1.5rem) var(--slide-pad-x);
  background: var(--paper);
  overflow: visible; /* let blobs show fully and tall content expand the slide */
}
.slide__inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

/* gradient "frame" slides */
.slide--dark {
  background: var(--grad);
  color: var(--ink);
}

/* persistent chrome: logo + slide counter (added by the engine) */
.slide__brand {
  position: absolute;
  right: var(--slide-pad-x);
  bottom: calc(var(--slide-pad-y) * 0.7);
  display: flex;
  align-items: center;
  user-select: none;
  z-index: 4;
}
.slide__brand-logo {
  height: clamp(20px, 2.4cqw, 28px);
  width: auto;
  display: block;
}
/* the asset is the white logo; recolor it for light (paper) slides while
   keeping the teal accent hue (invert flips lightness, hue-rotate restores hue) */
.slide__brand-logo {
  filter: var(--logo-filter, none);
}
.slide__num {
  position: absolute;
  left: var(--slide-pad-x);
  bottom: calc(var(--slide-pad-y) * 0.7);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  z-index: 4;
}

/* ---- shared typographic atoms ---- */
/* links written as [text](url) in rich fields */
.slide a[href^="http"],
.slide a[href^="mailto"] {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.slide a[href^="http"]:hover,
.slide a[href^="mailto"]:hover {
  color: var(--accent-ink);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(0.7rem, 1cqw, 0.82rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--accent-ink);
  margin: 0 0 1.1rem;
}
.eyebrow::before {
  content: "";
  width: 1.6rem;
  height: 2px;
  background: var(--accent);
}

.title {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.kicker {
  font-family: var(--font-body);
  font-weight: 800;
  color: var(--accent-ink);
  font-size: clamp(1.1rem, 1.8cqw, 1.45rem);
  margin: 0 0 0.3rem;
}
.subkicker {
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
  font-size: 1rem;
}

/* ============================================================================
   LAYOUT: cover
   ============================================================================ */
.l-cover .slide__inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2rem;
  position: relative;
  z-index: 2;
}
.l-cover .title,
.hero .title {
  font-size: clamp(2.8rem, 6.5cqw, 5.4rem);
  font-weight: 800;
}
.l-cover .cover-meta,
.hero .cover-meta {
  margin-top: 2.2rem;
}
.l-cover .cover-author,
.hero .cover-author {
  font-size: clamp(1.1rem, 2cqw, 1.6rem);
  font-weight: 600;
  color: var(--ink-soft);
}
.l-cover .cover-date,
.hero .cover-date {
  margin-top: 0.6rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
/* translucent 3D-glass blob motif (CSS-generated; no external asset).
   Real child elements (not pseudo) so GSAP can parallax them on scroll.
   No overflow:hidden — the full glass shapes stay visible. */
.blobs {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.blob {
  position: absolute;
  display: block;
  border-radius: 48% 52% 60% 40% / 52% 44% 56% 48%;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.55), rgba(173, 216, 255, 0.18) 55%, rgba(124, 58, 237, 0.05));
  box-shadow: inset 0 8px 30px rgba(255, 255, 255, 0.45), 0 30px 80px -20px rgba(60, 21, 118, 0.6);
  backdrop-filter: blur(4px);
  will-change: transform;
}
.blob--a {
  width: clamp(170px, 22cqw, 320px);
  aspect-ratio: 1;
  right: 9%;
  top: 24%;
  transform: rotate(-12deg);
}
.blob--b {
  width: clamp(110px, 14cqw, 200px);
  aspect-ratio: 1;
  right: 21%;
  top: 46%;
  border-radius: 56% 44% 38% 62% / 46% 58% 42% 54%;
  transform: rotate(18deg);
  opacity: 0.9;
}
/* on section dividers, sit the motif a touch lower/left and softer */
.l-section .blob--a {
  right: 4%;
  top: 30%;
  opacity: 0.7;
}
.l-section .blob--b {
  right: 16%;
  top: 50%;
  opacity: 0.55;
}

/* ============================================================================
   LAYOUT: section divider
   ============================================================================ */
.l-section .slide__inner {
  position: relative;
  z-index: 2;
}
/* oversized ghost numeral on the LEFT (blobs live on the right) so a
   number-only divider still reads as composed. Lifted out of .slide__inner by
   the engine (like .blobs) so entrance clip/transforms never crop it; it sits
   between the slide background and the content (inner is z-index: 2). */
.l-section .section-figure,
.hero .section-figure {
  position: absolute;
  top: 50%;
  left: clamp(1rem, 4cqw, 4rem);
  transform: translateY(-50%);
  z-index: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  line-height: 0.8;
  font-size: clamp(13rem, 32cqw, 28rem);
  color: rgba(255, 255, 255, 0.08);
  pointer-events: none;
  user-select: none;
}
/* hero dividers: above the decor (z 1, painted after it), below the copy */
.hero .section-figure {
  z-index: 1;
}
.l-section .section-num,
.hero .section-num {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.2rem, 2.4cqw, 1.9rem);
  color: var(--accent-ink);
  margin: 0 0 0.6rem;
}
.l-section .title {
  font-size: clamp(2.6rem, 7cqw, 5.6rem);
  font-weight: 800;
}
.l-section .section-rule {
  width: 4.5rem;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 1.6rem;
}
.l-section .section-sub {
  margin: 1.4rem 0 0;
  max-width: 48ch;
  font-size: clamp(1rem, 1.6cqw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ============================================================================
   LAYOUT: index / TOC timeline
   ============================================================================ */
.l-index .title {
  font-size: clamp(2rem, 4cqw, 3rem);
  margin-bottom: 2.4rem;
}
.toc {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.4rem;
  border-left: 2px solid var(--hair);
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 2cqh, 1.4rem);
  max-width: 640px;
}
.toc li {
  position: relative;
  font-size: clamp(1.05rem, 1.6cqw, 1.3rem);
  font-weight: 600;
  color: var(--ink-soft);
}
.toc li::before {
  content: "";
  position: absolute;
  left: calc(-1.4rem - 7px);
  top: 0.55em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 4px var(--paper);
}

/* ============================================================================
   LAYOUT: statement / big pull-quote
   ============================================================================ */
.l-statement .slide__inner {
  max-width: 1000px;
}
.l-statement .statement-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4.2cqw, 3.4rem);
  line-height: 1.18;
  margin: 0;
  color: var(--ink);
}
.l-statement .statement-text .hl {
  color: var(--accent-ink);
  font-style: italic;
}

/* ============================================================================
   LAYOUT: findings (status icons + optional figures)
   ============================================================================ */
.l-findings .findings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.4rem;
  align-items: stretch;
  min-height: 60cqh; /* fill the available height of the slide */
}
.l-findings.has-figures .findings-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}
.l-findings .findings-grid > .findings-main,
.l-findings .findings-figures {
  min-width: 0; /* allow grid children to shrink so content wraps, no overflow */
}
.l-findings .findings-grid > .findings-main {
  display: flex;
  flex-direction: column;
}
.l-findings .title {
  font-size: clamp(1.6rem, 3.2cqw, 2.5rem);
  margin-bottom: 1.6rem;
}
.findings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1; /* grow to fill the column height */
  display: flex;
  flex-direction: column;
  justify-content: space-evenly; /* distribute findings over the full height */
  gap: 0.95rem;
}
/* without side figures: keep line length readable instead of full-bleed */
.l-findings:not(.has-figures) .findings-list {
  max-width: 70ch;
}
.finding {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  font-size: clamp(0.98rem, 1.35cqw, 1.12rem);
  line-height: 1.45;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.finding__icon {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  margin-top: 0.08em;
}
.finding__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.finding b {
  color: var(--ink);
}
/* optional recommendation line under a finding (item `tip`) */
.finding__tip {
  display: flex;
  align-items: start;
  gap: 0.45rem;
  margin-top: 0.4rem;
  font-size: 0.9em;
  line-height: 1.4;
  color: var(--accent-ink);
}
.finding__tip svg {
  flex: none;
  width: 1em;
  height: 1em;
  margin-top: 0.16em;
}
.findings-figures {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%; /* share the full slide height with the findings list */
}
.findings-figures figure {
  margin: 0;
  flex: 1 1 0; /* figures split the column height evenly */
  min-height: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--band);
}
.findings-figures img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.findings-figures figcaption {
  display: none;
}

/* ============================================================================
   LAYOUT: icon-list (methodology) + icon-grid (USPs)
   ============================================================================ */
.l-icon-list .slide__inner,
.l-icon-grid .slide__inner {
  position: relative;
  z-index: 0;
}
/* keep text above the decorative ring */
.l-icon-list .eyebrow,
.l-icon-list .title,
.icon-rows {
  position: relative;
  z-index: 1;
}
.l-icon-list .title,
.l-icon-grid .title {
  font-size: clamp(1.8rem, 3.4cqw, 2.6rem);
  margin-bottom: 2rem;
}
.icon-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(1.2rem, 3cqh, 2.2rem);
  max-width: 760px;
}
.icon-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.4rem;
  align-items: center;
}
.icon-badge {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--band);
  color: var(--violet-ink);
  flex: none;
}
.icon-badge svg {
  width: 1.6rem;
  height: 1.6rem;
}
.icon-row p {
  margin: 0;
  font-size: clamp(1rem, 1.5cqw, 1.2rem);
  line-height: 1.5;
  color: var(--ink-soft);
}

.icon-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.4rem;
}
/* 5, 6 or 9 cards: three columns instead of a 4 + orphan split */
.icon-cards:has(> :nth-child(5):last-child),
.icon-cards:has(> :nth-child(6):last-child),
.icon-cards:has(> :nth-child(9):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@container deck (max-width: 820px) {
  .icon-cards:has(> :nth-child(5):last-child),
  .icon-cards:has(> :nth-child(6):last-child),
  .icon-cards:has(> :nth-child(9):last-child) {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}
.icon-card {
  padding: 1.6rem;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-card);
}
.icon-card .icon-badge {
  margin-bottom: 1rem;
}
.icon-card h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
}
.icon-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.45;
}
/* 7+ cards: icon beside the label, tighter cards, so three rows fit the frame */
.icon-cards:has(> :nth-child(7)) {
  gap: clamp(0.8rem, 2cqh, 1.2rem);
}
.icon-cards:has(> :nth-child(7)) .icon-card {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.9rem;
  row-gap: 0.6rem;
  align-items: center;
  align-content: start;
  padding: clamp(0.8rem, 2cqh, 1.1rem) clamp(1rem, 1.4cqw, 1.3rem);
}
.icon-cards:has(> :nth-child(7)) .icon-badge {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0;
}
.icon-cards:has(> :nth-child(7)) .icon-badge svg {
  width: 1.35rem;
  height: 1.35rem;
}
.icon-cards:has(> :nth-child(7)) .icon-card h3 {
  margin: 0;
  font-size: clamp(0.95rem, 1.15cqw, 1.1rem);
}
.icon-cards:has(> :nth-child(7)) .icon-card p {
  grid-column: 1 / -1;
  font-size: clamp(0.82rem, 1.02cqw, 0.98rem);
}

/* decorative gradient ring (icon-list) */
.deco-ring {
  position: absolute;
  width: 30cqw;
  max-width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: clamp(28px, 5cqw, 60px) solid transparent;
  background: var(--grad) border-box;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  left: -13cqw;
  bottom: -11cqw;
  opacity: 0.16;
  z-index: 0;
  pointer-events: none;
}

/* ============================================================================
   LAYOUT: stat-grid (animated counters)
   ============================================================================ */
.l-stat-grid .title {
  font-size: clamp(1.8rem, 3.4cqw, 2.6rem);
  margin-bottom: 2.4rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(1.5rem, 4cqw, 3.5rem);
}
.stat {
  border-top: 3px solid var(--accent);
  padding-top: 1rem;
}
.stat__value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 8cqw, 6rem);
  line-height: 0.95;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.1em;
}
.stat__suffix {
  font-size: 0.5em;
  color: var(--accent-ink);
}
.stat__label {
  margin-top: 0.7rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.4cqw, 1.1rem);
}

/* ============================================================================
   LAYOUT: data-tables (colored columns) + key-insight callout
   ============================================================================ */
.l-data-tables .title {
  font-size: clamp(1.6rem, 3.2cqw, 2.4rem);
  margin-bottom: 0.4rem;
}
.l-data-tables .lead {
  color: var(--ink-soft);
  max-width: 80ch;
  margin: 0 0 1.6rem;
  font-size: clamp(0.95rem, 1.3cqw, 1.05rem);
  line-height: 1.5;
}
.tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  align-items: start;
}
.dtable {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--hair);
  background: var(--paper);
}
.dtable__head {
  padding: 0.85rem 1rem;
  color: #fff;
  background: var(--violet-fill);
}
.dtable--magenta .dtable__head {
  background: #b5179e;
}
.dtable--teal .dtable__head {
  background: var(--accent-ink);
}
.dtable__head h3 {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dtable__head p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  font-style: italic;
  opacity: 0.85;
}
.dtable table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.dtable th {
  text-align: left;
  font-weight: 700;
  color: var(--ink-faint);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--hair);
}
.dtable td {
  padding: 0.5rem 1rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--hair);
}
.dtable tr:last-child td {
  border-bottom: none;
}
.dtable tr:nth-child(even) td {
  background: color-mix(in srgb, var(--band) 55%, transparent);
}
/* ==value== in a cell: circled figure (key numbers of a comparison) */
.dtable td .hl {
  display: inline-block;
  padding: 0.12em 0.7em;
  border: 2px solid var(--accent);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.dtable td:last-child {
  font-weight: 800;
  color: var(--accent-ink);
  text-align: right;
  white-space: nowrap;
}

/* ============================================================================
   LAYOUT: callout (purple key-insight band) — also used inside data-tables
   ============================================================================ */
.callout {
  margin-top: 1.6rem;
  padding: 1.3rem 1.6rem;
  border-radius: var(--radius);
  background: var(--grad);
  color: #fff;
  display: flex;
  gap: 1rem;
  align-items: baseline;
  box-shadow: var(--shadow-card);
}
.callout__label {
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--callout-label, #5ff0df);
  flex: none;
  padding-top: 0.1em;
}
.callout__text {
  margin: 0;
  font-size: clamp(0.98rem, 1.4cqw, 1.15rem);
  line-height: 1.45;
}
.l-callout .callout {
  margin: 0;
  padding: clamp(2rem, 5cqw, 3.5rem);
}
.l-callout .callout__text {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5cqw, 2.6rem);
  line-height: 1.25;
}

/* ============================================================================
   LAYOUT: conclusion
   ============================================================================ */
.l-conclusion .title {
  font-size: clamp(2rem, 4.2cqw, 3.2rem);
  margin-bottom: 1.8rem;
  max-width: 18ch;
}
.l-conclusion .points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  max-width: 900px;
}
.l-conclusion .points li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  font-size: clamp(1rem, 1.5cqw, 1.2rem);
  line-height: 1.45;
  color: var(--ink-soft);
}
.l-conclusion .points li::before {
  content: "→";
  color: var(--accent-ink);
  font-weight: 800;
}

/* ============================================================================
   deck chrome: progress rail, dot nav, error
   ============================================================================ */
.deck-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 50;
}
.deck-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent, #12c2b0);
  transition: width 0.2s ease;
}
.deck-nav {
  position: fixed;
  right: clamp(0.8rem, 2cqw, 1.6rem);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 50;
}
.deck-nav button {
  position: relative;
  width: 11px;
  height: 11px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: rgba(150, 130, 185, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}
/* chapter label on hover */
.deck-nav button::after {
  content: attr(title);
  position: absolute;
  right: 180%;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: #2c1b47;
  background: #fff;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  box-shadow: 0 6px 18px -6px rgba(44, 27, 71, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.deck-nav button:hover::after,
.deck-nav button[aria-current="true"]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.deck-nav button:hover {
  transform: scale(1.3);
}
.deck-nav button[aria-current="true"] {
  background: var(--accent, #12c2b0);
  transform: scale(1.3);
}
.deck-nav button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.deck-error[hidden] {
  display: none; /* author `display` beats the [hidden] UA rule, so be explicit */
}
.deck-error {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #1a0f2e;
  color: #fff;
  font-family: var(--font-body, sans-serif);
  padding: 2rem;
  text-align: center;
  z-index: 100;
}

/* ============================================================================
   responsive: collapse multi-column layouts on small viewports
   ============================================================================ */
@container deck (max-width: 820px) {
  .l-cover .slide__inner,
  .l-findings.has-figures .findings-grid {
    grid-template-columns: 1fr;
  }
  .l-findings .findings-grid {
    min-height: 0;
  }
  .findings-list {
    justify-content: flex-start;
  }
  .blobs {
    opacity: 0.5;
  }
  .findings-figures {
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
  }
  .findings-figures figure {
    flex: 1 1 40%;
    aspect-ratio: 16 / 9;
  }
  .callout {
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* ============================================================================
   LAYOUT: scorecard (note /10 — global hero + graded rows)
   ============================================================================ */
.l-scorecard .title {
  font-size: clamp(1.6rem, 3.2cqw, 2.5rem);
  margin-bottom: 1.6rem;
}
/* hero global score */
.sc-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0.5rem;
}
.l-scorecard.sc-solo .sc-hero {
  min-height: 55cqh;
  justify-content: center;
}
.sc-hero__num {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  font-size: clamp(4rem, 16cqw, 9rem);
  color: var(--sc-ink, var(--sc-color));
}
.sc-hero__max {
  font-size: 0.35em;
  color: var(--ink-faint);
  margin-left: 0.15em;
}
.sc-hero__label {
  font-size: clamp(1rem, 2cqw, 1.5rem);
  color: var(--ink-soft);
  text-align: center;
  max-width: 40ch;
}
/* graded rows */
.sc-rows {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
  max-width: 80ch;
}
.sc-row {
  border-left: 3px solid var(--sc-color);
  padding: 0.1rem 0 0.1rem 1rem;
}
.sc-row__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.sc-row__label {
  font-weight: 600;
  color: var(--ink);
  font-size: clamp(1rem, 1.5cqw, 1.18rem);
}
.sc-row__note {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 1.8cqw, 1.5rem);
  color: var(--sc-ink, var(--sc-color));
}
.sc-row__max {
  font-size: 0.62em;
  color: var(--ink-faint);
}
.sc-bar {
  margin: 0.5rem 0 0.45rem;
  height: 6px;
  border-radius: 999px;
  background: var(--hair);
  overflow: hidden;
}
.sc-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--sc-color);
}
.sc-row__analyse {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(0.92rem, 1.25cqw, 1.03rem);
  line-height: 1.45;
}

/* ============================================================================
   accessibility: honour reduced-motion (engine also checks this)
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .deck {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================================
   showcase — one large screenshot (optionally framed) + numbered pins/notes
   ============================================================================ */
.l-showcase {
  /* image height budget under eyebrow + title + slide padding */
  --shw-h: max(16rem, calc(100cqh - 21rem));
}
.l-showcase.has-caption {
  --shw-h: max(16rem, calc(100cqh - 24rem));
}
.l-showcase .title {
  font-size: clamp(1.7rem, 3.4cqw, 2.6rem);
  margin-bottom: clamp(1.2rem, 2.6cqh, 2rem);
}
.shw-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: clamp(1.5rem, 4cqw, 3rem);
}
.l-showcase.has-notes .shw-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: center;
}
.l-showcase.img-right .shw-grid { direction: rtl; }
.l-showcase.img-right .shw-grid > * { direction: ltr; }
.shw-figure {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* frame + canvas shrink-wrap the image so % pins land on the right pixels */
.shw-frame {
  width: fit-content;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--paper);
}
.shw-frame--none {
  border: 1px solid var(--hair);
}
.shw-frame--browser {
  border: 1px solid var(--hair);
}
.shw-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.1rem;
  padding: 0 0.9rem;
  background: var(--band);
  border-bottom: 1px solid var(--hair);
}
.shw-bar i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--hair);
}
.shw-url {
  flex: 1;
  min-width: 0;
  margin-left: 0.6rem;
  padding: 0.18rem 0.8rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shw-frame--phone {
  border: 10px solid var(--ink);
  border-radius: 2.2rem;
}
.shw-stage {
  position: relative;
}
.shw-canvas {
  position: relative;
  width: fit-content;
  max-width: 100%;
}
.shw-canvas > img,
.shw-canvas > .ph {
  display: block;
  max-width: 100%;
  max-height: var(--shw-h);
  width: auto;
  height: auto;
}
.shw-canvas > .ph {
  width: min(60cqw, 720px);
  height: var(--shw-h);
}

/* pan: tall capture capped to the viewport, scrolled through on hover/focus */
.l-showcase.is-pan .shw-frame {
  width: min(100%, 760px);
}
.l-showcase.is-pan.has-notes .shw-frame {
  width: 100%;
}
.l-showcase.is-pan .shw-stage {
  max-height: var(--shw-h);
  overflow: hidden;
  cursor: ns-resize;
}
.l-showcase.is-pan .shw-stage:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.l-showcase.is-pan .shw-canvas {
  width: 100%;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.l-showcase.is-pan .shw-canvas > img {
  width: 100%;
  max-height: none;
}
.l-showcase.is-pan .shw-stage:hover .shw-canvas,
.l-showcase.is-pan .shw-stage:focus-visible .shw-canvas {
  transform: translateY(calc(-100% + var(--shw-h)));
  transition-duration: 8s;
}
.l-showcase.is-pan .shw-stage::after {
  /* scroll cue — fades away once the pan starts */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  width: 2.2rem;
  height: 2.2rem;
  margin-left: -1.1rem;
  border-radius: 50%;
  background: var(--accent-ink)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    center / 60% no-repeat;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s;
  pointer-events: none;
}
.l-showcase.is-pan .shw-stage:hover::after,
.l-showcase.is-pan .shw-stage:focus-visible::after {
  opacity: 0;
}

/* numbered pins + matching note badges (margins centre the pin, leaving
   `transform` free for the GSAP reveal) */
.shw-pin,
.shw-num {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
}
.shw-pin {
  position: absolute;
  margin: -0.95rem 0 0 -0.95rem;
  border: 3px solid #fff;
  box-sizing: content-box;
  box-shadow: 0 0 0 0 rgba(18, 194, 176, 0.55), 0 6px 16px -6px rgba(0, 0, 0, 0.5);
  animation: shw-pulse 2.4s ease-out infinite;
}
@keyframes shw-pulse {
  0% { box-shadow: 0 0 0 0 rgba(18, 194, 176, 0.55), 0 6px 16px -6px rgba(0, 0, 0, 0.5); }
  70%, 100% { box-shadow: 0 0 0 14px rgba(18, 194, 176, 0), 0 6px 16px -6px rgba(0, 0, 0, 0.5); }
}
.shw-side {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  min-width: 0;
  justify-self: stretch;
}
.shw-notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.shw-notes li {
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  gap: 0.9rem;
  align-items: start;
}
.shw-notes p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.3cqw, 1.08rem);
  line-height: 1.45;
}
.shw-notes b {
  color: var(--ink);
}
.shw-caveat {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--status-issue);
  border-radius: var(--radius-sm);
  background: var(--band);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}
.shw-caveat svg {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--status-issue);
}
.shw-caption {
  margin-top: 0.9rem;
  max-width: 70ch;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

@container deck (max-width: 820px) {
  .l-showcase { --shw-h: 60cqh; }
  .l-showcase.has-notes .shw-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .shw-pin { animation: none; }
  .l-showcase.is-pan .shw-stage { overflow-y: auto; }
  .l-showcase.is-pan .shw-canvas { transform: none !important; transition: none; }
  .l-showcase.is-pan .shw-stage::after { display: none; }
}

/* ---- viewer: back-to-decks link (hidden until hovered near the corner) ---- */
.deck-home {
  position: fixed;
  top: 0.9rem;
  left: 1rem;
  z-index: 50;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font: 600 0.75rem/1.2 var(--font-body, sans-serif);
  color: #2c1b47;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px -8px rgba(44, 27, 71, 0.5);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.deck-home:hover,
.deck-home:focus-visible {
  opacity: 1;
}

/* ---- render-error placeholder slide ---- */
.slide--error {
  background: #fff4f4;
}
.slide--error .slide__error-msg {
  font-family: ui-monospace, monospace;
  color: #a02020;
}

/* ============================================================================
   print / PDF — view.html?print=1 (engine/viewer.js renderPrint)
   One 1600×900 .slide-frame per slide = one page. Used by Print → Save as PDF
   and by the studio's PDF export (headless Chrome --print-to-pdf).
   ============================================================================ */
@page {
  size: 1600px 900px;
  margin: 0;
}
body.print-mode {
  height: auto;
  background: #2a2433;
}
.print-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 72px 0 24px;
}
.print-deck .print-page {
  flex: none;
  overflow: hidden;
  background: var(--paper, #fff);
  box-shadow: 0 16px 50px -20px rgba(0, 0, 0, 0.7);
}
.print-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  background: rgba(23, 20, 29, 0.92);
  color: #a69db5;
  font: 600 0.8rem/1 var(--font-body, sans-serif);
}
.print-bar button {
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 8px;
  background: #8b5cf6;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
@media print {
  body.print-mode {
    background: none;
  }
  .print-deck {
    display: block;
    padding: 0;
    zoom: 1 !important;
  }
  .print-deck .print-page {
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }
  .print-bar,
  .deck-nav,
  .deck-progress,
  .deck-home {
    display: none !important;
  }
  .print-mode * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
