/* ── Variables ── */
:root {
  --primary: #2196F3;
  --primary-light: #E3F2FD;
  --accent: #FF9800;
  --accent-light: #FFF3E0;
  --emphasis: #F44336;
  --green: #4CAF50;
  --green-light: #E8F5E9;
  --bg: #FAFAFA;
  --card-bg: #FFFFFF;
  --text: #111111;
  --text-secondary: #555555;
  --border: #E0E0E0;
  --dot-red: #FF5F56;
  --dot-yellow: #FFBD2E;
  --dot-green: #27C93F;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: #222;
  font-family: var(--font);
  overflow: hidden;
}

/* ── Slide framework ── */
.slide-container {
  width: 1000px; height: 562.5px;
  position: absolute;
  /* top / left / transform set by JS scaleSlides() */
}

.slide {
  width: 1000px; height: 562.5px;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  position: relative;
  display: none;
  padding: 40px 50px;
  overflow: hidden;
}

.slide.active { display: flex; flex-direction: column; }

.slide::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.slide-header {
  position: absolute; top: 10px; left: 20px; right: 20px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-secondary); font-weight: 500;
  letter-spacing: 0.5px;
}

.slide-counter {
  position: fixed; bottom: 16px; right: 24px;
  font-family: var(--font); font-size: 13px;
  z-index: 100;
  background: rgba(0,0,0,0.6); color: #ccc;
  padding: 4px 10px; border-radius: 4px;
}

/* ── Card component ── */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: #F7F7F7;
  border-bottom: 1px solid var(--border);
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: var(--dot-red); }
.dot-y { background: var(--dot-yellow); }
.dot-g { background: var(--dot-green); }

.card-body { padding: 16px 20px; }

/* ── Typography ── */
.slide-title {
  font-size: 30px; font-weight: 700; color: var(--text);
  margin-bottom: 16px; line-height: 1.2;
}

.slide-subtitle {
  font-size: 18px; font-weight: 400; color: var(--text-secondary);
  margin-bottom: 20px;
}

.body-text { font-size: 15px; color: var(--text); line-height: 1.6; }

.highlight     { color: var(--primary); font-weight: 600; }
.highlight-accent { color: var(--accent); font-weight: 600; }
.highlight-red { color: var(--emphasis); font-weight: 600; }
.highlight-green { color: var(--green); font-weight: 600; }

.mono  { font-family: var(--mono); font-size: 13px; }
.small { font-size: 12px; }
.bold  { font-weight: 600; }

ul.bullets { list-style: none; padding: 0; }
ul.bullets li {
  padding: 4px 0 4px 18px;
  position: relative; font-size: 15px; color: var(--text); line-height: 1.5;
}
ul.bullets li::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}

/* ── Layout helpers ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center   { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.mt-auto { margin-top: auto; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* ── Architecture boxes ── */
.arch-box {
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; text-align: center;
  border: 2px solid; min-width: 100px;
}
.arch-box.blue   { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.arch-box.orange { background: var(--accent-light);  border-color: var(--accent);  color: #E65100; }
.arch-box.green  { background: var(--green-light);   border-color: var(--green);   color: #2E7D32; }
.arch-box.gray   { background: #F5F5F5; border-color: #BDBDBD; color: var(--text-secondary); }
.arch-box.dark   { background: #263238; border-color: #263238; color: #fff; }

.arch-arrow {
  width: 2px; height: 20px; background: #999; margin: 0 auto;
  position: relative;
}
.arch-arrow::after {
  content: ''; position: absolute; bottom: -4px; left: -4px;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid #999;
}

/* ── FX chip ── */
.fx-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary);
}
.fx-chip.selected { background: var(--primary); color: #fff; }

/* ── Tag ── */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.tag.blue   { background: var(--primary-light); color: var(--primary); }
.tag.orange { background: var(--accent-light);  color: #E65100; }
.tag.green  { background: var(--green-light);   color: #2E7D32; }
.tag.red    { background: #FFEBEE; color: var(--emphasis); }

/* ── Case flow row ── */
.case-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: 8px; font-size: 13px;
}
.case-row .arrow-right {
  width: 24px; height: 2px; background: #999; position: relative; flex-shrink: 0;
}
.case-row .arrow-right::after {
  content: ''; position: absolute; right: -1px; top: -4px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  border-left: 6px solid #999;
}

/* ── Loss card ── */
.loss-card { flex: 1; }
.loss-card .card-body { padding: 10px 14px; }
.loss-card svg { display: block; margin: 0 auto 6px; }

/* ── Word pair grid ── */
.pair-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  font-size: 12px;
}
.pair-cell {
  padding: 4px 6px; border-radius: 4px; text-align: center;
  background: var(--primary-light); color: var(--primary); font-weight: 500;
}

/* ── Results bar chart ── */
.bar-row   { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-label { width: 90px; font-size: 12px; text-align: right; color: var(--text-secondary); }
.bar-track { flex: 1; height: 18px; background: #ECEFF1; border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 6px; font-size: 10px; color: #fff; font-weight: 600; }
.bar-fill.ours     { background: var(--primary); }
.bar-fill.baseline { background: #B0BEC5; }

/* ── PCA dot visualization ── */
.pca-viz {
  width: 100%; height: 140px; position: relative;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.pca-dot {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* ── Demo button ── */
.demo-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px; border-radius: 12px;
  background: var(--primary); color: #fff;
  font-size: 18px; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(33,150,243,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.demo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(33,150,243,0.4);
}

/* ── Title slide ── */
.title-slide { justify-content: center; align-items: center; text-align: center; }
.title-slide .main-title    { font-size: 36px; font-weight: 800; color: var(--text); line-height: 1.15; margin-bottom: 12px; }
.title-slide .main-subtitle { font-size: 18px; color: var(--text-secondary); font-weight: 400; margin-bottom: 28px; line-height: 1.4; }
.title-slide .meta           { font-size: 14px; color: var(--text-secondary); line-height: 1.8; }

/* ── Timeline ── */
.timeline      { display: flex; align-items: flex-start; gap: 0; position: relative; }
.timeline-step { flex: 1; text-align: center; position: relative; padding-top: 24px; }
.timeline-step::before {
  content: ''; position: absolute; top: 8px; left: 0; right: 0;
  height: 3px; background: var(--border);
}
.timeline-step:first-child::before { left: 50%; }
.timeline-step:last-child::before  { right: 50%; }
.timeline-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  z-index: 1;
}

/* ── Intro slide — single centered system card ── */
.slide-intro-system.slide.active {
  justify-content: flex-start;
}

/* ── Exp 2 trajectory — real PNGs sized to avoid slide/clipping ── */
.slide-exp2-traj .exp2-traj-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 156px;
  object-fit: contain;
}

@media (max-height: 650px) {
  .slide-exp2-traj .exp2-traj-img { max-height: 136px; }
}

/* ── Horizontal infographic timeline (slide 18) ── */
.slide-timeline-h {
  overflow: visible;
  padding-bottom: 28px;
}

.slide-timeline-h .slide-title {
  margin-bottom: 8px !important;
  margin-top: 4px;
}

.slide-timeline-h .timeline-h-sub {
  font-size: 13px !important;
  margin-bottom: 20px !important;
}

.timeline-h-shell {
  position: relative;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  justify-content: flex-start;
  padding: calc(16px + 11px * 1.3 * 3) 0 0;
}

.timeline-h-top {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: stretch;
  justify-content: space-between;
  min-height: 0;
}

.timeline-h-step-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-h-rail-wrap {
  position: relative;
  flex-shrink: 0;
  height: 32px;
  margin-top: -7px;
  width: 100%;
}

.timeline-h-track {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  height: 5px;
  transform: translateY(-50%);
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    #7C4DFF 0%,
    #26C6DA 22%,
    #66BB6A 44%,
    #FFCA28 66%,
    #FF7043 82%,
    #EC407A 100%
  );
  opacity: 0.92;
  z-index: 0;
}

.timeline-h-dots-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 100%;
  pointer-events: none;
}

.timeline-h-dot-cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-h-periods {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: space-between;
  margin-top: 2px;
  width: 100%;
}

.timeline-h-periods > .timeline-h-period {
  flex: 1 1 0;
  min-width: 0;
}

.timeline-h-card {
  --tl-desc-lh: calc(11px * 1.3);
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: linear-gradient(180deg, #f8f9fa 0%, #eceff1 100%);
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  padding: calc(var(--tl-desc-lh) * 2) 8px calc(var(--tl-desc-lh) * 2) 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.timeline-h-card .tl-ico-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 3px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.timeline-h-card .tl-ico-ring svg {
  width: 18px;
  height: 18px;
  stroke: #1a1a1a;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-h-card .tl-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 2px;
  line-height: 1.15;
}

.timeline-h-card .tl-head {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.18;
  margin-bottom: 3px;
}

.timeline-h-card .tl-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 0;
}

.timeline-h-notch {
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 12px solid #eceff1;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.06));
  flex-shrink: 0;
}

.timeline-h-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(100, 100, 140, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 2;
}

.timeline-h-period {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.timeline-h-footer {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-top: 4px;
  padding-top: 0;
  line-height: 1.15;
  opacity: 0.92;
}

/* ── Slide 5: intro card header matches Related Works chrome ── */
.slide-intro-system-card .card-header {
  background: #f7f7f7;
  border-bottom: 1px solid var(--border);
}

/* ── Mobile letterbox notice ── */
.mobile-notice {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55);
  color: #999;
  font-size: 11px;
  font-family: var(--font);
  text-align: center;
  padding: 5px 16px 6px;
  z-index: 300;
  letter-spacing: 0.03em;
  pointer-events: none;
}

@media (max-width: 900px) {
  .mobile-notice { display: block; }
}

/* ── Print / PDF export (Ctrl+P) ── */
@media print {
  @page { size: 1000px 562.5px; margin: 0; }

  html, body {
    overflow: visible !important;
    background: white !important;
    width: 1000px !important;
    height: auto !important;
  }

  .slide-container {
    position: static !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    width: 1000px !important;
    height: auto !important;
    display: block !important;
  }

  .slide {
    display: flex !important;
    flex-direction: column !important;
    width: 1000px !important;
    height: 562.5px !important;
    page-break-after: always !important;
    break-after: page !important;
    overflow: hidden !important;
    position: relative !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .slide:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .slide-counter,
  .mobile-notice { display: none !important; }
}

