/* ── PRESENTATION STYLES ────────────────────────────────────────────────
 * Adapted from agent-presentation-markpress template.
 * Loaded via <link rel="stylesheet"> in the generated presentation HTML.
 * ───────────────────────────────────────────────────────────────────── */

:root {
  --ink: #18181b;
  --ink-dim: #52525b;
  --muted: #a1a1aa;
  --line: #e4e4e7;
  --accent: #4f46e5;
  --group-accent: #4f46e5;
  --border-accent-width: 5px;
  --radius: 20px;
}

html,
body {
  overflow: hidden;
  background: #f1f5f9;
  color: var(--ink);
  font-family: "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
}

@media (max-width: 900px) {
  html, body {
    overflow: auto;
  }
}

/* ── Slides ─────────────────────────────────────────────────────────── */
.step {
  width: min(1160px, 84vw);
  min-height: min(680px, 75vh);
  max-height: 75vh;
  padding: 2.8rem 3.2rem;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-top: var(--border-accent-width) solid var(--group-accent);
  border-radius: var(--radius);
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  overflow-x: hidden;
  overflow-y: auto;
}

.step.active {
  opacity: 1;
  pointer-events: auto;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.06);
}

.step > *:first-child {
  margin-top: 0;
}

/* ── Typography ─────────────────────────────────────────────────────── */
.step h1,
.step h2,
.step h3 {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 0.65rem;
  border-bottom: 0;
}

.step h1 {
  font-size: clamp(2.35rem, 4.9vmin, 4.8rem);
  font-weight: 700;
  max-width: 820px;
}

.step h2 {
  font-size: clamp(1.05rem, 2vmin, 1.6rem);
  color: var(--ink-dim);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.step h3 {
  font-size: clamp(0.85rem, 1.6vmin, 1.2rem);
  color: var(--group-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.step p,
.step li,
.step td,
.step th,
.step blockquote {
  font-size: clamp(1rem, 1.65vmin, 1.3rem);
  line-height: 1.45;
  color: var(--ink);
  font-weight: 400;
}

.step ul,
.step ol {
  margin-top: 1.2rem;
  padding-left: 1.1em;
}

.step li {
  margin: 0.45rem 0;
  padding-left: 0.3rem;
}

.step li::marker {
  color: var(--group-accent);
  content: "\25b8  ";
}

.step strong {
  color: var(--group-accent);
  font-weight: 700;
}

.step a {
  color: var(--group-accent);
  text-decoration: none;
  border-bottom: 1px solid #e4e4e7;
  transition: border-color 150ms;
}

.step a:hover {
  border-bottom-color: var(--group-accent);
}

.step blockquote {
  margin: 1.4rem 0 0;
  padding: 1rem 0 1rem 1.4rem;
  border-left: 4px solid var(--group-accent);
  color: var(--ink-dim);
  background: #f8fafc;
  border-radius: 0 12px 12px 0;
}

/* ── Tables ─────────────────────────────────────────────────────────── */
.step table {
  width: 100%;
  margin-top: 1.6rem;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
}

.step thead th {
  background: #f4f4f5;
  color: var(--group-accent);
  font-size: clamp(0.8rem, 1.45vmin, 1.05rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.step th,
.step td {
  padding: 0.9rem 1.1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.step tr:last-child td {
  border-bottom: 0;
}

/* ── Code ───────────────────────────────────────────────────────────── */
.step code {
  display: inline-block;
  padding: 0.1em 0.52em;
  border-radius: 6px;
  background: #fafafa;
  border: 1px solid #e4e4e7;
  color: #0f172a;
  font-size: 0.88em;
  font-family: "SF Mono", "Fira Code", monospace;
}

.step pre {
  padding: 0.95rem 1.1rem;
  border-radius: 18px;
  border: 1px solid #e4e4e7;
  background: #f8fafc;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.step pre code {
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  color: #18181b;
  border-radius: 0;
}

/* ── Images ─────────────────────────────────────────────────────────── */
.step img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
}

/* ── Per-slide group accent colors ──────────────────────────────────── */
/* Slide 1: Title — orange */
#step-1 {
  --group-accent: #f97316;
  background: #fff7ed;
  border-top-width: calc(var(--border-accent-width) + 1px);
}
#step-1 h1 {
  font-size: clamp(3.2rem, 6.4vmin, 6.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}
#step-1 h2 {
  margin-top: 0.7rem;
  font-weight: 400;
  color: var(--ink-dim);
}

/* Slides 2-5: Problems — red */
#step-2,
#step-3,
#step-4,
#step-5 {
  --group-accent: #ef4444;
}

/* Slides 6-7: SDD definition — green */
#step-6,
#step-7 {
  --group-accent: #22c55e;
}

/* Slides 8-10: Comparison & framework — blue */
#step-8,
#step-9,
#step-10 {
  --group-accent: #3b82f6;
}

/* Slides 11-13: Closing — purple */
#step-11,
#step-12,
#step-13 {
  --group-accent: #a855f7;
}

/* Thank You slide — centered */
#step-13 {
  text-align: center;
  justify-content: center;
}
#step-13 h1 {
  font-size: clamp(3.2rem, 6.4vmin, 6.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}
#step-13 table {
  width: min(100%, 480px);
  margin: 0.6rem auto 0;
  border: 0;
  background: transparent;
  table-layout: fixed;
  border-spacing: 20px 6px;
}
#step-13 thead th {
  background: transparent;
  color: var(--ink-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: clamp(0.8rem, 1.4vmin, 1rem);
  text-align: center;
  border: 0;
  padding-bottom: 0.1rem;
}
#step-13 td {
  border: 0;
  width: 50%;
  padding: 0.15rem 0.2rem;
  background: transparent;
}
#step-13 tbody tr:nth-child(1) img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  margin: 0 auto;
}
#step-13 tbody tr:nth-child(2) img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  margin: 4px auto 0;
  border: 0;
  border-radius: 0;
}

/* ── Syntax Highlighting (GitHub-inspired light) ────────────────────── */
.hljs {
  color: #24292e;
  background: transparent;
}
.hljs-keyword,
.hljs-selector-tag { color: #d73a49; font-weight: 600; }
.hljs-string,
.hljs-attr { color: #032f62; }
.hljs-number,
.hljs-literal { color: #005cc5; }
.hljs-property,
.hljs-built_in { color: #6f42c1; }
.hljs-comment,
.hljs-quote { color: #6a737d; font-style: italic; }
.hljs-variable,
.hljs-title { color: #e36209; }
.hljs-punctuation { color: #586069; }

/* ── Two-column layout: content (left) + image (right) ──────────── */
.step:has(.global-image-col) {
  justify-content: flex-start;
  padding-top: 2.8rem;
}

.global-image-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-rows: auto 1fr;
  column-gap: 2rem;
  row-gap: 1rem;
  flex: 1;
}

/* h1 spans full width inside the grid */
.global-image-col > h1 {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: 0 0 0.2rem 0;
  font-size: clamp(2.2rem, 4.4vmin, 4.4rem);
}

.global-image-col > .col-left {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-self: center;
}

.global-image-col > .col-left > *:first-child {
  margin-top: 0;
}

/* Compact blockquote inside image slide */
.global-image-col blockquote {
  margin: 0;
  padding: 0.5rem 0.8rem;
  font-size: clamp(0.85rem, 1.5vmin, 1.1rem);
  line-height: 1.35;
}

.global-image-col > .col-left ul,
.global-image-col > .col-left ol {
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.global-image-col > .col-left li {
  margin: 0.2rem 0;
  font-size: clamp(0.9rem, 1.5vmin, 1.1rem);
}

.global-image-col > .col-right {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.global-image-col img {
  width: 100%;
  max-height: 48vh;
  object-fit: contain;
  object-position: center center;
  display: block;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.5rem;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

/* ── Image-only slide: title + full-width image ──── */
.step:has(.image-only-col) {
  justify-content: flex-start;
  padding-top: 2.8rem;
}

.image-only-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.8rem;
}

.image-only-col > h1 {
  margin: 0 0 0.2rem 0;
}

.image-only-img {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.image-only-img img {
  max-width: 100%;
  max-height: 55vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.5rem;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

/* ── GitHub badge ──────────────────────────────────────────────────── */
.gh-badge {
  position: fixed;
  top: 16px;
  left: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 200ms ease, background 200ms ease;
}
.gh-badge:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.98);
}
.gh-badge svg {
  fill: #18181b;
  display: block;
}

/* ── Slide navigation bar ──────────────────────────────────────────── */
.slide-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
}

.slide-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.slide-nav-btn:hover,
.slide-nav-btn:focus-visible {
  background: rgba(15, 23, 42, 0.07);
  color: var(--ink);
  outline: none;
}

.slide-nav-btn:active {
  background: rgba(15, 23, 42, 0.12);
  color: var(--ink);
}

/* ── PDF download button ────────────────────────────────────────────── */
.slide-download-link {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  color: var(--ink-dim);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.slide-download-link:hover {
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.slide-download-link svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* ── Image zoom modal ──────────────────────────────────────────────── */
.img-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.img-modal.open {
  display: flex;
}

.img-modal img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  cursor: default;
  border: 0;
}

.img-modal .close-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  transition: background 150ms;
}

.img-modal .close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Language switcher ──────────────────────────────────────────────── */
#lang-switcher {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--group-accent);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 150ms, box-shadow 150ms;
}
#lang-switcher:hover {
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ── Print styles ──────────────────────────────────────────────────── */
@media print {
  .gh-badge,
  .slide-nav,
  .slide-download-link,
  #lang-switcher,
  #rc-btn,
  #rc-overlay {
    display: none !important;
  }
  .step {
    opacity: 1 !important;
    break-inside: avoid;
    page-break-after: always;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  body {
    background: white !important;
  }
}

/* ── Mobile responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .step {
    width: 90vw;
    min-height: 72vh;
    max-height: 75vh;
    padding: 2rem 1.8rem;
    border-radius: 16px;
    justify-content: flex-start;
  }
  .step h1 {
    font-size: clamp(1.8rem, 4.6vmin, 2.6rem);
    line-height: 1.12;
  }
  .step h2 {
    font-size: clamp(0.9rem, 2.25vmin, 1.15rem);
  }
  .step p,
  .step li,
  .step td,
  .step th,
  .step blockquote {
    font-size: clamp(0.9rem, 2.1vmin, 1.08rem);
    line-height: 1.38;
  }
  .step pre {
    padding: 0.62rem 0.8rem;
    border-radius: 12px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .step pre code {
    font-size: clamp(0.7rem, 1.9vmin, 0.95rem);
    white-space: pre;
    word-break: normal;
  }
  .slide-nav {
    bottom: 10px;
    gap: 2px;
    padding: 4px 6px;
  }
  .slide-nav-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
    gap: 3px;
  }
}
