:root {
    --ink: #09090d;
    --night: #12131a;
    --coal: #18120f;
    --paper: #fff3dc;
    --paper-deep: #ecd7b0;
    --text: #28190f;
    --muted: #765b42;
    --cream: #fff8ed;
    --signal: #f5c04f;
    --ember: #e85f34;
    --red: #a91f35;
    --cyan: #70d8d2;
    --line: rgba(255, 248, 237, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--ink);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--cream);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background:
        linear-gradient(180deg, rgba(9, 9, 13, 0.52), var(--ink) 34rem),
        linear-gradient(90deg, rgba(169, 31, 53, 0.18), transparent 18rem),
        url("/public/assets/img/site-background.png") top center / 100% auto no-repeat,
        var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid rgba(255, 248, 237, 0.12);
    background: rgba(9, 9, 13, 0.84);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    gap: 0.7rem;
    align-items: center;
    min-width: 0;
    font-weight: 900;
    text-transform: uppercase;
}

.brand img {
    width: 2.65rem;
    height: 2.65rem;
    object-fit: contain;
}

.brand span {
    overflow: hidden;
    max-width: 18rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.site-nav {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.site-nav a,
.site-nav button {
    display: inline-flex;
    align-items: center;
    min-height: 2.45rem;
    padding: 0 0.82rem;
    border: 0;
    color: rgba(255, 248, 237, 0.86);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    background: transparent;
    cursor: pointer;
}

.site-nav a:hover,
.site-nav button:hover,
.site-nav a:focus-visible,
.site-nav button:focus-visible {
    color: var(--signal);
    outline: none;
}

.profile-link {
    border: 1px solid rgba(245, 192, 79, 0.42) !important;
    color: var(--signal) !important;
    background: rgba(245, 192, 79, 0.1) !important;
}

.nav-group {
    position: relative;
}

.nav-group button::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    margin-left: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.14rem) rotate(45deg);
}

.nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 11rem;
    padding: 0.35rem;
    border: 1px solid rgba(255, 248, 237, 0.14);
    background: rgba(18, 19, 26, 0.96);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-0.15rem);
    transition: opacity 160ms ease, transform 160ms ease;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-menu a {
    display: flex;
    width: 100%;
}

.story-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: end;
    min-height: 34rem;
    padding: clamp(4rem, 9vw, 8rem) clamp(1rem, 5vw, 5rem) clamp(2rem, 5vw, 4rem);
    background:
        linear-gradient(90deg, rgba(9, 9, 13, 0.92), rgba(9, 9, 13, 0.7) 54%, rgba(9, 9, 13, 0.34)),
        radial-gradient(circle at 70% 30%, rgba(112, 216, 210, 0.16), transparent 20rem);
}

.story-hero-copy {
    max-width: 58rem;
}

.eyebrow,
.rail-heading span,
.archive-card > p,
.paper-topline {
    margin: 0;
    color: var(--signal);
    font-size: 0.78rem;
    font-weight: 950;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.story-hero h1 {
    max-width: 10ch;
    margin: 0.65rem 0 1rem;
    color: var(--cream);
    font-size: clamp(3rem, 9vw, 7.7rem);
    line-height: 0.88;
    text-transform: uppercase;
    text-shadow: 0 0.25rem 0 rgba(0, 0, 0, 0.75);
}

.story-hero p:not(.eyebrow) {
    max-width: 42rem;
    margin: 0;
    color: rgba(255, 248, 237, 0.86);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    line-height: 1.55;
}

.story-stats {
    display: grid;
    gap: 0.55rem;
    width: min(100%, 18rem);
}

.story-stats span {
    min-height: 3rem;
    padding: 0.85rem 1rem;
    border-left: 0.25rem solid var(--signal);
    color: var(--cream);
    font-weight: 900;
    background: rgba(255, 248, 237, 0.08);
}

.reader-shell {
    display: grid;
    grid-template-columns: minmax(14rem, 18rem) minmax(0, 54rem) minmax(14rem, 18rem);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
    padding: clamp(1rem, 5vw, 4rem);
}

.chapter-rail,
.archive-card {
    position: sticky;
    top: 5.5rem;
    border: 1px solid var(--line);
    background: rgba(18, 19, 26, 0.86);
    box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.32);
}

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

.rail-heading strong {
    color: var(--cream);
}

.chapter-rail ol {
    display: grid;
    gap: 1px;
    max-height: calc(100vh - 10rem);
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
    background: rgba(255, 248, 237, 0.08);
}

.chapter-rail a {
    display: grid;
    grid-template-columns: 2.2rem minmax(0, 1fr);
    gap: 0.7rem;
    align-items: center;
    min-height: 3.15rem;
    padding: 0.55rem 0.85rem;
    color: rgba(255, 248, 237, 0.78);
    background: rgba(18, 19, 26, 0.94);
}

.chapter-rail a:hover,
.chapter-rail a:focus-visible,
.chapter-rail a.is-active {
    color: var(--cream);
    outline: none;
    background: linear-gradient(90deg, rgba(169, 31, 53, 0.82), rgba(232, 95, 52, 0.42));
}

.chapter-rail a span {
    color: var(--cyan);
    font-size: 0.78rem;
    font-weight: 950;
}

.chapter-rail a strong {
    overflow: hidden;
    font-size: 0.88rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.story-paper {
    color: var(--text);
    background:
        linear-gradient(90deg, rgba(120, 73, 34, 0.08) 0 1px, transparent 1px 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 12rem),
        var(--paper);
    background-size: 2rem 100%, 100% 100%, auto;
    box-shadow:
        0 1.6rem 4rem rgba(0, 0, 0, 0.45),
        inset 0 0 0 1px rgba(91, 54, 25, 0.22);
}

.paper-topline {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1.1rem clamp(1.1rem, 4vw, 3.5rem);
    border-bottom: 1px solid rgba(77, 42, 18, 0.24);
    color: var(--red);
}

.archive-photos {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1rem, 3vw, 2rem);
    align-items: flex-start;
    padding: clamp(1.4rem, 4vw, 3rem) clamp(1.2rem, 5vw, 4rem) 0;
}

.archive-photo {
    position: relative;
    width: min(100%, 22rem);
    margin: 0;
    padding: 0.72rem 0.72rem 0.9rem;
    color: #1d1611;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(232, 218, 190, 0.5)),
        #f8f0df;
    box-shadow:
        0 1.1rem 1.7rem rgba(75, 41, 18, 0.24),
        0 0.18rem 0.45rem rgba(75, 41, 18, 0.18),
        inset 0 0 0 1px rgba(72, 50, 34, 0.18);
    transform: rotate(-2.4deg);
}

.archive-photo:nth-child(even) {
    transform: rotate(2.1deg) translateY(0.35rem);
}

.archive-photo::before {
    content: "";
    position: absolute;
    top: -0.95rem;
    left: 42%;
    width: 5.2rem;
    height: 1.65rem;
    background: rgba(255, 236, 171, 0.52);
    box-shadow: 0 0.16rem 0.45rem rgba(57, 34, 19, 0.16);
    transform: rotate(4deg);
}

.archive-photo:nth-child(even)::before {
    left: 18%;
    transform: rotate(-6deg);
}

.archive-photo-frame {
    position: relative;
    overflow: hidden;
    background: #151515;
}

.archive-photo-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle, rgba(0, 0, 0, 0.24) 0 1px, transparent 1.2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 42%, rgba(0, 0, 0, 0.12));
    background-size: 4px 4px, 100% 100%;
    mix-blend-mode: multiply;
    pointer-events: none;
}

.archive-photo img {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(1) contrast(1.04);
}

.archive-photo figcaption {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.62rem;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.archive-photo figcaption strong {
    font-size: 0.9rem;
    line-height: 1.2;
}

.archive-photo figcaption span {
    color: #6f5540;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.story-content {
    padding: clamp(1.4rem, 5vw, 4rem);
    font-family: Georgia, "Times New Roman", serif;
}

.story-content h2,
.story-content h3,
.story-content h4 {
    margin: 2rem 0 1rem;
    color: #251208;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0;
}

.story-content h2:first-child,
.story-content h3:first-child {
    margin-top: 0;
}

.story-content h3 {
    font-size: clamp(2rem, 5vw, 3.8rem);
    line-height: 0.98;
    text-transform: uppercase;
}

.story-content p {
    margin: 0 0 1.25rem;
    font-size: clamp(1.02rem, 1.45vw, 1.16rem);
    line-height: 1.82;
}

.story-content strong {
    color: #140b07;
}

.story-content em {
    color: #402817;
}

.story-content hr {
    width: 7rem;
    height: 0.18rem;
    margin: 2.5rem 0;
    border: 0;
    background: linear-gradient(90deg, var(--red), var(--ember), var(--signal));
}

.account-note {
    padding: 1rem 1.15rem;
    border-left: 0.22rem solid var(--red);
    color: #382110;
    background: rgba(120, 73, 34, 0.09);
}

.chapter-end {
    margin-top: 2rem !important;
    color: var(--red);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.82rem !important;
    font-weight: 950;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page-turner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    border-top: 1px solid rgba(77, 42, 18, 0.24);
    background: rgba(77, 42, 18, 0.22);
}

.page-turner a,
.page-turner-empty {
    display: grid;
    gap: 0.35rem;
    min-height: 5.8rem;
    padding: 1rem clamp(1rem, 3vw, 1.5rem);
    color: var(--text);
    background: rgba(255, 243, 220, 0.82);
}

.page-turner a:last-child {
    text-align: right;
}

.page-turner a:hover,
.page-turner a:focus-visible {
    outline: none;
    background: #ffe2a7;
}

.page-turner span {
    color: var(--red);
    font-size: 0.76rem;
    font-weight: 950;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page-turner strong {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.archive-card {
    padding: 1.15rem;
}

.archive-card h2 {
    margin: 0.55rem 0 0.85rem;
    color: var(--cream);
    font-size: 1.25rem;
    line-height: 1.15;
}

.archive-card p:last-child {
    margin: 0;
    color: rgba(255, 248, 237, 0.72);
    line-height: 1.6;
}

.social-footer {
    padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 5vw, 4rem);
    border-top: 1px solid rgba(255, 248, 237, 0.14);
    background:
        linear-gradient(90deg, rgba(169, 31, 53, 0.18), transparent 24rem),
        linear-gradient(180deg, #12131a, #09090d);
}

.social-footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(22rem, 37rem);
    gap: clamp(1.2rem, 4vw, 3rem);
    align-items: center;
    max-width: 76rem;
    margin: 0 auto;
}

.social-copy h2 {
    margin: 0.45rem 0 0.65rem;
    color: var(--cream);
    font-size: clamp(1.6rem, 3vw, 2.55rem);
    line-height: 1.04;
}

.social-copy p:last-child {
    max-width: 34rem;
    margin: 0;
    color: rgba(255, 248, 237, 0.72);
    line-height: 1.6;
}

.social-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.7rem;
}

.social-link {
    display: grid;
    grid-template-columns: 2.65rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    min-height: 5rem;
    padding: 0.75rem;
    border: 1px solid rgba(255, 248, 237, 0.14);
    color: var(--cream);
    background:
        linear-gradient(135deg, rgba(255, 248, 237, 0.08), rgba(255, 248, 237, 0.025)),
        rgba(255, 248, 237, 0.045);
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.social-link:hover,
.social-link:focus-visible {
    border-color: rgba(245, 192, 79, 0.46);
    outline: none;
    background:
        linear-gradient(135deg, rgba(245, 192, 79, 0.16), rgba(169, 31, 53, 0.1)),
        rgba(255, 248, 237, 0.07);
    transform: translateY(-2px);
}

.social-mark {
    display: inline-grid;
    width: 2.65rem;
    height: 2.65rem;
    place-items: center;
    overflow: hidden;
    background: rgba(255, 248, 237, 0.08);
}

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

.social-link strong,
.social-link small {
    display: block;
}

.social-link strong {
    font-size: 0.95rem;
}

.social-link small {
    margin-top: 0.18rem;
    color: rgba(255, 248, 237, 0.62);
    font-size: 0.76rem;
    line-height: 1.25;
}

@media (max-width: 1120px) {
    .reader-shell {
        grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr);
    }

    .archive-card {
        position: static;
        grid-column: 1 / -1;
    }
}

@media (max-width: 820px) {
    .site-header {
        position: relative;
        align-items: flex-start;
    }

    .site-nav {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .brand span {
        max-width: 9rem;
    }

    .story-hero,
    .reader-shell,
    .social-footer-inner {
        grid-template-columns: 1fr;
    }

    .social-links {
        grid-template-columns: 1fr;
    }

    .story-hero {
        min-height: 28rem;
    }

    .chapter-rail {
        position: static;
    }

    .chapter-rail ol {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: none;
    }
}

@media (max-width: 560px) {
    .site-header {
        display: block;
    }

    .site-nav {
        justify-content: flex-start;
        margin-top: 0.6rem;
    }

    .site-nav a,
    .site-nav button {
        min-height: 2.15rem;
        padding: 0 0.58rem;
        font-size: 0.82rem;
    }

    .story-content {
        padding: 1.1rem;
    }

    .archive-photos {
        display: grid;
        padding: 1.15rem 1.1rem 0;
    }

    .archive-photo,
    .archive-photo:nth-child(even) {
        width: 100%;
        transform: rotate(-1deg);
    }

    .paper-topline,
    .page-turner {
        display: block;
    }

    .paper-topline span {
        display: block;
    }

    .paper-topline span + span {
        margin-top: 0.35rem;
    }

    .chapter-rail ol {
        grid-template-columns: 1fr;
    }
}
