:root {
  --ink: #000;
  --paper: #fff;
  --blue: #006fe6;
  --blue-tint: #e6f0fd;
  --grey: #666;
  --soft: #8c8c8c;
  --panel: #f5f5f5;
  --line: #dcdcdc;
  --good: #0a8f4d;
  --bad: #d0021b;
  --sans: Helvetica, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; overscroll-behavior-x: none; background: #000; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }

#viewport { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; }
#stage { position: relative; width: 1600px; height: 900px; background: var(--paper); overflow: hidden; flex: none; }

#bar { position: absolute; inset: 0 0 auto 0; height: 60px; background: #000; color: #fff; display: flex; align-items: center; gap: 28px; padding: 0 96px; z-index: 20; font-size: 16px; }
#bar img { height: 26px; width: auto; }
#bar .where { opacity: .8; letter-spacing: .01em; font-size: 18px; }
#bar .count { margin-left: auto; opacity: .72; font-variant-numeric: tabular-nums; }
#progress { position: absolute; left: 0; top: 60px; height: 3px; background: var(--blue); z-index: 21; transition: width .25s; }

.slide { position: absolute; inset: 60px 0 0 0; display: none; padding: 60px 96px 52px; background: var(--paper); overflow: hidden; }
.slide.on { display: block; }
.slide.dark { background: #000; color: #fff; }
.slide.grey { background: var(--panel); }
.slide.flush { padding: 0; }

/* type: sizes are in stage pixels (stage is 1600 x 900) */
.kicker { font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); margin: 0 0 22px; font-weight: 400; }
.dark .kicker { color: rgba(255, 255, 255, .6); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.04em; text-wrap: balance; }
h1 { font-size: 104px; line-height: .98; }
h2 { font-size: 62px; line-height: 1.03; }
h3 { font-size: 32px; line-height: 1.15; letter-spacing: -.03em; }
h1 em, h2 em, h3 em, .lede em { font-style: italic; font-weight: 400; color: var(--blue); letter-spacing: -.045em; }
p { margin: 0; font-size: 26px; line-height: 1.38; color: var(--grey); text-wrap: pretty; }
.dark p { color: rgba(255, 255, 255, .72); }
.lede { font-size: 31px; line-height: 1.32; color: var(--grey); max-width: 23em; margin-top: 28px; }
.small { font-size: 19px; line-height: 1.4; }
.tiny { font-size: 15px; line-height: 1.4; color: var(--soft); }
strong, b { color: var(--ink); font-weight: 600; }
.dark strong, .dark b { color: #fff; }
.blue { color: var(--blue); }
.source { position: absolute; left: 96px; bottom: 22px; font-size: 14px; color: var(--soft); }

/* layout */
.split { display: grid; grid-template-columns: var(--l, 1fr) var(--r, 1fr); gap: var(--gap, 72px); align-items: var(--align, center); height: 100%; }
.cols { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: var(--gap, 48px); }
.stack > * + * { margin-top: var(--s, 24px); }
.fill { height: 100%; }
.center { display: grid; place-items: center; }
.mt { margin-top: 36px; }
.mt-l { margin-top: 56px; }

/* numbered rows: only for real sequences */
.rows { border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 76px var(--a, 1fr) var(--b, 1.25fr); gap: 28px; align-items: baseline; padding: 21px 0; border-top: 1px solid var(--line); }
.row .n { font-size: 17px; font-weight: 600; color: var(--blue); font-variant-numeric: tabular-nums; }
.row h3 { font-size: 29px; }
.row p { font-size: 22px; }
.dark .rows, .dark .row { border-color: rgba(255, 255, 255, .22); }

/* plain facts table */
table.t { width: 100%; border-collapse: collapse; font-size: 22px; }
table.t th { text-align: left; font-weight: 400; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--grey); padding: 0 20px 14px 0; border-bottom: 1px solid var(--ink); }
table.t td { padding: 17px 20px 17px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--grey); line-height: 1.3; }
table.t td:first-child { color: var(--ink); font-weight: 600; }

.panel { background: var(--panel); padding: 32px 36px; }
.note { border-left: 3px solid var(--blue); padding: 4px 0 4px 22px; font-size: 22px; line-height: 1.38; color: var(--grey); }
.note.warn { border-color: var(--bad); }
.tag { display: inline-block; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; padding: 6px 11px; border: 1px solid currentColor; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 26px; background: var(--blue); color: #fff; border: 1px solid var(--blue); font-size: 19px; cursor: pointer; text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #bdbdbd; }
.btn:hover { filter: brightness(.93); }
.btn:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.btn[disabled] { opacity: .4; cursor: default; }
ul.ticks { list-style: none; margin: 0; padding: 0; }
ul.ticks li { position: relative; padding: 0 0 0 38px; font-size: 25px; line-height: 1.35; color: var(--grey); }
ul.ticks li + li { margin-top: 16px; }
ul.ticks li::before { content: ""; position: absolute; left: 2px; top: .34em; width: 16px; height: 9px; border-left: 3px solid var(--blue); border-bottom: 3px solid var(--blue); transform: rotate(-45deg); }
ul.ticks.no li::before { width: 18px; height: 0; border-left: 0; border-color: var(--bad); transform: none; top: .62em; }

/* annotated file */
.code { background: var(--panel); font-family: var(--mono); font-size: 19px; line-height: 1.52; padding: 24px 0; color: #1a1a1a; overflow: hidden; }
.code .ln { display: block; padding: 0 28px; white-space: pre; transition: opacity .2s, background .2s; }
.code .k { color: var(--blue); }
.code .c { color: var(--soft); }
.code.focus .ln { opacity: .26; }
.code.focus .ln.hi { opacity: 1; background: var(--blue-tint); }

/* step reveals */
[data-step] { visibility: hidden; opacity: 0; transition: opacity .28s; }
[data-step].shown { visibility: visible; opacity: 1; }

/* Data Duck picture frames: art sits under the frame image */
.frame { position: relative; aspect-ratio: var(--ar); }
.frame > .art { position: absolute; inset: var(--inset); overflow: hidden; display: grid; place-items: center; background: var(--art-bg, #fff); }
.frame::after { content: ""; position: absolute; inset: 0; background: var(--img) center / 100% 100% no-repeat; pointer-events: none; filter: var(--tint, none) drop-shadow(0 18px 22px rgba(0, 0, 0, .22)); }
.frame.purple { --ar: 482 / 544; --img: url(assets/purple-frame.png); --inset: 15.2% 20.9% 18.4% 19%; }
.frame.yellow { --ar: 699 / 866; --img: url(assets/frame-ornate.png); --inset: 10.6% 12.1% 10.6% 11.4%; }
.frame.green { --ar: 1080 / 1080; --img: url(assets/frame-green-large.png); --inset: 15.6% 26% 16.7% 24.7%; }
.frame.wide { --ar: 1920 / 1073; --img: url(assets/frame-ornate-yellow.png); --inset: 20.8% 11.4% 20.1% 11.6%; }
.frame.red { --tint: hue-rotate(-52deg) saturate(1.5) brightness(.92); }

body::after { content: ""; position: fixed; left: -9px; width: 1px; height: 1px; background: url(assets/purple-frame.png), url(assets/frame-ornate.png), url(assets/frame-green-large.png), url(assets/frame-ornate-yellow.png); }

/* controls + overlays */
#nav { position: absolute; right: 20px; top: 14px; z-index: 30; display: flex; gap: 6px; opacity: .45; transition: opacity .2s; }
#nav:hover { opacity: 1; }
#nav button { width: 32px; height: 32px; border: 1px solid rgba(255, 255, 255, .5); background: #000; color: #fff; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 0 2px; }
#cue { position: absolute; left: 0; right: 0; bottom: 0; z-index: 40; background: #000; color: #fff; padding: 16px 96px; font-size: 20px; line-height: 1.4; display: none; }
#cue.on { display: block; }
#cue li { margin: 2px 0; }

#qa { position: absolute; inset: 60px 0 0 0; z-index: 50; background: #fff; display: none; padding: 44px 96px; overflow: auto; }
#qa.on { display: block; }
#qa input { width: 100%; font: inherit; font-size: 30px; padding: 16px 18px; border: 1px solid var(--ink); border-radius: 0; outline: none; }
#qa input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
#qa .list { margin-top: 18px; columns: 2; column-gap: 56px; }
#qa .q { break-inside: avoid; display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 14px 0; font-size: 21px; line-height: 1.3; cursor: pointer; }
#qa .q:hover, #qa .q.sel { color: var(--blue); }
#qa .answer { display: none; }
#qa .qa-close { position: absolute; right: 96px; top: 44px; min-height: 66px; z-index: 2; }
#qa:not(.one) input { width: calc(100% - 130px); }
#qa.one .list, #qa.one input { display: none; }
#qa.one .answer { display: block; max-width: 1180px; }
#qa .answer h2 { font-size: 54px; }
#qa .answer p:not(.kicker) { font-size: 32px; line-height: 1.36; margin-top: 30px; color: #333; }
#qa .none { font-size: 22px; padding: 18px 0; }
#qa input::-webkit-search-cancel-button { display: none; }
#qa .answer .btn { margin-top: 40px; }

body.overview #viewport { position: static; display: block; height: auto; padding: 24px; }
body.overview #stage { zoom: 1 !important; width: auto; height: auto; background: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; overflow: visible; }
body.overview #bar, body.overview #progress, body.overview #nav, body.overview #cue { display: none; }
body.overview .slide { display: block; position: relative; inset: auto; width: 1600px; height: 840px; zoom: var(--thumb, .18); cursor: pointer; outline: 6px solid transparent; }
body.overview .slide.on { outline-color: var(--blue); }
body.overview .slide * { pointer-events: none; }
body.overview [data-step] { visibility: visible; opacity: 1; }

#bar .mode { margin-left: auto; color: #fff; opacity: .72; font-size: 14px; text-underline-offset: 3px; }
#bar .mode + .count { margin-left: 0; }
#bar .mode:hover { opacity: 1; }

/* take-home guide: a readable summary, then every slide stacked with every step shown */
#summary { max-width: 780px; margin: 0 auto; padding: 36px 20px 8px; font-size: 17px; line-height: 1.5; color: #333; }
#summary .kicker { font-size: 12px; margin-bottom: 12px; }
#summary h1, #summary h2 { color: var(--ink); }
#summary h1 { font-size: clamp(34px, 7vw, 54px); line-height: 1.04; }
#summary h2 { font-size: 25px; line-height: 1.15; margin: 40px 0 12px; padding-top: 22px; border-top: 1px solid var(--ink); letter-spacing: -.03em; }
#summary p, #summary li { font-size: 17px; line-height: 1.5; color: #444; }
#summary .lede { font-size: 20px; line-height: 1.4; margin-top: 16px; color: var(--grey); max-width: none; }
#summary ol, #summary ul { margin: 0; padding-left: 22px; }
#summary li { margin: 0 0 10px; padding-left: 2px; }
#summary li ul { margin-top: 8px; }
#summary li li { margin-bottom: 4px; font-size: 16px; }
#summary ol > li::marker { color: var(--blue); font-weight: 600; }
#summary .note { font-size: 16px; margin: 18px 0 14px; }
#summary .cta { margin: 28px 0 0; }
#summary .hint { font-size: 15px; color: var(--grey); }
.narrow-only { display: none; }
.gw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 8px; font-size: 13px; color: var(--grey); }
.gw-head b { color: var(--ink); font-weight: 600; }
.gw-head button { font-size: 13px; border: 1px solid #bbb; background: #fff; padding: 6px 10px; cursor: pointer; flex: none; }
.gw { overflow-x: auto; contain: inline-size; border-bottom: 1px solid var(--line); }
@media (max-width: 819px) { .narrow-only { display: inline; } }

/* take-home guide: every slide stacked, every step shown */
body.guide { background: #fff; height: auto; }
body.guide #viewport { position: static; display: block; overflow: visible; }
body.guide #stage { zoom: 1 !important; width: auto; height: auto; overflow: visible; }
body.guide #bar { position: sticky; top: 0; padding: 0 20px; }
body.guide #bar .count, body.guide #progress, body.guide #nav, body.guide #cue { display: none; }
body.guide .gw .slide { border-bottom: 0; }
body.guide .slide { display: block; position: relative; inset: auto; width: 1600px; height: 840px; zoom: var(--fit, 1); border-bottom: 1px solid var(--line); }
body.guide [data-step] { visibility: visible; opacity: 1; }
body.guide #qa { position: static; display: block; padding: 40px 20px; }
body.guide #qa input, body.guide #qa .answer { display: none; }
body.guide #qa .list { columns: 1; }
body.guide #qa .q { cursor: default; font-weight: 600; font-size: 18px; border: 0; padding: 18px 0 4px; }
body.guide #qa .a { display: block; font-size: 16px; line-height: 1.45; color: var(--grey); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
#qa .a { display: none; }
.guide-only { display: none; }
body.guide .guide-only { display: block; }
body.guide .deck-only { display: none; }

#hint { position: absolute; right: 96px; bottom: 12px; margin: 0; padding: 9px 18px; background: #000; color: #fff; font-size: 17px; white-space: nowrap; }
#hint b { color: #fff; }
#summary .jump { margin-top: 18px; font-size: 16px; }
#summary .jump a { color: var(--blue); display: inline-block; padding: 8px 0; margin-right: 18px; }
#slides-start, #qa { scroll-margin-top: 72px; }
body.guide #qa { max-width: 780px; margin: 0 auto; }
body.guide #qa input { display: block; width: 100% !important; font-size: 17px; padding: 12px 14px; margin: 10px 0 0; }
body.guide #qa .end { margin-top: 28px; }
@media (max-width: 819px), (max-height: 520px) { body.guide #bar { position: static; } #slides-start, #qa { scroll-margin-top: 12px; } }

@media print {
  @page { size: 1600px 900px; margin: 0; }
  html, body { background: #fff; height: auto; }
  #viewport { position: static; display: block; }
  #stage { zoom: 1 !important; width: auto; height: auto; overflow: visible; }
  #bar, #progress, #nav, #cue, #qa, #summary, .gw-head, #hint { display: none !important; }
  .slide { display: block; position: relative; inset: auto; width: 1600px; height: 900px; padding-top: 80px; zoom: 1; break-after: page; }
  [data-step] { visibility: visible; opacity: 1; }
  .fa-back { display: none; } /* print ignores backface-visibility: the back of the card printed mirrored over the front */
  /* the guide prints as an A4 handout (deck.js adds the A4 @page rule): summary, two slides to a page, then the questions */
  body.guide #summary, body.guide #qa { display: block !important; max-width: none; padding: 0; }
  body.guide #summary .jump, body.guide #summary .hint, body.guide #qa input, body.guide .gw-head button { display: none !important; }
  body.guide .gw-head { display: flex !important; padding: 14px 0 6px; break-after: avoid; }
  body.guide .gw { contain: none; overflow: visible; border: 0; break-inside: avoid; } /* contain: inline-size prints 37 blank pages */
  body.guide .slide { zoom: .42 !important; height: 840px; padding-top: 60px; break-after: auto; break-inside: avoid; border: 1px solid var(--line); }
  body.guide .slide.flush { padding-top: 0; }
  body.guide #qa .q { break-after: avoid; }
  body.guide #qa .a { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}
