@import url("https://fonts.googleapis.com/css2?family=Abril+Fatface&family=IBM+Plex+Mono:wght@400;500;600;700&family=Oswald:wght@500;600;700&family=Source+Sans+3:wght@400;600&display=swap");

:root {
    --ink: #1a1a1a;
    --muted: #555555;
    --soft: #777777;
    --line: #1a1a1a;
    --dash: #888888;
    --gold: #9a7d55;
    --shell: min(980px, calc(100% - 3rem));
    --font-brand: "Abril Fatface", "Times New Roman", serif;
    --font-display: "Oswald", "Arial Narrow", sans-serif;
    --font-mono: "IBM Plex Mono", "Courier New", monospace;
    --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.5;
    background: #f0eeea;
}

.atmosphere {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: #f0eeea;
    background-image: url("../images/paper.png");
    background-size: 2048px 2048px;
    background-position: center top;
    background-repeat: repeat;
}

.atmosphere::before,
.atmosphere::after {
    content: none;
}

.shell {
    width: var(--shell);
    margin: 0 auto;
    padding: 2.5rem 0 3rem;
}

/* —— Header —— */
.site-header {
    margin: 0;
    padding: 0 0 1.15rem;
    border-bottom: 1.5px solid var(--line);
}

.site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.site-header__motif {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    pointer-events: none;
}

.site-header__motif img {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    max-height: 112px;
    object-fit: contain;
}

.site-header__aside {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    text-align: right;
}

.header-search {
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.header-search:hover { opacity: 0.65; }

.is-doc .site-header {
    padding-bottom: 0.8rem;
    border-bottom-color: rgba(0, 0, 0, 0.2);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    margin: 0;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.15s ease;
}

.brand-mark a {
    display: inline-flex;
    text-decoration: none;
}

.brand-mark:hover,
.brand-mark a:hover { opacity: 0.68; }

.brand-mark img {
    display: block;
    width: 140px;
    height: 140px;
}

.tagline {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0;
    max-width: 16rem;
}

/* —— Ledger table —— */
.ledger {
    margin: 0;
    padding: 0;
}

.ledger-head {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr) 6.25rem;
    gap: 1.5rem;
    padding: 1.15rem 0 0.55rem;
    border-bottom: 1.5px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.row-link {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr) 6.25rem;
    gap: 1.5rem;
    padding: 0.85rem 0;
    border-bottom: 1px dashed var(--dash);
    color: inherit;
    text-decoration: none;
}

.row-link:hover .row-title { text-decoration: underline; text-underline-offset: 2px; }
.row-link:hover .row-more { color: var(--ink); }

.row-id {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 0.12rem;
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.row-id-code {
    font-weight: 400;
}

.row-title {
    margin: 0 0 0.35rem;
    font-family: var(--font-mono);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
}

.row-excerpt {
    margin: 0;
    max-width: 58ch;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.85;
}

.row-more {
    justify-self: end;
    align-self: start;
    padding-top: 0.15rem;
    font-size: 0.9rem;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

/* —— Search (search page only) —— */
.search--page {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 1.25rem 0 0.5rem;
    border-bottom: 1px solid var(--ink);
    max-width: 28rem;
}

.search--page input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.4rem 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--ink);
    outline: none;
}

.search--page button {
    border: 0;
    background: transparent;
    padding: 0.4rem 0 0.4rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: underline;
    cursor: pointer;
    color: var(--ink);
}

/* —— Detail —— */
.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1.5rem 0 1.75rem;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--soft);
}

.crumbs--index {
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    margin: 1rem 0 0;
}

.crumbs a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.crumbs span[aria-hidden] { color: var(--dash); }

.doc {
    background: transparent;
    border: 0;
    padding: 0 0 3rem;
    max-width: 38rem;
}

.doc-title {
    margin: 0 0 0.75rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 5.8vw, 3.4rem);
    letter-spacing: 0.02em;
    line-height: 1.02;
    text-transform: uppercase;
}

.doc-meta {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.86rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--soft);
}

.doc-budget {
    margin: 1.15rem 0 1.65rem;
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--gold);
}

.doc-body {
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: 1.75;
    color: #222;
}

.doc-body p { margin: 0 0 1.1rem; }

.doc-cats {
    margin-top: 2.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.14);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    align-items: baseline;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.doc-cats .label { color: var(--soft); }
.doc-cats a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.doc-cats .sep { color: var(--dash); }

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pagination a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pagination .disabled {
    color: var(--muted);
    border-bottom: 1px dashed var(--dash);
}

/* —— Footer —— */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    margin-top: 0;
    padding-top: 1rem;
    border-top: 1.5px solid var(--line);
    color: var(--ink);
    font-size: 0.82rem;
    line-height: 1.45;
}

.site-footer p { margin: 0; }

.footer-search {
    margin-left: 0.5rem;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 720px) {
    .shell {
        width: calc(100% - 1.5rem);
        padding-top: 1.75rem;
    }

    .site-header__bar {
        flex-wrap: wrap;
        align-items: center;
    }

    .site-header__motif {
        order: 3;
        flex: 1 1 100%;
        margin-top: 0.35rem;
    }

    .site-header__motif img {
        max-height: 72px;
    }

    .brand-mark img {
        width: 112px;
        height: 112px;
    }

    .tagline {
        font-size: 0.85rem;
        max-width: 11rem;
    }

    .ledger-head,
    .row-link {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .ledger-head span:last-child { display: none; }

    .row-more { justify-self: start; }

    .site-footer { flex-direction: column; }
}
