/* ============================================================
   QC Linking Lecture — shared styles
   Aesthetic: academic cream paper × playful-technical annotation
   Type: Instrument Serif (titles) · Inter (body) · JetBrains Mono (code)
   ============================================================ */

:root {
  /* Paper-cream palette */
  --paper:        #f4efe6;
  --paper-2:      #ebe4d6;
  --paper-edge:   #d9d1bf;
  --ink:          #1a1a17;
  --ink-2:        #4a463e;
  --ink-3:        #7a7466;
  --ink-4:        #aea798;

  /* Single saturated accent — deep indigo ink */
  --accent:       #2a3d8f;
  --accent-2:     #4a6bd4;

  /* Hardware / phys vs. CS / info-theory distinction */
  --phys:         #b04a2f;   /* warm terracotta */
  --info:         #2a3d8f;   /* indigo ink */
  --bridge:       #6b4a8a;   /* purple, midpoint */

  /* Type scale (1920×1080) */
  --t-title:      64px;
  --t-subtitle:   44px;
  --t-body:       34px;
  --t-small:      28px;
  --t-caption:    24px;

  /* Spacing */
  --pad-x:        100px;
  --pad-top:      100px;
  --pad-bottom:   80px;
  --title-gap:    52px;
  --item-gap:     28px;
}

/* ---- fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #1a1a17;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
}

/* ============================================================
   Slide frame
   ============================================================ */
.slide {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  padding: var(--pad-top) var(--pad-x) var(--pad-bottom);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* subtle paper texture via layered gradients */
.slide::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1400px 800px at 20% 10%, rgba(255,255,255,0.35), transparent 60%),
    radial-gradient(1200px 900px at 90% 95%, rgba(176,74,47,0.04), transparent 70%);
  z-index: 0;
}

.slide > * { position: relative; z-index: 1; }

/* ============================================================
   Typography
   ============================================================ */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--t-caption);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 24px;
}

.title {
  font-family: 'Instrument Serif', serif;
  font-size: var(--t-title);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--title-gap);
  max-width: 1400px;
}

.title em {
  font-style: italic;
  color: var(--accent);
}

.subtitle {
  font-family: 'Instrument Serif', serif;
  font-size: var(--t-subtitle);
  font-weight: 400;
  font-style: italic;
  line-height: 1.15;
  color: var(--ink-2);
  margin: 0 0 40px;
  max-width: 1400px;
}

.body {
  font-size: var(--t-body);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 1400px;
  text-wrap: pretty;
}

.small {
  font-size: var(--t-small);
  line-height: 1.4;
  color: var(--ink-3);
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ============================================================
   Slide chrome — page number + section tab
   ============================================================ */
.page-num {
  position: absolute;
  bottom: 40px;
  right: var(--pad-x);
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
  z-index: 2;
}

.section-tab {
  position: absolute;
  top: 50px;
  left: var(--pad-x);
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  z-index: 2;
}
.section-tab::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--ink-3);
  vertical-align: middle;
  margin-right: 14px;
}

/* ============================================================
   Section header slides (slightly darker paper)
   ============================================================ */
.slide.section-header {
  background: var(--paper-2);
  justify-content: center;
  align-items: flex-start;
}
.slide.section-header .part-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  color: var(--phys);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 48px;
}
.slide.section-header.info .part-label { color: var(--info); }
.slide.section-header.bridge .part-label { color: var(--bridge); }

.slide.section-header h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 140px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 40px;
  max-width: 1500px;
}

.slide.section-header h1 em {
  font-style: italic;
  color: var(--phys);
}
.slide.section-header.info h1 em { color: var(--info); }
.slide.section-header.bridge h1 em { color: var(--bridge); }

/* ============================================================
   Chips / tags / buttons
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  letter-spacing: 0.04em;
  border: 1.5px solid var(--ink-4);
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--paper);
  cursor: pointer;
  transition: all 140ms ease;
  user-select: none;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chip.phys { border-color: var(--phys); color: var(--phys); }
.chip.phys.active { background: var(--phys); color: var(--paper); }
.chip.info { border-color: var(--info); color: var(--info); }
.chip.info.active { background: var(--info); color: var(--paper); }

/* ============================================================
   Interactive widget frame
   ============================================================ */
.widget {
  background: #fefcf7;
  border: 1.5px solid var(--paper-edge);
  border-radius: 14px;
  padding: 32px 36px;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 12px 28px -20px rgba(26,26,23,0.2);
  position: relative;
}
.widget-label {
  position: absolute;
  top: -14px;
  left: 28px;
  padding: 2px 12px;
  background: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* hand-drawn annotation feel */
.annotate {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 28px;
  color: var(--phys);
  position: absolute;
}
.annotate.info { color: var(--info); }

/* sliders */
input[type=range].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--paper-edge);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type=range].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  background: var(--ink);
  border-radius: 50%;
  cursor: grab;
  border: 3px solid var(--paper);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
input[type=range].slider::-moz-range-thumb {
  width: 24px; height: 24px;
  background: var(--ink);
  border-radius: 50%;
  cursor: grab;
  border: 3px solid var(--paper);
}

/* buttons */
button.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  padding: 10px 20px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  transition: all 120ms ease;
  letter-spacing: 0.02em;
}
button.btn:hover { background: var(--ink); color: var(--paper); }
button.btn.primary { background: var(--ink); color: var(--paper); }
button.btn.primary:hover { background: var(--accent); border-color: var(--accent); }

/* gate pill (for circuits) */
.gate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  padding: 0 14px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 24px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
}
.gate.h { background: #fff2e2; border-color: var(--phys); color: var(--phys); }
.gate.x { background: #e4eaff; border-color: var(--info); color: var(--info); }
.gate.rz { background: #f0e7f5; border-color: var(--bridge); color: var(--bridge); }
.gate.rx { background: #fff2e2; border-color: var(--phys); color: var(--phys); }
.gate.sx { background: #e4eaff; border-color: var(--info); color: var(--info); }
.gate.cz, .gate.cnot { background: var(--ink); color: var(--paper); }
.gate.u3 { background: #f0e7f5; border-color: var(--bridge); color: var(--bridge); }

/* wires */
.wire {
  flex: 1;
  height: 2px;
  background: var(--ink-3);
  min-width: 16px;
}

/* utility */
.row { display: flex; align-items: center; gap: 16px; }
.col { display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1; }
.center { display: flex; align-items: center; justify-content: center; }

/* hand-drawn arrow (SVG stroked) — reusable class */
.arrow-hand {
  stroke: var(--phys);
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
}

/* ---- Build / reveal system ------------------------------------------------
 * Elements tagged with data-build=N are hidden until the Nth ArrowRight on
 * that slide. builds.js adds a .built class when a step's threshold is met.
 * The transition is slightly longer and softer than a fade so that new bits
 * feel like they're being drawn in rather than popping. Respects
 * prefers-reduced-motion.
 * ------------------------------------------------------------------------- */
[data-build] {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 360ms cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
[data-build].built {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* SVG elements can't accept transform: translateY via the same mechanism
   when they are children of an <svg>, and pointer-events on SVG text is
   already 'none' by default — so we fall back to opacity-only. */
svg [data-build] {
  transform: none;
  transition: opacity 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  [data-build] { transition: opacity 120ms linear; transform: none; }
}

/* slide 02 · highlight the "you are here" row once step 3 is revealed */
section.slide[data-build-step="3"] .you-are-here-row {
  background: rgba(107, 74, 138, 0.12);
  padding: 4px 10px;
  margin-left: -10px;
}
