/*
  Shared base for the docs/digital-assembly-line/slides animations.
  Style inspired by the mokup.dev mini-animations: CSS only, infinite loop.
  Each page sets --loop and its own @keyframes; keyframe percentages
  are relative to the loop.
*/
@import url("https://fonts.googleapis.com/css2?family=Architects+Daughter&family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@500&display=swap");

:root {
  --loop: 12s;
  --ink: #1f1f1f;
  --pink: #FF00BF;
  --pink-soft: #ffd6f2;
  --pink-bg: #ffe3f6;
  --blue: #0d99ff;
  --blue-bg: #e3f2ff;
  --green: #12b76a;
  --green-bg: #dcfae6;
  --amber: #f79009;
  --amber-bg: #fef0c7;
  --red: #f04438;
  --red-bg: #fee4e2;
  --indigo: #4f46e5;
  --stage: #f0f6ff;
  --line: #e8ecf4;
  --muted: #b8c0d0;
  --hand: "Architects Daughter", cursive;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fafbff; }

/* 1920×1080 frame, centered in the window and scaled by anim.js. Fixed, not absolute: on phones an absolute
   1920px box widens the page before it is scaled, and the slide then comes out cropped.
   left/top 50% + translate(-50%, -50%) keeps it centered even when the window is narrower than 1920px. */
.frame {
  position: fixed; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform: translate(-50%, -50%); transform-origin: center; color: var(--ink); font-family: var(--sans);
  background-color: #fafbff;
  background-image: radial-gradient(circle, rgba(0,0,0,0.07) 1.5px, transparent 1.8px);
  background-size: 32px 32px;
  overflow: hidden;
}
.frame, .frame *, .frame *::before, .frame *::after { animation-duration: var(--loop); animation-iteration-count: infinite; }

/* ---------- Shared building blocks ---------- */

/* Section heading, top-left: "Step 1 — …" */
.kicker { position: absolute; left: 80px; top: 56px; font-family: var(--hand); font-size: 44px; line-height: 1.1; }
.kicker small { display: block; font-family: var(--sans); font-size: 20px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; opacity: .45; margin-bottom: 6px; }
.kicker::after { content: ""; display: block; height: 7px; margin-top: 6px; border-radius: 4px; background: var(--pink); width: 120px; }

/* White card */
.card { background: #fff; border: 1px solid #edf0f7; border-radius: 24px; box-shadow: 0 20px 40px -28px rgba(0,0,0,.35); }
/* Light-blue inner area */
.screen { border-radius: 16px; background: var(--stage); }

/* Small pill / keyboard-like chip */
.chip { display: inline-block; padding: 10px 18px; border-radius: 10px; background: #fff; border: 1.5px solid #d5dbe6; box-shadow: 0 2px 0 rgba(0,0,0,.08); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip--pink { border-color: var(--pink); }

/* Code / JSON badge */
.code { font-family: var(--mono); font-size: 26px; }
.json { display: inline-block; padding: 14px 22px; border-radius: 14px; font-family: var(--mono); font-size: 28px; background: var(--pink-bg); border: 2.5px solid var(--ink); white-space: nowrap; }

/* Hand-drawn style tag: "Jev", "LLM" */
.hand { font-family: var(--hand); }
.underline-pink { position: relative; }
.underline-pink::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 8px; border-radius: 4px; background: var(--pink); }

/* Probability bar: <div class="bar"><i style="--w: 80%"></i></div> */
.bar { height: 26px; border-radius: 999px; background: #dde4f0; overflow: hidden; }
.bar > i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: var(--pink); }
.bar--grey > i { background: var(--muted); }

/* Mouse cursor: <div class="cursor"><svg>…</svg></div> (see anim.js: cursorSvg) */
.cursor { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; }

/* Full-frame closing title */
.title-overlay {
  position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(250,251,255,.93); font-family: var(--hand); font-size: 110px; line-height: 1.15; text-align: center; opacity: 0;
}
.title-overlay .dim { opacity: .45; }

/* Play-again button, shown by anim.js when the animation ends. Outside .frame so it isn't scaled or paused. */
.replay {
  position: fixed; right: 32px; bottom: calc(32px + var(--notes-h, 0px)); z-index: 50; width: 72px; height: 72px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: #fff; border: 2.5px solid var(--pink);
  box-shadow: 0 12px 28px -14px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transform: scale(.8);
  transition: opacity .3s, transform .3s;
}
.replay.show { opacity: 1; pointer-events: auto; transform: none; }
.replay:hover { background: var(--pink-bg); }
.replay svg { width: 34px; height: 34px; margin-left: 4px; fill: var(--pink); }

/* Bottom left, outside .frame like the replay button: slide number (opens the slide menu) and notes toggle */
.dock {
  position: fixed; left: 24px; bottom: calc(20px + var(--notes-h, 0px)); z-index: 50; display: flex; gap: 6px;
}
.dock button {
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.85); border: 1px solid #e3e7ef; color: #6b7280;
  font: 500 14px/1 var(--mono); letter-spacing: .3px;
}
.dock button:hover, .notes-open .notes-toggle { color: var(--pink); border-color: var(--pink); }

/* Phones: smaller controls, closer to the corners, so they cover less of the scaled-down slide */
@media (max-width: 900px), (max-height: 500px) {
  .replay { right: 10px; bottom: calc(10px + var(--notes-h, 0px)); width: 40px; height: 40px; border-width: 2px; }
  .replay svg { width: 18px; height: 18px; margin-left: 2px; }
  .dock { left: 8px; bottom: calc(8px + var(--notes-h, 0px)); gap: 4px; }
  .dock button { padding: 4px 8px; font-size: 11px; background: rgba(255,255,255,.7); }
}

/* Slide menu: as tall as the window, scrolls on its own */
.slide-menu {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; width: 400px; max-width: 90vw; overflow-y: auto;
  padding: 12px 0; background: #fff; border-right: 1px solid #e3e7ef; box-shadow: 12px 0 32px -20px rgba(0,0,0,.35);
  transform: translateX(-102%); transition: transform .2s; font-family: var(--sans);
}
.slide-menu.open { transform: none; }
.slide-menu a {
  display: flex; gap: 14px; align-items: baseline; padding: 9px 20px; color: var(--ink); text-decoration: none; font-size: 15px;
}
.slide-menu a:hover { background: var(--stage); }
.slide-menu a.current { background: var(--pink-bg); color: var(--pink); font-weight: 600; }
.slide-menu code { flex: none; width: 36px; color: #6b7280; font: 500 13px var(--mono); }
.slide-menu a.current code { color: var(--pink); }

/* Speaker notes, read from the video script: bottom panel, the slide is scaled above it */
.notes {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 36vh; overflow-y: auto;
  background: #fff; border-top: 1px solid #e3e7ef; box-shadow: 0 -12px 32px -24px rgba(0,0,0,.35);
  font: 17px/1.55 var(--sans); color: var(--ink); display: none;
}
.notes-open .notes { display: block; }
.notes-body { max-width: 960px; margin: 0 auto; padding: 20px 32px 32px; }
.notes h2 { margin: 0 0 12px; font: 26px/1.2 var(--hand); color: var(--pink); }
.notes p { margin: 0 0 10px; }
.notes blockquote { margin: 0 0 14px; padding: 4px 0 4px 18px; border-left: 3px solid var(--pink); font-size: 20px; }
.notes blockquote p { margin: 0 0 6px; }
.notes code { font: 500 .9em var(--mono); background: var(--stage); padding: 1px 5px; border-radius: 4px; }
.notes pre { margin: 0 0 14px; padding: 12px 16px; background: var(--stage); border-radius: 8px; font: 500 14px/1.5 var(--mono); overflow-x: auto; }
.notes table { border-collapse: collapse; margin: 0 0 14px; }
.notes td { border: 1px solid var(--line); padding: 6px 12px; }
.notes ul { margin: 0 0 10px; padding-left: 22px; }
.notes-empty { color: #6b7280; }

/* Dev mode (npm run slides): Edit turns the notes into one textarea per block of the script section */
.notes-btn {
  padding: 6px 12px; border-radius: 8px; cursor: pointer; background: #fff; border: 1px solid #e3e7ef; color: #6b7280;
  font: 500 13px/1 var(--mono);
}
.notes-btn:hover { color: var(--pink); border-color: var(--pink); }
.notes-edit { float: right; margin-left: 12px; }
.notes-btn.save { background: var(--pink); border-color: var(--pink); color: #fff; }
.notes-form label { display: block; margin: 0 0 14px; font: 500 12px var(--mono); color: #6b7280; text-transform: uppercase; letter-spacing: .4px; }
.notes-form textarea {
  display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 10px 12px; resize: vertical;
  border: 1px solid #e3e7ef; border-radius: 8px; font: 16px/1.5 var(--sans); color: var(--ink); text-transform: none; letter-spacing: 0;
}
.notes-form textarea.quote { border-left: 3px solid var(--pink); font-size: 18px; }
.notes-form textarea:focus { outline: none; border-color: var(--pink); }
.notes-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notes-status { color: #6b7280; font-size: 14px; }

/* page.html?notes (P): the notes window, only the notes at full height; the slide number stays as a reference */
.presenter .frame, .presenter .replay, .presenter .slide-menu, .presenter .notes-toggle, .presenter .notes-window { display: none; }
.presenter .notes { display: block; top: 0; height: auto; border-top: 0; box-shadow: none; font-size: 22px; }
.presenter .notes-body { padding-bottom: 80px; }
.presenter .notes h2 { font-size: 34px; }
.presenter .notes blockquote { font-size: 26px; }
.presenter .slide-id { pointer-events: none; }

/* H toggles .bare on <html>: no on-screen controls, e.g. while recording */
.bare .replay, .bare .dock, .bare .notes, .bare .slide-menu { display: none; }

/* ---------- Drawing toolbar (draw.js, D) ---------- */
/* Layer over the slide, outside .frame (not paused with it): 1920×1080, placed and scaled like .frame by draw.js */
.draw-layer {
  position: fixed; left: 0; top: 0; z-index: 45; width: 1920px; height: 1080px; transform-origin: 0 0;
  overflow: hidden; pointer-events: none; touch-action: none;
}
.drawing .draw-layer { pointer-events: auto; cursor: crosshair; }
.draw-layer svg { position: absolute; inset: 0; }
.draw-stroke { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.draw-guide { fill: none; stroke-width: 2; stroke-dasharray: 6 12; stroke-linecap: round; opacity: .3; }
/* Spotlight: everything outside the box dims and blurs */
.draw-spot { position: absolute; inset: 0; animation: draw-fade .35s ease-out both; }
.draw-spot-dim { position: absolute; inset: 0; background: rgba(15,18,30,.55); backdrop-filter: blur(6px) saturate(.6); }
.draw-spot-ring { position: absolute; box-shadow: 0 0 0 4px rgba(255,255,255,.95), 0 24px 60px -12px rgba(0,0,0,.6); }
@keyframes draw-fade { from { opacity: 0; } }

/* Toolbar, right edge; the launcher button takes its place when it is closed */
.draw-bar, .draw-launcher { position: fixed; right: 20px; top: 50%; z-index: 55; transform: translateY(-50%); }
.draw-bar {
  display: none; flex-direction: column; align-items: center; gap: 2px; max-height: calc(100vh - 24px); overflow-y: auto; padding: 8px;
  border-radius: 16px; background: rgba(255,255,255,.95); border: 1px solid #e3e7ef; box-shadow: 0 16px 40px -20px rgba(0,0,0,.45);
}
.draw-open .draw-bar { display: flex; }
.draw-open .draw-launcher { display: none; }
.draw-bar button, .draw-launcher {
  flex: none; width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: none; color: #6b7280; cursor: pointer;
}
.draw-bar button:hover { background: var(--stage); color: var(--ink); }
.draw-bar button.on { background: var(--pink-bg); color: var(--draw-color, var(--pink)); }
.draw-bar svg, .draw-launcher svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.draw-bar hr { flex: none; width: 24px; margin: 4px 0; border: 0; border-top: 1px solid #e3e7ef; }
.draw-bar .draw-color { width: 34px; height: 34px; border-radius: 50%; }
.draw-color::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--c); }
.draw-bar .draw-color.on { background: none; box-shadow: inset 0 0 0 2.5px var(--c); }
.draw-launcher { background: rgba(255,255,255,.85); border: 1px solid #e3e7ef; opacity: .6; }
.draw-launcher:hover { opacity: 1; color: var(--pink); border-color: var(--pink); }
/* H (recording): no toolbar, but D, 1–5, Z, Esc and the last tool still work */
.bare .draw-bar, .bare .draw-launcher { display: none; }
@media (max-width: 900px), (max-height: 500px) {
  .draw-bar, .draw-launcher { right: 8px; }
  .draw-bar { padding: 4px; }
  .draw-bar button, .draw-launcher { width: 30px; height: 30px; }
  .draw-bar .draw-color { width: 26px; height: 26px; }
  .draw-color::after { width: 14px; height: 14px; }
  .draw-bar svg, .draw-launcher svg { width: 18px; height: 18px; }
}
