/* Presentation deck: a phone-sized, swipeable report digest.
 *
 * The deck's palette is chosen by the model that wrote it — presentation.js
 * sets --rt-accent / --rt-accent-alt from the deck's theme, and a slide may
 * override --rt-accent for itself. Everything accented below reads from those
 * two properties, so a deck about a Pali sutta and one about a legal contract
 * do not have to look alike. The values here are only fallbacks.
 *
 * --rt-fit is a per-slide type multiplier set by presentation.js: model-written
 * text varies in length, so an overflowing slide shrinks its type until it
 * fits instead of clipping. Every text size is therefore expressed as
 * calc(<clamp> * var(--rt-fit, 1)).
 */
:root {
    --rt-ink: light-dark(#76551e,#f3efe6);
    --rt-muted: light-dark(#344344,#aab0bc);
    --rt-bg: light-dark(#f0f3f2,#15181d);
    --rt-surface: light-dark(#f0f3f2,#21252b);
    --rt-line: light-dark(#a3aca9,#3b4048);
    --rt-accent: light-dark(#76551e,#e5c07b);
    --rt-accent-alt: light-dark(#586763,#98c379);
}

html,
body.rt-presentation-body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    background: light-dark(#f0f3f2,#090b0e);
}

.rt-presentation-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--rt-ink);
}

.rt-presentation-body > .site-navigation, .rt-presentation-body > .site-footer { width: 100%; }

.rt-deck {
    width: min(100vw, 56.25dvh);
    height: 100dvh;
    display: flex;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    touch-action: pan-x;
    background: var(--rt-bg);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.7);
}

.rt-deck::-webkit-scrollbar { display: none; }

.rt-slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    padding: max(28px, env(safe-area-inset-top)) 26px max(54px, env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 85% 8%, color-mix(in srgb, var(--rt-accent) 13%, transparent), transparent 30%),
        linear-gradient(155deg, light-dark(#f0f3f2,#20242b) 0%, var(--rt-bg) 55%, light-dark(#f0f3f2,#111419) 100%);
}

/* Faint scanline texture — the deck is a screen object, not a page. */
.rt-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 100% 5px;
    opacity: 0.45;
}

.rt-slide-inner {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

/* ---- shared type ------------------------------------------------------- */

.rt-kicker {
    margin: 0 0 16px;
    color: var(--rt-accent);
    font-size: calc(clamp(.75rem, 2.5vw, 0.9rem) * var(--rt-fit, 1));
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.rt-slide h1,
.rt-slide h2,
.rt-slide h3,
.rt-slide h4 {
    margin: 0;
    padding: 0;
    border: 0;
    text-transform: none;
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: var(--rt-ink);
    text-shadow: none;
    font-family: Georgia, 'Times New Roman', serif;
}

.rt-slide h1 { font-size: calc(clamp(2.5rem, 10vw, 4.6rem) * var(--rt-fit, 1)); }
.rt-slide h2 { font-size: calc(clamp(2rem, 8vw, 3.6rem) * var(--rt-fit, 1)); margin-bottom: 24px; }
.rt-slide h3 { font-size: calc(clamp(1.45rem, 6vw, 2.4rem) * var(--rt-fit, 1)); margin-bottom: 18px; }
.rt-slide h3::before { display: none; }

.rt-copy,
.rt-copy p {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: calc(clamp(1.18rem, 4.3vw, 1.75rem) * var(--rt-fit, 1));
    line-height: 1.48;
    color: var(--rt-ink);
}

.rt-copy p { margin: 0 0 0.85em; }
.rt-copy p:last-child { margin-bottom: 0; }

/* The three marks of emphasis the model may use, and nothing else. */
.rt-slide strong { color: var(--rt-accent); font-weight: 700; }
.rt-slide em { color: light-dark(#345b71,#d9dde5); font-style: italic; }
.rt-mark {
    padding: 0.04em 0.22em;
    border-radius: 3px;
    background: color-mix(in srgb, var(--rt-accent) 24%, transparent);
    box-shadow: inset 0 -0.42em 0 color-mix(in srgb, var(--rt-accent) 16%, transparent);
    color: var(--rt-ink);
}

.rt-meta,
.rt-note {
    margin-top: 22px;
    color: var(--rt-muted);
    font-size: calc(clamp(0.85rem, 3vw, 1.05rem) * var(--rt-fit, 1));
    line-height: 1.6;
}

.rt-note {
    padding-top: 14px;
    border-top: 1px solid var(--rt-line);
}

.rt-caption {
    margin: 14px 0 0;
    color: var(--rt-muted);
    font-size: calc(clamp(0.8rem, 2.9vw, 1rem) * var(--rt-fit, 1));
    line-height: 1.5;
}

/* ---- cover ------------------------------------------------------------- */

.rt-title-slide .rt-slide-inner { justify-content: flex-end; padding-bottom: 8vh; }
.rt-title-slide .rt-sigil { position: absolute; inset: 3vh -10px auto; opacity: 0.8; }
.rt-title-slide h1 { max-width: 11ch; }

/* ---- statement --------------------------------------------------------- */

.rt-statement {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: calc(clamp(1.8rem, 7.2vw, 3rem) * var(--rt-fit, 1));
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--rt-ink);
    text-wrap: balance;
}

/* ---- stat -------------------------------------------------------------- */

.rt-stat-value {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 0.08em;
    color: var(--rt-accent);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: calc(clamp(4.5rem, 22vw, 9rem) * var(--rt-fit, 1));
    line-height: 0.92;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

.rt-stat-unit {
    color: var(--rt-muted);
    font-size: max(12px, 0.32em);
    letter-spacing: 0;
}

.rt-stat-label {
    margin: 18px 0 0;
    font-family: Georgia, serif;
    font-size: calc(clamp(1.2rem, 4.6vw, 1.8rem) * var(--rt-fit, 1));
    line-height: 1.35;
    color: var(--rt-ink);
}

/* ---- quote ------------------------------------------------------------- */

.rt-quote-slide .rt-slide-inner { justify-content: center; }

.rt-quote {
    position: relative;
    margin: 0;
    padding-left: 22px;
    border-left: 2px solid var(--rt-accent);
    font: italic calc(clamp(1.35rem, 5.4vw, 2.2rem) * var(--rt-fit, 1)) / 1.36 Georgia, serif;
    color: var(--rt-ink);
    text-wrap: pretty;
}

.rt-attribution {
    margin: 20px 0 0 22px;
    color: var(--rt-accent);
    font-size: calc(clamp(0.82rem, 3vw, 1rem) * var(--rt-fit, 1));
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ---- versus ------------------------------------------------------------ */

.rt-versus {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.rt-versus-side {
    padding: 16px 16px 16px 18px;
    border: 1px solid var(--rt-line);
    border-left: 3px solid var(--rt-side, var(--rt-accent));
    border-radius: 12px;
    background: rgba(33, 37, 43, 0.72);
}

.rt-versus-label {
    margin: 0 0 8px;
    color: var(--rt-side, var(--rt-accent));
    font-family: 'JetBrains Mono', monospace;
    font-size: calc(clamp(.75rem, 2.5vw, 0.82rem) * var(--rt-fit, 1));
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.rt-versus-text {
    margin: 0;
    font-family: Georgia, serif;
    font-size: calc(clamp(1.02rem, 3.9vw, 1.4rem) * var(--rt-fit, 1));
    line-height: 1.42;
    color: var(--rt-ink);
}

/* Hairline with a centred "vs" — the two readings are held apart, not stacked. */
.rt-versus-rule {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--rt-muted);
    font-size: calc(.75rem * var(--rt-fit, 1));
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.rt-versus-rule::before,
.rt-versus-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rt-line);
}

/* ---- finding / ranking ------------------------------------------------- */

.rt-ranking {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.rt-rank-row {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--rt-line);
    border-radius: 14px;
    background: rgba(33, 37, 43, 0.88);
    font-size: calc(clamp(1rem, 3.8vw, 1.35rem) * var(--rt-fit, 1));
}

.rt-rank-row:first-child { border-color: var(--rt-accent); }
.rt-rank-position { color: var(--rt-accent); font-size: 1.35em; font-weight: 700; }
.rt-score { color: var(--rt-muted); font-variant-numeric: tabular-nums; }

.rt-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 18px; }

.rt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid var(--rt-line);
    border-radius: 999px;
    color: var(--rt-muted);
    font-size: calc(.75rem * var(--rt-fit, 1));
}

.rt-swatch { width: 8px; height: 8px; border-radius: 50%; }

/* ---- charts ------------------------------------------------------------ */

/* Chart slides read as one block: kicker, plot, caption. Letting the plot grow
 * to fill the slide would strand the caption at the bottom edge, away from the
 * thing it is captioning. */
.rt-chart-slide .rt-slide-inner,
.rt-signature-slide .rt-slide-inner { justify-content: center; }

.rt-chart-host { width: 100%; flex: 0 1 auto; min-height: 0; display: flex; align-items: center; }
.rt-chart-host > .wh-chart { width: 100%; padding: 14px 4px; border: 0; background: transparent; }
.rt-chart-host .wh-chart-header h4 { font-size: calc(clamp(1.3rem, 5vw, 1.9rem) * var(--rt-fit, 1)); color: var(--rt-ink); }
.rt-chart-host .wh-chart-subtitle { font-size: calc(clamp(.75rem, 2.6vw, 0.9rem) * var(--rt-fit, 1)); line-height: 1.4; }
.rt-chart-host .wh-legend-item { font-size: calc(clamp(.75rem, 2.4vw, 0.82rem) * var(--rt-fit, 1)); }
.rt-chart-host .wh-table-twin { display: none; }
.rt-chart-host svg { overflow: visible; }
.rt-chart-host svg text { font-size: 13px !important; }

/* The model's own chart. It brings its own labels, legend and axes, so the
 * slide adds no frame around it — it just gives it the room. */
.rt-signature {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The model chooses the aspect ratio via its viewBox; the chart scales to the
 * card's width and is capped in height so a very tall viewBox cannot push the
 * caption off the slide. */
.rt-signature svg {
    width: 100%;
    height: auto;
    max-height: 64vh;
    overflow: visible;
}

/* ---- closing ----------------------------------------------------------- */

.rt-final-slide { text-align: center; }
.rt-final-slide .rt-slide-inner { align-items: center; }

.rt-final-mark {
    color: var(--rt-accent);
    font: calc(clamp(2.6rem, 11vw, 5rem) * var(--rt-fit, 1)) / 1 Georgia, serif;
    letter-spacing: -0.06em;
    margin-bottom: 24px;
}

.rt-final-url {
    margin-top: 30px;
    padding: 14px 20px;
    border: 1px solid var(--rt-accent);
    border-radius: 999px;
    color: var(--rt-accent);
    font-size: calc(clamp(1rem, 4vw, 1.4rem) * var(--rt-fit, 1));
    letter-spacing: 0.08em;
}

/* ---- chrome ------------------------------------------------------------ */

/* The closing slide states the address itself, large; the corner mark
   would repeat it a few lines below. */
.rt-final-slide .rt-watermark { display: none; }

.rt-watermark {
    position: absolute;
    z-index: 2;
    left: 26px;
    bottom: max(17px, env(safe-area-inset-bottom));
    color: var(--rt-accent);
    font-size: .75rem;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    opacity: 0.82;
    text-shadow: 0 1px 8px light-dark(#f6f5ef,#000);
}

.rt-progress-track {
    position: fixed;
    z-index: 21;
    top: 0;
    width: min(100vw, 56.25dvh);
    height: 2px;
    background: rgba(255, 255, 255, 0.07);
}

.rt-progress {
    height: 100%;
    background: var(--rt-accent);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.28s ease;
}

.rt-controls {
    position: relative;
    flex-shrink: 0;
    z-index: 20;
    bottom: max(12px, env(safe-area-inset-bottom));
    margin: 12px auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(9, 11, 14, 0.72);
    backdrop-filter: blur(12px);
    opacity: 0.18;
    transition: opacity 0.2s;
}

.rt-controls:hover,
.rt-controls:focus-within { opacity: 1; }

.rt-control {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--rt-ink);
    text-decoration: none;
    font-size: 1rem;
}

.rt-control:hover { background: rgba(255, 255, 255, 0.1); transform: none; }
.rt-control:disabled { opacity: 0.25; cursor: default; }
.rt-counter { min-width: 52px; text-align: center; color: var(--rt-muted); font-size: .75rem; }
.rt-close { position: static; background: rgba(9, 11, 14, 0.7); }

@media (max-width: 600px) {
    .rt-deck { width: 100vw; }
    .rt-progress-track { width: 100vw; }
    .rt-slide { padding-left: 24px; padding-right: 24px; }
    .rt-controls { opacity: 0.12; }
    .rt-close { position: static; }
    /* The controls are centred at the foot of the screen, and a phone is
       narrow enough that the watermark ran underneath them. */
    .rt-watermark { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 58px); }
}

/* A touch screen never hovers, so controls that only brighten on hover stay
   at a tenth of their strength for good. Keep them visible, and finger-sized. */
@media (pointer: coarse) {
    .rt-controls { opacity: 0.75; }
    .rt-control { width: 44px; height: 44px; }
}

/* SMIL motion in a signature chart is not CSS, so it cannot be stopped from
 * here — presentation.js calls pauseAnimations() on the SVG instead. */
@media (prefers-reduced-motion: reduce) {
    .rt-deck { scroll-behavior: auto; }
    .rt-progress { transition: none; }
}

body.rt-presentation-body .rt-deck { height:calc(100dvh - var(--site-nav-height, 64px) - 100px); min-height:240px; }
