body {
  margin: 0;
  padding: 0;
  width: 100dvw;
  height: 100dvh;
  
  font-family: sans-serif;
  background-color: #000000;
  color: #FFFFFF;
  
  display: grid;
  grid-template-columns: min-content 1fr;
  grid-template-rows: min-content 1fr min-content;
}

body > #not-xhtml-warning {
  position: fixed;
  left: 0;
  top: 0;
  width: 100dvw;
  height: 100dvh;
  
  z-index: 999;
  
  background: black;
  text-align: center;
}

body.is-xhtml > #not-xhtml-warning {
  display: none;
}

body > #toolbar {
  grid-row: 1;
  grid-column: 1/-1;
  
  background-color: var(--ui-background);
}
body > #slides {
  grid-row: 2;
  grid-column: 2;
  
  /* Allow the slide to shrink to fit into the grid */
  min-width: 0;
  min-height: 0;
}
body > #thumbnails {
  grid-row: 2/-1;
  grid-column: 1;
  
  width: 256px;
  
  background-color: var(--ui-background);
  
  border-color: var(--ui-resize-handle-colour);
  border-width: var(--ui-resize-handle-width);
  border-style: none;
  border-right-style: solid;
}
body > #notes {
  grid-row: 3;
  grid-column: 2;
  
  height: 64px;
  
  background-color: var(--ui-background);
  
  border-color: var(--ui-resize-handle-colour);
  border-width: var(--ui-resize-handle-width);
  border-style: none;
  border-top-style: solid;
}

@media (max-aspect-ratio: 1/1) {  /* Portrait */
  body {
    grid-template-columns: 1fr;
    grid-template-rows: min-content 1fr min-content min-content;
  }
  body > #slides {
    grid-row: 2;
    grid-column: 1;
  }
  body > #thumbnails {
    grid-row: 4;
    grid-column: 1;
    
    width: auto !important;  /* Survive manual resizes whilst landscape */
    height: 134px;
  
    border-top-style: solid;
    border-right-style: none;
  }
  body > #notes {
    grid-row: 3;
    grid-column: 1;
  }
}
@media not (max-aspect-ratio: 1/1) {  /* Landscape */
  body > #thumbnails {
    height: 100% !important;  /* Survive manual resizes whilst portrait */
  }
}

body.hide-ui > #toolbar,
body.hide-ui > #thumbnails,
body.hide-ui > #notes {
	display: none;
}


#toolbar {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  
  padding: 8px;
  gap: 4px;
}
#toolbar > * {
  display: block;
  flex-shrink: 0;
}

#slide-selector input.slide-number {
  box-sizing: content-box;
  width: 3em;
  text-align: right;
  
  transition: width 0.2s;
}
#slide-selector input.slide-number:focus {
  width: 12em!important;  /* Override the custom resizing by JS */
}
#slide-selector input.slide-number.invalid {
  border-color: red;
}

#title {
  flex-grow: 1;
  flex-shrink: 1;
  
  text-align: center;
  font-weight: bold;
  
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  
  margin-left: 1em;
  margin-right: 1em;
}

button#show-help {
  padding-left: calc(1em + 16px);
  background-size: 1em;
  background-repeat: no-repeat;
  background-position: 8px center;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233"><path d="M2.452 3.09c0-.376.04-.438.381-.677.529-.376.683-.626.683-1.104C3.516.535 2.936 0 2.1 0 1.61 0 1.229.171.984.506c-.188.25-.262.523-.267.99h.774c0-.512.239-.825.632-.825.336 0 .592.279.592.654 0 .256-.068.364-.398.637-.455.387-.586.643-.569 1.127zm.091.313H1.69v.831h.853z" fill="white"/></svg>');
}

button#hide-ui {
  padding-left: calc(1em + 16px);
  background-size: 1em;
  background-repeat: no-repeat;
  background-position: 8px center;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 6.35 6.35"><path d="M.264.264h5.821v5.821H.264z" fill="none" stroke="white" stroke-width=".529"/></svg>');
}

button#full-screen {
  padding-left: calc(1em + 16px);
  background-size: 1em;
  background-repeat: no-repeat;
  background-position: 8px center;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 6.35 6.35"><path d="M.359 6.35l5.631-3.175L.359 0z" fill="white"/></svg>');
}

button#presenter-view {
  padding-left: calc(1em + 16px);
  background-size: 1em;
  background-repeat: no-repeat;
  background-position: 8px center;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 6.35 6.35"><g fill="none" stroke="white" stroke-width=".529"><path d="M.827.265v.467 1.262.65c0 .259.209.467.468.467h3.76c.259 0 .467-.208.467-.467v-.65V.732.265h-.467-3.76z"/><path d="M3.175 3.111l.013 2.974m-1.208 0h2.415M0 .265h6.35"/></g><path d="M1.899 1.22H4.45m-2.551.818H4.45" stroke="white" fill="white" stroke-width=".265"/></svg>');
}




#slides > .slide-container {
  /* Slides are hidden until explicitly displayed. */
  display: none;
  
  width: 100%;
  height: 100%;
  
  padding: 8px;
}

body.hide-ui #slides.mouse-idle,
#slides:fullscreen.mouse-idle {
  cursor: none;
}

body.hide-ui #slides > .slide-container,
#slides:fullscreen > .slide-container {
  padding: 0;
}


#thumbnails {
  overflow-y: auto;
  
  display: flex;
  flex-direction: column;
  gap: 24px;
  
  padding: 4px;
  padding-left: 0px;
}

.thumbnail-group {
  flex-shrink: 0;
  
  display: flex;
  
  width: 100%;
}

.thumbnail-group > .slide-number-column {
  min-width: 2em;
  flex-grow: 0;
}
.thumbnail-group > .step-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 4px;
  
  width: 100%;
}

.slide-number {
  text-align: right;
  padding-top: 4px;
  padding-right: 8px;
  
  font-weight: bold;
  
  position: sticky;
  top: 0;
}


.thumbnail {
  border-width: 4px;
  border-style: solid;
  border-color: transparent;
  
  width: 100%;
}
.thumbnail.selected {
  border-color: red;
}

.thumbnail img {
  display: block;
  width: 100%;
}

@media (max-aspect-ratio: 1/1) {  /* Portrait */
  #thumbnails {
    overflow-x: auto;
    overflow-y: hidden;
    flex-direction: row;
  }
  .thumbnail-group {
    width: auto;
    height: 100%;
  }
  .thumbnail-group > .step-thumbnails {
    flex-direction: row;
    width: auto;
    height: 100%;
  }
  .slide-number-column {
    position: sticky;
    left: 0;
    background-color: var(--ui-background);
  }
  .slide-number {
    top: 0;
    left: 0;
  }
  .thumbnail {
    width: auto;
    height: 100%;
  }
  .thumbnail img {
    max-width: none;
    width: auto;
    height: 100%;
  }
}


#notes {
  overflow-y: auto;
  padding: 8px;
  padding-top: 0;
  
  --subdued-opacity: 0.25;
  --paragraph-spacing: 8px;
}

#notes:empty::before {
  content: "No speaker notes for this slide.";
  font-style: italic;
  opacity: var(--subdued-opacity);
  
  display: block;
  margin-top: var(--paragraph-spacing);
  margin-bottom: var(--paragraph-spacing);
}

#notes p {
  margin-top: var(--paragraph-spacing);
  margin-bottom: var(--paragraph-spacing);
}

#notes > .note {
  opacity: var(--subdued-opacity);
}
#notes > .note.current {
  opacity: 1;
}


