/* Final palette corrections. This layer follows the older theme overrides and
   shared UI controls. Profile layout and stamp sizing remain in style.css. */

/* After Hours: blue-black room, moonlit paper text, restrained brass accents. */
body.skin-after-hours {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) header {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) #theme-toggle {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) :is(
    article:not(.author-library-card):not(.library-note), .story-header,
    .form-section, .settings-box, .filters, .published-intro-card,
    .published-details-card, .published-social-card, .published-collapsible,
    .chapter-editor-card, .text-conversation-builder, .library-note, .browse-work,
    .search-work, .dashboard-work, .dashboard-work-card, .account-box,
    .my-library-panel, .browse-shelf-card
) {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    :is(.settings-box, .my-library-panel) {
    box-sizing: border-box;
    padding: clamp(18px, 2vw, 28px);
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) :is(
    .chapter-text, #published-chapter-text, #published-notes, .preview-notes
) {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) :is(
    .tag-pill, .tag, .tags a, .relationship-badge
) {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) :is(
    .filters, .browse-shelf-card, .dashboard-work, .my-library-panel
) {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) :is(
    .filters .browse-filter-core fieldset, .browse-warning-filter,
    .chapter-navigation, .author-member-info, .author-works-ledger-header
) {}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) main :is(h2, h3, legend),
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) .browse-shelf-card h3 {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) main :is(input, textarea)::placeholder {
    opacity: 1 !important;
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) :is(
    .field-note, .filter-note, .dashboard-work-meta, .library-panel-note,
    .story-info, .story-stats, .published-secondary-meta
) { color: #a9afb5 !important; opacity: 1 !important; }
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    :is(button:not(#theme-toggle), .button-link) {
}
/* The shared control system owns controls inside main. */
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .browse-discovery-page .browse-shelf-grid .browse-shelf-card {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode)) .site-footer {
}

/* The homepage field had inherited a dark control surface and an older dark
   placeholder. Put warm paper back under readable ink in both toggle modes. */
body.home-page.skin-after-hours main .home-search-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not(#theme-toggle):not(#logout-button) {
}
body.home-page.skin-after-hours main .home-search-form input::placeholder {
    opacity: 1 !important;
}
body.home-page.skin-dark-academia main .home-search-form input::placeholder {
    color: #675547 !important;
    opacity: 1 !important;
}

/* Dark Academia: ink and olive-charcoal surroundings, brass accents, paper
   where the actual story and author Library Card already use paper. */
body.skin-dark-academia {
    --gm-header: #23241f;
    --gm-page: #20211e;
    --gm-card: #333129;
    --gm-border: #786b55;
    --gm-accent: #c9ad76;
    --gm-button: #424737;
    --ui-primary: #4e5a42;
    --ui-on-primary: #f8f2e6;
    --ui-focus: #c9ad76;
    background: radial-gradient(ellipse at 50% 0, #2b2c26, #20211e 55rem) !important;
    color: #f0e7d8 !important;
}
body.home-page.skin-dark-academia {
    --home-header: #23241f;
    --home-page: #20211e;
    --home-hero: #2b2b24;
    --home-card: #333129;
    --home-card-text: #f0e7d8;
    --home-border: #786b55;
    --home-button: #424737;
}
body.skin-dark-academia header {
    background: #23241f !important;
    border-bottom-color: #786b55 !important;
}
body.skin-dark-academia .home-hero {
    background:
        radial-gradient(circle at 19% 15%, rgb(200 173 118 / 14%), transparent 34%),
        radial-gradient(circle at 83% 75%, rgb(99 116 78 / 17%), transparent 42%),
        linear-gradient(128deg, #2b2822, #303328 52%, #211e1b) !important;
    border-color: #786b55 !important;
}
body.home-page.skin-dark-academia main .home-doorway-card {
    background: linear-gradient(145deg, #34342b, #292923) !important;
    border-color: #807157 !important;
    color: #eee4d3 !important;
}
body.home-page.skin-dark-academia main .home-doorway-card h3 {
    color: #e3c68d !important;
}
body.home-page.skin-dark-academia main .home-doorway-card p {
    color: #e1d5c1 !important;
    opacity: 1 !important;
}
body.home-page.skin-dark-academia main .home-doorway-mark {
    color: #d7b978 !important;
    opacity: 1 !important;
}
body.skin-dark-academia .browse-discovery-page .browse-shelf-grid .browse-shelf-card {
    background: linear-gradient(145deg, #34342b, #2b2a24) !important;
    color: #eee4d3 !important;
    border-color: #807157 !important;
}
body.skin-dark-academia .browse-discovery-page .browse-shelf-card h3 {
    color: #e3c68d !important;
    border-color: #807157 !important;
}
body.skin-dark-academia .browse-discovery-page .browse-shelf-card a {
    color: #edcf98 !important;
}
body.skin-dark-academia :is(
    .filters, .form-section, .settings-box, .my-library-panel,
    .dashboard-work, .dashboard-work-card, .account-box
) {
    background-color: #333129 !important;
    border-color: #786b55 !important;
    color: #f0e7d8 !important;
}
body.skin-dark-academia .site-footer {
    background: #1a1b18 !important;
    border-top-color: #645b49 !important;
}
.theme-options button[data-skin="dark-academia"]::before {
    background: linear-gradient(135deg,
        #20211e 0 25%, #34342b 25% 50%,
        #e9dfcf 50% 75%, #c9ad76 75% 100%) !important;
}

/* The older After Hours flourish and tracking were light-only, so the Dark
   toggle changed the heading's shape and spacing. Keep both modes steady. */
body.skin-after-hours main h1 { letter-spacing: -.025em !important; }
body.skin-after-hours:not(.home-page) :is(
    .catalogue-search-heading, .browse-discovery-intro, .my-library-heading,
    .writing-desk > h1
) { padding-bottom: 0 !important; }
body.skin-after-hours:not(.home-page) :is(
    .catalogue-search-heading, .browse-discovery-intro
) { margin-bottom: 22px !important; }
body.skin-after-hours:not(.home-page) .my-library-heading {
    margin-bottom: 18px !important;
}
body.skin-after-hours:not(.home-page) :is(
    .catalogue-search-heading, .browse-discovery-intro, .my-library-heading,
    .writing-desk > h1
)::after { content: none !important; display: none !important; }

/* The page is a profile; the card remains the vintage presentation within it.
   Removing the old tagline leaves room for the profile actions beside the title. */
body main.author-page > .author-page-heading {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 10px 18px !important;
}
body main.author-page > .author-page-heading h1 { margin: 0 !important; }
body main.author-page > .author-page-heading .author-heading-row {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: auto !important;
    margin: 0 !important;
}
body main.author-page > .author-page-heading #edit-library-card {
    position: static !important;
    margin: 0 !important;
}
@media (max-width: 700px) {
    body main.author-page > .author-page-heading .author-heading-row {
        width: 100% !important;
        align-items: flex-start !important;
    }
}

/* Ghostlight: give its light surfaces enough depth and use the same warm
   header on every page. Named themes and the separate Dark mode keep theirs. */
body:not([class*="skin-"]):not(.dark-mode) {
    --gm-header: #e8dfd1;
    --gm-header-text: #29242a;
    --gm-page: #eee8df;
    --gm-hero: #ddd2c6;
    --gm-card: #fffaf2;
    --gm-card-bg: #fffaf2;
    --gm-card-text: #302a2c;
    --gm-card-border: #b6a895;
    --gm-border: #b6a895;
    --gm-accent: #704b63;
    --gm-button: #473448;
    --gm-secondary-button: #e9dfd4;
    background: #eee8df;
    color: #302a2c;
}
body.home-page:not([class*="skin-"]):not(.dark-mode) {
    --home-header: #e8dfd1;
    --home-header-text: #29242a;
    --home-page: #eee8df;
    --home-hero: #ddd2c6;
    --home-card: #fffaf2;
    --home-card-text: #302a2c;
    --home-border: #b6a895;
    --home-accent: #704b63;
    --home-section-text: #302a2c;
}
body:not([class*="skin-"]):not(.dark-mode) > header {
    background: #e8dfd1 !important;
    color: #29242a !important;
    border-bottom-color: #b6a895 !important;
}
body.home-page:not([class*="skin-"]):not(.dark-mode) > header {
    background: #e8dfd1 !important;
    color: #29242a !important;
}
/* The account controls used the dark fallback token over a light header. */
body:not([class*="skin-"]):not(.dark-mode) > header :is(
    .gm-header-account, #user-greeting, #logout-button, #theme-toggle
) { color: #29242a !important; }

/* Writing Desk's links predate the shared button layer. Bring them into the
   same compact UI treatment as the rest of the site. */
body main.writing-desk .dashboard-actions > a {
    min-height: 40px !important;
    padding: 9px 14px !important;
    border-radius: 8px !important;
    font: 650 .9rem/1.25 var(--font-ui) !important;
    letter-spacing: .005em !important;
}
body main.writing-desk .dashboard-actions > .new-work-button {
    background: var(--ui-primary) !important;
    border: 1px solid var(--ui-primary) !important;
    color: var(--ui-on-primary) !important;
}
body main.writing-desk .dashboard-actions > .upload-work-button {
    background: var(--ui-soft) !important;
    border: 1px solid var(--ui-border) !important;
    color: var(--ui-ink) !important;
}
body main.writing-desk .dashboard-work-controls .work-actions > :is(a, button),
body main.writing-desk :is(.dashboard-chapter, .chapter-row) > :is(a, button) {
    border-radius: 8px !important;
    font-family: var(--font-ui) !important;
    font-size: .85rem !important;
    line-height: 1.25 !important;
}
body main.writing-desk .dashboard-actions > a:focus-visible {
    outline: 2px solid var(--ui-focus) !important;
    outline-offset: 2px !important;
}

/* Keep the public profile in the same After Hours room in both toggle modes. */
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .author-library-card.author-library-card-public {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .author-library-card.author-library-card-public :is(h1, h2, h3, p, span, strong, label) {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .author-library-card.author-library-card-public #author-display-name {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .author-library-card.author-library-card-public a {
}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .author-library-card.author-library-card-public :is(
        .author-stats, .author-member-info, .author-works-ledger-header,
        .author-content-tabs
    ) {}
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    .author-library-card.author-library-card-public .author-genre-tag {
}

/* Public bookmarks are catalogue slips inside the author's card. A generic
   article theme rule was making the slip dark while its text remained ink. */
body main .author-library-card.author-library-card-public article.author-public-bookmark,
body.skin-after-hours:not(.home-page):is(.dark-mode, :not(.dark-mode))
    main .author-library-card.author-library-card-public article.author-public-bookmark {
    background: var(--author-card-surface, #fff8e8) !important;
    color: var(--author-card-text, #342920) !important;
    border: 1px solid var(--author-card-border, #b8a77d) !important;
    border-radius: 6px;
    padding: 12px 14px;
}
body main .author-library-card.author-library-card-public .author-public-bookmark-title,
body main .author-library-card.author-library-card-public .author-public-bookmark-title:visited {
    color: var(--author-card-text, #342920) !important;
    -webkit-text-fill-color: var(--author-card-text, #342920) !important;
}
body main .author-library-card.author-library-card-public :is(
    .author-public-bookmark-meta, .author-public-bookmark-collection
) {
    color: var(--author-card-muted, #6b5746) !important;
    -webkit-text-fill-color: var(--author-card-muted, #6b5746) !important;
    opacity: 1;
}

/* Avatar and stamp panels need light headings on their dark inset surfaces,
   including Ghostlight's Dark toggle and Dark Academia. */
:is(body.dark-mode, body.skin-after-hours, body.skin-dark-academia)
    #edit-profile-form .profile-picker-heading h2 {
}
:is(body.dark-mode, body.skin-after-hours, body.skin-dark-academia)
    #edit-profile-form .profile-picker-heading p {
    opacity: 1 !important;
}

/* Mobile Library Card: keep the three stamps and genres close to the member
   details, centered within the existing paper card. */
@media (max-width: 700px) {
    body main.author-page .author-library-card-public .author-card-profile {
        padding-bottom: 20px !important;
    }
    body main.author-page .author-library-card-public .author-social-summary {
        justify-content: center !important;
        text-align: center !important;
    }
    body main.author-page .author-library-card-public .author-stamps {
        margin-top: 12px !important;
        padding: 0 !important;
    }
    body main.author-page .author-library-card-public .author-favorite-genres {
        margin-top: 16px !important;
        padding-top: 0 !important;
        text-align: center !important;
    }
    body main.author-page .author-library-card-public #author-genre-list {
        justify-content: center !important;
    }
}

/* One library, six distinct moods. These backgrounds belong only to the
   homepage hero; the masthead, page layout and reading surfaces stay put. */
body.home-page:not([class*="skin-"]) {
    --library-hero-image: url("ghostlight-hero.webp");
    --library-hero-mobile-image: url("ghostlight-hero-mobile.webp");
    --library-hero-wash: linear-gradient(rgb(35 26 22 / 7%), rgb(35 26 22 / 7%));
    --library-hero-ink: #28231f;
    --library-hero-kicker: #704d60;
    --library-hero-shadow: 0 1px 4px rgb(255 251 244 / 28%);
    --library-search-paper: #fffaf3;
}
body.home-page.dark-mode:not([class*="skin-"]) {
    --library-hero-wash: linear-gradient(rgb(19 17 20 / 64%), rgb(19 17 20 / 64%));
    --library-hero-ink: #fff5eb;
    --library-hero-kicker: #edcbdc;
    --library-hero-shadow: 0 2px 12px rgb(0 0 0 / 65%);
}
body.home-page:is(.skin-burnish, .skin-autumn) {
    --library-hero-image: url("burnish-hero.webp");
    --library-hero-mobile-image: url("burnish-hero-mobile.webp");
    --library-hero-wash: linear-gradient(rgb(25 12 6 / 18%), rgb(25 12 6 / 22%));
    --library-hero-ink: #fff4e6;
    --library-hero-kicker: #f2cf98;
    --library-search-paper: #fff5e8;
}
body.home-page:is(.skin-stormglass, .skin-blue) {
    --library-hero-image: url("stormglass-hero.webp");
    --library-hero-mobile-image: url("stormglass-hero-mobile.webp");
    --library-hero-wash: linear-gradient(rgb(8 23 33 / 18%), rgb(8 23 33 / 24%));
    --library-hero-ink: #f4f9fb;
    --library-hero-kicker: #c4dde9;
    --library-search-paper: #f5fafb;
}
body.home-page:is(.skin-night-bloom, .skin-plum, .skin-cotton-candy) {
    --library-hero-image: url("night-bloom-hero.webp");
    --library-hero-mobile-image: url("night-bloom-hero-mobile.webp");
    --library-hero-wash: linear-gradient(rgb(29 12 26 / 14%), rgb(29 12 26 / 22%));
    --library-hero-ink: #fff2f7;
    --library-hero-kicker: #f2bfd6;
    --library-search-paper: #fff7fb;
}
body.home-page:is(.skin-fernwood, .skin-matcha) {
    --library-hero-image: url("fernwood-hero.webp");
    --library-hero-mobile-image: url("fernwood-hero-mobile.webp");
    --library-hero-wash: linear-gradient(rgb(14 25 12 / 17%), rgb(14 25 12 / 22%));
    --library-hero-ink: #f6f4e9;
    --library-hero-kicker: #d7ddae;
    --library-search-paper: #f8f9f0;
}
body.home-page.skin-dark-academia {
    --library-hero-image: url("dark-academia-hero.webp");
    --library-hero-mobile-image: url("dark-academia-hero-mobile.webp");
    --library-hero-wash: linear-gradient(rgb(14 12 9 / 15%), rgb(14 12 9 / 24%));
    --library-hero-ink: #fff0dd;
    --library-hero-kicker: #dfc28b;
    --library-search-paper: #f7efdf;
}
body.home-page:not(.skin-after-hours) .home-hero {
    min-height: 390px;
    display: flex;
    align-items: center;
    background-image: var(--library-hero-wash), var(--library-hero-image) !important;
    background-position: center, center !important;
    background-size: cover, cover !important;
    background-repeat: no-repeat !important;
    color: var(--library-hero-ink) !important;
}
body.home-page:not(.skin-after-hours) .home-hero h2 {
}
body.home-page:not(.skin-after-hours) .home-hero-kicker {
}
body.home-page:not(.skin-after-hours) .home-hero h2::after {
}
body.home-page:not(.skin-after-hours) main .home-search-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not(#theme-toggle):not(#logout-button) {
}
body.home-page:not(.skin-after-hours) main .home-search-form input::placeholder {
    opacity: 1 !important;
}
@media (max-width: 760px) {
    body.home-page:not(.skin-after-hours) .home-hero {
        min-height: 520px;
        padding: 44px 18px 50px !important;
        background-image: var(--library-hero-wash), var(--library-hero-mobile-image) !important;
    }
    body.home-page:not(.skin-after-hours) .home-hero h2 {
        max-width: 10ch;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}


/* =========================================
   INTERIOR PAGE MODERNIZATION
   Old-library atmosphere, modern interface geometry.
   ========================================= */

body:not(.home-page) :is(
    .my-library-heading h1,
    .writing-desk > .dashboard-header h1,
    .browse-discovery-intro h2,
    .catalogue-search-heading h2,
    .request-desk-intro h1,
    .settings > h2
) {
    display: flex !important;
    align-items: center;
    gap: 11px;
    width: fit-content;
    max-width: 100%;
    margin-top: 0 !important;
    margin-bottom: 7px !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: clamp(2rem, 3vw, 2.55rem);
    line-height: 1.06;
    letter-spacing: -0.025em;
}

body:not(.home-page) :is(
    .my-library-heading h1,
    .writing-desk > .dashboard-header h1,
    .browse-discovery-intro h2,
    .catalogue-search-heading h2,
    .request-desk-intro h1,
    .settings > h2
)::before {
    content: "";
    flex: 0 0 25px;
    width: 25px;
    height: 25px;
    background: currentColor;
    opacity: .62;
    -webkit-mask: var(--gm-page-mark) center / contain no-repeat;
    mask: var(--gm-page-mark) center / contain no-repeat;
}

.my-library-heading { --gm-page-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%205.5h13v4H4z%22%2F%3E%3Cpath%20d%3D%22M7%2010h13v4H7z%22%2F%3E%3Cpath%20d%3D%22M3%2014.5h14v4H3z%22%2F%3E%3Cpath%20d%3D%22M6%205.5v4M16%2010v4M6%2014.5v4%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
.writing-desk > .dashboard-header { --gm-page-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2019l3.5-.7L19%207.8%2016.2%205%205.7%2015.5%205%2019z%22%2F%3E%3Cpath%20d%3D%22M14.8%206.4l2.8%202.8M5.7%2015.5l2.8%202.8%22%2F%3E%3Cpath%20d%3D%22M4%2020h9%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
.browse-discovery-intro { --gm-page-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%205h16M4%2012h16M4%2019h16%22%2F%3E%3Cpath%20d%3D%22M6%205v5M9%205v5M13%205v5M17%205v5M7%2012v5M11%2012v5M15%2012v5M18%2012v5%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
.catalogue-search-heading { --gm-page-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%3E%3Ccircle%20cx%3D%2210.5%22%20cy%3D%2210.5%22%20r%3D%225.5%22%2F%3E%3Cpath%20d%3D%22M14.5%2014.5L20%2020%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
.request-desk-intro { --gm-page-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%204h14v16H5z%22%2F%3E%3Cpath%20d%3D%22M8%208h8M8%2012h8M8%2016h5%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
.settings { --gm-page-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h5M13%207h7M4%2017h9M17%2017h3%22%2F%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%227%22%20r%3D%222%22%2F%3E%3Ccircle%20cx%3D%2215%22%20cy%3D%2217%22%20r%3D%222%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }

body:not(.home-page) :is(
    .my-library-heading,
    .writing-desk > .dashboard-header,
    .browse-discovery-intro,
    .catalogue-search-heading,
    .request-desk-intro
) > p {
    max-width: 62ch;
    line-height: 1.55;
}

/* Pull the important controls closer to the title. The previous default h1
   margins were responsible for much of the empty, older-looking top space. */
body:not(.home-page) .my-library-page {
    padding-top: 22px !important;
}

body:not(.home-page) main.writing-desk,
body:not(.home-page) main.browse-discovery-page,
body:not(.home-page) main.catalogue-search-page,
body:not(.home-page) main.settings-page {
    box-sizing: border-box;
    width: min(1120px, 100%);
    max-width: 1120px;
    margin: 0 auto !important;
    padding: 28px 20px 52px;
}

body:not(.home-page) main.writing-desk > .dashboard-header {
    margin-bottom: 24px;
}

/* Keep the archival cards, but give them contemporary spacing and corners. */
body:not(.home-page) :is(
    .my-library-panel .dashboard-work-card,
    .writing-desk .dashboard-work,
    .browse-shelf-card,
    .request-form-card,
    .request-browser,
    .settings-box
) {
    border-radius: 9px !important;
    box-shadow: 0 8px 24px rgb(26 20 17 / 5%);
}

body.dark-mode:not(.home-page) :is(
    .my-library-panel .dashboard-work-card,
    .writing-desk .dashboard-work,
    .browse-shelf-card,
    .request-form-card,
    .request-browser,
    .settings-box
),
body.skin-after-hours:not(.home-page) :is(
    .my-library-panel .dashboard-work-card,
    .writing-desk .dashboard-work,
    .browse-shelf-card,
    .request-form-card,
    .request-browser,
    .settings-box
),
body.skin-dark-academia:not(.home-page) :is(
    .my-library-panel .dashboard-work-card,
    .writing-desk .dashboard-work,
    .browse-shelf-card,
    .request-form-card,
    .request-browser,
    .settings-box
) {
    box-shadow: 0 10px 28px rgb(0 0 0 / 13%);
}

@media (max-width: 700px) {
    body:not(.home-page) :is(
        .my-library-heading h1,
        .writing-desk > .dashboard-header h1,
        .browse-discovery-intro h2,
        .catalogue-search-heading h2,
        .request-desk-intro h1,
        .settings > h2
    ) {
        gap: 9px;
        font-size: clamp(1.85rem, 9vw, 2.25rem);
    }

    body:not(.home-page) :is(
        .my-library-heading h1,
        .writing-desk > .dashboard-header h1,
        .browse-discovery-intro h2,
        .catalogue-search-heading h2,
        .request-desk-intro h1,
        .settings > h2
    )::before {
        flex-basis: 22px;
        width: 22px;
        height: 22px;
    }

    body:not(.home-page) main.writing-desk,
    body:not(.home-page) main.browse-discovery-page,
    body:not(.home-page) main.catalogue-search-page,
    body:not(.home-page) main.settings-page {
        padding: 20px 16px 46px;
    }
}

/* =========================================
   CROSS-POST / EXPORT PANEL
   ========================================= */

.gm-crosspost-dialog {
    width: min(690px, calc(100vw - 28px));
    max-height: min(84vh, 780px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--gm-card-border, var(--gm-border, #a99b86));
    border-radius: 14px;
    background: var(--gm-card-bg, var(--gm-card, #fffaf2));
    color: var(--gm-card-text, inherit);
    box-shadow: 0 28px 80px rgb(0 0 0 / 28%);
}

.gm-crosspost-dialog::backdrop {
    background: rgb(14 12 13 / 58%);
    backdrop-filter: blur(2px);
}

.gm-crosspost-shell {
    display: flex;
    flex-direction: column;
    max-height: min(84vh, 780px);
}

.gm-crosspost-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--gm-card-border, var(--gm-border, #b8aa96));
}

.gm-crosspost-kicker {
    margin: 0 0 4px;
    font: 700 .72rem/1.2 var(--font-ui);
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .62;
}

.gm-crosspost-header h2 {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1.7rem;
}

.gm-crosspost-close {
    flex: 0 0 auto;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: inherit !important;
    border: 1px solid currentColor !important;
    font: 600 1.25rem/1 var(--font-ui) !important;
    opacity: .72;
}

.gm-crosspost-body {
    overflow: auto;
    padding: 20px 24px 24px;
}

.gm-crosspost-note {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-left: 3px solid var(--ui-focus, var(--gm-accent, currentColor));
    background: rgb(127 110 88 / 8%);
    font-size: .92rem;
    line-height: 1.5;
}

.gm-crosspost-field {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.gm-crosspost-field > label {
    font-weight: 700;
}

.gm-crosspost-field select,
.gm-crosspost-field textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--ui-border, #a79ca0);
    border-radius: 8px;
    background: var(--ui-field, #fffdf9);
    color: var(--ui-ink, #29262b);
    font-family: var(--font-ui);
    font-size: .93rem;
    line-height: 1.35;
}

#ao3-export-html {
    min-height: 210px;
    resize: vertical;
    font: .82rem/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
}

.gm-crosspost-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 2px 0 16px;
}

.gm-crosspost-actions button {
    width: auto !important;
    min-height: 38px;
    margin: 0 !important;
    padding: 8px 12px;
    border: 1px solid var(--ui-border, #a79ca0) !important;
    border-radius: 8px !important;
    background: var(--ui-soft, #eee9e7) !important;
    color: var(--ui-ink, #29262b) !important;
    font: 650 .88rem/1.25 var(--font-ui) !important;
}

.gm-crosspost-actions .gm-crosspost-primary {
    background: var(--ui-primary, var(--gm-button, #473448)) !important;
    color: var(--ui-on-primary, #fffaf4) !important;
    border-color: var(--ui-primary, var(--gm-button, #473448)) !important;
}

.gm-crosspost-status {
    min-height: 1.25em;
    margin: 0;
    font-size: .88rem;
    opacity: .76;
}

#owner-work-actions {
    align-items: center;
}

#owner-work-actions :is(a, button) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 40px;
    width: auto !important;
    margin: 0 !important;
    padding: 9px 14px !important;
    border: 1px solid var(--ui-border, #a79ca0) !important;
    border-radius: 8px !important;
    background: var(--ui-soft, #eee9e7) !important;
    color: var(--ui-ink, #29262b) !important;
    font: 650 .9rem/1.25 var(--font-ui) !important;
    text-decoration: none !important;
}

#owner-work-actions .owner-export-button {
    background: var(--ui-primary, #392d39) !important;
    color: var(--ui-on-primary, #fffaf4) !important;
    border-color: var(--ui-primary, #392d39) !important;
}

@media (max-width: 600px) {
    .gm-crosspost-header,
    .gm-crosspost-body {
        padding-left: 17px;
        padding-right: 17px;
    }

    .gm-crosspost-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .gm-crosspost-actions button {
        width: 100% !important;
    }
}

/* Keep the AO3 export panel's action hierarchy intact even in themes with
   broad button overrides: one clear primary action, two quieter utilities. */
body .gm-crosspost-dialog .gm-crosspost-actions button:not(.gm-crosspost-primary) {
    background: var(--ui-soft, #eee9e7) !important;
    color: var(--ui-ink, #29262b) !important;
    border-color: var(--ui-border, #a79ca0) !important;
}

body .gm-crosspost-dialog .gm-crosspost-actions .gm-crosspost-primary {
    background: var(--ui-primary, var(--gm-button, #473448)) !important;
    color: var(--ui-on-primary, #fffaf4) !important;
    border-color: var(--ui-primary, var(--gm-button, #473448)) !important;
}


/* Export polish: keep cross-post actions legible without making them shout. */
body main.writing-desk .dashboard-work-controls .work-actions > .crosspost-work-link {
    background: var(--ui-soft, #eee9e7) !important;
    color: var(--ui-ink, #29262b) !important;
    border-color: var(--ui-border, #a79ca0) !important;
}

body main.writing-desk .dashboard-work-controls .work-actions > .crosspost-work-link:hover {
    border-color: var(--ui-focus, #865b79) !important;
}

.gm-crosspost-help {
    margin: -1px 0 7px;
    color: var(--gm-interior-muted, var(--ui-ink, #29262b));
    font: .82rem/1.4 var(--font-ui);
    opacity: .78;
}

body .edit-work-manager #publish-work-manager-button.is-secondary-action {
    --ui-action-bg: transparent;
    --ui-action-border: var(--ui-border);
    --ui-action-ink: var(--ui-ink);
    background: transparent !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-ink) !important;
}


/* AO3 linked-work bridge: a small connection card inside the export panel. */
.gm-ao3-link-card {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--ui-border, #a79ca0);
    border-radius: 10px;
    background: rgb(127 110 88 / 6%);
}

.gm-ao3-link-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.gm-ao3-link-heading-row h3 {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1.05rem;
}

.gm-ao3-link-state {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--ui-border, #a79ca0);
    border-radius: 999px;
    background: var(--ui-field, #fffdf9);
    color: var(--ui-ink, #29262b);
    font: 700 .72rem/1 var(--font-ui);
    opacity: .72;
}

.gm-ao3-link-state.is-linked {
    border-color: var(--ui-focus, var(--gm-accent, #76506a));
    opacity: 1;
}

.gm-ao3-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}

.gm-ao3-link-row input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--ui-border, #a79ca0) !important;
    border-radius: 8px !important;
    background: var(--ui-field, #fffdf9) !important;
    color: var(--ui-ink, #29262b) !important;
    -webkit-text-fill-color: var(--ui-ink, #29262b) !important;
    font: .9rem/1.3 var(--font-ui) !important;
}

.gm-ao3-link-row button {
    width: auto !important;
    min-height: 40px;
    margin: 0 !important;
    padding: 8px 12px !important;
    border: 1px solid var(--ui-border, #a79ca0) !important;
    border-radius: 8px !important;
    background: var(--ui-soft, #eee9e7) !important;
    color: var(--ui-ink, #29262b) !important;
    font: 650 .86rem/1.2 var(--font-ui) !important;
}

@media (max-width: 600px) {
    .gm-ao3-link-row {
        grid-template-columns: 1fr;
    }

    .gm-ao3-link-row button {
        width: 100% !important;
    }
}

/* =========================================================
   DARK ACADEMIA MODE REPAIR — 2026-09-27
   Light mode is warm parchment/walnut; dark mode is deep
   olive-charcoal. Keep the reading page itself paper-like.
   ========================================================= */

/* Light setting: still Dark Academia, but visibly a light interface. */
body.skin-dark-academia:not(.dark-mode) {
    --gm-header: #3a3028;
    --gm-header-text: #f4ecdf;
    --gm-page: #e7ded0;
    --gm-card: #f2e8d8;
    --gm-card-bg: #f2e8d8;
    --gm-card-text: #352920;
    --gm-card-border: #9b8468;
    --gm-border: #9b8468;
    --gm-accent: #8a6a40;
    --gm-button: #4d5940;
    --ui-field: #fff8ed;
    --ui-ink: #352920;
    --ui-border: #9b8468;
    --ui-soft: #e2d5c3;
    --ui-primary: #4d5940;
    --ui-on-primary: #fff8ed;
    --chapter-reader-bg: #f6efe4;
    --chapter-reader-text: #33271f;
    --chapter-reader-border: #9b8468;
    background: radial-gradient(ellipse at 50% 0, #f1e9dc, #e7ded0 55rem) !important;
    color: #352920 !important;
}

body.skin-dark-academia:not(.dark-mode) main {
    color: #352920 !important;
}

body.skin-dark-academia:not(.dark-mode) main :is(h1, h2, h3, h4, p, span, label, legend, strong, small) {
    color: inherit;
}

body.skin-dark-academia:not(.dark-mode) main a {
    color: #6f5036;
}

body.skin-dark-academia:not(.dark-mode) :is(
    .filters, .form-section, .settings-box, .my-library-panel,
    .dashboard-work, .dashboard-work-card, .account-box,
    .browse-shelf-card, .recent-work-card, .browse-work, .search-work,
    .published-intro-card, .published-details-card, .published-social-card,
    .published-collapsible, .chapter-editor-card, .text-conversation-builder
) {
    background: #f2e8d8 !important;
    color: #352920 !important;
    border-color: #9b8468 !important;
}

body.skin-dark-academia:not(.dark-mode) :is(
    .recent-work-card, .browse-work, .search-work, .browse-shelf-card,
    .dashboard-work, .dashboard-work-card, .my-library-panel
) :is(h1, h2, h3, h4, p, span, strong, small, label) {
    color: #352920 !important;
}

body.skin-dark-academia:not(.dark-mode) :is(
    .recent-work-card, .browse-work, .search-work, .browse-shelf-card,
    .dashboard-work, .dashboard-work-card, .my-library-panel
) a {
    color: #6f5036 !important;
}

body.skin-dark-academia:not(.dark-mode) main :is(input, textarea, select, [contenteditable="true"]) {
    background: #fff8ed !important;
    color: #352920 !important;
    border-color: #9b8468 !important;
}

body.skin-dark-academia:not(.dark-mode) main :is(input, textarea)::placeholder {
    color: #78695d !important;
    opacity: 1 !important;
}

body.skin-dark-academia:not(.dark-mode) .site-footer {
    background: #3a3028 !important;
    color: #e9decd !important;
    border-top-color: #806c59 !important;
}

body.skin-dark-academia:not(.dark-mode) .site-footer a {
    color: #ead0a0 !important;
}

/* Dark setting: a real night-mode change, not the same palette one shade lower. */
body.skin-dark-academia.dark-mode {
    --gm-header: #1c1d1a;
    --gm-header-text: #f0e7d8;
    --gm-page: #20211e;
    --gm-card: #333129;
    --gm-card-bg: #333129;
    --gm-card-text: #f0e7d8;
    --gm-card-border: #786b55;
    --gm-border: #665d4c;
    --gm-accent: #c9ad76;
    --gm-button: #424737;
    --ui-field: #292a25;
    --ui-ink: #f0e7d8;
    --ui-border: #786b55;
    --ui-soft: #35352f;
    --ui-primary: #58634b;
    --ui-on-primary: #f8f2e6;
    background: radial-gradient(ellipse at 50% 0, #2b2c26, #20211e 55rem) !important;
    color: #f0e7d8 !important;
}

body.skin-dark-academia.dark-mode main {
    color: #f0e7d8 !important;
}

body.skin-dark-academia.dark-mode main a {
    color: #dfc28a;
}

body.skin-dark-academia.dark-mode :is(
    .filters, .form-section, .settings-box, .my-library-panel,
    .dashboard-work, .dashboard-work-card, .account-box,
    .browse-shelf-card, .recent-work-card, .browse-work, .search-work,
    .published-intro-card, .published-details-card, .published-social-card,
    .published-collapsible, .chapter-editor-card, .text-conversation-builder
) {
    background: #333129 !important;
    color: #f0e7d8 !important;
    border-color: #786b55 !important;
}

body.skin-dark-academia.dark-mode :is(
    .recent-work-card, .browse-work, .search-work, .browse-shelf-card,
    .dashboard-work, .dashboard-work-card, .my-library-panel
) :is(h1, h2, h3, h4, p, span, strong, small, label) {
    color: #f0e7d8 !important;
}

body.skin-dark-academia.dark-mode :is(
    .recent-work-card, .browse-work, .search-work, .browse-shelf-card,
    .dashboard-work, .dashboard-work-card, .my-library-panel
) a {
    color: #e2c486 !important;
}

body.skin-dark-academia.dark-mode main :is(input, textarea, select, [contenteditable="true"]) {
    background: #292a25 !important;
    color: #f0e7d8 !important;
    border-color: #786b55 !important;
}

body.skin-dark-academia.dark-mode main :is(input, textarea)::placeholder {
    color: #c2b7a6 !important;
    opacity: 1 !important;
}

/* Keep actual reading-paper components deliberately paper-colored in both modes. */
body.skin-dark-academia :is(.chapter-reader, #published-chapter-text, .author-library-card, article.library-note) {
    --gm-card-bg: #eee3d2;
    --gm-card-text: #352920;
}

/* Homepage variables need their own mode-specific values because the homepage
   uses the --home-* layer rather than the interior --gm-* layer. */
body.home-page.skin-dark-academia:not(.dark-mode) {
    --home-header: #3a3028;
    --home-page: #e7ded0;
    --home-hero: #302820;
    --home-card: #f2e8d8;
    --home-card-text: #352920;
    --home-section-text: #352920;
    --home-border: #9b8468;
    --home-accent: #a47c43;
    --home-button: #4d5940;
    --home-search-bg: #fff8ed;
    --home-search-text: #352920;
}

body.home-page.skin-dark-academia.dark-mode {
    --home-header: #1c1d1a;
    --home-page: #20211e;
    --home-hero: #25251f;
    --home-card: #333129;
    --home-card-text: #f0e7d8;
    --home-section-text: #f0e7d8;
    --home-border: #786b55;
    --home-accent: #c9ad76;
    --home-button: #4b5540;
    --home-search-bg: #eee3d2;
    --home-search-text: #352920;
}

body.home-page.skin-dark-academia:not(.dark-mode) .recent-work-card,
body.home-page.skin-dark-academia:not(.dark-mode) .recent-work-card :is(h3, p, span, strong) {
    color: #352920 !important;
}

body.home-page.skin-dark-academia:not(.dark-mode) .recent-work-card a {
    color: #6f5036 !important;
}

body.home-page.skin-dark-academia.dark-mode .recent-work-card,
body.home-page.skin-dark-academia.dark-mode .recent-work-card :is(h3, p, span, strong) {
    color: #f0e7d8 !important;
}

body.home-page.skin-dark-academia.dark-mode .recent-work-card a {
    color: #e2c486 !important;
}

body.home-page.skin-dark-academia.dark-mode .recent-work-card .tag-pill,
body.skin-dark-academia.dark-mode :is(.browse-work, .search-work) .tag-pill {
    background: #3d4036 !important;
    color: #efe3cf !important;
    border-color: #7d745e !important;
}


/* =========================================================
   EDIT WORK CHAPTER SCHEDULER — v19
   ========================================================= */
.gm-chapter-schedule-dialog {
    width: min(520px, calc(100vw - 28px));
    max-width: 520px;
    padding: 0;
    border: 1px solid var(--ui-border, var(--gm-border, #8e8175));
    border-radius: 14px;
    background: var(--ui-field, var(--gm-page, #f7efe2));
    color: var(--ui-ink, var(--gm-text, #2b2521));
    box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}
.gm-chapter-schedule-dialog::backdrop { background: rgb(0 0 0 / 52%); }
.gm-chapter-schedule-shell { display: grid; }
.gm-chapter-schedule-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--ui-border, #8e8175) 65%, transparent);
}
.gm-chapter-schedule-header h2 { margin: 2px 0 0 !important; padding: 0 !important; border: 0 !important; }
.gm-chapter-schedule-name { margin: 5px 0 0; opacity: .72; font-size: .9rem; }
.gm-chapter-schedule-body { display: grid; gap: 10px; padding: 18px 20px 20px; }
.gm-chapter-schedule-body > label { font-weight: 700; }
.gm-chapter-schedule-body input[type="datetime-local"] {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
}
.gm-chapter-schedule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: .82rem;
    opacity: .72;
}
.gm-chapter-schedule-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.gm-chapter-schedule-actions button { width: auto !important; min-width: 0 !important; }

body .edit-work-manager .edit-work-chapter-state-action {
    display: inline-flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
body .edit-work-manager .schedule-work-chapter-button,
body .edit-work-manager .reschedule-work-chapter-button,
body .edit-work-manager .cancel-schedule-work-chapter-button {
    background: transparent !important;
    border: 1px solid currentColor !important;
    color: inherit !important;
}
@media (max-width: 600px) {
    .gm-chapter-schedule-header,
    .gm-chapter-schedule-body { padding-left: 15px; padding-right: 15px; }
    body .edit-work-manager .edit-work-chapter-state-action {
        display: inline-flex !important;
        flex: 0 1 auto;
    }
}
