/* ===========================================================================
   Slides — deck editor for markdown decks (slides separated by `---`).
   =========================================================================== */

.gslides {
  --sl-canvas: #eceff3;
  --sl-rail: #f6f7f9;
  --sl-slide: #ffffff;
  --sl-ink: #202124;
  --sl-ink-2: #3c4043;
  --sl-muted: #5f6368;
  --sl-line: #dadce0;
  --sl-chrome: #ffffff;
  --sl-hover: #f1f3f4;
  --sl-accent: #1a73e8;
  --sl-accent-soft: #e8f0fe;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--sl-canvas);
  color: var(--sl-ink);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] .gslides,
.cos-root.cos-dark .gslides {
  --sl-canvas: #15171b;
  --sl-rail: #1b1d22;
  --sl-slide: #232629;
  --sl-ink: #e8eaed;
  --sl-ink-2: #dadce0;
  --sl-muted: #9aa0a6;
  --sl-line: #3c4043;
  --sl-chrome: #1b1d22;
  --sl-hover: #2a2d33;
  --sl-accent: #8ab4f8;
  --sl-accent-soft: #29354a;
}

/* ---------- chrome ---------- */

.sl-menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px 0;
  background: var(--sl-chrome);
  min-height: 26px;
}

.sl-menubar button {
  font: inherit;
  font-size: 12.5px;
  color: var(--sl-ink-2);
  background: none;
  border: 0;
  border-radius: 4px;
  padding: 3px 9px;
  cursor: pointer;
}

.sl-menubar button:hover,
.sl-menubar button[aria-expanded="true"] { background: var(--sl-hover); }
.sl-menubar .sl-spacer { flex: 1 1 auto; }
.sl-menubar .sl-count { font-size: 11.5px; color: var(--sl-muted); padding-right: 6px; font-variant-numeric: tabular-nums; }

.sl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px;
  padding: 3px 8px 5px;
  background: var(--sl-chrome);
  border-bottom: 1px solid var(--sl-line);
}

.sl-toolbar button {
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border: 0;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  color: var(--sl-ink-2);
  font: inherit;
  font-size: 12.5px;
}

.sl-toolbar button:hover { background: var(--sl-hover); }
.sl-toolbar button.active { background: var(--sl-accent-soft); color: var(--sl-accent); }
.sl-toolbar button:disabled { opacity: .35; cursor: default; background: none; }
.sl-toolbar .material-symbols-outlined { font-size: 19px; }
.sl-toolbar .sl-sep { width: 1px; height: 20px; background: var(--sl-line); margin: 0 5px; }
.sl-toolbar .sl-present { background: var(--sl-accent); color: #fff; font-weight: 600; padding: 0 12px; } /* theme-ok: accent fill; dark theme flips the ink below */
.sl-toolbar .sl-present:hover { filter: brightness(1.08); background: var(--sl-accent); }
/* the dark accent is a light blue — white text on it fails contrast, so the ink inverts */
[data-theme="dark"] .sl-toolbar .sl-present,
.cos-root.cos-dark .sl-toolbar .sl-present { color: #10131a; }

/* ---------- body ---------- */

.sl-body { flex: 1 1 auto; min-height: 0; display: flex; }

.sl-rail {
  flex: 0 0 180px;
  background: var(--sl-rail);
  border-right: 1px solid var(--sl-line);
  overflow: auto;
  padding: 10px 8px 40px;
}

.sl-thumb {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-bottom: 8px;
  cursor: pointer;
}

.sl-thumb .n { flex: 0 0 14px; color: var(--sl-muted); font-size: 11px; padding-top: 4px; text-align: right; font-variant-numeric: tabular-nums; }

.sl-thumb .box {
  flex: 1 1 auto;
  aspect-ratio: 16 / 9;
  background: var(--sl-slide);
  border: 1px solid var(--sl-line);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  padding: 6px 7px;
  min-width: 0;
}

.sl-thumb.on .box { border-color: var(--sl-accent); box-shadow: 0 0 0 2px var(--sl-accent); }
.sl-thumb .box .t { font-size: 6.5px; font-weight: 700; line-height: 1.25; color: var(--sl-ink); margin-bottom: 3px; overflow: hidden; }
.sl-thumb .box .b { font-size: 5px; line-height: 1.35; color: var(--sl-muted); overflow: hidden; }
.sl-thumb[draggable="true"] { user-select: none; }
.sl-thumb.dragover .box { border-color: var(--sl-accent); border-style: dashed; }

.sl-stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 20px 24px 28px;
  align-items: center;
}

/* the slide: a fixed 16:9 canvas scaled to the stage, so what you edit is what you present */
.sl-slide {
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  background: var(--sl-slide);
  border: 1px solid var(--sl-line);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .28), 0 4px 14px rgba(60, 64, 67, .13);
  padding: 6% 7%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2.2%;
  overflow: hidden;
  container-type: inline-size;
}

/* type scales with the slide so the editor preview matches the projected result */
.sl-slide h1 { font-size: 5.2cqw; line-height: 1.12; font-weight: 700; margin: 0; color: var(--sl-ink); }
.sl-slide h2 { font-size: 3.9cqw; line-height: 1.18; font-weight: 700; margin: 0; color: var(--sl-ink); }
.sl-slide h3 { font-size: 3cqw; line-height: 1.2; font-weight: 600; margin: 0; color: var(--sl-ink-2); }
.sl-slide p, .sl-slide li { font-size: 2.35cqw; line-height: 1.45; color: var(--sl-ink-2); margin: 0; }
.sl-slide ul, .sl-slide ol { margin: 0; padding-left: 3.4cqw; display: flex; flex-direction: column; gap: .7cqw; }
.sl-slide blockquote { border-left: .5cqw solid var(--sl-accent); padding-left: 2cqw; margin: 0; font-style: italic; }
.sl-slide code { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-size: 2cqw; background: var(--sl-hover); border-radius: 3px; padding: 0 .5cqw; }
.sl-slide pre { background: var(--sl-hover); border-radius: .8cqw; padding: 1.6cqw 2cqw; overflow: auto; margin: 0; }
.sl-slide pre code { font-size: 1.75cqw; background: none; padding: 0; }
.sl-slide img { max-width: 100%; max-height: 46cqw; object-fit: contain; border-radius: .4cqw; }
.sl-slide hr { border: 0; border-top: .2cqw solid var(--sl-line); width: 100%; margin: 1cqw 0; }
.sl-slide a { color: var(--sl-accent); }
.sl-slide strong { font-weight: 700; }
/* same fixed-fill/fixed-ink pairing as docs: an inherited light ink on the pale highlight was
   unreadable on a dark slide */
.sl-slide mark { background: #fff475; color: #202124; border-radius: 2px; padding: 0 .2cqw; } /* theme-ok: fixed highlight pair */

.sl-slide [contenteditable] { outline: none; border-radius: 3px; }
.sl-slide [contenteditable]:hover { box-shadow: 0 0 0 1px var(--sl-line); }
.sl-slide [contenteditable]:focus { box-shadow: 0 0 0 2px var(--sl-accent); }

/* layouts */
.sl-slide.l-title { justify-content: center; align-items: center; text-align: center; }
.sl-slide.l-section { justify-content: center; background: var(--sl-ink); }
.sl-slide.l-section h1, .sl-slide.l-section h2, .sl-slide.l-section h3,
.sl-slide.l-section p, .sl-slide.l-section li { color: var(--sl-slide); }
.sl-slide.l-two .sl-bodyblocks { columns: 2; column-gap: 5%; display: block; }
.sl-slide.l-two .sl-bodyblocks > * { break-inside: avoid; margin-bottom: 2cqw; }
.sl-slide.l-blank .sl-title { display: none; }

.sl-bodyblocks { display: flex; flex-direction: column; gap: 1.6cqw; min-height: 0; flex: 1 1 auto; }

.sl-empty { color: var(--sl-muted); font-size: 2.2cqw; }

/* speaker notes */
.sl-notes {
  width: min(100%, 960px);
  margin-top: 14px;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.gslides.sl-shownotes .sl-notes { display: flex; }
.sl-notes label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--sl-muted); font-weight: 700; }

.sl-notes textarea {
  min-height: 76px;
  border: 1px solid var(--sl-line);
  border-radius: 8px;
  background: var(--sl-slide);
  color: var(--sl-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  padding: 9px 11px;
  resize: vertical;
}

.sl-notes textarea:focus-visible { outline: 2px solid var(--sl-accent); outline-offset: -1px; }

/* ---------- present mode ---------- */

.sl-present-overlay {
  position: fixed;
  inset: 0;
  z-index: 9600;
  background: #0b0d10;                    /* theme-ok: a projected deck is dark in every theme */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.sl-present-overlay .sl-slide {
  width: min(96vw, calc(96vh * 16 / 9));
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: none;
}

.sl-present-overlay .sl-hud {
  position: absolute;
  bottom: 14px;
  right: 18px;
  color: rgba(255, 255, 255, .65);        /* theme-ok: HUD sits on the fixed dark stage */
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 14px;
  align-items: center;
}

.sl-present-overlay .sl-hud button {
  background: rgba(255, 255, 255, .12);   /* theme-ok: HUD sits on the fixed dark stage */
  border: 0;
  color: #fff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sl-present-overlay .sl-pnotes {
  position: absolute;
  left: 18px;
  bottom: 14px;
  max-width: 42vw;
  max-height: 22vh;
  overflow: auto;
  color: rgba(255, 255, 255, .78);        /* theme-ok: HUD sits on the fixed dark stage */
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  display: none;
}

.sl-present-overlay.sl-pnotes-on .sl-pnotes { display: block; }

/* ---------- popovers ---------- */

.sl-pop {
  position: fixed;
  z-index: 9500;
  min-width: 210px;
  background: var(--sl-chrome);
  border: 1px solid var(--sl-line);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 8px 24px rgba(0, 0, 0, .18);
  padding: 6px 0;
  color: var(--sl-ink);
  max-height: min(70vh, 520px);
  overflow: auto;
}

.sl-pop .sl-mi {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 14px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sl-pop .sl-mi:hover { background: var(--sl-hover); }
.sl-pop .sl-mi.on .material-symbols-outlined { color: var(--sl-accent); }
.sl-pop .sl-mi .material-symbols-outlined { font-size: 18px; color: var(--sl-muted); }
.sl-pop hr { border: 0; border-top: 1px solid var(--sl-line); margin: 5px 0; }

@media (max-width: 720px) {
  .sl-rail { flex-basis: 116px; }
}

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