/* =============================================================
   The Lost Beauty of Code — deck design system
   Lightning talk · canvas 1280 x 720
   Self-contained: this file is the whole visual language of the
   deck. Nothing here is shared with, or ported from, other talks.
   ============================================================= */

:root {
  /* --- ink (dark slides) --- */
  --ink-900: #070A0F;   /* title / closing */
  --ink-850: #0C1118;   /* default slide */
  --ink-800: #111823;   /* raised panel */
  --ink-700: #18202C;   /* code block */

  /* --- paper (light slides) --- */
  --paper:      #F2EEE6;
  --paper-2:    #FBF8F2;
  --paper-line: #DCD5C6;

  /* --- text --- */
  --fg:      #EAE6DD;   /* on ink */
  --fg-2:    #B6BDC9;
  --fg-3:    #78838F;
  --ink-fg:  #151B24;   /* on paper */
  --ink-fg2: #4B5563;
  --ink-fg3: #8A8578;

  /* --- accents: one warm lead, three supports --- */
  --amber:  #E7A33C;
  --rust:   #CE5F39;
  --sage:   #74B190;
  --sky:    #67A5D5;
  --violet: #A38AD0;

  --rule:   rgba(255,255,255,.085);
  --rule-2: rgba(255,255,255,.16);

  /* --- type: serif for prose (this talk is about craft), mono for code --- */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* -------------------------------------------------------------
   REVEAL FRAME
   Slides are exactly 1280x720 and lay their content out with
   flow/flex — no pixel positioning anywhere in this deck.
   ------------------------------------------------------------- */
.reveal-viewport { background: #05080C; }
.reveal { font-family: var(--font-ui); font-size: 16px; }
.reveal .slides { text-align: left; }
.reveal .slides section {
  width: 1280px; height: 720px;
  padding: 0; overflow: hidden;
}
.reveal .progress { color: var(--amber); height: 3px; }
/* one neutral grey that stays legible on both the ink and the paper slides */
.reveal .slide-number {
  background: none; font-family: var(--font-mono);
  font-size: 12px; color: #7E7E7E; right: 22px; bottom: 18px;
}
.reveal .slide-number a { color: inherit; }

/* -------------------------------------------------------------
   SLIDE SHELL
   ------------------------------------------------------------- */
.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 54px 76px 56px;
  background: var(--ink-850); color: var(--fg);
}
.slide--deep  { background: var(--ink-900); }
.slide--paper { background: var(--paper); color: var(--ink-fg); }
.slide--center { justify-content: center; }

/* running foot — free, no markup per slide */
.slide::after {
  content: "The Lost Beauty of Code";
  position: absolute; left: 76px; bottom: 22px;
  font: 600 10.5px/1 var(--font-ui);
  letter-spacing: .22em; text-transform: uppercase;
  color: rgba(255,255,255,.20);
}
.slide--paper::after { color: rgba(21,27,36,.26); }
.slide--bare::after  { content: none; }

/* hairline accent along the top edge of a slide */
.slide--edge::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--amber) 0%, var(--rust) 38%, transparent 78%);
}

/* -------------------------------------------------------------
   TYPE SCALE
   ------------------------------------------------------------- */
.eyebrow {
  margin: 0 0 20px;
  font: 700 12px/1 var(--font-ui);
  letter-spacing: .28em; text-transform: uppercase;
  color: var(--amber);
}
.slide--paper .eyebrow { color: var(--rust); }
.eyebrow .sep { color: var(--fg-3); margin: 0 10px; font-weight: 400; }

h1.h, h2.h {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400; letter-spacing: -.015em;
}
h1.h { font-size: 66px; line-height: 1.08; }
h2.h { font-size: 40px; line-height: 1.14; }
h2.h em { font-style: italic; color: var(--amber); }
.slide--paper h2.h em { color: var(--rust); }

.sub {
  margin: 22px 0 0;
  font-family: var(--font-display);
  font-size: 25px; line-height: 1.4; font-style: italic;
  color: var(--fg-2); max-width: 900px;
}
.slide--paper .sub { color: var(--ink-fg2); }

/* body prose */
.p {
  margin: 0; font-size: 20px; line-height: 1.6; color: var(--fg-2);
  max-width: 940px;
}
.p.lg { font-size: 23px; }
.p.sm { font-size: 17px; }
.p b, .p strong { color: var(--fg); font-weight: 600; }
.slide--paper .p { color: var(--ink-fg2); }
.slide--paper .p b { color: var(--ink-fg); }

.muted { color: var(--fg-3); font-size: 15px; line-height: 1.5; margin: 0; }
.slide--paper .muted { color: var(--ink-fg3); }

/* the line the talk turns on */
.pull {
  margin: 0;
  font-family: var(--font-display);
  font-size: 46px; line-height: 1.24; color: var(--fg);
  max-width: 1000px;
}
.pull.sm { font-size: 36px; }
.pull em { font-style: italic; color: var(--amber); }
.slide--paper .pull { color: var(--ink-fg); }
.slide--paper .pull em { color: var(--rust); }

/* attribution / aside under a quote */
.by {
  margin: 26px 0 0; font: 400 16px/1.5 var(--font-ui); color: var(--fg-3);
}
.by .dash { color: var(--amber); margin-right: 10px; }

/* thin divider */
.rule { height: 1px; background: var(--rule); border: 0; margin: 28px 0; }
.slide--paper .rule { background: var(--paper-line); }

/* -------------------------------------------------------------
   LAYOUT HELPERS
   ------------------------------------------------------------- */
.grow  { flex: 1; min-height: 0; }
.two   { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.two.tight { gap: 28px; }
/* `mid` needs align-content too: align-items alone centres each cell inside a
   row that is still pinned to the top of a flex-grown container. */
.two.mid   { align-items: center; align-content: center; }
.two.code-left  { grid-template-columns: 1.05fr .95fr; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.spread { display: flex; flex-direction: column; justify-content: space-between; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* -------------------------------------------------------------
   CHIPS
   ------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  font: 600 13px/1 var(--font-ui); letter-spacing: .02em;
  color: var(--fg-2);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--rule-2);
}
.chip.amber  { color: #F1BE6E; border-color: rgba(231,163,60,.42); background: rgba(231,163,60,.10); }
.chip.sage   { color: #9BD0B4; border-color: rgba(116,177,144,.42); background: rgba(116,177,144,.10); }
.chip.sky    { color: #97C3E6; border-color: rgba(103,165,213,.42); background: rgba(103,165,213,.10); }
.chip.rust   { color: #E8896A; border-color: rgba(206,95,57,.42);  background: rgba(206,95,57,.10); }
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.slide--paper .chip {
  color: var(--ink-fg2); background: var(--paper-2); border-color: var(--paper-line);
}

/* -------------------------------------------------------------
   PANELS
   ------------------------------------------------------------- */
.panel {
  background: var(--ink-800); border: 1px solid var(--rule);
  border-radius: 14px; padding: 24px 26px;
}
.panel .pt {
  margin: 0 0 12px; font: 700 12px/1 var(--font-ui);
  letter-spacing: .16em; text-transform: uppercase; color: var(--fg-3);
}
.panel.lead-amber { border-left: 3px solid var(--amber); }
.panel.lead-rust  { border-left: 3px solid var(--rust); }
.panel.lead-sage  { border-left: 3px solid var(--sage); }
.panel.lead-sky   { border-left: 3px solid var(--sky); }
.slide--paper .panel {
  background: var(--paper-2); border-color: var(--paper-line);
}
.slide--paper .panel .pt { color: var(--ink-fg3); }

/* -------------------------------------------------------------
   BEATS — numbered story steps
   ------------------------------------------------------------- */
.beats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; }
.beats li { position: relative; padding-left: 62px; }
.beats .n {
  position: absolute; left: 0; top: 1px;
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font: 700 16px/1 var(--font-mono); color: var(--amber);
  background: rgba(231,163,60,.10); border: 1px solid rgba(231,163,60,.34);
}
.beats .bt {
  margin: 0 0 6px; font-family: var(--font-display);
  font-size: 26px; line-height: 1.2; color: var(--fg);
}
.beats .bd { margin: 0; font-size: 17.5px; line-height: 1.5; color: var(--fg-2); }
.slide--paper .beats .bt { color: var(--ink-fg); }
.slide--paper .beats .bd { color: var(--ink-fg2); }
.slide--paper .beats .n {
  color: var(--rust); background: rgba(206,95,57,.08); border-color: rgba(206,95,57,.30);
}

/* -------------------------------------------------------------
   CODE
   ------------------------------------------------------------- */
.code {
  margin: 0; padding: 22px 24px;
  background: var(--ink-700); border: 1px solid var(--rule);
  border-radius: 12px;
  font-family: var(--font-mono); font-size: 16px; line-height: 1.62;
  color: #D3DCE8; white-space: pre; overflow: hidden;
  tab-size: 4;
}
.code.lg { font-size: 19px; line-height: 1.66; }
.code.sm { font-size: 14.5px; line-height: 1.55; padding: 18px 20px; }
.code .kw   { color: #E39BC8; }
.code .ty   { color: #86BFE0; }
.code .fn   { color: #7FD3C4; }
.code .num  { color: var(--amber); }
.code .str  { color: #A7CE8C; }
.code .com  { color: #6A7686; font-style: italic; }
.code .op   { color: #AFBACA; }

/* One addressable line per row, so the visualizer can point at it.
   `.lines` drops `white-space: pre` on the block — the newlines between
   the row spans would otherwise render as extra blank lines — and each
   row re-enables it for its own indentation. */
.code.lines { white-space: normal; }
.code .l {
  display: block; white-space: pre;
  padding: 0 24px; margin: 0 -24px; border-left: 3px solid transparent;
}
.code.sm .l { padding: 0 20px; margin: 0 -20px; }
.code .l.on {
  background: rgba(231,163,60,.13);
  border-left-color: var(--amber);
}
.code-cap {
  margin: 12px 0 0; font: 400 14.5px/1.5 var(--font-ui); color: var(--fg-3);
}
.code-lang {
  display: inline-block; margin: 0 0 10px;
  font: 700 11px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase;
  color: var(--fg-3);
}

/* a caption strip that annotates a code block */
.gloss { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.gloss li {
  position: relative; padding-left: 22px;
  font-size: 17.5px; line-height: 1.5; color: var(--fg-2);
}
.gloss li::before {
  content: ""; position: absolute; left: 0; top: 10px;
  width: 8px; height: 8px; border-radius: 2px; background: var(--amber);
  transform: rotate(45deg);
}
.gloss li b { color: var(--fg); font-weight: 600; }
.slide--paper .gloss li { color: var(--ink-fg2); }
.slide--paper .gloss li b { color: var(--ink-fg); }
.slide--paper .gloss li::before { background: var(--rust); }

/* -------------------------------------------------------------
   QUICKSORT VISUALIZER  (js/quicksort.js)
   ------------------------------------------------------------- */
.qs { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: stretch; min-height: 0; }
.qs-left  { display: flex; flex-direction: column; min-height: 0; }
.qs-right { display: flex; flex-direction: column; min-height: 0; }

/* the bars */
.qs-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 16px 18px 0;
  background: var(--ink-800); border: 1px solid var(--rule);
  border-radius: 12px;
}
.qs-cell { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.qs-bar {
  border-radius: 5px 5px 2px 2px;
  background: #29323F;
  transition: height .18s ease, background .18s ease, box-shadow .18s ease;
}
.qs-val {
  text-align: center; font: 600 15px/1 var(--font-mono); color: var(--fg-2);
  transition: color .18s ease;
}
.qs-ptr {
  height: 22px; text-align: center;
  font: 700 13px/22px var(--font-mono); letter-spacing: .04em;
  color: transparent;
}
/* states */
.qs-cell.out .qs-bar { background: #1A2129; }
.qs-cell.out .qs-val { color: #4C5663; }
.qs-cell.active .qs-bar { background: #37485C; }
.qs-cell.piv .qs-bar { background: rgba(231,163,60,.85); box-shadow: 0 0 0 1px rgba(231,163,60,.5); }
.qs-cell.piv .qs-val { color: #F1BE6E; }
.qs-cell.at-i .qs-bar { background: var(--sky); }
.qs-cell.at-j .qs-bar { background: var(--violet); }
.qs-cell.at-i.at-j .qs-bar { background: linear-gradient(90deg, var(--sky) 50%, var(--violet) 50%); }
.qs-cell.swapping .qs-bar { background: var(--rust); box-shadow: 0 0 0 2px rgba(206,95,57,.35); }
.qs-cell.done .qs-bar { background: var(--sage); }
.qs-cell.done .qs-val { color: #9BD0B4; }
.qs-cell.at-i .qs-ptr { color: var(--sky); }
.qs-cell.at-j .qs-ptr { color: var(--violet); }
.qs-cell.at-i.at-j .qs-ptr { color: var(--fg); }

/* legend + narration + controls */
.qs-legend { display: flex; gap: 16px; margin: 14px 0 0; flex-wrap: wrap; }
.qs-key { display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px/1 var(--font-ui); color: var(--fg-3); }
.qs-key i { width: 11px; height: 11px; border-radius: 3px; display: block; }
.qs-note {
  margin: 14px 0 0; min-height: 46px;
  font-family: var(--font-mono); font-size: 15px; line-height: 1.5; color: var(--fg-2);
}
.qs-note .hi { color: var(--amber); }
.qs-note .dim { color: var(--fg-3); }

.qs-controls { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; }
.qs-btn {
  appearance: none; cursor: pointer;
  padding: 9px 15px; border-radius: 9px;
  font: 600 13.5px/1 var(--font-ui); letter-spacing: .01em;
  color: var(--fg); background: rgba(255,255,255,.06);
  border: 1px solid var(--rule-2);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.qs-btn:hover { background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.28); }
.qs-btn:disabled { opacity: .35; cursor: default; }
.qs-btn.primary {
  color: #1B1408; background: var(--amber); border-color: var(--amber);
}
.qs-btn.primary:hover { background: #F2B255; border-color: #F2B255; }
/* while the trace is running: readable, but no longer the call to action */
.qs-btn.running {
  color: #F1BE6E; background: rgba(231,163,60,.12); border-color: rgba(231,163,60,.45);
}
.qs-btn.running:hover { background: rgba(231,163,60,.2); border-color: rgba(231,163,60,.7); }
.qs-count {
  margin-left: auto; font: 600 12.5px/1 var(--font-mono); color: var(--fg-3);
}

/* -------------------------------------------------------------
   ABSTRACTION LADDER
   ------------------------------------------------------------- */
.ladder { display: flex; flex-direction: column; gap: 10px; }
.rung {
  display: grid; grid-template-columns: 96px 1fr 1fr;
  align-items: center; gap: 20px;
  padding: 13px 20px; border-radius: 11px;
  background: rgba(255,255,255,.035); border: 1px solid var(--rule);
}
.rung .era { font: 700 14px/1 var(--font-mono); color: var(--fg-3); letter-spacing: .02em; }
.rung .what { font-size: 18.5px; color: var(--fg); }
.rung .what span { color: var(--fg-3); font-size: 15.5px; }
.rung .gone { font-size: 16.5px; color: var(--fg-2); }
.rung.now {
  background: rgba(206,95,57,.10); border-color: rgba(206,95,57,.42);
}
.rung.now .era  { color: #E8896A; }
.rung.now .gone { color: #F0A588; font-weight: 600; }

/* -------------------------------------------------------------
   AGENT CHAT
   ------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat .msg { max-width: 78%; padding: 13px 17px; border-radius: 15px; font-size: 17.5px; line-height: 1.45; }
.chat .who { display: block; font: 700 10.5px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; margin-bottom: 7px; }
.chat .me  { align-self: flex-end; background: rgba(103,165,213,.14); border: 1px solid rgba(103,165,213,.34); color: #DCE7F1; border-bottom-right-radius: 4px; }
.chat .me .who { color: #97C3E6; }
.chat .ai  { align-self: flex-start; background: rgba(255,255,255,.05); border: 1px solid var(--rule-2); color: var(--fg-2); border-bottom-left-radius: 4px; }
.chat .ai .who { color: var(--fg-3); }
.chat .ai.agree { border-color: rgba(231,163,60,.38); background: rgba(231,163,60,.09); }
.chat .ai.agree b { color: #F1BE6E; }

/* -------------------------------------------------------------
   TWO-SIDED SCALE  (does elegance still matter?)
   ------------------------------------------------------------- */
.scale { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.pan { border-radius: 14px; padding: 24px 26px; border: 1px solid var(--rule); background: rgba(255,255,255,.035); }
.pan h3 {
  margin: 0 0 18px; font-family: var(--font-display); font-weight: 400;
  font-size: 26px; line-height: 1.2;
}
.pan.for  { border-color: rgba(116,177,144,.40); background: rgba(116,177,144,.07); }
.pan.for h3 { color: #9BD0B4; }
.pan.against { border-color: rgba(206,95,57,.40); background: rgba(206,95,57,.07); }
.pan.against h3 { color: #E8896A; }
.pan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.pan li { font-size: 17px; line-height: 1.45; color: var(--fg-2); padding-left: 20px; position: relative; }
.pan li::before { content: "—"; position: absolute; left: 0; color: var(--fg-3); }

/* -------------------------------------------------------------
   TITLE / CLOSING SLIDE
   ------------------------------------------------------------- */
.title-mark {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .1em;
  color: var(--fg-3); margin: 0 0 auto;
}
.title-meta {
  margin: auto 0 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px;
}
.title-meta .who { font-family: var(--font-display); font-size: 24px; color: var(--fg); }
.title-meta .who span { display: block; margin-top: 8px; font-family: var(--font-ui); font-size: 14.5px; letter-spacing: .04em; color: var(--fg-3); }
.title-meta .tag { font: 600 12px/1 var(--font-ui); letter-spacing: .24em; text-transform: uppercase; color: var(--amber); }

/* source credit on the closing slide: prose line, then the bare URL under it
   so it stays readable from the back of a room and in a photo of the slide */
.src {
  margin: 34px 0 0; font-size: 16.5px; line-height: 1.5; color: var(--fg-3);
}
.src a { color: var(--sky); text-decoration: none; border-bottom: 1px solid rgba(103,165,213,.4); }
.src .url {
  display: block; margin-top: 8px;
  font-family: var(--font-mono); font-size: 14px; color: var(--fg-3); opacity: .75;
}

/* faint quicksort watermark in the empty right half of the title slide —
   kept clear of the meta row at the bottom so nothing overlaps */
.watermark {
  position: absolute; right: 66px; top: 168px;
  font-family: var(--font-mono); font-size: 14.5px; line-height: 1.75;
  color: rgba(255,255,255,.055); white-space: pre; pointer-events: none;
  text-align: left;
}
