/* ==============================================
   SITE — one stylesheet for every page
   Colors are variables, so light and dark mode
   only swap the values at the top.
   ============================================== */

/* ---- Light mode ----
   The colors come from Hat Guy in the favicon: his hat (#62a8d6, the accent
   in dark mode, deepened here so it reads on white), his ink outline
   (#1f1b17, the headings) and the red behind him (--new, the "new!" tag).
   The paper and greys lean slightly blue to sit with the hat. */
:root {
    --bg: #f7f9fb;
    --surface: #e9f0f6;
    --surface-hover: #dce7f0;
    --heading: #1f1b17;
    --text: #363c43;
    --muted: #5c6670;
    --faint: #7d8791;
    --accent: #2c6e9e;
    --accent-hover: #235a82;
    --new: #c42323;
    --line: rgba(20, 45, 70, 0.12);
    --shadow: 0 6px 24px rgba(20, 45, 70, 0.12);
    --scrim: rgba(10, 16, 22, 0.88);
    --backdrop: rgba(20, 40, 60, 0.28);
    /* Search: one color per kind of thing */
    --tone-page: #2c6e9e;
    --tone-anim: #b0503a;
    --tone-comic: #2c7673;
    --tone-draw: #a0622a;
    --tone-story: #8a4f7d;
    --tone-blog: #5b5ea6;
    --tone-garden: #557535;
    color-scheme: light;
}

/* ---- Dark mode: the computer's setting, unless the toggle says light ---- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1419;
        --surface: #18202a;
        --surface-hover: #202a35;
        --heading: #e9eef3;
        --text: #cfd8e0;
        --muted: #8e9aa6;
        --faint: #6a7580;
        --accent: #62a8d6;
        --accent-hover: #8cc4e8;
        --new: #ff6b5e;
        --line: rgba(255, 255, 255, 0.08);
        --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
        --scrim: rgba(0, 0, 0, 0.92);
        --backdrop: rgba(0, 0, 0, 0.6);
        --tone-page: #62a8d6;
        --tone-anim: #e08c6e;
        --tone-comic: #6cbdb7;
        --tone-draw: #e3a96b;
        --tone-story: #c792bb;
        --tone-blog: #a3a6e6;
        --tone-garden: #9cc36f;
        color-scheme: dark;
    }
}

/* ---- Dark mode: chosen with the toggle ---- */
:root[data-theme="dark"] {
    --bg: #0f1419;
    --surface: #18202a;
    --surface-hover: #202a35;
    --heading: #e9eef3;
    --text: #cfd8e0;
    --muted: #8e9aa6;
    --faint: #6a7580;
    --accent: #62a8d6;
    --accent-hover: #8cc4e8;
    --new: #ff6b5e;
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    --scrim: rgba(0, 0, 0, 0.92);
    --backdrop: rgba(0, 0, 0, 0.6);
    --tone-page: #62a8d6;
    --tone-anim: #e08c6e;
    --tone-comic: #6cbdb7;
    --tone-draw: #e3a96b;
    --tone-story: #c792bb;
    --tone-blog: #a3a6e6;
    --tone-garden: #9cc36f;
    color-scheme: dark;
}


/* ====================
   BASE
   ==================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Libre Baskerville', Georgia, serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    transition: background-color 0.3s, color 0.3s;
}

/* Full-width blocks: body is a flex column, which would shrink them */
.hero,
.reel-block,
.about,
.photo,
.page {
    width: 100%;
}

h1,
h2,
h3 {
    color: var(--heading);
    line-height: 1.25;
}

img {
    max-width: 100%;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

a:hover {
    color: var(--accent-hover);
    border-bottom-color: currentColor;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    flex-shrink: 0;
}

.loading,
.empty {
    color: var(--faint);
    font-style: italic;
    font-size: 0.95rem;
}

.empty {
    padding: 2rem 1rem;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 8px;
}


/* ====================
   NAV
   ==================== */

.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 60px;
    padding: 0 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s;
}

.site-nav .nav-name {
    font-size: 1.2rem;
    font-weight: 700;
    font-style: italic;
    color: var(--heading);
    margin-right: auto;
    border: none;
    white-space: nowrap;
}

.site-nav .nav-name:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-links a {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
    border: none;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.nav-links a.active {
    background: var(--surface);
}

.theme-toggle,
.nav-feed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.theme-toggle:hover,
.nav-feed:hover,
.nav-feed[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

/* Follow the blog: the panel under the RSS button */
.feed-pop {
    position: absolute;
    top: calc(100% + 8px);
    right: 1rem;
    width: min(330px, calc(100vw - 2rem));
    padding: 1rem 1.1rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 110;
}

.feed-pop[hidden] {
    display: none;
}

.feed-pop p {
    margin: 0;
}

.feed-pop-title {
    font-weight: 700;
    color: var(--heading);
}

.feed-pop-text,
.feed-pop-help {
    margin-top: 0.35rem !important;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted);
}

.feed-pop-help {
    color: var(--faint);
    font-style: italic;
}

.feed-pop-copy {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.feed-pop-copy input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.75rem;
    font: inherit;
    font-size: 0.75rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.feed-pop-copy .button {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
}

.feed-pop-email {
    margin-top: 0.5rem;
}

.feed-pop-email input::placeholder {
    color: var(--faint);
}

.feed-pop-done {
    margin-top: 0.5rem !important;
    font-size: 0.8rem;
    color: var(--accent);
}

/* A line with words in the middle, between email and RSS */
.feed-pop-or {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem !important;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--faint);
}

.feed-pop-or::before,
.feed-pop-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

.feed-pop-or + .feed-pop-copy {
    margin-top: 0.6rem;
}

.feed-pop-apps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.feed-pop-apps a {
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.feed-pop-apps a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* The search button: looks like a small search box */
.nav-search {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 160px;
    height: 36px;
    padding: 0 0.45rem 0 0.85rem;
    font: inherit;
    font-size: 0.8rem;
    color: var(--faint);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.nav-search:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.nav-search-label {
    margin-right: auto;
    font-style: italic;
}

kbd {
    display: inline-block;
    min-width: 1.5em;
    padding: 0.05rem 0.35rem;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 0.68rem;
    line-height: 1.5;
    text-align: center;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
}


/* ====================
   FOOTER
   ==================== */

/* Stays at the bottom of the window (sticky, so it never covers the page's end) */
.site-footer {
    position: sticky;
    bottom: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 48px;
    margin-top: auto;
    padding: 0 2rem;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    transition: background-color 0.3s;
}

.socials {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.socials a {
    color: var(--faint);
    font-size: 1rem;
    border: none;
    display: inline-flex;
    transition: color 0.2s, transform 0.2s;
}

/* The way into the Everything page: an accent-tinted pill with a grid icon */
.everything-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.85rem 0.28rem 0.6rem;
    font-size: 0.8rem;
    font-style: italic;
    letter-spacing: 0.3px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 999px;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.everything-link:hover {
    color: var(--accent-hover);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    border-color: var(--accent);
    box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 25%, transparent);
    transform: translateY(-1px);
}

.everything-link[aria-current] {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
}

.everything-icon {
    width: 15px;
    height: 15px;
    fill: currentColor;
    overflow: visible;
}

.everything-icon rect {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.25s;
}

.everything-icon rect:nth-child(2),
.everything-icon rect:nth-child(3) {
    opacity: 0.55;
}

.everything-link:hover rect:nth-child(1) { transform: translate(-1px, -1px); }
.everything-link:hover rect:nth-child(2) { transform: translate(1px, -1px) rotate(45deg) scale(0.85); opacity: 1; }
.everything-link:hover rect:nth-child(3) { transform: translate(-1px, 1px); opacity: 1; }
.everything-link:hover rect:nth-child(4) { transform: translate(1px, 1px); }

/* Once a visit: the squares pop in one by one */
.everything-link.hello rect {
    animation: square-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
}

.everything-link.hello rect:nth-child(1) { animation-delay: 0.6s; }
.everything-link.hello rect:nth-child(2) { animation-delay: 0.7s; }
.everything-link.hello rect:nth-child(4) { animation-delay: 0.8s; }
.everything-link.hello rect:nth-child(3) { animation-delay: 0.9s; }

@keyframes square-pop {
    from { transform: scale(0); }
}

.socials a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}


/* ====================
   PAGE LAYOUT
   ==================== */

.page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 3rem;
    padding: 2.5rem 2rem 1rem;
}

.page-narrow {
    max-width: 680px;
}

.page-head {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-head h1 {
    font-size: 2rem;
    margin: 0;
}

.page-head h1::after,
.hero h1::after {
    content: '';
    display: block;
    width: 48px;
    height: 2px;
    background: var(--accent);
    margin: 0.9rem auto 0;
}

.page-head p {
    color: var(--muted);
    font-style: italic;
    margin: 1rem 0 0;
}

.section {
    margin: 0 0 3.5rem;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.section-head h2 {
    font-size: 1.2rem;
    font-style: italic;
    margin: 0;
}

.section-head a {
    font-size: 0.85rem;
    white-space: nowrap;
}

.section-intro {
    color: var(--muted);
    font-style: italic;
    font-size: 0.9rem;
    margin: -0.5rem 0 1rem;
}

/* Breadcrumbs at the top of a page inside a section: Read / Comics / Dan */
.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    row-gap: 0.2rem;
    margin-bottom: 2rem;
    font-size: 0.8rem;
    color: var(--faint);
}

.crumbs a {
    color: var(--muted);
}

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

.crumbs > * + *::before {
    content: '/';
    display: inline-block;
    margin: 0 0.55rem;
    color: var(--faint);
    opacity: 0.7;
}

.crumbs [aria-current] {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}

/* Lists of writing and notes stay a comfortable reading width on wide pages */
.reading-list {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}


/* ====================
   BUTTONS
   ==================== */

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--heading);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.button:hover {
    color: var(--accent);
    background: var(--surface-hover);
    border-color: var(--accent);
}

.button-primary {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
}

.button-primary:hover {
    color: var(--bg);
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* View buttons (All / Series / each group): wrap onto more lines if needed */
.view-switch {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 2.5rem;
    padding: 0.25rem;
    background: var(--surface);
    border-radius: 1.25rem;
}

.view-switch:empty {
    display: none;
}

/* A subsection heading inside a group's view */
.subsection {
    font-size: 1rem;
    font-style: italic;
    color: var(--muted);
    margin: 2.5rem 0 1rem;
}

.subsection:first-child {
    margin-top: 0;
}

.view-switch button {
    font: inherit;
    font-size: 0.85rem;
    padding: 0.4rem 1.2rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.view-switch button[aria-pressed="true"] {
    background: var(--bg);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}


/* ====================
   VIDEO PLAYER
   ==================== */

.player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.player.vertical {
    aspect-ratio: 9 / 16;
    max-width: 400px;
    max-height: 80vh;
    margin: 0 auto;
}

.player iframe,
.player video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.player-missing {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #aaa;
    font-style: italic;
    text-align: center;
}


/* ====================
   ABOUT (about.html; .reel-block is on reel.html too)
   ==================== */

.hero {
    text-align: center;
    padding: 4rem 2rem 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin: 0;
    letter-spacing: 0.5px;
}

.hero p {
    color: var(--muted);
    font-style: italic;
    margin: 1.2rem 0 0;
}

.reel-block {
    max-width: 820px;
    margin: 0 auto;
    padding: 1rem 2rem 1rem;
}

.about {
    max-width: 600px;
    margin: 0 auto;
    padding: 2.5rem 2rem 1rem;
}

.about p {
    margin: 0 0 1.25rem;
}

.about p:first-child {
    font-style: italic;
    color: var(--muted);
}

.photo {
    max-width: 380px;
    margin: 1rem auto 3rem;
    padding: 0 2rem;
    text-align: center;
}

.photo img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.photo figcaption {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--faint);
    margin-top: 0.6rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(48px + 1.25rem);  /* above the footer */
    transform: translate(-50%, 1rem);
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    color: var(--bg);
    background: var(--heading);
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 300;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* keys.js: what a shortcut did, or the keys that can follow g */
.key-hint {
    position: fixed;
    left: 50%;
    bottom: calc(48px + 1.25rem);
    z-index: 300;
    max-width: calc(100% - 2rem);
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 0.5rem);
    transition: opacity 0.15s, transform 0.15s;
}

.key-hint.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.key-hint kbd {
    margin-left: 0.5rem;
}

.key-hint kbd:first-child {
    margin-left: 0;
}


/* ====================
   CARDS & GRIDS
   ==================== */

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

/* Comics: portrait covers, so smaller columns */
.grid-portrait {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.card {
    display: block;
    width: 100%;
    padding: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

.card:hover {
    border: none;
}

.thumb {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
}

.thumb.portrait {
    aspect-ratio: 3 / 4;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}

.card:hover .thumb img {
    transform: scale(1.04);
}

.thumb-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-style: italic;
    color: var(--faint);
    text-align: center;
}

.thumb .play-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.card:hover .play-badge,
.card:focus-visible .play-badge {
    opacity: 1;
}

.card-title {
    display: block;
    margin-top: 0.7rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--heading);
    transition: color 0.2s;
}

.card:hover .card-title {
    color: var(--accent);
}

.card-meta {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--faint);
}

/* Horizontal shelf (streaming style) */
.shelf {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 260px);
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scroll-snap-type: x mandatory;
}

.shelf > * {
    scroll-snap-align: start;
}

.series-block {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 2rem;
    margin-bottom: 3.5rem;
    align-items: start;
}

.series-block h2 {
    font-size: 1.5rem;
    margin: 0.8rem 0 0.4rem;
}

.series-block p {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0 0 0.8rem;
}


/* ====================
   SERIES PAGE (streaming)
   ==================== */

.series-hero {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 2.5rem;
    align-items: center;
    margin-bottom: 3rem;
}

.series-hero h1 {
    font-size: 2.4rem;
    margin: 0 0 0.6rem;
}

.series-hero .lead {
    color: var(--text);
    margin: 0 0 1rem;
}

.platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.now-playing {
    margin-bottom: 3rem;
}

.now-playing h2 {
    font-size: 1.3rem;
    margin: 1.2rem 0 0.3rem;
}

.now-playing .episode-meta {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--faint);
}

.now-playing .description {
    max-width: 680px;
}

.episode-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.season-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.season-tabs button[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

.episode-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.episode {
    display: grid;
    grid-template-columns: 2.2rem 180px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: center;
    width: 100%;
    padding: 1rem;
    font: inherit;
    text-align: left;
    color: inherit;
    background: none;
    border: none;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background-color 0.2s;
}

.episode:hover,
.episode[aria-current="true"] {
    background: var(--surface);
}

.episode .number {
    font-size: 1.4rem;
    color: var(--faint);
    text-align: center;
}

.episode[aria-current="true"] .number {
    color: var(--accent);
}

.episode .ep-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0 0 0.25rem;
}

.episode .ep-summary {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
}


/* ====================
   COMIC READER
   ==================== */

.comic-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin: 2rem 0;
}

.comic-pages img {
    width: 100%;
    max-width: 800px;
    border-radius: 4px;
    box-shadow: var(--shadow);
}


/* ====================
   DRAWINGS (drawings.js, drawing.js)
   ==================== */

/* The wall: columns, each drawing at its own shape, filling down then across */
.drawing-wall {
    columns: 3 260px;
    column-gap: 1.5rem;
}

.drawing-tile {
    display: block;
    break-inside: avoid;
    margin-bottom: 1.5rem;
    border: none;
    color: inherit;
}

.drawing-tile img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.drawing-tile:hover img {
    transform: translateY(-3px);
}

.drawing-tile .card-title {
    display: block;
    margin-top: 0.6rem;
}

/* One drawing: as big as the window allows, whatever its shape */
.drawing-main {
    margin: 1rem 0 2rem;
    text-align: center;
}

.drawing-main img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.drawing-head {
    margin-bottom: 1.5rem;
}

.drawing-words {
    max-width: 680px;
    margin: 0 auto 2rem;
}

.drawing-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin: 2rem 0;
}

.drawing-more img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 4px;
    box-shadow: var(--shadow);
}


/* ====================
   LIGHTBOX
   ==================== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--scrim);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-body {
    width: min(960px, 100%);
    max-height: 100%;
}

.lightbox-body h2 {
    color: #eee;
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
    padding-right: 3rem;
}

.lightbox-body p {
    color: #bbb;
    font-size: 0.85rem;
    margin: 0.75rem 0 0;
}

.lightbox-body img {
    display: block;
    max-height: 80vh;
    margin: 0 auto;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font: inherit;
    font-size: 2rem;
    line-height: 1;
    color: #ccc;
    background: none;
    border: none;
    cursor: pointer;
}

.lightbox-close:hover {
    color: #fff;
}


/* ====================
   WRITING
   ==================== */

.writing-group {
    margin-bottom: 2.5rem;
}

.writing-group h2,
.writing-group h3 {
    font-size: 0.95rem;
    font-style: italic;
    font-weight: 400;
    color: var(--muted);
    text-transform: lowercase;
    letter-spacing: 1.5px;
    text-align: center;
    margin: 0 0 1rem;
}

.entry {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    transition: border-color 0.2s, transform 0.2s;
}

.entry:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.entry-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.entry-meta {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--faint);
    white-space: nowrap;
}

.entry-desc {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
    margin-top: 0.2rem;
}


/* ====================
   ARTICLE / NOTE PAGES (generated by publish.el)
   ==================== */

.prose-head {
    text-align: center;
    margin-bottom: 2.5rem;
}

.prose-head h1 {
    font-size: 2rem;
    margin: 0.3rem 0 0.6rem;
}

.eyebrow {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0;
}

.byline {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--faint);
    margin: 0;
}

/* Share (and Download PDF), under a title */
.prose-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

/* Share: just an icon, round; a check mark once the link's copied */
.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.share-button .icon {
    width: 0.95rem;
    height: 0.95rem;
}

/* "Link copied", just above the Share button that was clicked */
.share-tip {
    position: absolute;
    z-index: 300;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
}

.share-tip.show {
    opacity: 1;
    transform: translate(-50%, -100%);
}

/* Beside full-size buttons (series and book pages), the same height as them */
.platforms .share-button,
.book-actions .share-button {
    width: 2.6rem;
    height: 2.6rem;
}

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    font: inherit;
    font-size: 0.78rem;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.share-button:hover,
.action-link:hover,
.share-button.copied {
    color: var(--accent);
    border-color: var(--accent);
}

.prose {
    font-size: 1.02rem;
}

.prose p {
    margin: 0 0 1.4rem;
}

.prose h2 {
    font-size: 1.35rem;
    margin: 2.5rem 0 1rem;
}

.prose h3 {
    font-size: 1.1rem;
    margin: 2rem 0 0.8rem;
}

.prose hr {
    border: none;
    text-align: center;
    margin: 2.5rem 0;
}

.prose hr::after {
    content: '⁂';
    color: var(--faint);
    font-size: 1.2rem;
}

.prose blockquote {
    margin: 1.5rem 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--accent);
    color: var(--muted);
    font-style: italic;
}

.prose .verse {
    white-space: pre-line;
    font-style: italic;
    margin: 0 0 1.4rem;
}

.prose pre,
.prose code {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 0.85em;
}

.prose pre {
    padding: 1rem;
    overflow-x: auto;
    background: var(--surface);
    border-radius: 6px;
}

.prose img {
    display: block;
    margin: 1.5rem auto;
    border-radius: 4px;
}

.prose figure {
    margin: 1.5rem 0;
    text-align: center;
}

.prose figure img {
    margin-bottom: 0.6rem;
}

/* An image's #+caption: (publish.el), like the photo captions */
.prose figcaption {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--faint);
}

/* Org numbers captions "Figure 1:"; a piece of writing doesn't need that */
.prose .figure-number {
    display: none;
}

.prose ul,
.prose ol {
    padding-left: 1.4rem;
    margin: 0 0 1.4rem;
}

.prose .footnotes,
.prose #footnotes {
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    margin-top: 3rem;
    padding-top: 1rem;
}

/* Screenplays (.fountain files): laid out like a printed script, in Courier
   Prime. The indents are fractions of the column, as on a page: dialogue in
   the middle, character names further in, transitions on the right. */

.screenplay {
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    font-size: 1rem;
    line-height: 1.45;
}

.screenplay .prose-head h1 {
    font-family: inherit;
    text-transform: uppercase;
}

.screenplay p {
    margin: 0 0 1.45em;
}

.screenplay .action {
    white-space: pre-wrap;
}

.screenplay .scene-heading {
    font-weight: 700;
    margin-top: 2.2em;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.screenplay .scene-number {
    color: var(--faint);
    font-weight: 400;
}

.screenplay .speech {
    margin: 0 0 1.45em;
}

/* Only the vertical margins: the indents below set each part's left margin */
.screenplay .speech p {
    margin-top: 0;
    margin-bottom: 0;
}

.screenplay .character {
    margin-left: 37%;
}

.screenplay .parenthetical {
    margin-left: 27%;
    max-width: 40%;
}

.screenplay .dialogue,
.screenplay .speech .lyrics {
    margin-left: 17%;
    max-width: 60%;
}

.screenplay .lyrics {
    font-style: italic;
}

.screenplay .transition {
    text-align: right;
}

.screenplay .centered {
    text-align: center;
}

.screenplay .page-break {
    border: none;
    border-top: 1px dashed var(--line);
    margin: 2.5em 0;
}

/* Two characters speaking at once: side by side, each with its own indents */
.screenplay .dual-dialogue {
    display: flex;
    gap: 1.5rem;
    margin: 0 0 1.45em;
}

.screenplay .dual-dialogue .speech {
    flex: 1;
    margin: 0;
}

.screenplay .dual-dialogue .character { margin-left: 20%; }
.screenplay .dual-dialogue .parenthetical { margin-left: 10%; max-width: none; }
.screenplay .dual-dialogue .dialogue { margin-left: 0; max-width: none; }

@media (max-width: 760px) {
    .screenplay { font-size: 0.92rem; }
    .screenplay .character { margin-left: 30%; }
    .screenplay .parenthetical { margin-left: 18%; max-width: 70%; }
    .screenplay .dialogue,
    .screenplay .speech .lyrics { margin-left: 8%; max-width: 84%; }
}

.backlinks {
    margin-top: 3rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.backlinks h2 {
    font-size: 0.85rem;
    font-weight: 400;
    font-style: italic;
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.backlinks ul {
    margin: 0;
    padding-left: 1.2rem;
}


/* ====================
   HOME: everything on the site (index.html, home.js)
   ==================== */

.home-head {
    text-align: center;
    margin: 1rem 0 2rem;
}

.home-head h1 {
    font-size: 2.6rem;
    margin: 0;
    letter-spacing: 0.5px;
}

.home-head p {
    color: var(--muted);
    font-style: italic;
    margin: 0.75rem 0 0;
}

.home-head a {
    white-space: nowrap;
    margin-left: 0.35rem;
}

/* The big search box: hands over to the search panel (search.js) */
.home-search {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.home-search input {
    width: 100%;
    height: 60px;
    padding: 0 3.5rem 0 3.4rem;
    font: inherit;
    font-size: 1.05rem;
    color: var(--heading);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.home-search input::placeholder {
    color: var(--faint);
    font-style: italic;
}

.home-search input:hover,
.home-search input:focus {
    border-color: var(--accent);
}

.home-search input::-webkit-search-cancel-button {
    display: none;
}

.home-search-icon {
    position: absolute;
    left: 1.35rem;
    top: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.6;
    stroke-linecap: round;
    pointer-events: none;
}

.home-search-key {
    position: absolute;
    right: 1.35rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* A link to each part of the site, under the search box, with the same
   colors as the search panel's filters */
.home-jump {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.25rem 0 3rem;
}

.home-jump:empty {
    min-height: 2.1rem;
}

.home-jump a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    color: var(--heading);
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: border-color 0.2s, color 0.2s;
}

.home-jump a:hover {
    color: var(--tone);
    border-color: var(--tone);
}

.home-jump-count {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--faint);
}

.tone-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tone);
    flex-shrink: 0;
}

/* The reel beside the newest of each */
.home-top {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 2rem;
    margin-bottom: 3.5rem;
}

.home-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    margin-bottom: 0.8rem;
}

.home-label h2 {
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0;
}

.home-new {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.home-new a {
    display: block;
    padding: 0.8rem 0.25rem 0.8rem 1rem;
    color: var(--heading);
    border-bottom: 1px solid var(--line);
    border-left: 3px solid transparent;
    transition: border-color 0.2s, background-color 0.2s;
}

.home-new a:hover {
    color: var(--heading);
    background: var(--surface);
    border-bottom-color: var(--line);
    border-left-color: var(--tone);
}

.home-new-kind {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--tone);
}

.home-new-title {
    display: block;
    margin-top: 0.15rem;
    font-weight: 700;
    line-height: 1.4;
}

.home-new-meta {
    display: block;
    font-size: 0.78rem;
    font-style: italic;
    color: var(--faint);
}

/* The newest thing on the site (home.js): its color down the side, a wash
   of the hat blue, and a small red "new!" tag beside what it is */
.home-new .is-new a {
    border-left-color: var(--tone);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.home-new .is-new a:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.new-tag {
    display: inline-block;
    margin-left: 0.45rem;
    padding: 0 0.4rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: none;
    line-height: 1.6;
    color: var(--new);
    border: 1px solid currentColor;
    border-radius: 999px;
    vertical-align: 1px;
}

/* Animation: a row per series and group, its first four */
.home-row + .home-row {
    margin-top: 2rem;
}

.home-row h3 {
    font-size: 1rem;
    margin: 0 0 0.9rem;
}

.home-row h3 a {
    color: var(--heading);
}

.home-row h3 a:hover {
    color: var(--accent);
}

.home-row h3 span {
    margin-left: 0.4rem;
    font-size: 0.8rem;
    font-weight: 400;
    font-style: italic;
    color: var(--faint);
}

.home-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.home .section-head {
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--line);
}

.garden-graph.home-graph {
    height: 340px;
}

@media (max-width: 860px) {
    .home-top {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .home-head h1 {
        font-size: 2rem;
    }

    .home-search input {
        height: 52px;
        font-size: 1rem;
        padding-right: 1.25rem;
    }

    .home-search-key {
        display: none;
    }
}

.garden-graph {
    position: relative;
    width: 100%;
    height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.garden-graph + .writing-group,
.garden-graph + .section {
    margin-top: 2.5rem;
}

/* The garden page's own graph: most of the screen */
.garden-graph-large {
    height: max(440px, 64vh);
}

.garden-graph > svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.garden-graph line {
    stroke: var(--line);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.garden-graph circle {
    fill: var(--accent);
    stroke: var(--bg);
    stroke-width: 2;
    cursor: pointer;
}

.garden-graph text {
    fill: var(--muted);
    font-family: 'Libre Baskerville', Georgia, serif;
    pointer-events: none;
}

/* A name that would cover another (catalog.js decides) */
.garden-graph text.hidden {
    visibility: hidden;
}

.garden-graph g.node:hover circle {
    fill: var(--accent-hover);
}

.garden-graph g.node:hover text {
    fill: var(--heading);
}

.garden-graph g.node {
    outline: none;
}

.garden-graph g.node:focus-visible circle {
    stroke: var(--heading);
    stroke-width: 2.5;
}

/* Pointing at a note: it and its neighbours stay, the rest fade */
.garden-graph svg.lit g.node:not(.lit-node):not(.lit-near) {
    opacity: 0.2;
}

.garden-graph svg.lit line:not(.lit-line) {
    opacity: 0.2;
}

.garden-graph line.lit-line {
    stroke: var(--accent);
}

.garden-graph g.node.lit-node text,
.garden-graph g.node.lit-near text {
    fill: var(--heading);
}

/* The note this graph is under */
.garden-graph g.node.current circle {
    fill: var(--heading);
}

.garden-graph g.node.current text {
    fill: var(--heading);
    font-weight: 700;
}

.graph-zoom {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
}

.graph-zoom button {
    width: 30px;
    height: 30px;
    padding: 0;
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    color: var(--muted);
    background: none;
    border: 0;
    cursor: pointer;
}

.graph-zoom button + button {
    border-top: 1px solid var(--line);
}

.graph-zoom button:hover {
    color: var(--accent);
}

/* Under a garden note: the notes near it (publish.el, garden-note.js) */
.note-graph-section {
    margin-top: 3rem;
}

.note-graph-section h2 {
    font-size: 0.85rem;
    font-weight: 400;
    font-style: italic;
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.garden-graph.note-graph {
    height: 320px;
}

.note-graph-section + .backlinks {
    margin-top: 1.5rem;
}

.note-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}


/* Finding a note in the graph (the search button in its corner) */
.graph-search {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.graph-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.graph-search-toggle:hover,
.graph-search-toggle[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

.graph-search-box {
    width: min(250px, calc(100vw - 6rem));
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.graph-search-box input {
    display: block;
    width: 100%;
    height: 32px;
    padding: 0 0.75rem;
    font: inherit;
    font-size: 0.8rem;
    color: var(--heading);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    outline: none;
}

.graph-search-box input::placeholder {
    color: var(--faint);
    font-style: italic;
}

.graph-search-results {
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    max-height: 190px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.graph-search-results li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
}

/* The same dot as the graph's notes */
.graph-search-results li[data-i]::before {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.graph-search-results li:hover,
.graph-search-results li[aria-selected="true"] {
    color: var(--heading);
    background: var(--surface);
}

.graph-search-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.graph-search-meta {
    font-size: 0.7rem;
    color: var(--faint);
}

.graph-search-results .graph-search-none {
    color: var(--faint);
    font-style: italic;
    cursor: default;
}

.graph-search-hint {
    margin: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.68rem;
    color: var(--faint);
    border-top: 1px solid var(--line);
}

.garden-graph svg g.node,
.garden-graph svg line {
    transition: opacity 0.25s;
}

.garden-graph svg.searching g.node:not(.match),
.garden-graph svg.focused g.node:not(.found):not(.near) {
    opacity: 0.2;
}

.garden-graph svg.searching line,
.garden-graph svg.focused line:not(.found) {
    opacity: 0.25;
}

.garden-graph g.node.match text,
.garden-graph g.node.found text {
    fill: var(--heading);
    font-weight: 700;
}

.garden-graph g.node.found circle {
    stroke: var(--heading);
    stroke-width: 2.5;
}

.garden-graph line.found {
    stroke: var(--accent);
}


/* ====================
   SEARCH (search.js)
   ==================== */

/* Each kind of result has a color: icon, label and highlights use it */
[data-tone="page"] { --tone: var(--tone-page); }
[data-tone="anim"] { --tone: var(--tone-anim); }
[data-tone="comic"] { --tone: var(--tone-comic); }
[data-tone="draw"] { --tone: var(--tone-draw); }
[data-tone="story"] { --tone: var(--tone-story); }
[data-tone="blog"] { --tone: var(--tone-blog); }
[data-tone="garden"] { --tone: var(--tone-garden); }

.search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12vh 1rem 1rem;
    background: var(--backdrop);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.15s;
}

.search-backdrop[hidden] {
    display: none;
}

.search-backdrop.open {
    opacity: 1;
}

.search-panel {
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: min(560px, 76vh);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    transform: translateY(-6px);
    transition: transform 0.15s;
}

.search-backdrop.open .search-panel {
    transform: none;
}

/* Only the results shrink when the panel is full */
.search-field,
.search-filters,
.search-footer {
    flex-shrink: 0;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem 0 1.1rem;
    border-bottom: 1px solid var(--line);
}

.search-field svg,
.search-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-field svg {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    color: var(--accent);
}

.search-field input {
    flex: 1;
    min-width: 0;
    height: 56px;
    font: inherit;
    font-size: 1rem;
    color: var(--heading);
    background: transparent;
    border: none;
    outline: none;
}

.search-field input::placeholder {
    color: var(--faint);
    font-style: italic;
}

.search-filters {
    display: flex;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--line);
}

.search-filters:empty {
    display: none;
}

.search-filters button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    padding: 0.2rem 0.7rem;
    font: inherit;
    font-size: 0.75rem;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.search-filters button[data-tone]::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tone);
}

.search-filters button:hover:not([disabled]) {
    color: var(--heading);
}

.search-filters button[aria-pressed="true"] {
    color: var(--heading);
    background: var(--surface);
    border-color: var(--tone, var(--accent));
}

.search-filters button[disabled] {
    opacity: 0.45;
    cursor: default;
}

.search-filters .count {
    font-size: 0.68rem;
    color: var(--faint);
}

.search-results {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0.4rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.search-result,
.search-result:hover {
    display: grid;
    grid-template-columns: 2.1rem minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: center;
    padding: 0.55rem 0.75rem;
    color: inherit;
    border: none;
    border-radius: 8px;
    scroll-margin: 0.4rem;
}

.search-result[aria-selected="true"] {
    background: var(--surface);
    box-shadow: inset 3px 0 0 var(--tone);
}

.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    color: var(--tone);
    background: color-mix(in srgb, var(--tone) 14%, transparent);
    border-radius: 8px;
}

.search-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.search-text {
    min-width: 0;
    line-height: 1.45;
}

.search-title,
.search-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--heading);
}

.search-meta {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--faint);
}

.search-snippet {
    display: -webkit-box;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--muted);
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-results mark {
    color: inherit;
    background: color-mix(in srgb, var(--tone) 24%, transparent);
    border-radius: 2px;
}

.search-kind {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
    color: var(--tone);
    white-space: nowrap;
}

.search-kind kbd {
    visibility: hidden;
}

.search-result[aria-selected="true"] .search-kind kbd {
    visibility: visible;
}

.search-empty {
    padding: 2rem 1rem;
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
    color: var(--faint);
}

.search-more {
    padding: 0.75rem;
    font-size: 0.8rem;
}

.search-all {
    font: inherit;
    color: var(--accent);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.search-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 2.4rem;
    padding: 0.45rem 1rem;
    font-size: 0.75rem;
    color: var(--faint);
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.search-action {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.search-action strong {
    color: var(--tone);
}

.search-keys {
    flex-shrink: 0;
    white-space: nowrap;
}

.search-keys kbd + kbd {
    margin-left: 0.15rem;
}


/* The shortcut list (keys.js, press ?): the search panel's look */
.keys-panel {
    width: min(620px, 100%);
    outline: none;
}

.keys-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.keys-head h2 {
    margin: 0;
    font-size: 1rem;
    font-style: italic;
}

.keys-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 2rem;
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
}

.keys-body section:first-child {
    grid-row: span 2;
}

.keys-body h3 {
    margin: 0.5rem 0 0.4rem;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
}

.keys-body dl {
    margin: 0;
}

.keys-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--line);
}

.keys-row dt {
    flex-shrink: 0;
    color: var(--faint);
    font-size: 0.75rem;
}

.keys-row dd {
    margin: 0;
    color: var(--text);
    text-align: right;
}

/* Shortcuts that do nothing on this page */
.keys-row.unavailable {
    opacity: 0.4;
}


/* ====================
   BOOKS (generated by publish.el): the book's page and its chapters
   ==================== */

.book-hero {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
    margin-bottom: 2.5rem;
}

/* A book's shape (2:3), with a spine-side edge that's squarer */
.book-cover img,
.book-cover-blank,
.thumb.book img,
.thumb.book .thumb-placeholder {
    border-radius: 3px 8px 8px 3px;
}

.book-cover img,
.book-cover-blank {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    box-shadow: var(--shadow);
}

/* No #+cover:? The title, set on a plain cover */
.book-cover-blank,
.thumb.book .thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1.3;
    color: var(--bg);
    background: linear-gradient(160deg, var(--accent), var(--accent-hover));
}

.book-info h1 {
    font-size: 2rem;
    margin: 0.3rem 0 0.5rem;
}

.book-desc {
    margin: 0.9rem 0 1.25rem;
}

.book-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.book-actions .button:hover {
    border-bottom-width: 1px;
}

.book-epub-note {
    margin: 0.7rem 0 0;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--faint);
}

.book-about {
    margin-bottom: 2.5rem;
}

.book-toc h2 {
    font-size: 0.95rem;
    font-style: italic;
    font-weight: 400;
    color: var(--muted);
    text-transform: lowercase;
    letter-spacing: 1.5px;
    text-align: center;
    margin: 0 0 0.75rem;
}

.book-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.book-toc a {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.8rem 0.4rem;
    color: var(--heading);
    border-bottom: 1px solid var(--line);
}

.book-toc a:hover {
    color: var(--accent);
    border-bottom-color: var(--line);
}

.toc-num {
    min-width: 1.6em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.toc-title {
    flex: 1;
    font-weight: 700;
}

.toc-meta {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--faint);
    white-space: nowrap;
}

/* Under a chapter: previous, the contents, next */
.chapter-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.chapter-nav .prev,
.chapter-nav .next {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: var(--heading);
    border: none;
}

.chapter-nav .next {
    text-align: right;
}

.chapter-nav .prev:hover,
.chapter-nav .next:hover {
    color: var(--accent);
}

.chapter-nav-label {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--faint);
}

.chapter-nav-title {
    font-weight: 700;
}

.chapter-nav-toc {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.chapter-nav-toc:hover {
    border-color: var(--accent);
}

/* Book covers on the Read page */
.thumb.book {
    aspect-ratio: 2 / 3;
    border: none;
    box-shadow: var(--shadow);
}

.grid-books {
    grid-template-columns: repeat(auto-fill, minmax(160px, 200px));
}

/* Books and scripts on the Read page: two centered shelves, side by side
   when there are both, covers and title pages the same width */
.cover-shelves {
    display: grid;
    gap: 2.75rem 3rem;
    margin-bottom: 3rem;
}

.cover-shelves.two {
    grid-template-columns: 1fr 1fr;
}

.shelf-half h3 {
    font-size: 0.95rem;
    font-style: italic;
    font-weight: 400;
    color: var(--muted);
    text-transform: lowercase;
    letter-spacing: 1.5px;
    text-align: center;
    margin: 0 0 1.25rem;
}

.covers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.75rem 1.5rem;
}

.covers .card {
    width: 170px;
}

.covers .thumb {
    transition: transform 0.25s, box-shadow 0.25s;
}

.covers .card:hover .thumb {
    transform: translateY(-4px);
}

/* A script's title page: white paper, Courier, the title centered a third
   of the way down, then which draft and its date, the way a printed script
   starts. The same shape as a
   book cover, so the two shelves line up; the type is bigger than on paper so
   it reads at this size */
.thumb.script {
    aspect-ratio: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 42% 0.8rem 0;
    text-align: center;
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    color: #1a1a1a;
    background: #fbfaf6;
    border: none;
    border-radius: 2px;
    box-shadow: var(--shadow);
}

.script-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

.script-draft {
    margin-top: 1.4rem;
    font-size: 0.78rem;
    line-height: 1.5;
}

.script-revision {
    text-transform: uppercase;
}

@media (max-width: 760px) {
    .cover-shelves.two { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .covers .card { width: calc(50% - 0.75rem); }
}


/* ====================
   READ PAGE: the All view, one panel per kind of reading
   ==================== */

.hub {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: start;
}

/* All gold, like the rest of the site (the per-kind colors are for search) */
.hub-panel {
    --tone: var(--accent);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.25rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--tone);
    border-radius: 10px;
}

.hub-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hub-head h2 {
    margin: 0;
    font-size: 1.35rem;
    font-style: italic;
    color: var(--heading);
}

.hub-count {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--tone);
    white-space: nowrap;
}

.hub-blurb {
    margin: -0.6rem 0 1rem;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--muted);
}

/* The newest one, big */
.hub-feature {
    display: block;
    margin-bottom: 0.75rem;
    padding: 1rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color 0.2s, transform 0.2s;
}

.hub-feature:hover {
    color: var(--text);
    border-color: var(--tone);
    border-bottom-color: var(--tone);
    transform: translateY(-1px);
}

.hub-feature .card {
    margin: 0;
}

.hub-new {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--tone);
}

.hub-title {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--heading);
}

.hub-feature:hover .hub-title {
    color: var(--tone);
}

.hub-desc {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.hub-meta {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--faint);
}

/* A comic's cover in its panel: a smaller cover beside its name */
.hub-feature.hub-cover {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.hub-cover img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 4px;
}

/* The rest, as a short list */
.hub-list {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}

.hub-list a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.15rem;
    font-size: 0.9rem;
    color: var(--heading);
    border-bottom: 1px solid var(--line);
}

.hub-list a:hover {
    color: var(--tone);
    border-bottom-color: var(--line);
}

.hub-list .hub-meta {
    margin: 0;
    white-space: nowrap;
}

/* The foot: the "all" link, and the Blog's Follow button */
.hub-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.hub-more {
    font-size: 0.85rem;
    color: var(--tone);
}

.hub-follow {
    padding: 0.3rem 0.8rem;
    font: inherit;
    font-size: 0.78rem;
    font-style: italic;
    color: var(--muted);
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.hub-follow:hover {
    color: var(--tone);
    border-color: var(--tone);
}

.hub-more:hover {
    color: var(--tone);
}

.hub-empty {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--faint);
}

@media (max-width: 900px) {
    .hub {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .book-hero {
        grid-template-columns: minmax(0, 1fr);
        text-align: center;
    }

    .book-cover {
        width: 55%;
        margin: 0 auto;
    }

    .book-actions {
        justify-content: center;
    }

    .chapter-nav {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .chapter-nav-toc {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
    }
}


/* ====================
   SMALL SCREENS
   ==================== */

@media (max-width: 760px) {
    .site-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 0.6rem 1rem;
        row-gap: 0.25rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: space-between;
    }

    .nav-links a {
        padding: 0.3rem 0.4rem;
    }

    /* Just the magnifying glass, like the light/dark button */
    .nav-search {
        width: 36px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        background: transparent;
        color: var(--muted);
    }

    /* Breadcrumbs on one line: the page itself is the heading just below */
    .crumbs {
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    .crumbs > * {
        flex-shrink: 0;
    }

    .crumbs [aria-current] {
        display: none;
    }

    .crumbs > :nth-last-child(2) {
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-search-label,
    .nav-search kbd,
    .search-keys,
    .search-esc {
        display: none;
    }

    .search-backdrop {
        padding: 0.75rem;
    }

    .keys-body {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The backdrop is sized to what the keyboard leaves showing (search.js) */
    .search-panel {
        max-height: 100%;
    }

    .search-result,
    .search-result:hover {
        gap: 0.65rem;
        padding: 0.5rem;
    }

    .search-kind kbd {
        display: none;
    }

    .page {
        padding: 2rem 1rem 1rem;
    }

    .site-footer {
        padding: 0 1rem;
    }

    .socials {
        gap: 1.1rem;
    }

    .hero {
        padding: 3rem 1rem 1.5rem;
    }

    .hero h1 {
        font-size: 2.3rem;
    }

    .reel-block,
    .about,
    .photo {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .series-block,
    .series-hero,
    .dash-top {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.25rem;
    }

    .series-block > .card,
    .series-hero > .thumb {
        max-width: 220px;
    }

    .episode {
        grid-template-columns: 120px minmax(0, 1fr);
        padding: 0.8rem 0.25rem;
        gap: 0.9rem;
    }

    .episode .number {
        display: none;
    }

    .entry {
        flex-direction: column;
        gap: 0.2rem;
    }

    .entry-meta {
        white-space: normal;
    }

    .garden-graph {
        height: 320px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
