@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Eagle+Lake&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&display=swap');

:root {
    --ash: #8f8c8c;
    --redhot: #b00b0b;
    --spirit: #c5c025;
    --blume: #bd9b53;
    --soot: #292727;
    --shell: #fefff3;
    --parchment: #f0ead6;
    --ink: #1a1815;
}

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

/* ── Base typography ── */
body {
    font-family: 'IM Fell English', serif;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--ink);

    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-color: var(--shell);
    z-index: -1;
}

/* ── Emboss ── */
.embossed {
    text-shadow: 2px 2px 2px var(--soot);
}

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    padding: 1rem 2rem;
    background-color: var(--soot);
    color: #fff;
    border-bottom: 3px solid var(--blume);
}

#logo {
    display: flex;
    align-items: center;
    gap: 15px;
    color: inherit;
}

#logo img {
    width: 50px;
    height: 50px;
}


#logo h1 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 1.8rem;
    line-height: 1.2;
    color: var(--redhot);
}

/* ── Nav ── */
nav {
    position: relative;
    display: flex;
    align-items: center;
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: #fff;
    font-family: 'Cinzel', serif;
    font-size: 0.70rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--blume);
}

.nav-toggle {
    display: none;
}

.nav-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0.4rem;
}

.nav-btn span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: #fff;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-menu {
    display: flex;
}

/* ═══════════════════════════════════════
   MAIN & SECTIONS
═══════════════════════════════════════ */
main {
    padding: 2.5rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    flex: 1;
}

section {
    background-color: var(--parchment);
    border-radius: 3px;
    border: 1px solid var(--blume);
    border-radius: 0 6px 6px 0;
    box-shadow:
        2px 2px 0px var(--blume),
        4px 4px 12px rgba(0, 0, 0, 0.15);
    padding: 2.5rem 2rem 2.5rem 2.25rem;
    margin-bottom: 2rem;
}

/* Section heading */
section h2 {
    font-family: 'Eagle Lake', cursive;
    font-size: 1.75rem;
    color: var(--soot);
    width: fit-content;
    position: relative;
    margin-bottom: 1.5rem;
}

section h2::after {
    content: "";
    position: absolute;
    left: -5px;
    bottom: -6px;
    width: calc(100% + 1.5rem);
    height: 2px;
    background: linear-gradient(to right, var(--redhot), var(--blume), transparent);
}

section h3 {
    font-family: 'Eagle Lake', cursive;
    font-size: 1.15rem;
    color: var(--redhot);
    margin: 1.5rem 0 0.4rem;
}

section p {
    margin-bottom: 0.9rem;
}

section p:last-child {
    margin-bottom: 0;
}

section a {
    color: var(--redhot);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}

section a:hover {
    color: var(--blume);
    border-bottom-color: var(--blume);
}

.tagline {
    font-size: 1.1rem;
    color: var(--ash);
    margin-bottom: 1rem !important;
}

.note {
    color: var(--ash);
    font-size: 0.9rem;
    margin-bottom: 1rem !important;
}

/* ── Cards ── */
.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.info-card {
    background-color: var(--shell);
    border: 1px solid var(--blume);
    border-top: 3px solid var(--blume);
    border-radius: 4px;
    padding: 1.1rem 1rem;
    box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.08);
}

.info-card h3,
.info-card h4 {
    font-family: 'Eagle Lake', cursive;
    font-size: 0.95rem;
    color: var(--soot);
    margin: 0 0 0.4rem;
}

.info-card p {
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 0.5rem !important;
}

.info-card a {
    font-size: 0.85rem;
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Fan cards ── */
.fan-card {
    border-top-color: var(--redhot);
}

.fan-author {
    font-style: italic;
    font-size: 0.8rem !important;
    color: var(--ash) !important;
    margin-bottom: 0.3rem !important;
}

/* ── Writing / ToC ── */

.toc-wrapper {
    position: relative;
    display: inline-block;
    margin: 0 0 1.25rem 0;
    clear: left;
}

#table-of-contents {
    display: block;
    padding: 0.3rem 0;
    font-family: 'Eagle Lake', cursive;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    text-transform: none;
    background: transparent;
    color: var(--redhot);
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
    text-align: left;
    position: relative;
}

#table-of-contents::after {
    content: " ▾";
    font-size: 0.75em;
    color: var(--blume);
    vertical-align: middle;
    display: inline-block;
    transition: transform 0.25s ease;
}

#table-of-contents.open::after {
    transform: rotate(90deg);
}

#table-of-contents:hover {
    color: var(--blume);
    background: transparent;
}

.toc-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    list-style: none;
    margin: 0;
    padding: 0.3rem 0;
    background-color: var(--soot);
    border: 1px solid var(--blume);
    border-radius: 3px;
    min-width: 220px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.toc-menu::-webkit-scrollbar {
    width: 5px;
}

.toc-menu::-webkit-scrollbar-track {
    background: transparent;
}

.toc-menu::-webkit-scrollbar-thumb {
    background: var(--blume);
    border-radius: 3px;
}

.toc-menu::-webkit-scrollbar-thumb:hover {
    background: var(--redhot);
}

.toc-menu li a {
    display: block;
    padding: 0.5rem 1rem;
    font-family: 'Cinzel', serif;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    color: #fff;
    border-bottom: none;
    transition: color 0.15s, background-color 0.15s;
}

.toc-menu li a:hover {
    color: var(--soot);
    background-color: var(--blume);
    border-bottom: none;
}

#bookContent {
    all: unset;
    display: block;
    clear: both;
}

/* ── News articles ── */
.news-article {
    border-bottom: 1px dashed var(--ash);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.news-article:last-of-type {
    border-bottom: none;
}

.news-article h3 {
    margin-top: 0.3rem;
    margin-bottom: 0.6rem;
}

.article-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.article-date {
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    color: var(--ash);
    letter-spacing: 0.05em;
}

.article-tag {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    background-color: var(--redhot);
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Contact blocks ── */
.contact-block {
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}

.contact-block h3 {
    margin-top: 0;
}

.contact-link {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--redhot) !important;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
footer {
    background-color: var(--soot);
    border-top: 3px solid var(--blume);
    color: var(--ash);
    padding: 1.25rem;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════
   JS SECTION VISIBILITY
═══════════════════════════════════════ */
main>section {
    display: none;
}

#Home {
    display: block;
}

/* ═══════════════════════════════════════
   CANVAS OVERLAY
═══════════════════════════════════════ */
canvas#fire-overlay {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Pages you read */
.page {
    max-width: 65ch;
    margin: 0 auto;
    padding: 0 1rem;
}

.page p {
    word-spacing: 0.1em;
    text-align: justify;
    hyphens: auto;
    text-indent: 2em;
    line-height: 1.9;
    margin-bottom: 0;
}

.page .quote {
    font-style: italic;
    font-size: 1.2em;
    margin: 1em;
    text-align: center;
    color: var(--redhot);
}

/* looks like etched in */
.etched {
    text-align: center;
    font-size: 1.5rem;
    text-shadow: 1px 1px 0px var(--redhot),
        4px 4px 12px rgba(0, 0, 0, 0.15);
}

.intro {
    max-width: 65ch;
    margin: 0 auto 1.5rem;
    text-align: center;
    font-style: italic;
}

/* Scroll bar webkit */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--soot);
}

::-webkit-scrollbar-thumb {
    background: var(--blume);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--spirit);
}

/* ── Page controls ── */
.page {
    max-width: 65ch;
    margin: 0 auto;
    padding: 0 1rem;
}

.page p {
    word-spacing: 0.1em;
    text-align: justify;
    hyphens: auto;
    text-indent: 2em;
    line-height: 1.9;
    margin-bottom: 0.6rem;
}

.page h3+p,
.page h4+p,
.page hr+p,
.page blockquote+p {
    text-indent: 0;
}

.page .quote {
    font-style: italic;
    font-size: 1.2em;
    margin: 1.2em auto;
    text-align: center;
    color: var(--redhot);
    text-indent: 0;
    /* quotes shouldn't be indented */
}

.page p.etched {
    text-align: center;
    font-size: 1.5rem;
    text-indent: 0;
    margin: 1.5em auto;
    text-shadow: 1px 1px 0px var(--redhot),
        4px 4px 12px rgba(0, 0, 0, 0.15);
}

.page p.quote {
    font-style: italic;
    font-size: 1.2em;
    margin: 1.2em auto;
    text-align: center;
    text-indent: 0;
    color: var(--redhot);
}

.scene-break {
    border: none;
    text-align: center;
    margin: 1.5em auto;
    opacity: 0.4;
    border-top: 1px solid var(--blume);
    width: 40%;
}

.page-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--blume);
}

.page-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--shell);
    background-color: var(--soot);
    border: 1px solid var(--blume);
    padding: 0.4rem 1rem;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--blume);
    color: var(--soot);
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.page-indicator {
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    color: var(--ash);
    letter-spacing: 0.05em;
}

/* ── Page jump row ── */

.page-controls {
    flex-wrap: nowrap;
}

.page-jump-row {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
    overflow: hidden;
}

.page-jump-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    color: var(--ash);
    background: none;
    border: none;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
    transition: color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.page-jump-btn:hover {
    color: var(--ink);
}

.page-jump-btn.current-page {
    font-size: 0.85rem;
    color: var(--soot);
    cursor: default;
    font-weight: 700;
}

/* ═══════════════════════════════════════
   TABLET / MOBILE
═══════════════════════════════════════ */
@media (max-width: 840px) {

    header {
        padding: 1rem;
    }

    .nav-btn {
        display: flex;
    }

    .nav-menu {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 0;
        background-color: var(--soot);
        min-width: 180px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
        z-index: 15;
    }

    .nav-toggle:checked~.nav-menu {
        max-height: 350px;
    }

    .nav-toggle:checked~.nav-btn span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle:checked~.nav-btn span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked~.nav-btn span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    nav a {
        padding: 1rem 1rem;
        font-size: 0.9rem;
    }

    main {
        padding: 1.25rem 0.75rem;
    }

    section {
        padding: 1.5rem 1.1rem;
    }

    .card-row {
        grid-template-columns: 1fr;
    }

    /* ── TOC mobile ── */
    .toc-wrapper {
        display: block;
        /* full width on mobile */
    }

    #table-of-contents {
        font-size: 1.05rem;
    }

    .toc-menu {
        min-width: 200px;
        left: 0;
        right: auto;
    }
}

/* Dark mode*/
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--soot);
    }
}


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

    :root {
        --parchment:      #1a1917;
        --parchment-dark: #141312;
        --ink:            #d6d0c4;
        --ash:            #7a7672;
        --blume:          #8a6f3a;
        --soot:           #0d0c0b;
    }

    /* Animated smoke backdrop on body */
    body::before {
        background-color: #111010;
        background-image:
            radial-gradient(ellipse 60% 40% at 20% 60%, rgba(80,70,60,0.18) 0%, transparent 70%),
            radial-gradient(ellipse 40% 60% at 80% 30%, rgba(60,55,50,0.14) 0%, transparent 70%);
        animation: smokeShift 18s ease-in-out infinite alternate;
    }

    @keyframes smokeShift {
        0%   { background-position: 0% 0%,   100% 100%; }
        33%  { background-position: 30% 20%,  70% 80%;  }
        66%  { background-position: 60% 50%,  40% 50%;  }
        100% { background-position: 100% 100%, 0% 0%;   }
    }

    /* Sections and header */
    section {
        background-color: rgba(28, 26, 24, 0.85);
        border-color: #5a4828;
        box-shadow:
            2px 2px 0px #3a2e18,
            4px 4px 16px rgba(0, 0, 0, 0.5);
    }

    header {
        background-color: #0d0c0b;
        border-bottom-color: #5a4828;
    }

    section h2 {
        color: #888888;
    }

    footer {
        background-color: #0d0c0b;
        border-top-color: #5a4828;
    }

    .toc-menu {
        background-color: #1a1917;
        border-color: #5a4828;
    }

    /* Scrollbar */
    ::-webkit-scrollbar-track { background: #111010; }
}