/* =========================================================
The Prosaic Mosaic
Main site stylesheet

Copyright (c) 2026 Rozzie Square.
All rights reserved.
========================================================= */

/* =========================================================
   Self-hosted story fonts
   ========================================================= */

@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-regular.woff2")
        format("woff2");

    font-weight: 400;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-500.woff2")
        format("woff2");

    font-weight: 500;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-600.woff2")
        format("woff2");

    font-weight: 600;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-700.woff2")
        format("woff2");

    font-weight: 700;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-regular.woff2")
        format("woff2");

    font-weight: 400;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-500.woff2")
        format("woff2");

    font-weight: 500;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-600.woff2")
        format("woff2");

    font-weight: 600;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-700.woff2")
        format("woff2");

    font-weight: 700;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-regular.woff2")
        format("woff2");

    font-weight: 400;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-500.woff2")
        format("woff2");

    font-weight: 500;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-600.woff2")
        format("woff2");

    font-weight: 600;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-700.woff2")
        format("woff2");

    font-weight: 700;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-regular.woff2")
        format("woff2");

    font-weight: 400;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-500.woff2")
        format("woff2");

    font-weight: 500;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-600.woff2")
        format("woff2");

    font-weight: 600;
    font-style: normal;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-700.woff2")
        format("woff2");

    font-weight: 700;
    font-style: normal;

    font-display: swap;
}

/* =========================================================
   Self-hosted story italic fonts
   ========================================================= */

@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-italic.woff2")
        format("woff2");

    font-weight: 400;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-500-italic.woff2")
        format("woff2");

    font-weight: 500;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-600-italic.woff2")
        format("woff2");

    font-weight: 600;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Source Serif 4";

    src:
        url("../fonts/source-serif-4-700-italic.woff2")
        format("woff2");

    font-weight: 700;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-italic.woff2")
        format("woff2");

    font-weight: 400;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-500-italic.woff2")
        format("woff2");

    font-weight: 500;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-600-italic.woff2")
        format("woff2");

    font-weight: 600;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Literata";

    src:
        url("../fonts/literata-700-italic.woff2")
        format("woff2");

    font-weight: 700;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-italic.woff2")
        format("woff2");

    font-weight: 400;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-500-italic.woff2")
        format("woff2");

    font-weight: 500;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-600-italic.woff2")
        format("woff2");

    font-weight: 600;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Crimson Pro";

    src:
        url("../fonts/crimson-pro-700-italic.woff2")
        format("woff2");

    font-weight: 700;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-italic.woff2")
        format("woff2");

    font-weight: 400;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-500-italic.woff2")
        format("woff2");

    font-weight: 500;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-600-italic.woff2")
        format("woff2");

    font-weight: 600;
    font-style: italic;

    font-display: swap;
}


@font-face {
    font-family: "Libre Baskerville";

    src:
        url("../fonts/libre-baskerville-700-italic.woff2")
        format("woff2");

    font-weight: 700;
    font-style: italic;

    font-display: swap;
}

/* =========================================================
   Theme variables
   ========================================================= */

:root {
    color-scheme: light dark;

    --site-header-height: 96px;
    --timeline-controls-height: 60px;
    --story-filter-height: 52px;

    --background: #f7f7f5;
    --surface: #ffffff;
    --surface-alt: #eeeeeb;

    --text: #202020;
    --text-secondary: #666666;

    --border: #d5d5d5;

    --accent: #555555;
    --accent-hover: #333333;

    --header-background: rgba(247, 247, 245, 0.94);

    --shadow: 0 4px 16px rgba(0, 0, 0, 0.10);

    --timeline-line: #999999;
    --timeline-dot: #333333;
}


/* =========================================================
   Explicit Light theme
   ========================================================= */

html[data-theme="light"] {
    color-scheme: light;

    --background: #f7f7f5;
    --surface: #ffffff;
    --surface-alt: #eeeeeb;

    --text: #202020;
    --text-secondary: #666666;

    --border: #d5d5d5;

    --accent: #555555;
    --accent-hover: #333333;

    --header-background: rgba(247, 247, 245, 0.94);

    --shadow: 0 4px 16px rgba(0, 0, 0, 0.10);

    --timeline-line: #999999;
    --timeline-dot: #333333;
}


/* =========================================================
   Explicit Dark theme
   ========================================================= */

html[data-theme="dark"] {
    color-scheme: dark;

    --background: #111111;
    --surface: #1d1d1d;
    --surface-alt: #444444;

    --text: #eeeeee;
    --text-secondary: #aaaaaa;

    --border: #3d3d3d;

    --accent: #cccccc;
    --accent-hover: #ffffff;

    --header-background: rgba(17, 17, 17, 0.94);

    --shadow: 0 4px 18px rgba(0, 0, 0, 0.40);

    --timeline-line: #666666;
    --timeline-dot: #eeeeee;
}


/* =========================================================
   System dark mode
   ========================================================= */

@media (prefers-color-scheme: dark) {

    html:not([data-theme="light"]) {

        --background: #111111;
        --surface: #1d1d1d;
        --surface-alt: #444444;

        --text: #eeeeee;
        --text-secondary: #aaaaaa;

        --border: #3d3d3d;

        --accent: #cccccc;
        --accent-hover: #ffffff;

        --header-background: rgba(17, 17, 17, 0.94);

        --shadow: 0 4px 18px rgba(0, 0, 0, 0.40);

        --timeline-line: #666666;
        --timeline-dot: #eeeeee;
    }
}


/* =========================================================
   Story typography
   ========================================================= */

:root {
    --story-font-family: "Source Serif 4", Georgia, serif;
    --story-font-weight: 400;
    --story-font-size-factor: 1;
    --story-background: var(--surface);
}


/* =========================================================
   Story page background options
   ========================================================= */

html[data-story-background="default"] {
    --story-background: var(--surface);
    --story-text: var(--text);
}

html[data-story-background="white"] {
    --story-background: #ffffff;
    --story-text: #202020;
}

html[data-story-background="paper"] {
    --story-background: #f5f1e8;
    --story-text: #202020;
}

html[data-story-background="cream"] {
    --story-background: #faf7ef;
    --story-text: #202020;
}

html[data-story-background="blue"] {
    --story-background: #eef4f8;
    --story-text: #202020;
}

/* =========================================================
   Base
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;

    min-height: 100vh;

    display: flex;
    flex-direction: column;

    background: var(--background);
    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.6;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}


/* =========================================================
   Header
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    min-height: 96px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    padding: 12px 24px;

    background: var(--header-background);

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(10px);
}

.logo-link {
    display: block;

    grid-column: 2;

    text-decoration: none;
}

.site-logo {
    display: block;

    width: auto;
    height: auto;

    max-width: min(260px, 55vw);
    max-height: 72px;
}

.header-controls {
    grid-column: 3;

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

    gap: 10px;
}

/* =========================================================
   Buttons / icons
   ========================================================= */

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);

    background: var(--surface);

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.icon-button:hover {
    background: var(--surface-alt);
}

.icon-button:active {
    transform: scale(0.96);
}

.icon-button:focus-visible {
    border-color: var(--accent);

    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hamburger-button {
    grid-column: 1;

    width: 42px;
    height: 42px;

    flex-direction: column;

    gap: 5px;

    border-radius: 8px;
}

.hamburger-button span {
    display: block;

    width: 22px;
    height: 2px;

    background: var(--text);
}


/* =========================================================
   Navigation
   ========================================================= */

.navigation-menu {
    position: fixed;

    top: 96px;
    left: 0;

    width: min(280px, 85vw);
    height: calc(100vh - 96px);

    z-index: 90;

    background: var(--surface);

    border-right: 1px solid var(--border);

    box-shadow: var(--shadow);

    transform: translateX(-100%);

    transition: transform 0.2s ease;
}

.navigation-menu.open {
    transform: translateX(0);
}

.navigation-inner {
    padding: 16px 0;
}

.navigation-item {
    display: block;

    padding: 15px 28px;

    color: var(--text);

    text-decoration: none;
}

.navigation-item:hover {
    background: var(--surface-alt);
}

.navigation-button {
    width: 100%;

    margin: 0;

    font-family: inherit;
    font-size: inherit;

    text-align: left;

    background: transparent;

    cursor: pointer;
}

.navigation-item.navigation-button {
    width: 100%;

    margin: 0;

    border: 0;

    background: transparent;

    color: var(--text);

    font: inherit;

    text-align: left;

    cursor: pointer;
}

.navigation-item:first-child {
    border-bottom: 0;
}

.navigation-item.navigation-button:hover {
    background: var(--surface-alt);
}

.navigation-item.navigation-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}


/* =========================================================
   Main
   ========================================================= */

.site-main {
    width: 100%;
    max-width: 1280px;

    margin: 0 auto;

    flex: 1;

    padding:
        clamp(24px, 4vw, 52px)
        clamp(16px, 4vw, 40px)
        40px;
}

.story-section {
    width: 100%;
}

/* =========================================================
   Story view selector
   ========================================================= */

.view-selector {
    display: inline-flex;
}


.view-select {
    min-width: 130px;

    padding: 8px 34px 8px 12px;

    border: 1px solid var(--border);

    border-radius: 999px;

    background-color: var(--surface);

    color: var(--text);

    font: inherit;
    font-size: 0.9rem;

    cursor: pointer;

    outline: none;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}


.view-select:hover {
    background-color: var(--surface-alt);
}


.view-select:focus-visible {
    border-color: var(--accent);

    outline: 2px solid var(--accent);

    outline-offset: 2px;
}

.settings-button {
    width: 42px;
    height: 42px;

    border-radius: 50%;

    font-size: 20px;
}

.share-button {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border-radius: 50%;
}


.share-button-icon {
    width: 21px;
    height: 21px;
}


/* =========================================================
   Share dialog
   ========================================================= */

.share-dialog {
    width: min(420px, calc(100vw - 32px));

    padding: 0;

    color: var(--text);
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.30);
}


.share-dialog::backdrop {
    background:
        rgba(0, 0, 0, 0.50);
}


.share-dialog-content {
    padding: 20px;
}


.share-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 16px;
}


.share-dialog-header h2 {
    margin: 0;

    font-size: 1.3rem;
}


.share-actions {
    display: grid;

    gap: 6px;
}


.share-action {
    display: flex;
    align-items: center;

    gap: 12px;

    width: 100%;

    padding: 11px 12px;

    border: 1px solid transparent;
    border-radius: 8px;

    background: transparent;
    color: var(--text);

    font: inherit;
    text-align: left;
    text-decoration: none;

    cursor: pointer;
}


.share-action:hover {
    background:
        var(--surface-alt);
}


.share-action:focus-visible {
    outline:
        2px solid var(--accent);

    outline-offset:
        2px;
}


.share-action-icon {
    display: block;

    flex:
        0 0 28px;

    width: 28px;
    height: 28px;
}


.share-action[hidden] {
    display: none;
}

/* =========================================================
   Active story tag filter
   ========================================================= */

.story-filter {
    position: sticky;

    top: calc(var(--site-header-height) + 8px);

    z-index: 50;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;

    width: 100%;

    margin: 0 0 1.75rem;

    padding: 0.8rem 1rem;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface-alt);
    color: var(--text);

    font-size: 0.95rem;

    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.06);
}


.story-filter-text {
    font-weight: 600;
}

.story-filter-clear {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.story-filter-clear:hover {
    text-decoration: underline;
}

.story-filter-clear:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* =========================================================
   Story grid
   ========================================================= */

.story-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 280px), 360px));

    justify-content: start;

    gap: clamp(18px, 2.5vw, 30px);
}

.story-card {
    width: 100%;
    max-width: 360px;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 10px;

    box-shadow: var(--shadow);

    cursor: pointer;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.story-card:hover {
    transform: translateY(-3px);

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.16);
}

.story-card:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.story-card-image {
    display: block;

    width: 100%;
    height: auto;

    aspect-ratio: 3 / 2;

    object-fit: contain;
    object-position: center;

    background: var(--surface-alt);
}

.story-card-content {
    padding: 18px 20px 20px;
}

.story-card-title {
    margin: 0 0 5px;

    font-size: 1.15rem;

    line-height: 1.35;
}

/* =========================================================
   Story reading-status indicators
   ========================================================= */

.story-card-title-row {
    display: flex;

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

    gap: 0.75rem;
}


.story-card-title-row .story-card-title {
    flex: 1;
}


/*
 * The status indicator is deliberately compact so that
 * it reads as a quiet annotation rather than another
 * prominent piece of card content.
 */

.story-status-indicator {
    display: inline-flex;

    flex:
        0 0 auto;

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

    width: 1.15rem;
    height: 1.35rem;

    color: #B58A3A;
}


/*
 * In-progress — solid minimalist bookmark.
 */

.story-status-in-progress {
    display: inline-block;

    width: 0.85rem;
    height: 1.15rem;

    margin-right: 0.15rem;

    background: currentColor;

    clip-path: polygon(
        0 0,
        100% 0,
        100% 100%,
        50% 72%,
        0 100%
    );
}


/*
 * Completed — Option A hand-drawn/written checkmark.
 */

.story-status-completed {
    color: #4F8A5B;

    width: 1.35rem;
    height: 1.35rem;
}


.story-status-completed svg {
    display: block;

    width: 100%;
    height: 100%;

    overflow: visible;
}

.story-card-date {
    margin: 0;

    color: var(--text-secondary);

    font-size: 0.95rem;
}

/* =========================================================
   Story page
   ========================================================= */

.story-content {
    width: 100%;
    max-width: 820px;

    margin:
        clamp(24px, 5vw, 60px)
        auto;

    padding:
        80px
        100px
        90px;

    background: var(--story-background);
    color: var(--story-text);

    border: 1px solid var(--border);

    box-shadow: var(--shadow);

    font-family: var(--story-font-family);
    font-size: calc(1.15rem * var(--story-font-size-factor));
    font-weight: var(--story-font-weight);
    line-height: 1.5;
}

/* =========================================================
   Story navigation panel
   ========================================================= */

.story-navigation-panel {
    position: sticky;

    top: 0;

    z-index: 50;

    margin:
        0
        0
        1.75rem;

    padding:
        0.75rem
        1rem
        1.25rem;

    background:
        var(--story-background);

    border-bottom:
        1px solid
        var(--border);

    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.06);
}


.story-navigation-controls {
    display: flex;

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

    gap: 1rem;

    margin-bottom:
        1.75rem;
}


.story-home-link {
    color:
        var(--story-text);

    font-family:
        var(--story-font-family);

    font-size:
        calc(
            0.95rem *
            var(--story-font-size-factor)
        );

    font-weight: 600;

    text-decoration:
        none;
}


.story-home-link:hover {
    text-decoration:
        underline;
}


.story-navigation-actions {
    display: flex;
    align-items: center;

    gap: 0.5rem;

    flex:
        0 0 auto;
}


.story-share-button {
    display: flex;

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

    flex:
        0 0 auto;

    width:
        2rem;

    height:
        2rem;

    padding:
        0;

    border:
        none;

    background:
        transparent;

    color:
        var(--story-text);

    cursor:
        pointer;
}


.story-share-button-icon {
    width:
        1.3rem;

    height:
        1.3rem;
}


.story-share-button:hover {
    opacity:
        0.7;
}


.story-share-button:focus-visible {
    outline:
        2px solid
        currentColor;

    outline-offset:
        3px;
}


.story-close-button {
    display: flex;

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

    flex:
        0 0 auto;

    width:
        2rem;

    height:
        2rem;

    padding:
        0;

    border:
        none;

    background:
        transparent;

    color:
        var(--story-text);

    font:
        inherit;

    font-size:
        1.75rem;

    line-height:
        1;

    cursor:
        pointer;
}


.story-close-button:hover {
    opacity:
        0.7;
}


.story-close-button:focus-visible,
.story-home-link:focus-visible {
    outline:
        2px solid
        currentColor;

    outline-offset:
        3px;
}

.story-close-button[hidden] {
    display: none;
}

/* =========================================================
   Story heading
   ========================================================= */

.story-header {
    font-family: var(--story-font-family);
    margin-bottom: 0;
}

.story-header h1 {
    margin: 0;
    text-align: center;
    font-weight: 700;
    font-size: 1.8rem;
}

.story-date {
    margin: 1.30em 0 1.25em;

    color: var(--story-text);

    font-family: var(--story-font-family);

    font-size:
        calc(
            1.15rem *
            var(--story-font-size-factor)
        );

    line-height: 1.5;

    text-align: left;
}


/* =========================================================
   Story paragraphs
   ========================================================= */

.story-paragraph {
    margin: 0 0 0.9em;
}

.story-paragraph-center {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0;
}

.story-paragraph-center + .story-paragraph-center {
    margin-top: 0;
}

.story-paragraph-center + .story-paragraph:not(.story-paragraph-center) {
    margin-top: 1.25em;
}

.story-paragraph-right {
    text-align: right;
}

.story-paragraph-justify {
    text-align: justify;
}

/* =========================================================
Story copyright
========================================================= */

.story-copyright {
margin-top: 2em;

color: var(--text-secondary);

font-family:
    var(--story-font-family);

font-size:
    calc(
        1.0rem *
        var(--story-font-size-factor)
    );

line-height: 1.45;

}


/* =========================================================
   Intentional blank space
   ========================================================= */

.story-spacer {
    height: 1.5em;
}

/* =========================================================
   End-of-story completion control
   ========================================================= */

.story-completion-control {
    margin-top: 3.5rem;

    padding-top: 1.75rem;

    border-top:
        1px solid
        color-mix(
            in srgb,
            var(--story-text) 22%,
            transparent
        );
}


.story-completion-label {
    display: flex;

    align-items: flex-start;

    gap: 0.75rem;

    margin: 0;

    cursor: pointer;

    color: var(--story-text);

    font-family:
        var(--story-font-family);

    font-size:
        calc(
            1.0rem *
            var(--story-font-size-factor)
        );

    line-height: 1.45;
}


.story-completion-label input {
    flex:
        0 0 auto;

    width: 1.15rem;
    height: 1.15rem;

    margin:
        0.12em
        0
        0;

    accent-color: #4F8A5B;

    cursor: pointer;
}


.story-completion-label input:focus-visible {
    outline:
        2px solid var(--accent);

    outline-offset:
        3px;
}


.story-completion-text {
    transition:
        color 0.15s ease;
}


.story-completion-label:has(input:checked)
.story-completion-text {
    color: #4F8A5B;

    font-weight: 600;
}

/* =========================================================
   Story tags
   ========================================================= */

html[data-story-background="white"] .story-tags,
html[data-story-background="paper"] .story-tags,
html[data-story-background="cream"] .story-tags,
html[data-story-background="blue"] .story-tags {
    --text: var(--story-text);
    --text-secondary: #666666;
    --accent: #555555;
}

.story-tags {
    margin-top: 1.5rem;

    color: var(--text-secondary);

    font-family: var(--story-font-family);
    font-size: calc(1rem * var(--story-font-size-factor));
    font-weight: var(--story-font-weight);
    line-height: 1.5;
}

.story-tags-label {
    color: var(--text-secondary);
}

.story-tag-link {
    color: var(--text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.story-tag-link:hover {
    color: var(--accent);
}

.story-tag-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* =========================================================
   Vertical Story Timeline
   ========================================================= */

#timelineView {
    --timeline-surface-background: #ffffff;
    --timeline-surface-text: #222222;
}

.timeline-controls {
    position: sticky;

    top:
        calc(
            var(--site-header-height)
            +
            8px
            +
            var(--story-filter-height)
        );

    z-index: 50;

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

    gap: 0.6rem;

    width: 100%;

    margin: 0 0 2rem;

    padding:
        0.75rem
        1rem;

    background: var(--background);

    border-bottom: 1px solid var(--border);

    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.06);
}


.timeline-jump-label {
    font-weight: 600;
}


.timeline-decade-select {
    font: inherit;

    padding: 0.4rem 0.6rem;

    border: 1px solid var(--border-color, #bbb);
    border-radius: 0.35rem;

    background:
        var(--timeline-surface-background);

    color:
        var(--timeline-surface-text);
}


/*
 * The timeline is now an ordinary vertical document flow.
 */

.timeline-axis {
    position: relative;

    width: 100%;

    padding: 1rem 0 4rem;
}


/*
 * Central vertical line.
 */

.timeline-axis::before {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;

    left: 50%;

    width: 2px;

    transform: translateX(-50%);

    background: currentColor;

    opacity: 0.25;
}


/* =========================================================
   Decade markers
   ========================================================= */

.timeline-decade-marker {
    position: relative;

    z-index: 2;

    display: flex;

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

    min-height: 4rem;

    margin: 2.5rem 0 1.5rem;

    scroll-margin-top:
        calc(
            var(--site-header-height)
            +
            var(--timeline-controls-height)
            +
            24px
        );
}


.timeline-decade-label {
    display: inline-flex;

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

    min-width: 5rem;

    padding: 0.45rem 0.8rem;

    border-radius: 999px;

    background:
        var(--timeline-surface-background);

    color:
        var(--timeline-surface-text);

    border: 2px solid currentColor;

    font-weight: 700;

    letter-spacing: 0.04em;
}


/* =========================================================
   Timeline stories
   ========================================================= */

.timeline-story {
    position: relative;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        3rem
        minmax(0, 1fr);

    align-items: center;

    width: 100%;

    min-height: 6rem;

    margin: 1.5rem 0;
}


/*
 * The dot occupies the center column.
 */

.timeline-dot {
    grid-column: 2;

    grid-row: 1;

    justify-self: center;

    width: 1rem;
    height: 1rem;

    border-radius: 50%;

    background: currentColor;

    border: 3px solid
        var(--background-color, white);

    box-shadow:
        0 0 0 1px currentColor;

    z-index: 2;
}


/*
 * Story label.
 */

.timeline-label {
    grid-row: 1;

    width: min(
        100%,
        28rem
    );

    padding: 0.8rem 1rem;

    border-radius: 0.5rem;

    background:
        var(--timeline-surface-background);

    color:
        var(--timeline-surface-text);

    box-shadow:
        0 1px 4px rgb(0 0 0 / 12%);
}


/*
 * Alternate stories left and right.
 */

.timeline-story[data-side="left"]
.timeline-label {
    grid-column: 1;

    justify-self: end;

    margin-right: 1rem;

    text-align: right;
}


.timeline-story[data-side="right"]
.timeline-label {
    grid-column: 3;

    justify-self: start;

    margin-left: 1rem;

    text-align: left;
}


/*
 * Date and title.
 */

.timeline-year {
    display: block;

    margin-bottom: 0.2rem;

    font-size: 0.9rem;

    opacity: 0.75;
}


.timeline-title {
    display: block;

    font-size: 1.1rem;

    font-weight: 600;
}

.timeline-title-row {
    display: flex;

    align-items: center;

    gap: 0.55rem;
}


.timeline-title-row .story-status-indicator {
    flex:
        0 0 auto;
}


/*
 * Timeline labels use their own surface color rather than
 * the page/card surface.
 */

.timeline-label .story-status-in-progress {
    color: #B58A3A;
}


.timeline-label .story-status-in-progress::after {
    background:
        var(--timeline-surface-background);
}

/* =========================================================
   Narrow screens
   ========================================================= */

@media (max-width: 700px) {

    :root {
        --timeline-controls-height: 110px;
        --story-filter-height: 78px;
    }
    
    .timeline-controls {
        flex-direction: column;

        align-items: stretch;

        margin-bottom: 1.5rem;

        padding:
            0.6rem
            0.75rem;
    }


    .timeline-decade-select {
        width: 100%;
    }


    /*
     * Keep the central axis, but give the cards more room by
     * reducing the center column.
     */

    .timeline-story {
        grid-template-columns:
            minmax(0, 1fr)
            2rem
            minmax(0, 1fr);

        min-height: 5rem;

        margin: 1rem 0;
    }


    .timeline-label {
        width: auto;

        padding: 0.65rem 0.75rem;
    }


    .timeline-story[data-side="left"]
    .timeline-label {
        margin-right: 0.6rem;
    }


    .timeline-story[data-side="right"]
    .timeline-label {
        margin-left: 0.6rem;
    }


    .timeline-title {
        font-size: 1rem;
    }


    .timeline-year {
        font-size: 0.8rem;
    }
}


/* =========================================================
   Settings dialog
   ========================================================= */

.settings-dialog {
    width: min(420px, calc(100vw - 32px));

    padding: 0;

    color: var(--text);

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 12px;

    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
}


.settings-dialog::backdrop {
    background: rgba(0, 0, 0, 0.50);
}


.settings-dialog-content {
    padding: 20px;
}


.settings-header {
    display: flex;

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

    margin-bottom: 16px;
}


.settings-header h2 {
    margin: 0;

    font-size: 1.3rem;
}


/* =========================================================
   Settings groups
   ========================================================= */

.setting-group {
    margin-bottom: 16px;
}


.setting-group:last-child {
    margin-bottom: 0;
}


.setting-group h3 {
    margin: 0 0 5px;

    font-size: 1rem;
}


.theme-options {
    display: flex;

    flex-direction: column;

    gap: 2px;
}


.theme-options label {
    display: flex;

    align-items: center;

    gap: 8px;

    padding: 4px 6px;

    border-radius: 6px;

    cursor: pointer;
}


.theme-options label:hover {
    background: var(--surface-alt);
}

/* =========================================================
   The Setting dialog
   ========================================================= */

.setting-dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 650px;
    width: calc(100% - 40px);
}


.setting-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}


.setting-dialog-content {
    padding: 28px 32px 32px;
}


.setting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}


.setting-header h2 {
    margin: 0;
}


.setting-message-body {
    white-space: pre-line;
    line-height: 1.7;
}

/* =========================================================
   About dialog
   ========================================================= */

.about-dialog {
    width: min(460px, calc(100vw - 32px));

    padding: 0;

    color: var(--text);

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 12px;

    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
}

.about-dialog::backdrop {
    background: rgba(0, 0, 0, 0.50);
}

.about-dialog-content {
    padding: 24px;
}

.about-header {
    display: flex;

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

    margin-bottom: 20px;
}

.about-header h2 {
    margin: 0;

    font-size: 1.3rem;
}

.about-dialog p {
    margin: 0 0 1em;

    line-height: 1.5;
}

.about-dialog p:last-child {
    margin-bottom: 0;
}

.about-credit {
    color: var(--text-secondary);
}

.about-dialog a {
    color: var(--accent);

    font-weight: 600;

    text-decoration: underline;
}

.about-dialog a:hover {
    color: var(--accent-hover);
}

/* =========================================================
   Resume story dialog
   ========================================================= */

.resume-story-dialog {
    width: min(520px, calc(100vw - 32px));

    margin: auto;

    padding: 0;

    color: var(--text);

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 12px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.30);
}


.resume-story-dialog::backdrop {
    background: rgba(0, 0, 0, 0.50);
}


.resume-story-dialog-content {
    padding: 24px;
}


.resume-story-dialog h2 {
    margin: 0 0 16px;

    font-size: 1.3rem;
}


.resume-story-message {
    margin: 0 0 20px;

    color: var(--text);

    font-family:
        var(--story-font-family),
        Georgia,
        serif;

    font-size: 1rem;

    line-height: 1.7;
}


.resume-story-actions {
    display: flex;

    justify-content: flex-end;

    gap: 10px;
}


.resume-story-button,
.resume-story-dismiss {
    flex-shrink: 0;

    padding:
        8px 16px;

    border: 1px solid var(--border);

    border-radius: 999px;

    background:
        var(--surface);

    color:
        var(--text);

    font: inherit;

    font-size: 0.9rem;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}


.resume-story-button:hover,
.resume-story-dismiss:hover {
    background:
        var(--surface-alt);
}


.resume-story-button:active,
.resume-story-dismiss:active {
    transform:
        scale(0.96);
}


.resume-story-button:focus-visible,
.resume-story-dismiss:focus-visible {
    outline:
        2px solid var(--accent);

    outline-offset:
        2px;
}


@media (max-width: 600px) {

    .resume-story-dialog {
        width:
            calc(100vw - 32px);
    }


    .resume-story-dialog-content {
        padding:
            20px;
    }


    .resume-story-actions {
        flex-direction: column-reverse;

        align-items: stretch;
    }


    .resume-story-button,
    .resume-story-dismiss {
        width: 100%;
    }
}


/* =========================================================
   Utility
   ========================================================= */

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}


/* =========================================================
   Footer
   ========================================================= */

.site-footer {
    padding: 20px 16px 35px;

    color: var(--text-secondary);

    text-align: center;

    font-size: 0.85rem;
}


/* =========================================================
   Smaller screens
   ========================================================= */

@media (max-width: 600px) {

    :root {
        --site-header-height: 80px;
    }

    .site-header {
        min-height: 80px;

        padding: 10px 14px;
    }

    .logo-link {
        transform: translateX(-12px);
    }

    .site-logo {
        max-width: min(210px, 55vw);
        max-height: 58px;
    }

    .navigation-menu {
        top: 80px;
        height: calc(100vh - 80px);
    }

    .header-controls {
        gap: 6px;
    }

    .view-select {
        min-width: 115px;

        padding:
            8px 30px 8px 10px;

        font-size: 0.78rem;
    }

    .settings-button {
        flex-shrink: 0;
    }

    .timeline {
        padding-bottom: 50px;
    }

    .timeline-axis {
        min-height: 500px;
    }

    .timeline-label {
        width: 135px;

        font-size: 0.78rem;
    }

    .timeline-label.above {
        right: calc(50% + 20px);
    }

    .timeline-label.below {
        left: calc(50% + 20px);
    }

    .story-content {
        margin:
            16px 0
            24px;

        padding:
            48px 28px
            56px;
    }

        .story-navigation-panel {
        margin-bottom:
            1.5rem;

        padding:
            0.65rem
            0.75rem
            1rem;
    }


    .story-navigation-controls {
        margin-bottom:
            1.25rem;
    }


    .story-home-link {
        font-size:
            calc(
                0.9rem *
                var(--story-font-size-factor)
            );
    }

    .story-header h1 {
        font-size: 1.45rem;
    }
}

/* =========================================================
   Site messages
   ========================================================= */

.site-messages {

    width: min(
        calc(100% - 40px),
        900px
    );

    margin: 24px auto 32px;

}


.site-message {

    position: relative;

    margin-bottom: 16px;

    padding: 24px 56px 24px 28px;

    background: var(--site-message-background, #f5f1e8);

    border: 1px solid var(--site-message-border, #d8d0c2);

    border-radius: 8px;

    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.08);

}


.site-message-title {

    margin: 0 0 14px;

    font-family:
        var(--story-font-family),
        Georgia,
        serif;

    font-size: 1.15rem;

    font-weight: 600;

}


.site-message-body {

    margin: 0;

    font-family:
        var(--story-font-family),
        Georgia,
        serif;

    font-size: 1rem;

    line-height: 1.7;

    white-space: pre-line;
}


.site-message-close {

    position: absolute;

    top: 10px;

    right: 12px;

    width: 32px;

    height: 32px;

    padding: 0;

    border: 0;

    background: transparent;

    color: inherit;

    font-size: 1.6rem;

    line-height: 1;

    cursor: pointer;

    opacity: 0.65;

}


.site-message-close:hover {

    opacity: 1;

}


.site-message-close:focus-visible {

    outline: 2px solid currentColor;

    outline-offset: 2px;

}


/*
 * Dark theme
 */

/* =========================================================
   Site messages — dark theme
   ========================================================= */

html[data-theme="dark"] .site-message {

    --site-message-background: #f5f1e8;

    --site-message-border: #d8d0c2;

    color: #2b2926;
}


@media (prefers-color-scheme: dark) {

    html:not([data-theme]) .site-message {

        --site-message-background: #f5f1e8;

        --site-message-border: #d8d0c2;

        color: #2b2926;
    }

}