/* =========================================
   Sharded PIR — Reveal.js theme
   Visual language inherited from privreads.ethereum.foundation/presentations/pir
   ========================================= */

:root {
  /* Palette: Sage on white, with coral as the "this is consequential" accent.
   * Three-color discipline:
   *   --accent     teal: primary accent (titles, eyebrows, links, normal highlights)
   *   --emphasis   coral: reserved for crucial concepts (e.g. "decoy queries")
   *                and notes/caveats. Use sparingly — overuse devalues it.
   *   text/bg     sage on white for body.
   */
  --bg: #ffffff;
  --accent: #0d9488;             /* teal */
  --accent-light: #5eead4;
  --accent-dim: #d3eee9;
  --emphasis: #e11d48;           /* coral — sparingly */
  --emphasis-dim: #fde2e7;
  --green: #16a34a;
  --green-bg: #d2f0d5;
  --red: #b91c1c;
  --amber: #92400e;
  --amber-bg: #fef3c7;
  --text: #1c2e21;               /* deep forest */
  --text-secondary: #3a4f3f;
  --text-muted: #6b7c6f;
  --text-dim: #a4b0a6;
  --border: #e2e5eb;
  --surface: #f4f5f1;            /* very faint sage tint */
  --font-display: "Ubuntu", system-ui, sans-serif;
  --font-body: "Ubuntu", system-ui, sans-serif;
  --font-mono: "Ubuntu Mono", ui-monospace, monospace;
}

html, body {
  background: var(--bg);
  color: var(--text);
}

/* Reveal base overrides ------------------------------------------------- */

.reveal {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.45;
  color: var(--text);
}

.reveal .slides {
  text-align: left;
}

.reveal .slides section {
  padding: 0;
  height: 100%;
}

.reveal h1, .reveal h2, .reveal h3, .reveal h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin: 0 0 0.4em 0;
  text-transform: none;
  letter-spacing: -0.01em;
}

.reveal h1 { font-size: 2.6em; }
.reveal h2 { font-size: 1.7em; }
.reveal h3 { font-size: 1.25em; }
.reveal h4 { font-size: 1.05em; color: var(--text-secondary); }

.reveal .accent   { color: var(--accent); }
.reveal .emphasis { color: var(--emphasis); font-weight: 600; }   /* sparingly! */
.reveal .muted    { color: var(--text-muted); }
.reveal .dim      { color: var(--text-dim); }
.reveal .small    { font-size: 0.7em; }
.reveal .mono     { font-family: var(--font-mono); }

.reveal a { color: var(--accent); text-decoration: none; }
.reveal a:hover { text-decoration: underline; }

/* Subtle hyperlink: inherits surrounding color, reveals as a link by changing
   to accent on hover. No underline. Useful where the link should not visually
   shout (title-slide credits, workshop info). */
.reveal a.hover-link,
.reveal a.hover-link:hover { text-decoration: none; }
.reveal a.hover-link { color: inherit; transition: color 0.15s ease; }
.reveal a.hover-link:hover { color: var(--accent); }

.reveal strong { font-weight: 600; color: var(--text); }
.reveal em { font-style: italic; color: var(--text-secondary); }

.reveal code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.reveal ul, .reveal ol {
  margin: 0.4em 0 0.4em 1.2em;
}
.reveal li {
  margin: 0.25em 0;
}
.reveal ul.clean { list-style: none; margin-left: 0; }
.reveal ul.clean > li { padding-left: 0; }

/* Standard slide container -------------------------------------------- */

.slide {
  width: 100%;
  height: 100%;
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  padding: clamp(4.5rem, 8vh, 6rem) clamp(2rem, 5vw, 4.5rem) clamp(2rem, 4vh, 3.5rem);
  box-sizing: border-box;
  position: relative;
}

.slide.center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.slide-eyebrow {
  font-family: var(--font-body);
  font-size: 0.55em;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  position: absolute;
  top: clamp(2rem, 4vh, 3.5rem);
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
}

/* Section divider slides — single centered line between subsections of a Part. */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  text-align: center;
  margin: 0;
}

.slide-eyebrow .accent { color: var(--accent); }

.slide-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 0.6em;
}

.slide-subtitle {
  font-size: 1.05em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1.4em;
  max-width: 60ch;
}

/* Title slide ---------------------------------------------------------- */

.title-slide {
  text-align: center;
  align-items: center;
  justify-content: center;
}
.title-slide .ef-logo {
  width: clamp(56px, 6vw, 80px);
  height: auto;
  margin-bottom: 1.6rem;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}
.title-slide h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  margin-bottom: 0.4em;
}
.title-slide .talk-subtitle {
  color: var(--text-secondary);
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  font-weight: 500;
  margin-bottom: 2.2em;
  white-space: nowrap;
}
.title-slide .talk-meta {
  font-size: 0.78em;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.18em;
}
.title-slide .talk-meta .speaker {
  color: var(--text);
  font-weight: 600;
  font-size: 1em;
}

/* Two-column layouts --------------------------------------------------- */

.cols { display: flex; gap: clamp(1rem, 3vw, 2.5rem); width: 100%; align-items: stretch; }
.cols.center { align-items: center; }
.col { flex: 1; min-width: 0; }
.col-narrow { flex: 0 0 38%; }
.col-wide   { flex: 1 1 62%; }

/* Cards ---------------------------------------------------------------- */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(0.8rem, 1.6vw, 1.4rem);
  font-size: 0.85em;
  line-height: 1.5;
}
.card.surface  { background: var(--surface); }
.card.accent   { border-color: var(--accent); background: var(--accent-dim); }
.card.emphasis { border-color: var(--emphasis); background: var(--emphasis-dim); }

/* Tradeoff list — used for slide-8 MPT/UBT advantages-disadvantages lists.
 * Plain bullets, no card chrome — just text + the title above. */
.tradeoff-card {
  background: transparent;
  border: none;
  padding: 0.4rem 0.2rem 0;
  font-size: 1.02rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.tradeoff-card .t-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.22rem;
  color: var(--text);
  margin-bottom: 0.45em;
}
.tradeoff-card ul {
  list-style-type: disc;
  padding-left: 1.3em;
  margin: 0;
}
.tradeoff-card li { margin: 0.3em 0; }
.tradeoff-card .t-sub {
  font-size: 0.88em;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.15em;
}
.tradeoff-card .t-cite {
  font-size: 0.85em;
  color: var(--text-muted);
}
.tradeoff-card .hl   { color: var(--accent);   font-weight: 700; }
.tradeoff-card .emph { color: var(--emphasis); font-weight: 700; }

/* Note / caveat — for footnotes and "watch out" callouts.
 * Uses the emphasis (coral) color sparingly: a left border, no fill, small text. */
.note {
  border-left: 3px solid var(--emphasis);
  background: transparent;
  padding: 0.5em 0.9em;
  font-size: 0.78em;
  color: var(--text-secondary);
  border-radius: 0 4px 4px 0;
}
.note .label {
  font-weight: 600;
  color: var(--emphasis);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85em;
  margin-right: 0.4em;
}
.card-title {
  font-family: var(--font-display);
  font-size: 0.95em;
  font-weight: 600;
  margin-bottom: 0.4em;
  color: var(--text);
}
.card-title.accent { color: var(--accent); }

/* Pills / badges ------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 0.15em 0.7em;
  border-radius: 999px;
  font-size: 0.7em;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill.accent   { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
.pill.emphasis { background: var(--emphasis-dim); color: var(--emphasis); border-color: transparent; }
.pill.green    { background: var(--green-bg); color: var(--green); border-color: transparent; }
.pill.red      { background: #fee2e2; color: #991b1b; border-color: transparent; }
.pill.amber    { background: var(--amber-bg); color: var(--amber); border-color: transparent; }

/* Decorative rule ------------------------------------------------------ */

.rule {
  height: 1px; background: var(--border); width: 100%; margin: 1em 0;
}
.rule.accent {
  background: linear-gradient(90deg, var(--accent), transparent);
  height: 2px;
}

/* QR component --------------------------------------------------------- */

.qr {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  text-decoration: none;
}
.qr img {
  display: block;
  border: 6px solid white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.qr-url {
  font-family: var(--font-mono);
  font-size: 0.55em;
  color: var(--text-dim);
  max-width: 22ch;
  overflow: hidden;
  white-space: nowrap;
  /* No text-overflow:ellipsis — long URLs are manually cropped with literal ".." per CLAUDE.md. */
}

/* Figure container ----------------------------------------------------- */

.fig {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  width: 100%;
}
.fig img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
.fig-caption {
  font-size: 0.7em;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* Big stat / callout --------------------------------------------------- */

.big-stat {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.big-stat .unit {
  font-size: 0.4em;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.05em;
}

/* Custom chrome (back arrow, slide nav, hardlink copy) ----------------- */

.chrome-back {
  position: fixed;
  top: clamp(0.7rem, 1.6vh, 1.2rem);
  left: clamp(0.8rem, 1.6vw, 1.4rem);
  z-index: 100;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.3em 0.55em;
  border-radius: 6px;
  transition: all 0.15s ease;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
}
.chrome-back:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.chrome-link {
  position: fixed;
  bottom: clamp(0.7rem, 1.6vh, 1.2rem);
  right: clamp(0.8rem, 1.6vw, 1.4rem);
  z-index: 100;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.chrome-link:hover { color: var(--accent); background: var(--accent-dim); }
.chrome-link svg { width: 16px; height: 16px; }
.chrome-link.copied {
  color: var(--green);
  background: #d1fae5;
}

.chrome-toast {
  position: fixed;
  bottom: clamp(2.6rem, 5vh, 3.4rem);
  right: clamp(0.8rem, 1.6vw, 1.4rem);
  z-index: 101;
  background: var(--text);
  color: white;
  padding: 0.5em 0.9em;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.2s ease;
}
.chrome-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.chrome-nav {
  position: fixed;
  bottom: clamp(0.5rem, 1.2vh, 0.9rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 4px;
  padding: 0.35em 0.5em;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  flex-wrap: wrap;
  max-width: 80vw;
  justify-content: center;
}
.chrome-nav-btn {
  width: 22px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.55rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}
.chrome-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chrome-nav-btn.current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
/* Title + section-divider buttons: distinct grey fill so the eye groups
   them apart from body-content slides. */
.chrome-nav-btn--divider {
  background: var(--surface);
  border-color: var(--text-dim);
}
.chrome-nav-btn--divider.current {
  background: var(--text-dim);
  border-color: var(--text-dim);
  color: white;
}

/* Family-comparison scorecard matrix (slide 19) ----------------------- */

.matrix-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
table.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.05rem;
  table-layout: fixed;
}
table.matrix th, table.matrix td {
  padding: 0.7rem 0.35rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.matrix thead th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
table.matrix thead th.fam-col { text-align: left; padding-left: 0.9rem; width: 32%; }
table.matrix thead th:not(.fam-col) { width: 13.6%; }
table.matrix tbody td.fam {
  text-align: left;
  padding-left: 0.9rem;
}
table.matrix tbody td.fam .name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
  display: block;
  line-height: 1.2;
}
table.matrix tbody td.fam .members {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}
table.matrix tbody td.fam .members a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-dim);
  transition: color 0.12s, border-color 0.12s;
  position: relative;
}
table.matrix tbody td.fam .members a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
/* Custom tooltip on scheme-name links (parallel to .cell tooltip). */
table.matrix tbody td.fam .members a[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  padding: 0.55em 0.8em;
  border-radius: 6px;
  width: max-content;
  max-width: 280px;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
table.matrix tbody td.fam .members a[data-tip]:hover::after { opacity: 1; }
.cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em; height: 1.6em;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95em;
  line-height: 1;
}
.cell.good { background: #16a34a;            color: transparent; }
.cell.warn { background: #fef3c7;            color: #92400e; }
.cell.bad  { background: #dc2626;            color: transparent; }

/* Custom tooltip on scorecard cells — instant on hover, styled to match the deck.
 * Uses data-tip (not title) so the native browser tooltip is suppressed. */
.cell[data-tip] { position: relative; cursor: help; }
.cell[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  padding: 0.55em 0.8em;
  border-radius: 6px;
  width: max-content;
  max-width: 260px;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.cell[data-tip]:hover::after { opacity: 1; }
/* Ensure td doesn't clip the tooltip */
table.matrix td { overflow: visible; }
.legend-row {
  margin-top: 0.9rem;
  display: flex;
  gap: 1.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
}
.legend-row .swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.takeaway {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}
.takeaway strong { color: var(--text); font-style: normal; }

/* Mobile adjustments --------------------------------------------------- */

@media (max-width: 720px) {
  .reveal { font-size: 22px; }
  .reveal h1 { font-size: 2em; }
  .reveal h2 { font-size: 1.45em; }
  .slide { padding: 2.5rem 1.2rem 3rem; }
  .cols { flex-direction: column; gap: 1rem; }
  .col-narrow, .col-wide { flex: 1 1 auto; }
  .chrome-nav { max-width: 92vw; }
  .chrome-nav-btn { width: 18px; height: 14px; font-size: 0.5rem; }
  .fig img { max-height: 50vh; }
}

@media (max-width: 480px) {
  .reveal { font-size: 19px; }
  .reveal h1 { font-size: 1.7em; }
  .reveal h2 { font-size: 1.3em; }
  .slide { padding: 2.2rem 0.9rem 2.6rem; }
  .chrome-back { font-size: 0.7rem; }
}

/* Family cards (slide 19 — "no scheme dominates") ----------------------- */

.fam-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 0.8rem 1.05rem 0.85rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.fam-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.1em;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.fam-card .members {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.55em;
}
.fam-card ul {
  list-style: none;
  padding: 0; margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}
.fam-card li {
  display: flex;
  align-items: flex-start;
  gap: 0.45em;
  margin: 0.22em 0;
}
.fam-card li .mark {
  flex-shrink: 0;
  width: 1em;
  font-weight: 700;
  line-height: 1.4;
}
.fam-card li.good .mark { color: var(--accent); }
.fam-card li.bad  .mark { color: var(--emphasis); }
.fam-card li.good { color: var(--text); }
.fam-card li.bad  { color: var(--text-secondary); }
.fam-card li em { font-style: italic; color: var(--emphasis); font-weight: 600; }
.fam-card li strong { font-weight: 700; }

/* Print / screenshot ---------------------------------------------------- */

@media print {
  .chrome-back, .chrome-link, .chrome-nav, .chrome-toast { display: none; }
}

/* Reveal sets .print-pdf on <html> when rendering ?print-pdf. Within that
   mode every fragment should appear in its FINAL state — opacity 1 and
   visible. The fragment-swap pattern (a "default" element with
   .fragment.fade-out paired with a .fragment.fade-in replacement at the
   same data-fragment-index) needs the default hidden so the replacement
   wins; otherwise both stack on top of each other in print. */
.print-pdf .reveal .fragment,
.print-pdf .reveal .fragment.visible,
.print-pdf .reveal .fragment.current-fragment {
  opacity: 1 !important;
  visibility: inherit !important;
}
.print-pdf .reveal .fragment.fade-out,
.print-pdf .reveal .fragment.fade-out.visible {
  display: none !important;
}
/* Hide the chrome (back arrow, slide-num nav, hardlink icon, toast) in
   print since the PDF is for static review, not interactive use. */
.print-pdf .chrome-back,
.print-pdf .chrome-link,
.print-pdf .chrome-nav,
.print-pdf .chrome-toast { display: none !important; }

/* Slide 26 (#middleware): the right-column overrides that pull the SVG
   up and out on screen (negative margin-top + width:130% + max-height:72vh)
   make the slide content overflow the 800-px print page (SVG col ends up
   ~580 px tall + ~280 px chrome > 800). Tighten for print so the whole
   slide fits one page. */
.print-pdf #middleware .col[style*="margin-top:-2.5em"] {
  margin-top: 0 !important;
  align-self: stretch !important;
}
.print-pdf #middleware .cols {
  align-items: flex-start !important;
}
.print-pdf #middleware svg[viewBox^="0 0 480 460"] {
  width: 100% !important;
  max-height: 58vh !important;
}
