@font-face {
    font-family: AdventureSerif;
    src: url('../assets/fonts/adventure/noto-serif-sc.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    color-scheme: light;
    --paper: #f3ebdd;
    --ink: #352c27;
    --gold: #a78959;
    --red: #934c43;
    --muted: #786a5b;
    --line: rgba(112,87,55,.24);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 94px;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: AdventureSerif,'Songti SC','STSong',serif;
    background-image: radial-gradient(ellipse at 10% 0,rgba(167,137,89,.1),transparent 45%),linear-gradient(90deg,rgba(167,137,89,.04),transparent 25%,transparent 75%,rgba(167,137,89,.04));
    overflow-wrap: anywhere;
}

button,a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

a {
    color: inherit;
    text-underline-offset: 5px;
}

button,a,summary {
    touch-action: manipulation;
}

button {
    cursor: pointer;
}

a:focus-visible,button:focus-visible,summary:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 6px;
}

button:disabled {
    cursor: default;
}

[hidden] {
    display: none!important;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 22px;
    background: var(--paper);
    padding: 12px;
    z-index: 10;
}

.skip-link:focus {
    top: 10px;
}

.book-topbar {
    height: 76px;
    padding: 0 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    gap: 12px;
}

.quiet-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border: 0;
    background: none;
    text-decoration: none;
    font-size: 13px;
    color: var(--muted);
}

.quiet-button[aria-pressed=true] {
    color: var(--red);
}

.topbar-mark {
    font-size: 13px;
    letter-spacing: .24em;
    color: var(--gold);
}

.book {
    max-width: 880px;
    margin: auto;
    padding: 0 50px;
}

.book-cover {
    text-align: center;
    padding: 94px 0 70px;
}

.eyebrow {
    font-family: Georgia,serif;
    font-size: 10px;
    letter-spacing: .26em;
    color: var(--muted);
}

.cover-ornament {
    font-size: 25px;
    color: var(--gold);
    margin: 32px 0 25px;
}

h1 {
    font-size: 52px;
    line-height: 1.5;
    letter-spacing: .13em;
    font-weight: 500;
    margin: 0;
}

h1 span {
    display: block;
    font-size: 39px;
    letter-spacing: .28em;
    padding-left: .28em;
}

.cover-subtitle {
    font-size: 15px;
    line-height: 1.9;
    color: var(--muted);
    margin: 27px 0;
}

.cover-rule {
    width: 42px;
    height: 1px;
    background: var(--gold);
    margin: 33px auto 23px;
}

.cover-note {
    font-size: 12px;
    letter-spacing: .2em;
    color: var(--muted);
}

.cover-begin {
    display: inline-flex;
    gap: 30px;
    text-decoration: none;
    font-size: 13px;
    margin-top: 34px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.book-navigation {
    border-block: 1px solid var(--line);
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 17px 0;
    font-size: 13px;
    margin-bottom: 66px;
}

.book-navigation details {
    flex: 1;
    min-width: 0;
}

.book-navigation summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    min-height: 28px;
    align-items: center;
}

.book-navigation summary::-webkit-details-marker {
    display: none;
}

.book-navigation summary>span:first-child:after {
    content: ' ＋';
    color: var(--gold);
}

.book-navigation details[open] summary>span:first-child:after {
    content: ' −';
}

#adventure-count {
    color: var(--muted);
    font-size: 11px;
}

.book-navigation>a {
    white-space: nowrap;
    padding-top: 5px;
    text-decoration: none;
    color: var(--red);
}

#adventure-toc {
    padding: 15px 0 7px;
}

#adventure-toc details {
    margin: 12px 0;
}

#adventure-toc a {
    display: block;
    padding: 10px 0;
    text-decoration: none;
    color: var(--muted);
    line-height: 1.7;
}

#adventure-toc a:hover {
    color: var(--red);
}

.journal-entry {
    max-width: 680px;
    margin: 0 auto 86px;
    scroll-margin-top: 40px;
}

.entry-date {
    font-family: Georgia,serif;
    color: var(--red);
    letter-spacing: .12em;
    font-size: 12px;
}

.entry-chapter {
    font-size: 11px;
    letter-spacing: .12em;
    color: var(--muted);
    margin-bottom: 18px;
}

.journal-entry h2 {
    font-size: 30px;
    font-weight: 500;
    line-height: 1.6;
    margin: 13px 0 30px;
}

.entry-body {
    font-size: 18px;
    line-height: 1.95;
    letter-spacing: .025em;
}

.entry-body p {
    margin: 0 0 1.4em;
}

.entry-body h3,.entry-body h4 {
    font-weight: 600;
    line-height: 1.6;
    margin: 2em 0 1em;
}

.entry-body h3 {
    font-size: 23px;
}

.entry-body h4 {
    font-size: 20px;
}

.entry-body blockquote {
    margin: 32px 0;
    padding: 6px 0 6px 24px;
    border-left: 2px solid var(--gold);
    color: var(--muted);
}

.entry-body ul,.entry-body ol {
    padding-left: 1.5em;
}

.entry-body li {
    padding-left: 5px;
    margin: 8px 0;
}

.entry-body hr {
    border: 0;
    width: 36px;
    height: 1px;
    background: var(--gold);
    margin: 45px auto;
}

.photo-pair {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 18px;
    align-items: start;
}

.journal-photo {
    margin: 34px 0;
}

.photo-pair .journal-photo {
    margin: 20px 0;
}

.journal-photo button {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    width: 100%;
    cursor: zoom-in;
}

.journal-photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    border: 6px solid rgba(255,255,255,.6);
    box-shadow: 0 4px 16px rgba(53,44,39,.07);
}

figcaption {
    font-size: 12px;
    line-height: 1.8;
    text-align: center;
    color: var(--muted);
    margin-top: 12px;
}

.book-status {
    text-align: center;
    padding: 15px 0 65px;
    max-width: 380px;
    margin: auto;
}

.book-status p {
    font-size: 14px;
    line-height: 2;
}

.loading-track {
    height: 1px;
    background: var(--line);
    margin-top: 25px;
}

.loading-track span {
    display: block;
    background: var(--gold);
    height: 100%;
    width: 0;
    transition: width .25s;
}

.loading-details {
    display: flex;
    justify-content: space-between;
    font: 11px Georgia,serif;
    color: var(--muted);
    padding-top: 12px;
}

.empty-page {
    text-align: center;
    border: 1px solid var(--line);
    padding: 54px 24px 48px;
    max-width: 680px;
    margin: auto;
}

.empty-page>span {
    font-size: 26px;
    color: var(--gold);
}

.empty-page h2 {
    font-size: 24px;
    font-weight: 500;
    margin: 23px 0 18px;
}

.empty-page p {
    font-size: 15px;
    line-height: 2.1;
    color: var(--muted);
    margin: 0;
}

.empty-page button {
    border: 1px solid var(--line);
    background: none;
    padding: 10px 24px;
    margin-top: 22px;
    color: var(--ink);
}

.book-colophon {
    text-align: center;
    color: var(--muted);
    padding: 65px 0 58px;
    font-size: 12px;
}

.book-colophon>span {
    color: var(--gold);
    font-size: 18px;
}

.book-colophon p {
    letter-spacing: .12em;
    margin: 20px 0 28px;
}

.book-colophon a {
    text-decoration: none;
    font-size: 11px;
}

.reading-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    z-index: 5;
}

.reading-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--red);
}

.page-sound-resume {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: none;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    padding: 12px 18px;
    font-size: 12px;
    z-index: 6;
}

.page-sound-resume.is-visible {
    display: flex;
}

.page-sound-resume svg {
    width: 15px;
    height: 15px;
}

dialog {
    border: 0;
    padding: 20px 28px;
    color: var(--paper);
    background: #211d19;
    width: calc(100% - 48px);
    max-width: 1200px;
    height: calc(100dvh - 48px);
    max-height: none;
}

dialog::backdrop {
    background: rgba(15,12,10,.9);
    backdrop-filter: blur(8px);
}

.lightbox-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    height: 44px;
}

.lightbox-toolbar button {
    width: 44px;
    height: 44px;
    color: var(--paper);
    background: none;
    border: 1px solid #ffffff30;
    font-size: 24px;
    margin-left: 10px;
}

.lightbox-stage {
    height: calc(100% - 100px);
    overflow: auto;
    display: grid;
    place-items: center;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.lightbox-stage.is-zoomed {
    display: block;
}

.lightbox-stage.is-zoomed img {
    max-width: none;
    max-height: none;
    width: 150%;
    height: auto;
    cursor: zoom-out;
}

#lightbox-caption {
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
    margin: 14px 0;
}

.journal-entry {
    animation: page-settle .6s ease both;
}

@keyframes page-settle {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media(max-width:600px) {
    html {
        scroll-padding-top: 35px;
    }
    .book-topbar {
        height: 66px;
        padding: 0 22px;
    }
    .quiet-button {
        font-size: 12px;
        gap: 7px;
    }
    .topbar-mark {
        display: none;
    }
    .book {
        padding: 0 22px;
    }
    .book-cover {
        padding: 66px 0 52px;
    }
    h1 {
        font-size: 37px;
        letter-spacing: .1em;
    }
    h1 span {
        font-size: 30px;
    }
    .cover-ornament {
        margin: 26px 0 23px;
    }
    .cover-subtitle {
        font-size: 13px;
        margin-top: 24px;
    }
    .cover-begin {
        margin-top: 23px;
    }
    .book-navigation {
        margin-bottom: 42px;
        gap: 15px;
    }
    .journal-entry {
        margin-bottom: 64px;
    }
    .journal-entry h2 {
        font-size: 26px;
        margin-bottom: 25px;
    }
    .entry-body {
        font-size: 17px;
        line-height: 1.9;
        letter-spacing: .01em;
    }
    .photo-pair {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .photo-pair .journal-photo {
        margin: 20px 0;
    }
    .entry-body h3 {
        font-size: 22px;
    }
    .entry-body h4 {
        font-size: 19px;
    }
    .empty-page {
        padding: 42px 19px;
    }
    .empty-page h2 {
        font-size: 22px;
    }
    .empty-page p {
        font-size: 14px;
    }
    .book-colophon {
        padding-top: 48px;
    }
    dialog {
        width: 100%;
        height: 100dvh;
        margin: 0;
        padding: 12px 15px;
    }
    .page-sound-resume {
        right: 18px;
        bottom: 18px;
    }
}

body {
    background: #141119;
    background-image: radial-gradient(ellipse at 15% 10%,rgba(149,97,119,.14),transparent 50%),radial-gradient(ellipse at 90% 70%,rgba(167,137,89,.12),transparent 55%),linear-gradient(145deg,#1b1520,#111016 65%,#1d1718);
    min-height: 100vh;
}

.book-topbar {
    color: #eee1d3;
    border-bottom-color: #ead8bd1c;
    max-width: 1440px;
    margin: auto;
}

.book-topbar .quiet-button {
    color: #d1bfae;
}

.book-topbar .quiet-button[aria-pressed=true] {
    color: #e0b287;
}

.book-topbar .topbar-mark {
    color: #b79a70;
}

.book {
    background-color: var(--paper);
    background-image: radial-gradient(ellipse at 10% 0,rgba(167,137,89,.1),transparent 45%),linear-gradient(90deg,rgba(167,137,89,.04),transparent 25%,transparent 75%,rgba(167,137,89,.04));
    margin: 28px auto 60px;
    box-shadow: 0 12px 70px #0005;
    border: 1px solid #b59a6d30;
    min-height: calc(100vh - 164px);
}

.lightbox-toolbar button:disabled {
    opacity: .25;
}

.cover-subtitle {
    max-width: 100%;
}

@media(min-width:1100px) {
    .book {
        max-width: 1100px;
        padding: 0 50px;
    }
    .book-cover {
        max-width: 680px;
        margin: auto;
    }
    #adventure-reader {
        display: grid;
        grid-template-columns: 180px minmax(0,680px);
        column-gap: 65px;
        justify-content: center;
        align-items: start;
    }
    .book-navigation {
        position: sticky;
        top: 30px;
        grid-column: 1;
        grid-row: 1;
        display: block;
        margin: 0;
        font-size: 12px;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    .book-navigation>a {
        display: block;
        margin-top: 20px;
        padding-top: 18px;
        border-top: 1px solid var(--line);
    }
    .book-navigation summary {
        gap: 10px;
    }
    #adventure-count {
        font-size: 10px;
    }
    #adventure-entries {
        grid-column: 2;
        min-width: 0;
    }
    .book-colophon {
        grid-column: 2;
    }
    .empty-page {
        min-height: 300px;
    }
    .book-navigation>details>summary {
        font-size: 13px;
    }
    #adventure-toc details summary {
        line-height: 1.7;
    }
}

@media(max-width:600px) {
    .book {
        margin: 0;
        box-shadow: none;
        border: 0;
        min-height: calc(100vh - 66px);
    }
    .lightbox-toolbar button {
        width: 36px;
        height: 40px;
        margin-left: 5px;
    }
    .lightbox-toolbar {
        gap: 8px;
    }
    .lightbox-toolbar>div {
        display: flex;
    }
    .book-topbar .quiet-button {
        color: #d1bfae;
    }
}

@media(prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto;
    }
    *,*::before,*::after {
        animation: none!important;
        transition: none!important;
    }
}
