/* Slides — a PDF presenter. Dark by design: a projected slide sits on black,
   never on a bright chrome that washes out the room. */

:root {
  --bg:        #0b0b0d;
  --ink:       #f2f2f4;
  --ink-dim:   #9a9aa4;
  --ink-faint: #5c5c66;
  --line:      #24242a;
  --panel:     #131318;
  --accent:    #6ea8fe;
  --radius:    10px;
  --chrome-fade: 320ms;
}

* { box-sizing: border-box; }

/* The UA stylesheet's [hidden] rule loses to any class that sets `display`,
   which left the loading spinner painted over a slide that had finished
   rendering. Everything here toggles visibility with the hidden attribute,
   so make it win outright. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

/* ============================== Start screen ============================== */

.start {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 0;
}

.start-inner { width: 100%; max-width: 560px; }

.wordmark {
  margin: 0 0 10px;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.tagline {
  margin: 0 0 32px;
  color: var(--ink-dim);
  font-size: 16px;
  max-width: 46ch;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 52px 24px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink-faint);
  cursor: pointer;
  transition: border-color 140ms, background 140ms, color 140ms;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--ink-faint); color: var(--ink-dim); outline: none; }
.dropzone.dragging {
  border-color: var(--accent);
  border-style: solid;
  background: #12182a;
  color: var(--accent);
}

.dz-icon { width: 48px; height: 34px; margin-bottom: 10px; }
.dz-main { margin: 0; font-size: 17px; color: var(--ink); }
.dz-sub  { margin: 0; font-size: 14px; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.start-error {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #2a1416;
  color: #ff9a9a;
  font-size: 14px;
}

/* ---- recents ---- */

.recents { margin-top: 34px; }
.recents-head { display: flex; align-items: baseline; justify-content: space-between; }
.recents h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.linkbtn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 13px; color: var(--ink-faint);
}
.linkbtn:hover { color: var(--ink-dim); }

.recents-list { list-style: none; margin: 10px 0 0; padding: 0; }
.recents-list li { border-bottom: 1px solid var(--line); }
.recents-list li:first-child { border-top: 1px solid var(--line); }

.recent-btn {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.recent-btn:hover { background: var(--panel); }
.recent-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-meta { color: var(--ink-faint); font-size: 13px; flex: none; }
.recents-note { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-faint); }

/* ---- shortcut list ---- */

.keys-details { margin: 34px 0 0; }
.keys-details summary {
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 13.5px;
  list-style: none;
}
.keys-details summary::-webkit-details-marker { display: none; }
.keys-details summary::before { content: "▸ "; }
.keys-details[open] summary::before { content: "▾ "; }
.keys-details summary:hover { color: var(--ink-dim); }

.keys {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 16px 0 0;
  font-size: 14px;
}
.keys dt { color: var(--ink-dim); }
.keys dd { margin: 0; color: var(--ink-dim); }
kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}

.colophon {
  margin-top: auto;
  padding: 40px 0 20px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ================================ Viewer ================================= */

.viewer {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}
.viewer.cursor-hidden { cursor: none; }

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* Fit-width reading mode: the page can be taller than the screen, so scroll. */
.stage.fit-width {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.page-canvas { display: block; }
.stage.fit-width .page-canvas { margin: 0 auto; }

.blank { position: absolute; inset: 0; background: #000; z-index: 40; }
.blank.white { background: #fff; }

.laser {
  position: absolute;
  z-index: 60;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 14px 5px rgba(255, 59, 48, 0.55);
  pointer-events: none;
}

/* ---- chrome (top bar, arrows, bottom bar) ---- */

.chrome {
  position: absolute;
  inset: 0;
  /* Above the overview grid: the top bar is the only visible way back out of
     it for someone who does not know Esc. */
  z-index: 55;
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--chrome-fade) ease;
}
.chrome.hidden { opacity: 0; }
.chrome > * { pointer-events: auto; }
.chrome.hidden > * { pointer-events: none; }

.bar {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}
.bar-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.72), rgba(0,0,0,0));
  padding-bottom: 34px;
}
.bar-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0));
  padding-top: 34px;
}

.doc-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: rgba(255,255,255,0.72);
}
.bar-actions { display: flex; gap: 4px; flex: none; }

.cbtn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.82);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cbtn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.cbtn.on { background: var(--accent); color: #06101f; }

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.nav:hover { background: rgba(255,255,255,0.16); color: #fff; }
.nav:disabled { opacity: 0; pointer-events: none; }
.viewer.overview-open .nav,
.viewer.overview-open .bar-bottom { display: none; }

.nav-prev { left: 14px; }
.nav-next { right: 14px; }

.progress {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.16);
  cursor: pointer;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: rgba(255,255,255,0.85);
  transition: width 120ms linear;
}
.counter {
  flex: none;
  font: 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: rgba(255,255,255,0.72);
  font-variant-numeric: tabular-nums;
}

/* ---- jump-to-slide indicator ---- */

.goto {
  position: absolute;
  z-index: 70;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 30px;
  border-radius: 12px;
  background: rgba(0,0,0,0.82);
  font: 44px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ---- overview grid ---- */

.overview {
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  /* Clear the top bar, which floats above this and would otherwise sit on the
     first row of thumbnails. */
  padding: 58px 24px 24px;
  background: rgba(8,8,10,0.97);
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.thumb {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #17171c;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}
.thumb:hover { border-color: rgba(255,255,255,0.4); }
.thumb.current { border-color: var(--accent); }
.thumb canvas { max-width: 100%; max-height: 100%; display: block; }
.thumb-num {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.72);
  font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fff;
}

/* ---- loading ---- */

.loading {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

@media (max-width: 640px) {
  .wordmark { font-size: 32px; }
  .nav { width: 38px; height: 60px; font-size: 24px; }
  .nav-prev { left: 6px; }
  .nav-next { right: 6px; }
}
