/*
 * Brandable training decks. A slide is a 16:9 box sized entirely in
 * container units (cqw), so the same markup works as a thumbnail, a live
 * preview and full screen. Brand values arrive as --brand-* custom
 * properties (Decks::Theme#css_variables) on any ancestor.
 */

.dk-theme {
  --brand-bg: #f6f3ec; --brand-text: #1c1b19; --brand-accent: #0f6b5c; --brand-surface: #fffdf8;
  --brand-on-accent: #ffffff; --brand-ink-accent: #f6f3ec;
  --brand-heading-font: "Fraunces", Georgia, serif; --brand-body-font: "Inter", system-ui, sans-serif;
  --brand-radius: 8px; --brand-radius-cq: 0.62cqw;
}

/* ---------- The slide ---------- */
.dk-slide {
  --dk-bg: var(--brand-bg); --dk-fg: var(--brand-text); --dk-accent: var(--brand-accent);
  --dk-card: var(--brand-surface); --dk-card-fg: var(--brand-text); --dk-rule: color-mix(in srgb, var(--dk-fg) 18%, transparent);
  container-type: inline-size;
  position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden;
  display: flex; flex-direction: column;
  /* Percentages, not cqw: an element can't use its own container units,
     but % padding (even vertical) tracks the slide's width. */
  padding: 4.4% 5.6% 3%;
  background: var(--dk-bg); color: var(--dk-fg);
  font-family: var(--brand-body-font); line-height: 1.38;
  text-align: left;
}
.dk-slide.dk-bg-brand {
  --dk-bg: var(--brand-accent); --dk-fg: var(--brand-on-accent); --dk-accent: var(--brand-on-accent);
  --dk-card: color-mix(in srgb, var(--brand-on-accent) 12%, transparent); --dk-card-fg: var(--brand-on-accent);
}
.dk-slide.dk-bg-ink {
  --dk-bg: var(--brand-text); --dk-fg: var(--brand-bg); --dk-accent: var(--brand-ink-accent);
  --dk-card: color-mix(in srgb, var(--brand-bg) 9%, transparent); --dk-card-fg: var(--brand-bg);
}

.dk-head { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; min-height: 3.6cqw; }
.dk-logo { display: inline-flex; align-items: center; gap: 0.8cqw; font-family: var(--brand-heading-font); font-weight: 700; font-size: 2cqw; color: var(--dk-accent); }
.dk-logo img { height: 3.6cqw; width: auto; max-width: 22cqw; object-fit: contain; }
.dk-logo-mark { width: 2.6cqw; height: 2.6cqw; border-radius: var(--brand-radius-cq); background: var(--dk-accent); display: inline-block; }
.dk-bg-brand .dk-logo img, .dk-bg-ink .dk-logo img { background: var(--brand-bg); padding: 0.5cqw 0.8cqw; border-radius: var(--brand-radius-cq); }

.dk-main { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; font-size: 2.2cqw; }
.dk-foot { display: flex; justify-content: space-between; gap: 2cqw; font-size: 1.3cqw; opacity: 0.62; padding-top: 1.4cqw; }

.dk-eyebrow { font-size: 1.5cqw; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dk-accent); margin: 0 0 1.2cqw; }
.dk-h { font-family: var(--brand-heading-font); font-weight: 700; font-size: 4.6cqw; line-height: 1.08; letter-spacing: -0.01em; margin: 0; max-width: 90%; text-wrap: balance; }
.dk-sub { font-size: 2.3cqw; margin: 1.6cqw 0 0; max-width: 75%; opacity: 0.85; }
.dk-body { margin-top: 2cqw; max-width: 88%; }
.dk-body p { margin: 0 0 1cqw; }
.dk-body ul, .dk-body ol { margin: 0 0 1cqw; padding-left: 1.2em; }
.dk-body li { margin-bottom: 0.7cqw; }
.dk-slide strong { font-weight: 700; color: inherit; }
.dk-slide em { font-style: italic; }
.dk-slide a { color: inherit; text-decoration: underline; text-decoration-color: var(--dk-accent); text-underline-offset: 0.2em; }
.dk-slide code { font-family: ui-monospace, monospace; font-size: 0.88em; background: var(--dk-card); padding: 0.1em 0.35em; border-radius: 0.3em; }

/* Bullets: big, airy, accent markers */
.dk-list { list-style: none; padding: 0; margin: 2.4cqw 0 0; display: grid; gap: 1.5cqw; max-width: 86%; }
.dk-list li { position: relative; padding-left: 2.6cqw; font-size: 2.5cqw; line-height: 1.3; }
.dk-list li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 1.1cqw; height: 1.1cqw; border-radius: var(--brand-radius-cq); background: var(--dk-accent); }
.dk-list li b { color: var(--dk-accent); }

/* Cover */
.dk-layout-cover .dk-main { justify-content: flex-end; padding-bottom: 2cqw; }
.dk-layout-cover .dk-h { font-size: 6cqw; max-width: 82%; }
.dk-layout-cover .dk-sub { font-size: 2.5cqw; }
.dk-layout-cover::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.1cqw; background: var(--dk-accent); }
.dk-layout-cover.dk-bg-brand::after { background: var(--brand-bg); opacity: 0.35; }

/* Title */
.dk-layout-title .dk-h { font-size: 5.6cqw; }

/* Three-up */
.dk-three { list-style: none; padding: 0; margin: auto 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2cqw; padding-top: 2.4cqw; }
.dk-three li { background: var(--dk-card); color: var(--dk-card-fg); border-radius: var(--brand-radius-cq); border-top: 0.55cqw solid var(--dk-accent); padding: 2.2cqw 2.2cqw 2.4cqw; font-size: 2cqw; line-height: 1.35; }
.dk-three .dk-num { display: block; font-family: var(--brand-heading-font); font-weight: 700; font-size: 3.2cqw; color: var(--dk-accent); line-height: 1; margin-bottom: 1.2cqw; }
.dk-three .dk-label { display: block; font-weight: 700; font-size: 2.3cqw; margin-bottom: 0.5cqw; }
.dk-layout-three-up .dk-main { justify-content: flex-start; padding-top: 1.6cqw; }

/* Split */
.dk-split { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; align-items: center; flex: 1; }
.dk-split .dk-h { font-size: 4.2cqw; }
.dk-split-panel { background: var(--dk-card); color: var(--dk-card-fg); border-radius: var(--brand-radius-cq); padding: 2.8cqw; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.dk-split-panel .dk-list { margin: 0; max-width: none; }
.dk-split-panel .dk-list li { font-size: 2.1cqw; }
.dk-split-panel img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--brand-radius-cq); }
.dk-split-panel.dk-has-image { padding: 0; overflow: hidden; }

/* Quote */
.dk-layout-quote .dk-main { justify-content: center; }
.dk-quote { margin: 0; position: relative; padding-left: 6cqw; max-width: 90%; }
.dk-quote::before { content: "\201C"; position: absolute; left: 0; top: -1.6cqw; font-family: var(--brand-heading-font); font-size: 11cqw; line-height: 1; color: var(--dk-accent); }
.dk-quote p { font-family: var(--brand-heading-font); font-size: 3.9cqw; line-height: 1.18; font-weight: 600; margin: 0; text-wrap: balance; }
.dk-quote cite { display: block; margin-top: 2.4cqw; font-style: normal; font-size: 1.9cqw; color: var(--dk-accent); font-weight: 600; }

/* Checklist */
.dk-checks { list-style: none; padding: 0; margin: 2.8cqw 0 0; display: grid; gap: 1.6cqw; max-width: 86%; }
.dk-checks li { display: flex; gap: 1.8cqw; align-items: flex-start; font-size: 2.45cqw; line-height: 1.3; background: var(--dk-card); color: var(--dk-card-fg); border-radius: var(--brand-radius-cq); padding: 1.4cqw 2cqw; }
.dk-box { flex: none; width: 2.4cqw; height: 2.4cqw; margin-top: 0.15em; border: 0.3cqw solid var(--dk-accent); border-radius: calc(var(--brand-radius-cq) * 0.6); display: inline-grid; place-items: center; color: var(--dk-accent); font-size: 1.8cqw; font-weight: 700; }

/* Section divider */
.dk-layout-section .dk-main { justify-content: flex-end; padding-bottom: 3cqw; }
.dk-layout-section .dk-h { font-size: 6.4cqw; max-width: 80%; }
.dk-layout-section .dk-eyebrow { font-size: 1.8cqw; }

/* Closing */
.dk-closing { display: grid; grid-template-columns: 1fr auto; gap: 4cqw; align-items: center; flex: 1; }
.dk-closing .dk-h { font-size: 5.4cqw; }
.dk-qr { background: #fff; padding: 1.4cqw; border-radius: var(--brand-radius-cq); width: 21cqw; text-align: center; color: #1c1b19; }
.dk-qr svg { display: block; width: 100%; height: auto; }
.dk-qr p { margin: 0.8cqw 0 0; font-size: 1.35cqw; font-weight: 600; line-height: 1.25; }

/* Locked preview CTA slide */
.dk-locked .dk-main { align-items: flex-start; }
.dk-cta { display: inline-block; margin-top: 2.6cqw; background: var(--dk-accent); color: var(--dk-bg); font-weight: 700; font-size: 2cqw; padding: 1.3cqw 2.6cqw; border-radius: var(--brand-radius-cq); text-decoration: none !important; }

/* ---------- Present mode ---------- */
.dk-present-body { margin: 0; background: #0d0d0c; overflow: hidden; height: 100vh; }
.dk-present { position: fixed; inset: 0; display: grid; place-items: center; background: #0d0d0c; user-select: none; cursor: pointer; }
.dk-present .dk-stage { position: relative; width: min(100vw, calc(100vh * 16 / 9)); }
.dk-present .dk-stage > .dk-slide { position: absolute; inset: 0; animation: dk-in 0.24s ease; }
.dk-present .dk-stage > .dk-slide[hidden] { display: none; }
.dk-present .dk-stage::before { content: ""; display: block; padding-top: 56.25%; }
@keyframes dk-in { from { opacity: 0; transform: translateY(0.6%); } to { opacity: 1; transform: none; } }

.dk-segs { position: fixed; top: 10px; left: 12px; right: 12px; display: flex; gap: 4px; z-index: 5; }
.dk-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.22); overflow: hidden; }
.dk-seg span { display: block; height: 100%; width: 0; background: rgba(255,255,255,0.92); }
.dk-seg.is-done span, .dk-seg.is-current span { width: 100%; }


.dk-controls { position: fixed; right: 16px; bottom: 16px; z-index: 6; display: flex; align-items: center; gap: 6px; background: rgba(20,20,18,0.82); color: #f6f3ec; border-radius: 999px; padding: 6px 10px; font: 500 13px/1 Inter, system-ui, sans-serif; transition: opacity 0.3s; }
.dk-controls button, .dk-controls a { background: transparent; border: 0; color: inherit; padding: 6px 9px; border-radius: 999px; font: inherit; text-decoration: none; }
.dk-controls button:hover, .dk-controls a:hover { background: rgba(255,255,255,0.14); }
.dk-counter { padding: 0 6px; font-variant-numeric: tabular-nums; opacity: 0.85; }
.dk-present.is-idle .dk-controls { opacity: 0; }
.dk-present.is-idle { cursor: none; }
.dk-flag { position: fixed; left: 16px; bottom: 16px; z-index: 6; background: #c4501b; color: #fff; font: 600 12px Inter, sans-serif; padding: 6px 10px; border-radius: 6px; }

/* ---------- Speaker view ---------- */
.dk-speaker { min-height: 100vh; background: #151513; color: #ece7dc; font-family: Inter, system-ui, sans-serif; display: grid; grid-template-rows: auto 1fr auto; gap: 18px; padding: 18px 22px; box-sizing: border-box; }
.dk-speaker header, .dk-speaker footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dk-speaker .dk-sp-title { font-weight: 600; }
.dk-speaker .dk-sp-clock { font: 600 28px/1 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.dk-speaker .dk-sp-planned { font-size: 12px; opacity: 0.6; }
.dk-sp-btn { background: #2a2925; color: #ece7dc; border: 1px solid #3a3934; border-radius: 8px; padding: 8px 14px; font: 600 13px Inter, sans-serif; }
.dk-sp-btn:hover { background: #34332e; }
.dk-sp-main { display: grid; grid-template-columns: 3fr 2fr; gap: 22px; min-height: 0; }
.dk-sp-label { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; margin-bottom: 8px; }
.dk-sp-col { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.dk-sp-notes { background: #1f1e1b; border: 1px solid #2f2e29; border-radius: 10px; padding: 18px 20px; font-size: 20px; line-height: 1.5; overflow: auto; flex: 1; }
.dk-sp-notes p { margin: 0 0 0.8em; }
.dk-sp-notes ul { padding-left: 1.2em; }
.dk-sp-empty { opacity: 0.5; font-style: italic; }
.dk-sp-end { aspect-ratio: 16 / 9; display: grid; place-items: center; border: 1px dashed #3a3934; border-radius: 8px; opacity: 0.6; }

/* ---------- Thumbnails / previews in normal pages ---------- */
.dk-thumb { border-radius: 8px; overflow: hidden; box-shadow: 0 1px 0 rgba(28,27,25,0.06), 0 10px 24px -16px rgba(28,27,25,0.45); border: 1px solid rgba(28,27,25,0.08); }
.dk-thumb .dk-slide { pointer-events: none; }

/* ---------- Handout (print to PDF) ---------- */
.dk-handout { max-width: 980px; margin: 0 auto; padding: 32px 24px 80px; font-family: Inter, system-ui, sans-serif; color: #1c1b19; }
.dk-handout-page { display: grid; gap: 14px; margin-bottom: 40px; }
.dk-handout-notes { font-size: 14px; line-height: 1.55; color: #4a4740; border-left: 3px solid #ddd7ca; padding-left: 14px; }
.dk-handout-notes p { margin: 0 0 0.6em; }
.dk-handout-label { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: #6b675f; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .dk-no-print, .dk-no-print * { display: none !important; }
  body { background: #fff !important; }
  .dk-handout { max-width: none; padding: 0; }
  .dk-handout-page { break-after: page; page-break-after: always; margin: 0; }
  .dk-handout-page:last-child { break-after: auto; page-break-after: auto; }
  .dk-handout-page .dk-thumb { box-shadow: none; width: 72%; }
  .dk-slide { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ---------- Diff ---------- */
.dk-diff { font: 12px/1.55 "JetBrains Mono", ui-monospace, monospace; border: 1px solid #ddd7ca; border-radius: 8px; overflow: auto; background: #fffdf8; }
.dk-diff div { padding: 0 10px; white-space: pre-wrap; word-break: break-word; }
.dk-diff .is-add { background: #e3f3ea; color: #0a5245; }
.dk-diff .is-del { background: #fbe7e1; color: #8a2d0f; text-decoration: line-through; text-decoration-color: rgba(138,45,15,0.35); }
.dk-diff .is-add::before { content: "+ "; }
.dk-diff .is-del::before { content: "− "; }
.dk-diff .is-same::before { content: "  "; }

/* Split slides written as "### Before" / "### After" columns */
.dk-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4cqw; margin-top: 2.6cqw; }
.dk-col { background: var(--dk-card); color: var(--dk-card-fg); border-radius: var(--brand-radius-cq); padding: 2.2cqw 2.4cqw; border-left: 0.5cqw solid var(--dk-accent); }
.dk-col + .dk-col { border-left-color: color-mix(in srgb, var(--dk-accent) 45%, transparent); }
.dk-col-title { margin: 0 0 1cqw; font-family: var(--brand-heading-font); font-size: 2.5cqw; font-weight: 700; color: var(--dk-accent); }
.dk-col-body { font-size: 2.05cqw; line-height: 1.38; }
.dk-col-body p { margin: 0 0 0.8cqw; }
.dk-col-body ul, .dk-col-body ol { margin: 0; padding-left: 1.1em; }
.dk-col-body li { margin-bottom: 0.6cqw; }
.dk-layout-split .dk-main { justify-content: flex-start; padding-top: 1.6cqw; }
.dk-list-sm { gap: 1.1cqw; margin-top: 2cqw; }
.dk-list-sm li { font-size: 2.1cqw; }

/* "[contact or channel]" fill-ins, highlighted in previews and the editor */
.dk-fillin { background: transparent; color: inherit; border-bottom: 0.25cqw dashed #e0a100; padding: 0 0.1em; }
mark.dk-fillin { background: color-mix(in srgb, #f5b700 22%, transparent); }

/* Dense slides: tighten long lists so they stay on the slide */
.dk-list:has(> li:nth-child(6)) { gap: 1cqw; }
.dk-list:has(> li:nth-child(6)) li { font-size: 2.1cqw; }
.dk-checks:has(> li:nth-child(6)) { gap: 1cqw; }
.dk-checks:has(> li:nth-child(6)) li { font-size: 2cqw; padding: 1cqw 1.8cqw; }

/* Progress segments stay visible on light and dark slides */
.dk-segs { mix-blend-mode: difference; }
