html {
    height: 100%;
}

body[data-mode="presentation"] {
    height: 100%;
    overflow: hidden;
}

body[data-mode="presentation-xbottom"] {
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

body[data-mode="presentation"] #editor-app,
body[data-mode="presentation-xbottom"] #editor-app {
    display: none;
}

body[data-mode="presentation"] #presentation-app,
body[data-mode="presentation-xbottom"] #presentation-app {
    display: flex;
}

body[data-mode="presentation"] #presentation-app {
    height: 100vh;
}

body[data-mode="presentation-xbottom"] #presentation-app {

    display: flex;
    flex-direction: column;

    min-height: 100vh;
    height: auto;

    overflow: visible;
}

body[data-mode="presentation-xbottom"] #slide-container {

    flex: 1 0 auto;

    display: flex;
    justify-content: flex-start;
    align-items: stretch;
}

body[data-mode="presentation"] p {
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

body[data-mode="presentation-xbottom"] p {
    line-height: 1.8;
    margin-bottom: 1rem;
}

body[data-mode="presentation-xbottom"] li {
    line-height: 1.8;
}

body[data-mode="presentation-xbottom"] li + li {
    margin-top: 0.35rem;
}

body[data-mode="presentation"] .slide {
    height: 100vh;
}

body[data-mode="presentation"] #presentation-app {
    overflow: hidden;
}

body[data-mode="presentation-xbottom"] #presentation-app {
    overflow: visible;
}

body[data-mode="presentation-xbottom"] .slide {
    min-height: auto;
    height: auto;
}

#presentation-app {

    display: none;
    flex-direction: column;

    justify-content: flex-start;
    align-items: center;

    width: 100%;
    height: 100vh;

    padding: 2.5rem 2rem;
    box-sizing: border-box;

    font-family: system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.5;

    color: #222;
    background: white;
}

#slide-container {

    flex: 1;
    width: 100%;
    display: flex;
}

.slide {

    width: min(48rem, 100%);

    display: flex;
    flex-direction: column;

    box-sizing: border-box;
}

/* ----------------------------------------------------------
   Normal slides participate in the layout toggle.
   ---------------------------------------------------------- */

.slide.content {
    padding-top: 2.5rem;
}

body.left-layout #slide-container.content-slide {
    margin-top: 0;
    justify-content: flex-start;
    align-items: flex-start;
}

body.centered-layout #slide-container.content-slide {
    margin-top: 18vh;
    justify-content: center;
    align-items: flex-start;
}

body[data-mode="presentation-xbottom"] .slide.content {
    padding-top: 0;
}

body[data-mode="presentation-xbottom"] #slide-container.content-slide {
    margin-top: 0;
}

#slide-container.title-slide {
    justify-content: center;
    align-items: center;
}

/* ----------------------------------------------------------
   Title slides ALWAYS stay centred.
   ---------------------------------------------------------- */

.slide.title {

    align-self: center;

    justify-content: center;
    align-items: center;
    text-align: center;

    width: 100%;
    max-width: none;

    margin-top: auto;
    margin-bottom: auto;

    padding-top: 0;
}

.slide.title h1 {
    font-size: 3rem;
}

.slide ul {

    margin: 0 0 1rem;
    padding-left: 1.4em;
}

.slide h1,
.slide h2,
.slide h3,
.slide h4,
.slide h5,
.slide h6 {

    margin: 0 0 1rem 0;

    color: inherit;
    font-size: 1.5rem;
}


/* ----------------------------------------------------------
   Heading underlines (Presentation + Print)
   ---------------------------------------------------------- */

.slide.title h1::after {

    content: "";
    display: block;
    width: 100%;
    margin-top: .35rem;
    border-bottom: 3px solid currentColor;
}

.slide.content h1::after,
.slide.content h2::after,
.slide.content h3::after,
.slide.content h4::after,
.slide.content h5::after,
.slide.content h6::after,

.print-slide h1::after,
.print-slide h2::after,
.print-slide h3::after,
.print-slide h4::after,
.print-slide h5::after,
.print-slide h6::after {

    content: "";
    display: block;

    width: 66%;
    margin-top: .2rem;

    border-bottom-style: solid;
    border-bottom-color: currentColor;
}

/* ----------------------------------------------------------
   Underline thickness
   ---------------------------------------------------------- */

.slide.content h1::after,
.print-slide h1::after {
    border-bottom-width: 3px;
}

.print-slide h1::after {
    width: 100%;
}

.slide.content h2::after,
.print-slide h2::after {
    border-bottom-width: 2px;
}

.slide.content h3::after,
.slide.content h4::after,
.slide.content h5::after,
.slide.content h6::after,

.print-slide h3::after,
.print-slide h4::after,
.print-slide h5::after,
.print-slide h6::after {
    border-bottom-width: 1px;
}

/* ----------------------------------------------------------
   Screen colour mode
   ---------------------------------------------------------- */

body.color-headings .slide h1 { color: purple;        }
body.color-headings .slide h2 { color: navy;          }
body.color-headings .slide h3 { color: deeppink;      }
body.color-headings .slide h4 { color: slateblue;     }
body.color-headings .slide h5 { color: teal;          }
body.color-headings .slide h6 { color: darkgoldenrod; }

/* ----------------------------------------------------------
   Print monochrome (default)
   ---------------------------------------------------------- */

#print-container .print-slide h1,
#print-container .print-slide h2,
#print-container .print-slide h3,
#print-container .print-slide h4,
#print-container .print-slide h5,
#print-container .print-slide h6 {
    color: black;
}

/* ----------------------------------------------------------
   Print colour mode
   ---------------------------------------------------------- */

#print-container.color-headings .print-slide h1 { color: purple;        }
#print-container.color-headings .print-slide h2 { color: navy;          }
#print-container.color-headings .print-slide h3 { color: deeppink;      }
#print-container.color-headings .print-slide h4 { color: slateblue;     }
#print-container.color-headings .print-slide h5 { color: teal;          } /* darker yellow for print */
#print-container.color-headings .print-slide h6 { color: darkgoldenrod; } /* darker gray for print */

.slide li {
    margin: .25em 0;
}

body[data-mode="presentation"] #presentation-app .footer {

    position: fixed;

    left: 0;
    right: 0;
    bottom: 1rem;

    font-size: .875rem;
    color: #888;
    text-align: center;
}

body[data-mode="presentation-xbottom"] #presentation-app .footer {

    position: static;

    margin-top: 2rem;

    font-size: .875rem;
    color: #888;
    text-align: center;
}

#page_number {
    cursor: pointer;
    user-select: none;
}

#page_number:hover {
    text-decoration: underline;
}

.edge_nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);

    width: 56px;
    height: 96px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 42px;
    font-weight: bold;

    color: #fff;
    background: rgba(0, 0, 0, 0.25);

    border-radius: 8px;

    cursor: pointer;
    user-select: none;

    opacity: 0;
    transition: opacity 150ms ease;

    z-index: 1000;
}

#edge_prev {
    left: 12px;
}

#edge_next {
    right: 12px;
}

.edge_nav.visible {
    opacity: 1;
}

.edge_nav:hover {
    background: rgba(0, 0, 0, 0.45);
}

#goto-dialog {

    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    background: white;
    border: 1px solid #888;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
    z-index: 1000;
}

#goto-slide {
    width: 5em;
    font-size: 20px;
}

#fast-nav {

    display: none;
    position: fixed;
    inset: 0;
    overflow: auto;
    padding: 30px;
    background: rgba(255,255,255,.95);
    z-index: 2000;
}

#fast-nav-grid {

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.fast-nav-slide {

    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    background: white;
    overflow: hidden;
    height: 180px;
    transform-origin: top left;
}

.fast-nav-slide:hover {
    border-color: black;
}

.fast-nav-number {

    font-size: 12px;
    color: gray;
    margin-bottom: 8px;
    text-align: right;
}

.fast-nav-preview {

    transform: scale(.35);
    transform-origin: top left;
    width: 285%;
    pointer-events: none;
}

.fast-nav-slide.selected {
    border: 3px solid navy;
    background: aliceblue;
}

.fast-nav-slide.bump-left  { animation: bump-left 140ms ease-out; }
.fast-nav-slide.bump-right { animation: bump-right 140ms ease-out; }
.fast-nav-slide.bump-up    { animation: bump-up 140ms ease-out; }
.fast-nav-slide.bump-down  { animation: bump-down 140ms ease-out; }

#help-overlay {

    display: none;

    position: fixed;
    inset: 0;

    background: rgba(255,255,255,.35);

    justify-content: center;
    align-items: center;

    z-index: 3000;
}

#help-window {

    width: 80vw;
    height: 80vh;

    background: white;

    border: 1px solid #d8d8d8;
    border-radius: 12px;

    box-shadow: 0 10px 32px rgba(0,0,0,.18);

    padding: 1.5rem;

    overflow: auto;

    box-sizing: border-box;
}

#help-window h2 {

    text-align: center;
    color: navy;
    margin-top: 0;
}

#help-columns {

    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 2rem;
}

.help-column h3 {

    border-bottom: 2px solid navy;
    padding-bottom: .25rem;
    margin-bottom: .6rem;
}

.help-column h4 {

    width: 50%;
    border-bottom: 1px solid navy;
    padding-bottom: .25rem;
    margin-bottom: .6rem;
}

.help-row {

    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin: .25rem 0;
    line-height: 1.2;
}

.help-key {

    font-weight: bold;
    color: navy;
    white-space: nowrap;
}

.help-desc {

    flex: 1;
    text-align: right;
    padding-left: 2rem;
}

.spotlight_overlay {

    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12vh;
    background: rgba(0,0,0,.02);
    z-index: 5000;
}

.spotlight {

    position: relative;
    width: min(700px,80vw);
    background: white;
    border-radius: 14px;
    box-shadow:
        0 15px 40px rgba(0,0,0,.35);
    overflow: hidden;
}

.spotlight input {

    width: 100%;
    padding: 18px 22px;
    font-size: 1.3rem;
    border: none;
    outline: none;
    box-sizing: border-box;
}

.spotlight_clear {

    position: absolute;
    top: 1em;
    right: .8em;

    transform: translateY(-50%);
    width: 1.5em;
    height: 1.5em;
    border: none;
    border-radius: 50%;

    background: transparent;
    color: #888;
    font-size: 2em;

    cursor: pointer;
    transition:
        background-color .15s,
        color .15s;
}

.spotlight_clear:hover {
    background: gainsboro;
    color: #333;
}

.spotlight_clear:focus {
    outline: none;
    background: aliceblue;
    color: navy;
}

.spotlight_clear:active {
    background: lightsteelblue;
    color: navy;
}

.spotlight_results {
    max-height: 420px;
    overflow-y: auto;
}

.spotlight_result {

    padding: 14px 20px;
    cursor: pointer;
    border-top:
        1px solid #ececec;
}

.spotlight_result:hover,
.spotlight_result.selected {
    background: aliceblue;
    color: black;
    border-left: 4px solid slateblue;
}

.spotlight_empty {

    padding: 2em;
    text-align: center;
    color: #666;
    font-style: italic;
}

.spotlight_title {

    margin-bottom: .3em;
    font-weight: bold;
    color: #222;
}

.spotlight_snippet {

    font-size: .9rem;
    color: #555;
    opacity: .8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight mark {

    background: slateblue;
    color: white;
    padding: 0 .15em;
    border-radius: 3px;
    font-weight: bold;
}

.hidden {
    display: none;
}

#print-container {
    display: none;
}

.print-slide {
    break-after: page;
}

@media print {

    #presentation-app {
        display: none !important;
    }

    #print-container {
        display: block !important;
    }

}

#notification {
    position: fixed;

    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);

    padding: 8px 16px;

    color: white;
    background: rgba(64, 64, 64, 0.75);

    border-radius: 6px;

    opacity: 0;
    pointer-events: none;

    transition: opacity 200ms ease;

    z-index: 10000;
}

#notification.visible {
    opacity: .75;
}

@keyframes bump-left {

     0% { transform: translateX(0); }
    50% { transform: translateX(-8px); }
   100% { transform: translateX(0); }
}

@keyframes bump-right {

     0% { transform: translateX(0); }
    50% { transform: translateX(8px); }
   100% { transform: translateX(0); }
}

@keyframes bump-up {

     0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
   100% { transform: translateY(0); }
}

@keyframes bump-down {

     0% { transform: translateY(0); }
    50% { transform: translateY(8px); }
   100% { transform: translateY(0); }
}

/**** Markdown Elements ****/

.slide p {
    margin: 0 0 1rem;
}

.slide strong,
.slide b {
    font-weight: 700;
}

.slide em,
.slide i {
    font-style: italic;
}

.slide del {
    text-decoration: line-through;
}

.slide mark {
    padding: .05em .15em;
    background: #fff2a8;
}

.slide small {
    font-size: .85em;
}

.slide sup {
    vertical-align: super;
    font-size: .7em;
}

.slide sub {
    vertical-align: sub;
    font-size: .7em;
}

.slide code {

    font-family: ui-monospace,
                 SFMono-Regular,
                 Consolas,
                 "Liberation Mono",
                 monospace;
    font-size: .9em;
    padding: .05em .3em;
    border-radius: 4px;
    background: #f4f4f4;
}

.slide pre {

    overflow-x: auto;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.4;
    background: #f6f6f6;
}

.slide pre code {

    padding: 0;
    background: transparent;
}

.slide blockquote {

    margin: 1rem 0;
    padding-left: 1rem;

    border-left: 4px solid #999;
    color: #555;
}

.slide hr {

    margin: 1.5rem 0;

    border: none;
    border-top: 2px solid #ccc;
}

.slide a {

    color: inherit;

    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.slide img {

    max-width: 100%;
    max-height: 70vh;

    object-fit: contain;
}

.slide figure {
    margin: 1rem auto;
    text-align: center;
}

.slide figcaption {
    margin-top: .5rem;
    font-size: .85em;
    color: #666;
}

.slide table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}

.slide th,
.slide td {
    padding: .45rem .7rem;
    border: 1px solid #bbb;
    text-align: left;
}

.slide th {
    background: #f3f3f3;
    font-weight: bold;
}

.slide tbody tr:nth-child(even) {
    background: #fafafa;
}

.slide dl {
    margin: 1rem 0;
}

.slide dt {

    font-weight: bold;
    margin-top: .75rem;
}

.slide dd {
    margin-left: 1.5rem;
}

.slide kbd {

    display: inline-block;

    padding: .1em .4em;

    border: 1px solid #bbb;
    border-radius: 4px;

    background: #f7f7f7;

    font-family: inherit;
    font-size: .9em;
}

.slide iframe {

    max-width: 100%;
    max-height: 70vh;

    border: none;
}

.slide video,
.slide audio {
    max-width: 100%;
}

/* Journey History */

.journey_overlay {

    position: fixed;
    inset: 0;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding-top: 12vh;

    background: rgba(255,255,255,.35);

    z-index: 5000;
}

.journey_overlay.hidden {
    display: none;
}

#journey_window {

    width: min(700px, 80vw);
    max-height: 80vh;

    display: flex;
    flex-direction: column;

    background: white;

    border: 1px solid #d8d8d8;
    border-radius: 12px;

    box-shadow: 0 10px 32px rgba(0,0,0,.18);

    overflow: hidden;
}

#journey_window h2 {

    margin: 0;
    padding: 1rem 1.5rem;

    text-align: center;
    color: navy;

    border-bottom: 1px solid #ececec;
}

#journey_results {

    overflow-y: auto;
    max-height: 65vh;
}

.journey_row {

    display: grid;
    grid-template-columns: 4em 1fr;
    gap: 1rem;

    align-items: center;

    padding: .85rem 1.25rem;

    cursor: pointer;

    border-top: 1px solid #ececec;

    transition:
        background-color .15s,
        border-left-color .15s;
}

.journey_row:first-child {
    border-top: none;
}

.journey_row:hover {

    background: aliceblue;
    border-left: 4px solid slateblue;
    padding-left: calc(1.25rem - 4px);
}

.journey_number {

    text-align: center;

    font-weight: bold;

    color: navy;
}

.journey_title {

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;

    color: #222;
}

.journey_selected {

    background: aliceblue;
    border-left: 4px solid royalblue;
}
