/* =========================================================================
   COMS W4181 Security I - lecture deck theme
   Terminal/manpage design system (light), ported from the DESIGN.md system
   used by the "Discovering Security Primitives with AI" deck:
   monochrome-on-cream, one accent, ASCII-bracket iconography, one dark
   surface, no shadows, no gradients. Extended here with the components a
   teaching deck needs (definitions, threat models, attack/defense splits,
   protocol ladders, packet layouts, stack frames, quizzes).
   Coordinate space: reveal frame 1280x720.
   ========================================================================= */

/* ---- Fonts (self-hosted, no CDN) ------------------------------------- */
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jbmono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jbmono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jbmono-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: block;
}

/* ---- Tokens ---------------------------------------------------------- */
:root {
  --canvas:        #fdfcfc;
  --surface-soft:  #f8f7f7;
  --surface-card:  #f1eeee;
  --surface-dark:  #201d1d;
  --surface-dark2: #302c2c;

  --ink:           #201d1d;
  --charcoal:      #302c2c;
  --body:          #424245;
  --mute:          #646262;
  --stone:         #6e6e73;
  --ash:           #9a9898;

  --hairline:      rgba(15, 0, 0, 0.12);
  --hairline-2:    #646262;

  /* Semantic accents - attack/defense/focus vocabulary + .term panels */
  --accent:        #007aff;
  --danger:        #ff3b30;
  --success:       #30d158;
  --warning:       #ff9f0a;
  /* darkened variants that hold up on cream at body weight */
  --danger-ink:    #c8281f;
  --success-ink:   #1f9e43;
  --warning-ink:   #a86a04;

  --radius-sm: 4px;
  --radius-0:  0px;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
          Consolas, "Liberation Mono", monospace;

  /* type scale (px in the 1280x720 frame) */
  --fs-display: 62px;
  --fs-h:       34px;
  --fs-lead:    30px;
  --fs-body:    27px;
  --fs-dense:   23px;
  --fs-small:   21px;
  --fs-code:    22px;
  --fs-stat:    52px;
  --fs-caption: 18px;
}

/* ---- Base ------------------------------------------------------------ */
.reveal {
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--fs-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.reveal-viewport { background: var(--canvas); }
.reveal .slides { text-align: left; }

.reveal .slides > section,
.reveal .slides > section > section {
  height: 100%;
  padding: 52px 76px 64px;
  box-sizing: border-box;
}

/* headings */
.reveal h1, .reveal h2, .reveal h3 {
  font-family: var(--mono);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0 0 var(--fs-small);
}
.reveal h1 { font-weight: 700; font-size: var(--fs-display); }
.reveal h2 { font-weight: 700; font-size: var(--fs-h); }
.reveal h3 { font-weight: 700; font-size: var(--fs-lead); }

.reveal p { margin: 0 0 0.6em; line-height: 1.5; }
.reveal strong { font-weight: 700; color: var(--ink); }
.reveal em { font-style: normal; font-weight: 500; color: var(--charcoal); }
.reveal a { color: var(--ink); text-decoration: underline; }
.reveal sup { font-size: 0.62em; vertical-align: super; color: var(--mute); }

/* kill reveal's default blue chrome -> ink/mono */
.reveal .progress { color: var(--ink); height: 3px; }
.reveal .progress span { background: var(--ink); }
.reveal .controls { color: var(--mute); }
.reveal .slide-number {
  background: transparent !important; color: var(--ash) !important;
  font-family: var(--mono); font-size: 15px;
  left: 22px !important; right: auto !important; top: auto !important; bottom: 14px !important;
}

/* ---- Section label: [+] bracketed man-page header + hairline --------- */
.slabel {
  font-weight: 700;
  font-size: var(--fs-h);
  color: var(--ink);
  padding-bottom: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
  display: block;
  line-height: 1.2;
}
.slabel .br { color: var(--ash); font-weight: 700; }   /* the [ ] brackets */
.slabel.sm { font-size: 29px; margin-bottom: 18px; }
/* continuation marker for a split topic: "(2/2)" */
.slabel .cont { color: var(--ash); font-weight: 400; font-size: 0.72em; margin-left: 8px; }

/* lead line under a label */
.lead {
  font-size: var(--fs-lead);
  color: var(--body);
  line-height: 1.42;
  max-width: 46ch;
}
.lead.wide { max-width: 72ch; }
.reveal .muted { color: var(--mute); }
.reveal .dim   { color: var(--ash); }
.reveal .ink   { color: var(--ink); }
.reveal .acc   { color: var(--accent); font-weight: 700; }
.reveal .red   { color: var(--danger-ink); font-weight: 700; }
.reveal .grn   { color: var(--success-ink); font-weight: 700; }
.reveal .wrn   { color: var(--warning-ink); font-weight: 700; }

/* concrete-detail line under a lead */
.detail { font-size: 20px; color: var(--mute); line-height: 1.4; margin-top: 10px; max-width: 78ch; }
.detail .ie { color: var(--ash); font-weight: 700; }
.detail code, .detail .m { color: var(--charcoal); }

/* inline mono token inside prose (already mono - reads as a code chip) */
.reveal code, .m {
  color: var(--charcoal); font-weight: 500;
  background: var(--surface-card); border-radius: var(--radius-sm);
  padding: 0 6px;
}
.reveal pre code { background: none; padding: 0; }

/* ---- ASCII mark lists ------------------------------------------------ */
ul.marks { list-style: none; margin: 0; padding: 0; }
ul.marks > li {
  position: relative;
  padding: 11px 0 11px 60px;
  line-height: 1.42;
  border-bottom: 1px solid var(--hairline);
}
ul.marks > li:last-child { border-bottom: 0; }
ul.marks > li::before {
  position: absolute; left: 0; top: 11px;
  font-weight: 700;
  color: var(--ink);
}
ul.marks > li.plus::before  { content: "[+]"; color: var(--ink); }
ul.marks > li.minus::before { content: "[-]"; color: var(--mute); }
ul.marks > li.x::before     { content: "[x]"; color: var(--danger-ink); }
ul.marks > li.ok::before    { content: "[/]"; color: var(--success-ink); }
ul.marks > li.q::before     { content: "[?]"; color: var(--accent); }
ul.marks > li.bang::before  { content: "[!]"; color: var(--warning-ink); }
ul.marks > li.arrow::before { content: "->";  color: var(--ink); left: 2px; }
ul.marks > li.n1::before { content: "[1]"; } ul.marks > li.n2::before { content: "[2]"; }
ul.marks > li.n3::before { content: "[3]"; } ul.marks > li.n4::before { content: "[4]"; }
ul.marks > li.n5::before { content: "[5]"; } ul.marks > li.n6::before { content: "[6]"; }
ul.marks > li.n7::before { content: "[7]"; } ul.marks > li.n8::before { content: "[8]"; }

ul.marks .k { font-weight: 700; color: var(--ink); }        /* label */
ul.marks .v { color: var(--body); }                         /* description */
ul.marks .tag { color: var(--mute); font-size: var(--fs-small); }
ul.marks.dense > li { padding: 8px 0 8px 56px; font-size: var(--fs-dense); }
ul.marks.dense > li::before { top: 8px; }
ul.marks.tight > li { border-bottom: 0; padding-top: 7px; padding-bottom: 7px; }
/* nested sub-points inside a mark row */
ul.marks .sub { display: block; margin-top: 6px; color: var(--mute);
  font-size: var(--fs-small); line-height: 1.4; }

/* ---- Terminal panel (the single dark surface) ------------------------ */
.term {
  background: var(--surface-dark);
  color: #e9e6e6;
  border-radius: var(--radius-0);
  padding: 22px 26px;
  font-size: var(--fs-code);
  line-height: 1.55;
  white-space: pre-wrap;
}
.term.sm { font-size: 19px; padding: 16px 20px; line-height: 1.5; }
.term .prompt { color: var(--ash); }
.term .cmd    { color: #e9e6e6; font-weight: 500; }
.term .ok     { color: var(--success); }
.term .warn   { color: var(--warning); }
.term .err    { color: var(--danger); }
.term .accent { color: var(--accent); }
.term .dim    { color: var(--ash); }
.term .tok    { color: var(--accent); font-weight: 500; }
.term code, .term .m { background: none; padding: 0; color: inherit; }

/* ---- Light code block (source listings) ------------------------------ */
.code {
  background: var(--surface-card);
  border-left: 3px solid var(--hairline-2);
  padding: 16px 20px;
  font-size: var(--fs-code);
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  color: var(--charcoal);
}
.code.sm { font-size: 19px; padding: 12px 16px; }
.code .c  { color: var(--ash); }                       /* comment */
.code .kw { color: var(--ink); font-weight: 700; }     /* keyword */
.code .s  { color: var(--success-ink); }               /* string  */
.code .fn { color: var(--accent); font-weight: 700; }  /* function name */
.code .bad{ color: var(--danger-ink); font-weight: 700; }
.code .hi { background: rgba(0,122,255,0.13); }        /* highlight span */
.code .m  { background: none; padding: 0; color: inherit; }

/* ---- Definition / concept box ---------------------------------------- */
.defbox {
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  background: var(--surface-soft);
}
.defbox .dt {
  display: block; font-weight: 700; color: var(--ink);
  font-size: var(--fs-small); letter-spacing: .05em; text-transform: uppercase;
  margin-bottom: 8px;
}
.defbox .dd { color: var(--body); font-size: var(--fs-dense); line-height: 1.45; }
.defbox.acc  { border-color: var(--accent); }
.defbox.acc .dt  { color: var(--accent); }
.defbox.warn { border-color: var(--danger); }
.defbox.warn .dt { color: var(--danger-ink); }
.defbox.good { border-color: var(--success-ink); }
.defbox.good .dt { color: var(--success-ink); }

/* ---- Question-to-the-class callout ----------------------------------- */
.qbox {
  border-left: 4px solid var(--accent);
  padding: 4px 0 4px 22px;
  margin: 22px 0;
  font-size: var(--fs-lead);
  color: var(--ink);
  line-height: 1.35;
}
.qbox .qm { color: var(--accent); font-weight: 700; }
.qbox .ans { display: block; margin-top: 12px; font-size: var(--fs-dense);
  color: var(--body); line-height: 1.45; }

/* ---- Takeaway / punchline line --------------------------------------- */
.tagline { margin-top: 20px; font-weight: 700; font-size: var(--fs-lead);
  color: var(--ink); line-height: 1.3; }
.tagline .q { color: var(--accent); }
.tagline.red .q { color: var(--danger-ink); }

/* ---- Columns --------------------------------------------------------- */
.cols { display: grid; gap: 40px; grid-template-columns: 1fr 1fr; align-items: start; }
.cols.c3 { grid-template-columns: repeat(3, 1fr); gap: 30px; }
.cols.c4 { grid-template-columns: repeat(4, 1fr); gap: 22px; }
.cols.w60 { grid-template-columns: 1.5fr 1fr; }
.cols.w40 { grid-template-columns: 1fr 1.5fr; }
.cols.ruled > div { border-right: 1px solid var(--hairline); padding-right: 32px; }
.cols.ruled > div:last-child { border-right: 0; padding-right: 0; }
.cols p { font-size: var(--fs-dense); line-height: 1.45; }

.col-label {
  font-weight: 700; font-size: var(--fs-small);
  color: var(--mute); letter-spacing: 0.06em;
  text-transform: uppercase; margin-bottom: 12px; display: block;
}
.col-label.attack  { color: var(--danger-ink); }
.col-label.defense { color: var(--success-ink); }
.col-label.idea    { color: var(--accent); }

/* ---- Card grid (concept tiles) --------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border-top: 1px solid var(--hairline); margin-top: 22px; }
.cards.c2 { grid-template-columns: repeat(2, 1fr); }
.cards.c4 { grid-template-columns: repeat(4, 1fr); }
.card { padding: 22px 26px 14px; border-right: 1px solid var(--hairline); }
.card:first-child { padding-left: 0; }
.card:last-child  { border-right: 0; padding-right: 0; }
.card .idx { font-weight: 700; color: var(--ink); font-size: 38px; line-height: 1;
  margin: 0 0 14px; }
.card .name { font-weight: 700; font-size: var(--fs-dense); color: var(--ink); line-height: 1.25; }
.card .sub  { color: var(--body); font-size: var(--fs-small); margin-top: 9px; line-height: 1.4; }
.cards.c4 .card .name { font-size: var(--fs-small); }
.cards.c4 .card .sub  { font-size: 18px; }

/* ---- Stat tiles ------------------------------------------------------ */
.stats { display: grid; gap: 0; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-top: 1px solid var(--hairline); }
.stat { padding: 20px 16px; border-right: 1px solid var(--hairline); }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; padding-right: 0; }
.stat .n { display: block; font-weight: 700; font-size: var(--fs-stat);
  color: var(--ink); line-height: 1; letter-spacing: -0.02em; }
.stat .l { display: block; margin-top: 10px; font-size: var(--fs-small);
  color: var(--mute); line-height: 1.3; }

/* ---- Tables ---------------------------------------------------------- */
table.tbl { width: 100%; border-collapse: collapse; margin-top: 10px;
  font-size: var(--fs-dense); }
table.tbl th, table.tbl td { text-align: left; padding: 11px 16px;
  border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.tbl thead th { color: var(--mute); font-weight: 500; font-size: var(--fs-small);
  border-bottom: 1px solid var(--hairline-2); letter-spacing: .04em; text-transform: uppercase; }
table.tbl td.k { font-weight: 700; color: var(--ink); white-space: nowrap; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.bad td { background: rgba(255,59,48,0.06); }
table.tbl tr.good td { background: rgba(48,209,88,0.09); }
table.tbl.sm { font-size: var(--fs-small); }
table.tbl.sm th, table.tbl.sm td { padding: 8px 12px; }

/* ---- Packet / byte-layout strip -------------------------------------- */
.pkt { display: flex; margin-top: 16px; border: 1px solid var(--ink); }
.pkt .f { flex: 1; padding: 12px 10px; border-right: 1px solid var(--ink);
  text-align: center; font-size: var(--fs-small); color: var(--charcoal); }
.pkt .f:last-child { border-right: 0; }
.pkt .f .fn { display: block; font-weight: 700; color: var(--ink); }
.pkt .f .fb { display: block; font-size: 15px; color: var(--ash); margin-top: 4px; }
.pkt .f.hi { background: rgba(0,122,255,0.10); }
.pkt .f.bad { background: rgba(255,59,48,0.10); }
.pkt .f.pay { flex: 2.4; }

/* ---- Memory / stack frame diagram ------------------------------------ */
.mem { border: 1px solid var(--ink); width: 380px; font-size: var(--fs-small); }
.mem .cell { padding: 10px 14px; border-bottom: 1px solid var(--hairline-2);
  color: var(--charcoal); display: flex; justify-content: space-between; gap: 12px; }
.mem .cell:last-child { border-bottom: 0; }
.mem .cell .lbl { font-weight: 700; color: var(--ink); }
.mem .cell .adr { color: var(--ash); font-size: 15px; }
.mem .cell.hi  { background: rgba(0,122,255,0.10); }
.mem .cell.bad { background: rgba(255,59,48,0.12); color: var(--danger-ink); font-weight: 700; }
.mem .cell.pad { color: var(--ash); }
.memcap { font-size: var(--fs-caption); color: var(--mute); margin-top: 8px; }

/* ---- Numbered step list (procedures / protocols) --------------------- */
ol.steps { list-style: none; counter-reset: st; margin: 14px 0 0; padding: 0; }
ol.steps > li { counter-increment: st; position: relative;
  padding: 10px 0 10px 62px; line-height: 1.42; font-size: var(--fs-dense);
  color: var(--body); border-bottom: 1px solid var(--hairline); }
ol.steps > li:last-child { border-bottom: 0; }
ol.steps > li::before {
  content: "[" counter(st) "]"; position: absolute; left: 0; top: 10px;
  font-weight: 700; color: var(--ink); font-size: var(--fs-dense);
}
ol.steps > li .k { font-weight: 700; color: var(--ink); }

/* ---- Badges / flags -------------------------------------------------- */
.flag { display: inline-block; font-size: 16px; color: var(--mute);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 2px 8px; vertical-align: middle; font-weight: 400; }
.flag.attack  { color: var(--danger-ink);  border-color: var(--danger); }
.flag.defense { color: var(--success-ink); border-color: var(--success-ink); }
.flag.acc     { color: var(--accent);      border-color: var(--accent); }
.flag.warn    { color: var(--warning-ink); border-color: var(--warning-ink); }

.kbd { border: 1px solid var(--hairline-2); border-radius: var(--radius-sm);
  padding: 1px 8px; font-size: var(--fs-small); color: var(--charcoal); }

/* ---- Figure caption -------------------------------------------------- */
.fig { display: block; margin-top: 10px; }
.fig .cap { font-size: var(--fs-caption); color: var(--mute); }

/* ---- Exhibit: a real-world photo/screenshot, framed into the system ---
   The design language is text-and-hairline, so evidence images are boxed,
   captioned in mono, and never bleed to the slide edge. */
.exhibit { display: inline-block; border: 1px solid var(--hairline-2);
  background: var(--canvas); padding: 8px; max-width: 100%;
  box-sizing: border-box; }
/* Safety net: an exhibit can never push a slide off the bottom. object-fit
   keeps the aspect ratio when the cap bites, instead of squashing. */
.exhibit img { display: block; max-width: 100%; max-height: 420px;
  object-fit: contain; }
.exhibit .cap { display: block; margin-top: 8px; font-size: var(--fs-caption);
  color: var(--mute); line-height: 1.35; }
.exhibit .cap .src { color: var(--ash); font-size: 15px; }
/* Text beside an exhibit. A grid, not a flex row: the exhibit column is a
   fixed track (--ex) so the caption wraps inside the picture's width instead
   of stretching the row and starving the prose column. */
.exrow { display: grid; gap: 30px; align-items: start; margin-top: 14px;
  grid-template-columns: 1fr var(--ex, 380px); }
.exrow.rev { grid-template-columns: var(--ex, 380px) 1fr; }
.exrow.center { align-items: center; }
.exrow > * { min-width: 0; }
/* callout pinned over an exhibit ("can the barcode be faked?") */
.excall { position: relative; }
.excall .pin { position: absolute; border: 2px solid var(--danger);
  border-radius: 50%; pointer-events: none; }
.excall .note { position: absolute; background: var(--danger); color: #fff;
  font-size: 17px; font-weight: 500; padding: 5px 10px; border-radius: var(--radius-sm);
  line-height: 1.25; max-width: 22ch; }

/* ---- Section divider slide ------------------------------------------- */
.divider { display: flex; flex-direction: column; height: 100%;
  justify-content: center; }
.divider .dnum { font-size: var(--fs-small); color: var(--ash); font-weight: 700;
  letter-spacing: .1em; margin-bottom: 16px; }
.divider h2 { font-size: 52px; line-height: 1.15; max-width: 24ch; }
.divider .dsub { font-size: var(--fs-lead); color: var(--mute); margin-top: 12px;
  max-width: 52ch; line-height: 1.35; }

/* ---- Title slide ----------------------------------------------------- */
.title-wrap { display: flex; flex-direction: column; height: 100%; justify-content: center; }
.byline { font-size: var(--fs-lead); color: var(--body); margin-top: 8px; }
.byline .sep { color: var(--ash); }
.title-term { margin-top: 38px; max-width: 44ch; }
.course-tag { font-size: var(--fs-small); color: var(--mute); letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 18px; display: block; }

/* ---- Roadmap / agenda ------------------------------------------------ */
.roadmap { list-style: none; margin: 0; padding: 0; }
.roadmap > li { display: flex; align-items: baseline; gap: 18px;
  padding: 12px 0; border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-dense); color: var(--mute); }
.roadmap > li:last-child { border-bottom: 0; }
.roadmap > li .n { font-weight: 700; color: var(--ash); width: 44px; flex: none; }
.roadmap > li .t { color: var(--body); }
.roadmap > li.now { color: var(--ink); }
.roadmap > li.now .n { color: var(--accent); }
.roadmap > li.now .t { color: var(--ink); font-weight: 700; }
.roadmap > li.done .t { color: var(--ash); }

/* ---- Acknowledgements ------------------------------------------------ */
.ack { font-size: var(--fs-small); color: var(--mute); line-height: 1.7; }
.ack .who { color: var(--charcoal); font-weight: 700; }
.ackline { position: absolute; left: 76px; right: 76px; bottom: 34px;
  font-size: 16px; color: var(--ash); border-top: 1px solid var(--hairline);
  padding-top: 10px; }

/* ---- Unified diagram language ----------------------------------------
   Outlined nodes on cream, one dark focal node, accent for the active edge. */
svg text { font-family: var(--mono); }
svg .node      { fill: var(--canvas); stroke: var(--ink); stroke-width: 1.4; }
svg .node-soft { fill: var(--surface-soft); stroke: var(--hairline-2); stroke-width: 1.1; }
svg .node-dark { fill: var(--surface-dark); stroke: none; }
svg .node-acc  { fill: var(--canvas); stroke: var(--accent); stroke-width: 1.8; }
svg .node-warn { fill: var(--canvas); stroke: var(--danger); stroke-width: 1.7; }
svg .node-ok   { fill: var(--canvas); stroke: var(--success-ink); stroke-width: 1.7; }
svg .fill-acc  { fill: rgba(0,122,255,0.10); stroke: var(--accent); stroke-width: 1.6; }
svg .fill-red  { fill: rgba(255,59,48,0.10); stroke: var(--danger); stroke-width: 1.6; }
svg .fill-grn  { fill: rgba(48,209,88,0.13); stroke: var(--success-ink); stroke-width: 1.6; }
svg .chip      { fill: var(--surface-soft); stroke: var(--hairline-2); stroke-width: 1; }

svg .edge      { stroke: var(--ink);   stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .edge-acc  { stroke: var(--accent); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .edge-red  { stroke: var(--danger); stroke-width: 2.0; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .edge-grn  { stroke: var(--success-ink); stroke-width: 2.0; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .edge-thin { stroke: var(--hairline-2); stroke-width: 1.1; fill: none; }
svg .edge-dash { stroke-dasharray: 4 5; }

svg .nt   { fill: var(--ink); font-weight: 700; }      /* node title */
svg .ns   { fill: var(--mute); font-weight: 400; }     /* node sub   */
svg .ntd  { fill: #f1eeee; font-weight: 700; }         /* title on dark */
svg .nsd  { fill: var(--ash); font-weight: 400; }      /* sub on dark   */
svg .nacc { fill: var(--accent); font-weight: 700; }
svg .nred { fill: var(--danger-ink); font-weight: 700; }
svg .ngrn { fill: var(--success-ink); font-weight: 700; }
svg .nwrn { fill: var(--warning-ink); font-weight: 700; }
svg .el   { fill: var(--mute); font-weight: 500; }     /* edge label */
svg .elk  { fill: var(--ink);  font-weight: 700; }     /* edge label strong */
svg .lane { fill: var(--ash); font-weight: 700; letter-spacing: .04em; }
svg .mono { fill: var(--charcoal); font-weight: 400; }

/* protocol-ladder lifelines */
svg .life { stroke: var(--hairline-2); stroke-width: 1; stroke-dasharray: 3 6; }
svg .actor { fill: var(--surface-card); stroke: var(--ink); stroke-width: 1.3; }

/* ---- Diagram motion --------------------------------------------------- */
svg .flow { stroke-dasharray: 7 7; animation: dash 0.9s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -14; } }
svg .flow-slow { stroke-dasharray: 6 8; animation: dash 1.8s linear infinite; }
svg .flowdot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
svg .blink { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 0%,49% { opacity: 1; } 50%,100% { opacity: .18; } }
svg .throb { transform-box: fill-box; transform-origin: center;
  animation: throb 1.9s ease-in-out infinite; }
@keyframes throb { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }

/* diagram rises in when its slide becomes current */
.reveal section.present .dgm:not(.fragment) { animation: dgmrise .5s cubic-bezier(.16,1,.3,1) both; }
@keyframes dgmrise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.dgm { width: 100%; margin-top: 6px; display: block; }
.dgm.tight { margin-top: 0; }

/* current-fragment emphasis: the step being explained gets weight */
.reveal .fragment.step.current-fragment .node,
.reveal .fragment.step.current-fragment .node-acc { stroke-width: 3; }
.reveal .fragment.step.current-fragment .nt { fill: var(--accent); }

/* ---- Interactive diagram hotspots + full-screen detail modal --------- */
svg .hot { cursor: pointer; }
svg .hot .hit { fill: transparent; transition: fill .12s; }
svg .hot:hover .hit { fill: rgba(0,122,255,0.10); }
svg .badge   { fill: var(--accent); }
svg .badge-t { fill: #ffffff; font-weight: 700; }

.modal { position: fixed; inset: 0; z-index: 4000; display: none; }
.modal.open { display: flex; align-items: center; justify-content: center; }
.modal-bg { position: absolute; inset: 0; background: rgba(20, 18, 18, 0.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(80vw, 62vh * 1.9); max-width: 1100px;
  max-height: 84vh; overflow: auto;
  background: var(--canvas); border: 1.5px solid var(--ink); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(15, 0, 0, 0.32); font-family: var(--mono); }
.modal-h { position: sticky; top: 0; background: var(--surface-dark); color: var(--canvas);
  display: flex; justify-content: space-between; align-items: center;
  padding: clamp(14px, 1.8vw, 26px) clamp(20px, 2.6vw, 40px);
  font-weight: 700; font-size: clamp(20px, 2.3vw, 36px); }
.modal-x { background: none; border: none; color: var(--ash);
  font-size: clamp(26px, 2.8vw, 44px); line-height: 1; cursor: pointer;
  font-family: var(--mono); padding: 0 4px; }
.modal-x:hover { color: var(--canvas); }
.modal-b { padding: clamp(20px, 2.8vw, 44px) clamp(24px, 3.2vw, 52px);
  font-size: clamp(18px, 1.95vw, 30px); line-height: 1.5; color: var(--ink); }
.modal-b .m { color: var(--charcoal); font-weight: 700; }
.modal-b .snip { display: block; margin-top: clamp(14px, 1.6vw, 26px);
  background: var(--surface-dark); color: #e9e6e6; border-radius: 8px;
  padding: clamp(12px, 1.4vw, 22px) clamp(14px, 1.8vw, 26px);
  font-size: clamp(15px, 1.6vw, 24px); white-space: pre-wrap; }
@media (prefers-reduced-motion: no-preference) {
  .modal.open .modal-card { animation: modalpop .22s cubic-bezier(.16,1,.3,1) both; }
  @keyframes modalpop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
}

/* ---- Fullscreen toggle button --------------------------------------- */
.fs-btn { position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--canvas); color: var(--mute);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  cursor: pointer; opacity: .5; transition: opacity .15s, color .15s, border-color .15s; }
.fs-btn:hover { opacity: 1; color: var(--ink); border-color: var(--ash); }
.fs-btn svg { width: 20px; height: 20px; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fs-btn .fs-compress { display: none; }
body.is-fs .fs-btn .fs-expand  { display: none; }
body.is-fs .fs-btn .fs-compress { display: block; }

/* deck-home link, top-left (bottom corners belong to the slide number and
   reveal's own controls) */
.home-link { position: fixed; top: 16px; left: 18px; z-index: 50;
  font-family: var(--mono); font-size: 14px; color: var(--ash);
  text-decoration: none; opacity: .55; }
.home-link:hover { color: var(--ink); opacity: 1; }

/* ---- Motion: calm. Honor reduced-motion. ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  .reveal .slides section .fragment { transition: none !important; }
  svg .flow, svg .flow-slow { animation: none; stroke-dasharray: none; }
  svg .flowdot, svg .blink { animation: none; opacity: 1; }
  svg .throb { animation: none; }
  .reveal section.present .dgm { animation: none; }
}

/* ---- Course-page QR code on a title slide -----------------------------
   Bottom-right, clear of reveal's controls (which sit in the frame's corner). */
.title-qr { position: absolute; right: 84px; bottom: 84px; width: 124px; text-align: center; }
.title-qr img { display: block; width: 124px; height: 124px; }
.title-qr span { display: block; margin-top: 4px; font-size: 13px; color: var(--ash);
  letter-spacing: .08em; text-transform: uppercase; }

/* ---- Optional lecture icon on the title slide -------------------------
   Each deck's title slide carries a self-removing <img>. Drop a correctly
   named PNG into that deck's assets/ and it appears; until then the slide
   renders exactly as it does now. No layout shift either way. */
.deck-icon { position: absolute; top: 84px; right: 84px;
  width: 190px; height: 190px; object-fit: contain; }

/* ---- Optional concept icon on a section divider -----------------------
   Same self-removing pattern as .deck-icon: the divider is complete without
   the file, and a dropped-in PNG simply appears. Shared across decks, so the
   same concept reuses one image. */
.divider-icon { position: absolute; top: 50%; right: 96px;
  transform: translateY(-50%);
  width: 220px; height: 220px; object-fit: contain; opacity: .96; }
/* keep divider text clear of the icon on the right */
.divider-icon ~ .divider .dsub,
.divider-icon ~ .divider h2 { max-width: min(52ch, calc(100% - 360px)); }

/* ---- Multiple-choice question ----------------------------------------
   Four options in a 2x2 grid. The answer box is a fragment with class
   .mcq-ans; once it is shown, the option marked .right turns green. */
.mcq { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 10px; }
.mcq .opt { border: 1px solid var(--hairline-2); border-radius: var(--radius-sm);
  padding: 9px 14px; font-size: var(--fs-small); line-height: 1.35; color: var(--body);
  transition: border-color .2s, background .2s; }
.mcq .opt b { color: var(--ink); margin-right: 6px; }
.reveal section:has(.mcq-ans.visible) .mcq .opt.right,
.reveal section:has(.mcq-ans:not(.fragment)) .mcq .opt.right {
  border-color: var(--success-ink); border-width: 2px; padding: 8px 13px;
  background: rgba(48,209,88,0.09); }
.mcq-ans { margin-top: 10px; }
.mcq-ans .dd { font-size: var(--fs-small); }
.mcq-ans .dd strong { display: block; margin-bottom: 2px; }
.mcq-ans ul.marks.dense > li { font-size: var(--fs-small); padding-top: 3px; padding-bottom: 3px; }
.mcq-ans ul.marks.dense > li::before { top: 3px; }
.qbox .ans ul.marks { margin-top: 2px; }
.qbox .ans ul.marks.dense > li { padding-top: 4px; padding-bottom: 4px; }
.qbox .ans ul.marks.dense > li::before { top: 4px; }
/* options on the left, the answer on the right */
.mcq-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; align-items: start; }
.mcq-row .mcq { grid-template-columns: 1fr; margin-top: 0; gap: 8px; }
.mcq-row .mcq-ans { margin-top: 0; }
