/* Sidebar read markers */

#mdbook-sidebar a.fablore-read::after {
    content: '✓';
    margin-left: 0.45em;
    font-size: 0.78em;
    font-weight: 700;
    color: #6abf82;
    vertical-align: 0.05em;
}

/* Reading progress bar */

#reading-progress-bar {
    position: fixed;
    height: 5px;
    z-index: 101;
    pointer-events: none;
}

#reading-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--links);
    transition: width 0.1s linear;
}

/* Heading anchor links */

.heading-anchor {
    opacity: 0;
    margin-left: 0.4em;
    font-size: 0.65em;
    color: var(--searchresults-header-fg);
    text-decoration: none;
    transition: opacity 0.15s, color 0.15s;
    vertical-align: middle;
    font-weight: normal;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor {
    opacity: 1;
}

.heading-anchor:hover,
.heading-anchor--copied {
    color: var(--links);
    text-decoration: none;
}

/* Hide secondary toolbar buttons on narrow viewports — toolbar is already full at mobile widths */
@media only screen and (max-width: 599px) {
    #random-story-button,
    #accessibility-toggle {
        display: none;
    }
}

/* Reading preferences popup */

.accessibility-popup {
    position: absolute;
    left: 10px;
    top: var(--menu-bar-height);
    z-index: 1000;
    border-radius: 4px;
    font-size: 0.7em;
    color: var(--fg);
    background: var(--theme-popup-bg);
    border: 1px solid var(--theme-popup-border);
    padding: 10px 0 6px;
    min-width: 200px;
    display: none;
}

.accessibility-section {
    padding: 2px 16px 8px;
}

.accessibility-section + .accessibility-section {
    border-top: 1px solid var(--theme-popup-border);
    padding-top: 10px;
}

.accessibility-label {
    display: block;
    font-size: 0.9em;
    color: var(--searchresults-header-fg);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    white-space: nowrap;
}

.accessibility-choices {
    display: flex;
    gap: 4px;
}

.accessibility-choice {
    flex: 1;
    border: 1px solid var(--theme-popup-border);
    background: none;
    color: inherit;
    cursor: pointer;
    border-radius: 3px;
    padding: 3px 6px;
    line-height: 1.6;
    font-family: inherit;
    font-size: inherit;
    text-align: center;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}

.accessibility-choice:hover {
    background: var(--theme-hover);
}

.accessibility-choice.accessibility-selected {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
    color: #fff;
}

/* Apply user font scale to content text only */
#mdbook-content main {
    font-size: calc(var(--fablore-font-scale, 1) * 1em);
}

/* Nav bar copy-link button — resets browser button defaults so spacing matches the <a>-based print/git buttons */

#copy-link-button,
#reading-mode-toggle {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--icons);
}

/*
 * Make the left-side <button>s match the right-side <a> links. mdBook pads both
 * an .icon-button and the .fa-svg inside it (~45px per button against ~32px),
 * and a <button> keeps the browser's 13.3px font-size, which the 1em icon
 * follows (13px icons against 16px).
 */
#mdbook-menu-bar .icon-button {
    font-size: inherit;
}

#mdbook-menu-bar .icon-button .fa-svg {
    padding: 0;
}

/* mdBook's .left-buttons is a flex row but .right-buttons is not, so template
   whitespace added ~4px gaps (and widened the print link) on the right only. */
#mdbook-menu-bar .right-buttons {
    display: flex;
    align-items: center;
}

#copy-link-done,
#copy-link-button.copy-link-button--done #copy-link-icon {
    display: none;
}

#copy-link-button.copy-link-button--done #copy-link-done {
    display: inline;
}

/* Injected by mdbook_story_meta preprocessor — story metadata card below the chapter title. */

/* Story card: context row (arc · part · heroes), byline, links row */

.story-card {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: 1rem;
    margin-bottom: 1.4rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--table-border-color);
    font-size: 1.25rem;
    color: var(--searchresults-header-fg);
    line-height: 1.6;
}

.story-card > p {
    margin: 0;
}

.story-card-context {
    font-size: 0.92em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.story-card-context > * + *::before,
.story-card-links > a + a::before {
    content: '·';
    margin: 0 0.6em;
    color: var(--searchresults-header-fg);
    font-weight: 400;
}

.story-card-heroes a,
.story-card-links a {
    color: var(--links);
    text-decoration: none;
}

.story-card-heroes a:hover,
.story-card-links a:hover {
    text-decoration: underline;
}

.story-card-more {
    cursor: help;
    font-weight: 400;
}

.story-card-links:empty {
    display: none;
}

.story-card-links .fa-svg {
    margin-right: 0.15em;
}

/* Hero and set information. Outside a story card (a hero page's later forms)
   it carries the card's own type and rule. */
.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.4rem;
    margin-top: 0.5rem;
    margin-bottom: 1.4rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--table-border-color);
    font-size: 1.25rem;
    color: var(--searchresults-header-fg);
    line-height: 1.6;
}

.story-card .story-meta {
    margin: 0;
    padding: 0;
    border: none;
    font-size: inherit;
}

.story-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    white-space: nowrap;
}

.story-meta-item .fa {
    font-size: 0.9em;
}

.story-meta-item strong {
    color: var(--fg);
    font-weight: 600;
}

.story-meta-item a {
    color: var(--links);
    text-decoration: none;
}

.story-meta-item a:hover {
    text-decoration: underline;
}

/* Share buttons */

.story-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.8rem;
    margin-bottom: 2.2rem;
    font-size: 1.4rem;
}

.story-share-label {
    color: var(--searchresults-header-fg);
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-right: 0.15rem;
}

.story-share .story-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4em;
    height: 2.4em;
    border-radius: 50%;
    font-size: 1.4rem;
    text-decoration: none;
    color: var(--fg);
    background: var(--quote-bg);
    border: 1px solid var(--table-border-color);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
    flex-shrink: 0;
}

.story-share .story-share-btn:hover {
    text-decoration: none;
}

.story-share .story-share-btn .fa,
.story-share .story-share-btn svg {
    font-size: 1em;
    flex-shrink: 0;
}

.story-share-x-logo {
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1;
    font-family: sans-serif;
}

.story-share .story-share-copy.story-share-copied {
    background: #25a244;
    border-color: #25a244;
    color: #fff;
}

.story-share .story-share-facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: #fff;
}

.story-share .story-share-twitter:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

.story-share .story-share-bluesky:hover {
    background: #0085ff;
    border-color: #0085ff;
    color: #fff;
}

.story-share .story-share-whatsapp:hover {
    background: #25d366;
    border-color: #25d366;
    color: #fff;
}

.story-share .story-share-copy:hover {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
    color: #fff;
}
