:root {
  font-family: "Instrument Sans", system-ui, sans-serif;
  color: #1c3028;
  background: #f5f7f3;
  font-synthesis: none;
  --ink: #1c3028;
  --muted: #52645a;
  --accent: #006644;
  --line: #d8e1d9;
  --paper: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
button, input, a { font: inherit; }
:focus-visible { outline: 3px solid #597c31; outline-offset: 3px; }

.shell { width: min(100% - 3rem, 71rem); margin-inline: auto; }
.masthead { background: #006644; color: #fff; }
.masthead-inner { display: flex; align-items: center; gap: .7rem; min-height: 3.75rem; }
.wordmark-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .55rem;
  background: #e3eddf;
  color: #005238;
  font-size: 1.28rem;
  font-weight: 700;
}
.masthead h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; }
main {
  --order-width: 4rem;
  --preview-width: 6.5rem;
  --trash-width: 2.5rem;
  --row-gap: .8rem;
  --row-padding: .75rem;
  --action-width: 15.6rem;
  --download-width: 6.25rem;
  padding-top: 1.35rem;
}
.drop-zone, .slide, .zip-row {
  display: grid;
  grid-template-columns: var(--order-width) var(--preview-width) minmax(0, 1fr) var(--action-width) var(--trash-width);
  align-items: center;
  gap: var(--row-gap);
  padding: var(--row-padding);
  border-radius: .8rem;
}
h1, h2, p { margin: 0; }
.intro { margin-bottom: 1rem; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.caveat {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.5;
}
.caveat b { font-weight: 700; }
.open-pdf b, .download b { font-weight: 700; margin-left: .1em; }
footer { padding-block: 1.35rem 2rem; color: var(--muted); font-size: .8rem; }
footer a { color: var(--accent); text-underline-offset: .15em; }

.drop-zone {
  min-height: 5rem;
  border: 1px dashed #9eb28f;
  background: #edf4eb;
}
.drop-zone.active { border-color: var(--accent); background: #deeddf; }
#export:disabled { cursor: wait; opacity: .7; }
.zip-row { margin-top: 1rem; border: 1px solid transparent; border-top: 3px solid var(--accent); border-radius: 0; }
.zip-preview { grid-column: 2; }
.zip-icon {
  display: grid;
  place-items: end center;
  width: 1.9rem;
  height: 2.25rem;
  padding-bottom: .2rem;
  border: 1px solid currentColor;
  border-radius: .22rem;
  background: repeating-linear-gradient(var(--accent) 0 2px, transparent 2px 4px) center top / 3px .85rem no-repeat, var(--paper);
  font-size: .58rem;
}
.zip-name { position: relative; }
.zip-name .title { padding-right: 3rem; }
.zip-name span {
  position: absolute;
  inset: 1px 1px 1px auto;
  display: grid;
  place-items: center;
  width: 2.6rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  pointer-events: none;
}
#slides:not([hidden]) + .drop-zone { margin-top: .65rem; }
.add-icon {
  display: grid;
  grid-column: 2;
  height: 3rem;
  place-items: center;
  border: 1px solid #d2e0d1;
  border-radius: .75rem;
  background: #f9fbf8;
  color: var(--accent);
  font-size: 1.65rem;
  cursor: pointer;
}
.add-icon:hover { border-color: var(--accent); background: #deeddf; }
.drop-copy { min-width: 0; padding-inline: .45rem; }
.receive-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  align-self: end;
  gap: .0625rem;
  margin: 0 -.25rem -.25rem 0;
  text-align: right;
  grid-column: 4 / -1;
}
.receive-actions :is(a, button) {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .6875rem;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: .15em;
  cursor: pointer;
}
.receive-actions :is(a, button):is(:hover, :focus-visible) { color: var(--accent); }
.drop-copy h2 { font-size: 1.1rem; letter-spacing: -.025em; }
.drop-copy p { margin-top: .25rem; color: var(--muted); font-size: .9rem; }
.link-entry { display: flex; gap: .4rem; max-width: 34rem; margin-top: .6rem; }
.link-entry input {
  flex: 1 1 auto;
  min-width: 0;
  height: 2.25rem;
  padding: .3rem .55rem;
  border: 1px solid #c9d7c8;
  border-radius: .45rem;
  background: #fff;
  color: var(--ink);
  font-size: .85rem;
}
.link-entry input::placeholder { color: #727e75; opacity: 1; }
.link-entry input:hover { border-color: #7f9f88; }
.link-entry .button { min-height: 2.25rem; padding-block: .3rem; font-size: .8rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .55rem .9rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  font-size: .875rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { background: #edf4eb; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: #004d33; }

#slides { position: relative; list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .65rem; }
.slide {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 2px 4px #1236250a;
  cursor: grab;
}
.slide.dragging {
  position: relative;
  z-index: 1;
  border-color: var(--accent);
  box-shadow: 0 .65rem 1.4rem #12362529;
}
#slides.reordering, #slides.reordering .slide { cursor: grabbing; user-select: none; }
.order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-self: stretch;
  gap: .4rem;
  min-width: 0;
  padding: 0 .45rem 0 .65rem;
  border: 0;
  border-radius: .4rem;
  background: transparent;
  color: var(--muted);
  cursor: inherit;
  touch-action: none;
}
.order:hover { background: #edf4eb; color: var(--accent); }
.grip {
  flex: 0 0 9px;
  height: 75%;
  min-height: 24px;
  background: radial-gradient(circle, currentColor 1px, transparent 1.4px) 0 0 / 4.5px 5px;
  opacity: .75;
}
.position {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.thumbnail {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: #edf4eb;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .045em;
}
.thumbnail img { position: absolute; width: 100%; height: 100%; object-fit: contain; background: #f5f7f3; }
.slide-name { min-width: 0; }
.title {
  width: 100%;
  padding: .38rem .45rem;
  border: 1px solid #dce4dc;
  border-radius: .35rem;
  background: #fff;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 680;
  text-overflow: ellipsis;
}
.title:hover { border-color: #7f9f88; }
.title::placeholder { color: #727e75; opacity: 1; }
.file-details {
  display: flex;
  align-items: baseline;
  gap: .3rem;
  margin: .25rem .45rem 0;
  color: var(--muted);
  font-size: .77rem;
}
.filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metadata { white-space: nowrap; }
.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--download-width);
  align-items: center;
  gap: .4rem;
}
.download, .get-pdf { grid-column: 2; }
.get-pdf:disabled { cursor: wait; opacity: .7; }
.link-thumbnail { background: #f5f7f3; color: #6f8a78; }
.preview-button {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: .62rem;
  font-weight: 650;
  letter-spacing: .02em;
  cursor: pointer;
}
.preview-button span { opacity: 0; transition: opacity .12s; }
.preview-button:is(:hover, :focus-visible) { background: #edf4eb; color: var(--accent); }
.preview-button:is(:hover, :focus-visible) span { opacity: 1; }
.preview-button:disabled { cursor: wait; opacity: .6; }
.source-link { color: var(--muted); white-space: nowrap; text-underline-offset: .15em; }
.source-link:hover { color: var(--accent); }
.actions .button { height: 2.75rem; }
.icon-button {
  display: grid;
  place-items: center;
  width: var(--trash-width);
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover { color: #9d2544; background: #fff0f4; }
.error { margin-top: 1rem; font-size: .84rem; line-height: 1.5; }
.error { color: #9d2544; }
.error a { color: inherit; text-underline-offset: .15em; font-weight: 650; }
.notice { margin-top: 1rem; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 780px) {
  main { --order-width: 3.35rem; --preview-width: 4.65rem; --row-gap: .55rem; }
  .slide, .drop-zone, .zip-row { grid-template-columns: var(--order-width) var(--preview-width) minmax(0, 1fr) var(--trash-width); }
  .order { grid-row: 1 / 3; padding-inline: .4rem; }
  .slide-name, .drop-copy { grid-column: 3 / -1; }
  .receive-actions { grid-column: 2 / -1; grid-row: 2; }
  .actions { grid-column: 2 / 4; grid-row: 2; width: min(100%, var(--action-width)); justify-self: end; }
  .remove { grid-column: 4; grid-row: 2; }
}
@media (max-width: 440px) {
  .shell { width: calc(100% - 1.5rem); }
  main { --order-width: 2.7rem; --preview-width: 3.2rem; --row-gap: .45rem; --row-padding: .55rem; --trash-width: 2rem; --download-width: 4.55rem; }
  .position { font-size: 1.08rem; }
  .order { padding-inline: .2rem; gap: .18rem; }
  .actions .button { padding-inline: .3rem; font-size: .75rem; }
  .file-details { flex-wrap: wrap; row-gap: .1rem; }
}

/* Presenter page (present.html) */
.deck-body {
  margin: 0;
  background: #101014;
  color: #f2f2f4;
}

.deck-page {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  /* The strip parks below the foot, so clip rather than grow a scrollbar and
     shove the slide around. Clip, not hidden: hidden still makes a scroll
     container that script and focus can scroll, which moved the slide. */
  overflow: clip;
}

.deck-bar {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .5rem .9rem;
  background: #1b1b21;
  border-bottom: 1px solid #2c2c34;
}

.deck-title {
  flex: 0 1 auto;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The file's own name, for picking the right deck off a projector when the
   talk has been given a friendlier one. It yields the room first. */
.deck-source {
  flex: 0 2 auto;
  min-width: 2rem;
  margin-left: -.35rem;
  color: #8b8b96;
  font-size: .82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: #b4b4bd;
}

.deck-button {
  font: inherit;
  color: inherit;
  background: #2c2c34;
  border: 1px solid #3c3c46;
  border-radius: .4rem;
  padding: .3rem .7rem;
  cursor: pointer;
}

.deck-button:hover { background: #3a3a44; }

.deck-stage {
  display: grid;
  place-items: center;
  /* clip, not hidden, so nothing can scroll the slide out of place. */
  overflow: clip;
  padding: .5rem;
}

.deck-stage > * { max-width: 100%; max-height: 100%; }

.deck-message {
  color: #b4b4bd;
  text-align: center;
  padding: 2rem;
  max-width: 32rem;
}

/* Click targets along each edge, invisible until focused. */
.deck-edge {
  position: absolute;
  top: 3rem;
  bottom: 0;
  width: 12%;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  /* Drawn over the slide, so they must not take its clicks: a link at the edge
     of a page would never be reachable. present.mjs places edge clicks by
     coordinate instead. Keyboard focus is unaffected. */
  pointer-events: none;
}

.deck-prev { left: 0; }
.deck-next { right: 0; }
.deck-edge:focus-visible { opacity: 1; background: rgba(255, 255, 255, .12); }

/* In full screen the bar hides until the pointer reaches the top. */
:fullscreen .deck-page { grid-template-rows: 1fr; }
:fullscreen .deck-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  opacity: 0;
  transition: opacity .15s;
}
:fullscreen .deck-bar:hover,
:fullscreen .deck-bar:focus-within { opacity: 1; }
:fullscreen .deck-edge { top: 0; }

/* B and W blank the screen, as in PowerPoint. */
.deck-blank {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000;
}
.deck-blank[data-colour="white"] { background: #fff; }

/* Slide picker: a strip of thumbnails along the bottom. */
.deck-picker {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .2s ease-out, visibility 0s linear .2s;
  display: flex;
  gap: .5rem;
  padding: .6rem;
  overflow-x: auto;
  overscroll-behavior: contain;
  background: rgba(16, 16, 20, .94);
  border-top: 1px solid #2c2c34;
}

.deck-picker.open {
  transform: none;
  visibility: visible;
  transition: transform .2s ease-out, visibility 0s;
}

.deck-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 9rem;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 2px solid #3c3c46;
  border-radius: .25rem;
  cursor: pointer;
}

.deck-thumb.current { border-color: #f2f2f4; }
.deck-thumb:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 2px; }
.deck-thumb svg { display: block; width: 100%; height: 100%; }

.deck-thumb-number {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 1;
  padding: .05rem .3rem;
  font-size: .7rem;
  color: #f2f2f4;
  background: rgba(16, 16, 20, .75);
  border-radius: 0 .25rem 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .deck-picker { scroll-behavior: smooth; }
}

/* Keyboard guide, raised with ? or / */
.deck-help {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(16, 16, 20, .72);
  backdrop-filter: blur(3px);
}

.deck-help-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55rem 1.1rem;
  align-items: center;
  margin: 0;
  padding: 1.25rem 1.5rem;
  max-width: min(32rem, 100%);
  font-size: .9rem;
  background: #1b1b21;
  border: 1px solid #3c3c46;
  border-radius: .6rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .45);
}

.deck-help-list dt { display: flex; gap: .3rem; justify-self: end; }
.deck-help-list dd { margin: 0; color: #c9c9d2; }

.deck-help kbd {
  font: inherit;
  font-size: .78rem;
  padding: .1rem .4rem;
  color: #f2f2f4;
  background: #2c2c34;
  border: 1px solid #4a4a56;
  border-bottom-width: 2px;
  border-radius: .3rem;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .deck-picker, .deck-picker.open { transition: none; }
}

/* PDF presenting: the page, and the link layer over it. */
.pdf-page {
  position: relative;
  background: #fff;
  /* PDF.js sizes the link layer from these; --scale-factor is set per page. */
  --user-unit: 1;
  --total-scale-factor: calc(var(--scale-factor) * var(--user-unit));
  --scale-round-x: 1px;
  --scale-round-y: 1px;
}

.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* The subset of PDF.js's annotation styles that clickable links need. Forms,
   popups and editing are not rendered here, so their rules are left out. */
.annotationLayer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  transform-origin: 0 0;
}

.annotationLayer section {
  position: absolute;
  text-align: initial;
  pointer-events: auto;
  box-sizing: border-box;
  transform-origin: 0 0;
}

.annotationLayer .linkAnnotation > a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 1em;
}

.annotationLayer .linkAnnotation:not(.hasBorder) > a:hover {
  opacity: .2;
  background-color: rgb(255 255 0);
}

.annotationLayer .linkAnnotation.hasBorder:hover { background-color: rgb(255 255 0 / .2); }
.annotationLayer .hasBorder { background-size: 100% 100%; }
