:root {
    --bg0: #000;
    --bg1: #090101;
    --ink: #c49a90;
    --muted: #91675f;
    --accent: #a56a2a;
    --line: rgba(120, 68, 50, 0.22);
    --max: 1240px;
    --reading-width: 720px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background:
        radial-gradient(
            1100px 700px at 70% 20%,
            rgba(90, 40, 18, 0.06),
            transparent 55%
        ),
        radial-gradient(
            900px 600px at 20% 70%,
            rgba(55, 20, 12, 0.05),
            transparent 60%
        ),
        linear-gradient(180deg, var(--bg0), var(--bg1));
}

a {
    color: inherit;
}

.wrap {
    width: min(100% - 36px, var(--max));
    margin: 0 auto;
    padding: 32px 0 28px;
}

/* Site header */

body > .wrap > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
}

.mark {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1;
}

.sigil {
    display: flex;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #2a0806;
}

.sigil img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-block {
    display: flex;
    flex-direction: column;
    transform: translateY(4px);
}

.brand {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
}

.tagline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 3px 0 0 8px;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    opacity: 0.85;
}

.tagline::before,
.tagline::after {
    height: 1px;
    background: currentColor;
    content: "";
    opacity: 0.6;
}

.tagline::before {
    width: 25px;
}
.tagline::after {
    width: 43px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-buttons {
    display: flex;
    gap: 16px;
}

nav a {
    padding: 10px 12px;
    border: 1px solid rgba(58, 22, 14, 0.18);
    border-radius: 999px;
    background: rgba(10, 6, 4, 0.35);
    font-size: 15px;
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

nav a:hover {
    color: #754e06;
    border-color: rgb(75, 44, 1);
}

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

/* Novel */

.novel-page {
    padding: clamp(54px, 8vw, 104px) 0 clamp(44px, 7vw, 88px);
}

.story {
    width: min(100%, var(--reading-width));
    margin: 0 auto;
}

.story-header {
    margin-bottom: clamp(38px, 6vw, 64px);
    text-align: center;
}

.story-series {
    margin: 0 0 18px;
    color: var(--muted);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.story-header h2 {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(2.7rem, 7vw, 4.8rem);
    font-weight: 600;
    line-height: 0.98;
    letter-spacing: 0.015em;
}

.route-number {
    display: inline-block;
    font-size: 1.14em;
    line-height: 1;
    letter-spacing: 0;
    transform: translateY(0.02em);
}

.chapter-title {
    margin: 18px 0 0;
    color: var(--muted);
    font-family: "Alegreya", Georgia, serif;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-style: italic;
    line-height: 1.35;
}

.story-header::after {
    display: block;
    width: 72px;
    height: 1px;
    margin: 30px auto 0;
    background: var(--line);
    content: "";
}

.story-text {
    font-family: "Alegreya", Georgia, "Times New Roman", serif;
    font-size: clamp(1.18rem, 1.6vw, 1.32rem);
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.008em;
}

.story-text p {
    margin: 0 0 1.25em;
}

.story-text p:first-child::first-letter {
    float: left;
    margin: 0.08em 0.1em 0 0;
    color: var(--accent);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 4.25em;
    font-weight: 600;
    line-height: 0.72;
}

.story-text em {
    color: #d0aaa1;
}

.story-text hr {
    width: 72px;
    height: 1px;
    margin: 2.75em auto;
    border: 0;
    background: var(--line);
}

.chapter-navigation {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 1rem;
    margin-top: clamp(56px, 8vw, 88px);
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.chapter-navigation a {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--muted);
    font-family: "Alegreya", Georgia, serif;
    font-size: 1.08rem;
    text-decoration: none;
}

.chapter-navigation a:hover {
    color: var(--accent);
    background: none;
}

.chapter-navigation .previous-chapter {
    text-align: left;
}

.chapter-navigation .back-to-stories {
    text-align: center;
}

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

/* Footer */

.footer {
    margin-top: 36px;
    color: rgba(145, 103, 95, 0.75);
    font-size: 12px;
    line-height: 1.6;
    letter-spacing: 0.04em;
    text-align: left;
    hyphens: auto;
}

/* Responsive layout */

@media (max-width: 640px) {
    .wrap {
        width: min(100% - 24px, var(--max));
        padding: 18px 0 22px;
    }

    body > .wrap > header {
        flex-direction: column;
        gap: 14px;
        padding: 12px 0 16px;
    }

    .mark {
        gap: 10px;
    }

    .sigil {
        width: 42px;
        height: 42px;
        border-radius: 16px;
    }

    .brand-block {
        transform: none;
    }

    .brand {
        position: relative;
        top: 2px;
        font-size: 27px;
        line-height: 1.05;
    }

    .tagline {
        margin: 4px 0 0 2px;
        font-size: 0.58rem;
        letter-spacing: 0.1em;
    }

    .tagline::before {
        width: 22px;
    }
    .tagline::after {
        width: 34px;
    }

    nav,
    .nav-buttons {
        width: 100%;
    }

    nav a {
        padding: 9px 11px;
        font-size: 14px;
    }

    .novel-page {
        padding: 48px 4px 54px;
    }

    .story-header {
        margin-bottom: 38px;
    }

    .story-series {
        font-size: 0.85rem;
        letter-spacing: 0.14em;
    }

    .story-header h2 {
        font-size: clamp(2.5rem, 14vw, 3.7rem);
    }

    .story-text {
        font-size: 1.16rem;
        line-height: 1.68;
    }

    .chapter-navigation {
        gap: 14px;
    }
    .chapter-navigation a {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
