/* ============================================================
   THE RIEMANN FILES -- design tokens
   Warm paper + ink navy + a muted antique-gold accent. Deliberately
   not the cream/terracotta combo that's become an AI-design default --
   picked instead as a small nod to "old mathematical journal meets
   modern prize money," tied to the actual subject.
   ============================================================ */
:root {
    --rh-paper: #F3F1EC;
    --rh-paper-raised: #FFFFFF;
    --rh-ink: #1E2A38;
    --rh-ink-muted: #5B6A78;
    --rh-gold: #A8781F;
    --rh-gold-soft: #F1E4C8;
    --rh-hairline: #D8D2C4;

    --rh-font-display: 'Lora', Georgia, serif;
    --rh-font-body: 'Inter', system-ui, sans-serif;
    --rh-font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--rh-paper);
    color: var(--rh-ink);
    font-family: var(--rh-font-body);
    font-size: 16px;
    line-height: 1.6;
}

#rh-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 64px;
}

/* ============================================================
   HEADER + CHAPTER TABS
   Real page links, not JS-driven -- a full navigation between
   chapters, matching the rest of the site's multi-page structure.
   ============================================================ */
#rh-header {
    padding: 32px 0 0;
}

#rh-brand {
    display: block;
    font-family: var(--rh-font-display);
    font-weight: 600;
    font-size: 22px;
    color: var(--rh-ink);
    text-decoration: none;
    margin-bottom: 20px;
}

.rh-chapter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--rh-hairline);
}

.rh-chapter-tab {
    font-family: var(--rh-font-body);
    font-weight: 500;
    font-size: 14px;
    color: var(--rh-ink-muted);
    text-decoration: none;
    padding: 10px 16px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.rh-chapter-tab:hover {
    color: var(--rh-ink);
}

.rh-chapter-tab.active {
    color: var(--rh-ink);
    border-bottom-color: var(--rh-gold);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#rh-main {
    padding-top: 40px;
}

h1 {
    font-family: var(--rh-font-display);
    font-weight: 600;
    font-size: 32px;
    margin: 4px 0 20px;
}

h2 {
    font-family: var(--rh-font-display);
    font-weight: 600;
    font-size: 22px;
    margin: 0 0 12px;
}

p {
    color: var(--rh-ink);
    max-width: 62ch;
}

.rh-stub-eyebrow {
    font-family: var(--rh-font-mono);
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--rh-gold);
    margin: 0 0 8px;
}

/* ============================================================
   STUB CHAPTERS
   ============================================================ */
.rh-stub {
    background: var(--rh-paper-raised);
    border: 1px solid var(--rh-hairline);
    border-radius: 12px;
    padding: 40px;
}

.rh-stub p {
    color: var(--rh-ink-muted);
}

/* ============================================================
   CHAPTER 1 -- PAGE TABS (nested tabs within the chapter tab)
   Same JS-driven, in-page tab-panel pattern as Chapter 2's scene
   tabs, but wider -- these carry real title text, not bare digits --
   and use the body font rather than mono, since a title isn't a
   short numeric tag the way a scene number is.
   ============================================================ */
.rh-page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 24px 0 28px;
}

.rh-page-tab {
    font-family: var(--rh-font-body);
    font-weight: 500;
    font-size: 13px;
    color: var(--rh-ink-muted);
    background: var(--rh-paper-raised);
    border: 1px solid var(--rh-hairline);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.rh-page-tab:hover {
    border-color: var(--rh-gold);
    color: var(--rh-ink);
}

.rh-page-tab.active {
    background: var(--rh-gold-soft);
    border-color: var(--rh-gold);
    color: var(--rh-gold);
}

.rh-page-panels {
    background: var(--rh-paper-raised);
    border: 1px solid var(--rh-hairline);
    border-radius: 12px;
    padding: 40px;
    min-height: 200px;
}

.rh-page-panel[hidden] {
    display: none;
}

.rh-page-title {
    margin-top: 0;
}

/* ============================================================
   CHAPTER 2 -- SCENE TABS (nested tabs within the chapter tab)
   These are JS-driven, in-page tab panels -- no navigation, no page
   reload. Visually related to the chapter tabs but smaller and
   distinctly "nested," using the mono font for the bare numbers.
   ============================================================ */
.rh-scene-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 24px 0 28px;
}

.rh-scene-tab {
    font-family: var(--rh-font-mono);
    font-weight: 500;
    font-size: 14px;
    color: var(--rh-ink-muted);
    background: var(--rh-paper-raised);
    border: 1px solid var(--rh-hairline);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.rh-scene-tab:hover {
    border-color: var(--rh-gold);
    color: var(--rh-ink);
}

.rh-scene-tab.active {
    background: var(--rh-gold-soft);
    border-color: var(--rh-gold);
    color: var(--rh-gold);
}

.rh-scene-tab:focus-visible,
.rh-page-tab:focus-visible,
.rh-chapter-tab:focus-visible {
    outline: 2px solid var(--rh-gold);
    outline-offset: 2px;
}

.rh-scene-panels {
    background: var(--rh-paper-raised);
    border: 1px solid var(--rh-hairline);
    border-radius: 12px;
    padding: 40px;
    min-height: 300px;
}

.rh-scene-panel[hidden] {
    display: none;
}

.rh-scene-title {
    margin-top: 0;
}

.rh-scene-placeholder {
    color: var(--rh-ink-muted);
    font-style: italic;
}

/* ============================================================
   SCENE COPY -- reusable prose classes for any scene, not just
   Scene 1. Keeps future scenes visually consistent for free.
   ============================================================ */
.rh-scene-copy {
    max-width: 60ch;
}

.rh-scene-copy code {
    font-family: var(--rh-font-mono);
    background: var(--rh-gold-soft);
    color: var(--rh-gold);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.92em;
}

.rh-scene-teaser {
    color: var(--rh-ink-muted);
    font-style: italic;
}

/* ============================================================
   FOOTNOTES -- reusable by any page or scene, not just this one.
   ============================================================ */
.rh-footnote-ref {
    font-size: 0.75em;
    margin-left: 1px;
}

.rh-footnote-ref a {
    color: var(--rh-gold);
    text-decoration: none;
}

.rh-footnote-ref a:hover {
    text-decoration: underline;
}

.rh-footnotes {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--rh-hairline);
}

.rh-footnote {
    font-size: 13px;
    color: var(--rh-ink-muted);
    max-width: 60ch;
}

.rh-footnote a {
    color: var(--rh-gold);
}

/* ============================================================
   FORMULA BLOCK -- reusable by any page or scene needing to
   display a standalone equation with visual weight.
   ============================================================ */
.rh-formula {
    font-family: var(--rh-font-mono);
    font-size: 18px;
    text-align: center;
    background: var(--rh-gold-soft);
    border: 1px solid var(--rh-gold);
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
    color: var(--rh-ink);
}

/* ============================================================
   CASE-FILE LABELS -- small caps tags used for the "tip line /
   verdict" structure on pages like "Is This Even a Real Question?".
   Reusable anywhere a page wants that procedural, case-file feel.
   ============================================================ */
.rh-case-label {
    display: inline-block;
    font-family: var(--rh-font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--rh-gold);
    border: 1px solid var(--rh-gold);
    border-radius: 4px;
    padding: 2px 8px;
    margin: 20px 0 4px;
}

.rh-tip-quote {
    font-style: italic;
    color: var(--rh-ink-muted);
    max-width: 60ch;
    margin: 4px 0 12px;
}

/* ============================================================
   SCENE 1 -- the complex plane widget
   ============================================================ */
.rh-plane-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 24px 0;
}

.rh-plane-svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    display: block;
    touch-action: none; /* required for clean drag on touch devices */
    cursor: grab;
}

.rh-plane-svg:active {
    cursor: grabbing;
}

.rh-plane-grid {
    stroke: var(--rh-hairline);
    stroke-width: 1;
}

.rh-plane-axis {
    stroke: var(--rh-ink-muted);
    stroke-width: 1.5;
}

.rh-plane-axis-label {
    font-family: var(--rh-font-display);
    font-style: italic;
    font-size: 20px;
    fill: var(--rh-ink);
}

.rh-plane-tick {
    font-family: var(--rh-font-mono);
    font-size: 11px;
    fill: var(--rh-ink-muted);
}

.rh-plane-projection {
    stroke: var(--rh-gold);
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
    opacity: 0.7;
}

.rh-plane-foot {
    fill: var(--rh-gold);
}

.rh-plane-point {
    fill: var(--rh-gold);
    stroke: var(--rh-paper-raised);
    stroke-width: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.rh-plane-hint {
    font-size: 13px;
    color: var(--rh-ink-muted);
    margin: 8px 0 0;
}

.rh-plane-readout {
    font-family: var(--rh-font-mono);
    font-size: 18px;
    color: var(--rh-ink);
    background: var(--rh-gold-soft);
    border-radius: 8px;
    padding: 8px 20px;
    margin-top: 12px;
}


/* ============================================================
   SCENE 2 -- safe zeta: the curve widget and term-builder
   ============================================================ */
.rh-s2-curve {
    fill: none;
    stroke: var(--rh-gold);
    stroke-width: 2.5;
}

.rh-s2-exact-tag {
    font-size: 12px;
    color: var(--rh-ink-muted);
    font-style: italic;
    margin-left: 6px;
}

.rh-term-builder {
    margin-top: 24px;
    width: 100%;
    max-width: 360px;
}

.rh-term-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 60px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rh-hairline);
}

.rh-term-bar {
    flex: 1 1 auto;
    min-width: 4px;
    background: var(--rh-gold);
    border-radius: 2px 2px 0 0;
    transition: height 0.15s ease;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    #rh-page { padding: 0 16px 48px; }
    .rh-stub, .rh-scene-panels { padding: 24px; }
    h1 { font-size: 26px; }
}

/* ============================================================
   REDUCED MOTION
   Scenes with animation must respect this -- noted here so it's
   visible from the start of the project, not bolted on later.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
