:root {
    --c-bg: #14181f;
    --c-figure-bg: #241c33;
    --c-book-bg: #1c2a24;
    --c-trivia-bg: #1c2333;
    --c-term-bg: #2a2015;
    --c-text: #f5f6f8;
    --c-muted: #b7bec9;
    --c-accent: #ffb454;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    width: 100dvw;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}

a { color: inherit; }

/* ---------- Top bar ----------
   Same conventions as present.css: every clamp()/min() has a plain
   fixed-unit fallback declared first (some interactive-display browsers
   silently drop a function they don't recognize), and spacing between
   flex children is done with margins on `> * + *` rather than the
   flexbox `gap` property, which isn't reliable on older bundled
   Chromium builds seen on some classroom displays. */
.landing-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 0.5rem 1rem;
    padding: clamp(0.4rem, 1.1vh, 0.75rem) clamp(0.6rem, 2vw, 1.25rem);
    padding-left: max(0.6rem, env(safe-area-inset-left));
    padding-right: max(0.6rem, env(safe-area-inset-right));
    padding-top: max(0.4rem, env(safe-area-inset-top));
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.landing-bar-hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}
.landing-bar-right { display: flex; align-items: center; flex: 0 0 auto; }
.landing-bar-right > * + * { margin-left: 0.6rem; }
.landing-bar-link {
    flex: 0 0 auto;
    color: var(--c-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-size: clamp(0.68rem, 1.3vw, 0.9rem);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.35rem 0.7rem;
    padding: clamp(0.28rem, 0.9vh, 0.4rem) clamp(0.5rem, 1.5vw, 0.8rem);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.landing-bar-link:hover { background: rgba(255, 255, 255, 0.18); }
.landing-clock {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    font-size: clamp(0.75rem, 1.6vw, 1.15rem);
    font-weight: 600;
    color: var(--c-muted);
    letter-spacing: 0.02em;
}
.landing-bar-fsicon { display: none; }

/* ---------- Stage / slides ---------- */
.landing-stage {
    position: relative;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
}

.c-slide {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6vh 5vw;
    padding: clamp(1.25rem, 6vh, 4.5rem) clamp(1.25rem, 6vw, 4.5rem);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease;
    background: var(--c-bg);
    text-align: center;
    cursor: pointer;
}
.c-slide.active { opacity: 1; visibility: visible; }

.c-slide-figure { background-color: var(--c-figure-bg); }
.c-slide-book { background-color: var(--c-book-bg); }
.c-slide-trivia { background-color: var(--c-trivia-bg); }
.c-slide-term { background-color: var(--c-term-bg); }
.c-slide-empty { background-color: var(--c-bg); cursor: default; }

.c-slide-inner {
    position: relative;
    max-width: 1100px;
    max-width: min(90vw, 1400px);
    width: 100%;
    max-height: 85vh;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
}

.c-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.85rem;
    font-size: clamp(0.68rem, 1vw + 0.7vh, 1.1rem);
    color: var(--c-accent);
    font-weight: 700;
    margin: 0 0 1.25rem;
    margin: 0 0 clamp(0.9rem, 2.5vh, 1.75rem);
}

.c-title {
    margin: 0 0 0.75rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.6rem;
    font-size: clamp(1.7rem, 2vw + 2.4vh, 4.6rem);
    line-height: 1.18;
}
.c-sub {
    margin: 0 0 1.25rem;
    color: var(--c-muted);
    font-size: 1.15rem;
    font-size: clamp(0.95rem, 0.8vw + 1vh, 1.5rem);
}

.c-rich {
    font-size: 1.25rem;
    font-size: clamp(1rem, 0.9vw + 1.2vh, 2rem);
    line-height: 1.5;
}
.c-rich p { margin: 0 0 0.75rem; }
.c-rich p:last-child { margin-bottom: 0; }
.c-rich em { color: var(--c-accent); font-style: italic; }
.c-rich strong { color: var(--c-accent); }

/* Round portrait frame for a figure's photo, or a plain colored badge
   with their initial when no photo has been uploaded yet. Books get a
   rectangular "cover" treatment instead — a colored spine stripe down
   the left edge suggests a book without needing a real cover image. */
.c-image {
    display: block;
    margin: 0 auto 1.5rem;
    object-fit: cover;
}
.c-image-figure {
    width: 9rem;
    width: clamp(6rem, 9vw + 6vh, 12rem);
    height: 9rem;
    height: clamp(6rem, 9vw + 6vh, 12rem);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
}
.c-image-book {
    width: 7rem;
    width: clamp(5rem, 7vw + 5vh, 9rem);
    height: 9.5rem;
    height: clamp(6.5rem, 9vw + 6vh, 12rem);
    border-radius: 3px;
    border-left: 6px solid var(--c-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.c-monogram {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    color: var(--c-accent);
    background: rgba(255, 255, 255, 0.08);
    border: 3px solid rgba(255, 255, 255, 0.18);
}
.c-monogram-figure {
    width: 9rem;
    width: clamp(6rem, 9vw + 6vh, 12rem);
    height: 9rem;
    height: clamp(6rem, 9vw + 6vh, 12rem);
    border-radius: 50%;
    font-size: 3.5rem;
    font-size: clamp(2.4rem, 3vw + 3vh, 5rem);
}
.c-monogram-book {
    width: 7rem;
    width: clamp(5rem, 7vw + 5vh, 9rem);
    height: 9.5rem;
    height: clamp(6.5rem, 9vw + 6vh, 12rem);
    border-radius: 3px;
    border-left: 6px solid var(--c-accent);
    font-size: 2.8rem;
    font-size: clamp(2rem, 2.4vw + 2.4vh, 4rem);
}

/* ---------- Trivia reveal ---------- */
.c-reveal-hint {
    margin: 0;
    color: var(--c-muted);
    font-size: 1rem;
    font-size: clamp(0.85rem, 0.7vw + 0.8vh, 1.2rem);
    font-style: italic;
}
.c-reveal-answer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.5s ease;
    margin-top: 0;
}
.c-slide.c-revealed .c-reveal-hint { display: none; }
.c-slide.c-revealed .c-reveal-answer {
    max-height: 600px;
    opacity: 1;
    margin-top: 1.5rem;
}
.c-answer-label {
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    color: var(--c-accent);
    font-weight: 700;
}

/* ---------- Nav arrows (present.css conventions reused) ---------- */
.c-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    width: 3rem;
    width: clamp(2.4rem, 3vw + 2vh, 3.4rem);
    height: 3rem;
    height: clamp(2.4rem, 3vw + 2vh, 3.4rem);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: var(--c-text);
    font-size: 1.8rem;
    font-size: clamp(1.4rem, 1.6vw + 1vh, 2rem);
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.c-arrow:hover { opacity: 1; background: rgba(0, 0, 0, 0.6); }
.c-arrow-prev { left: 1rem; left: max(1rem, env(safe-area-inset-left)); }
.c-arrow-next { right: 1rem; right: max(1rem, env(safe-area-inset-right)); }

/* ---------- Progress bar + counter ---------- */
.c-progress-track {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    z-index: 15;
}
.c-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--c-accent);
}
.c-counter {
    position: fixed;
    right: 1rem;
    right: max(1rem, env(safe-area-inset-right));
    bottom: 0.9rem;
    bottom: max(0.9rem, env(safe-area-inset-bottom));
    z-index: 15;
    font-size: 0.8rem;
    font-size: clamp(0.65rem, 1.2vw, 0.9rem);
    color: var(--c-muted);
    background: rgba(0, 0, 0, 0.4);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

/* ---------- Attribution credit ----------
   Small, permanently-visible (not tied to fullscreen auto-hide) credit
   line for the carousel content adapted from Ribó's Prose Fiction —
   satisfies CC BY 4.0's attribution requirement without cluttering every
   individual slide with repeated citation text. */
.c-credit {
    position: fixed;
    left: 1rem;
    left: max(1rem, env(safe-area-inset-left));
    bottom: 0.9rem;
    bottom: max(0.9rem, env(safe-area-inset-bottom));
    z-index: 15;
    max-width: 60vw;
    font-size: 0.68rem;
    font-size: clamp(0.55rem, 1vw, 0.7rem);
    line-height: 1.35;
    color: var(--c-muted);
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.6rem;
    border-radius: 10px;
}
.c-credit a { text-decoration: underline; }
.c-credit:hover { opacity: 0.95; }

/* ---------- Small-screen tuning ---------- */
@media (max-width: 480px) {
    .c-arrow { display: none; }
    .c-slide { padding: 1.1rem 1.1rem; }
    .c-credit { max-width: 46vw; }
}

@media (max-width: 540px) {
    .landing-bar-text { display: none; }
    .landing-bar-fsicon { display: inline; font-size: 1.05rem; }
    .landing-bar-link { font-size: 0.85rem; font-size: clamp(0.75rem, 3.4vw, 0.95rem); }
}

@media (max-height: 420px) and (orientation: landscape) {
    .landing-bar { padding-top: 0.3rem; padding-bottom: 0.3rem; }
    .c-counter { bottom: 0.4rem; }
    .c-credit { bottom: 0.4rem; max-width: 40vw; }
}

/* ---------- Captioned / aligned images from the editor ----------
   The editor wraps a captioned image in <figure class="image"> with an
   optional align-left / align-center / align-right class. */
.c-rich figure { display: table; max-width: 100%; margin: 1rem auto; }
.c-rich figure img { display: block; max-width: 100%; margin: 0; }
.c-rich figcaption { display: table-caption; caption-side: bottom; padding-top: 0.4rem;
    font-size: 0.85em; opacity: 0.8; text-align: center; }
.c-rich figure.align-left { float: left; margin: 0.25rem 1.25rem 0.75rem 0; }
.c-rich figure.align-right { float: right; margin: 0.25rem 0 0.75rem 1.25rem; }
.c-rich figure.align-center { margin-left: auto; margin-right: auto; }
.c-rich::after { content: ""; display: block; clear: both; }
