/* ilias-latina site */

:root {
    --paper: #f7f3ea;
    --paper-raised: #fffdf8;
    --ink: #000;
    --ink-soft: #000;
    --ink-faint: #000;
    --link-soft: #5d554c;
    --link-faint: #6f665b;
    --rule: #ddd3c2;
    --rule-soft: #ebe4d6;
    --accent: #8a2f24;
    --accent-soft: #f1e1d9;
    --sidebar-bg: #efe8da;
    --sic-bg: #f6e7b8;
    --font-text: "Gentium Book Plus", "Gentium Plus", "Noto Serif", Georgia, serif;
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --sidebar-width: 17rem;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #1c1a17;
        --paper-raised: #23201c;
        --ink: #e8e1d5;
        --ink-soft: #b9b0a3;
        --ink-faint: #9a9184;
        --link-soft: #b9b0a3;
        --link-faint: #9a9184;
        --rule: #3b362f;
        --rule-soft: #2e2a25;
        --accent: #e09a85;
        --accent-soft: #3a2621;
        --sidebar-bg: #181613;
        --sic-bg: #4a3f1c;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: 1.5rem; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

/* --- layout ------------------------------------------------------------ */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 1.25rem 2rem;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--rule);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    line-height: 1.4;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 52rem;
    padding: 2.5rem 3rem 3rem;
}
/* Wider for the verse tables with a translation column. */
.content:has(table.verses.translated) { max-width: 64rem; }
.content:has(table.names) { max-width: 64rem; }

/* --- sidebar ----------------------------------------------------------- */


/* Japanese: serif and sans-serif fonts for the Japanese text. */
html[lang="ja"] body { font-family: var(--font-text), "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; line-height: 1.8; }
html[lang="ja"] .sidebar, html[lang="ja"] .page-footer, html[lang="ja"] .eyebrow {
    font-family: var(--font-ui), "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}
html[lang="ja"] .sidebar-title a { font-style: normal; }

.sidebar-title a {
    font-family: var(--font-text);
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}

.sidebar-group {
    margin: 1.5rem 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.sidebar-edition { margin-bottom: 1rem; }
.sidebar-overview { margin-top: 1.5rem; }

.sidebar-edition h2 { margin: 0 0 0.25rem; font-size: 0.9375rem; font-weight: 600; }

.sidebar a { color: var(--link-soft); text-decoration: none; }
.sidebar a:hover { color: var(--accent); }
.sidebar a.active { color: var(--accent); font-weight: 600; }
.sidebar-edition h2 a { color: var(--ink); }

.sidebar ul { list-style: none; margin: 0; padding: 0; }

.sidebar-files { padding-left: 0.75rem !important; border-left: 1px solid var(--rule); }
.sidebar-files > li { padding: 0.15rem 0; }

.sidebar-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin: 0.4rem 0 0.4rem !important;
}

.sidebar-pages a {
    display: inline-block;
    min-width: 2.4em;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    background: var(--paper-raised);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.sidebar-pages a:hover { background: var(--accent-soft); }

/* --- page header and prose -------------------------------------------- */

.page-header { margin-bottom: 2rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--rule); }

.eyebrow {
    margin: 0 0 0.25rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.eyebrow a { color: var(--link-faint); }

h1 { margin: 0; font-size: 2.25rem; line-height: 1.2; font-weight: 700; }

.source-note { margin-top: 0.75rem; color: var(--ink-soft); font-size: 0.95rem; }
.source-note p { margin: 0; }

.prose { max-width: 40rem; margin-bottom: 2rem; }
.prose h2 { margin: 2rem 0 0.75rem; font-size: 1.375rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }

.contents { margin-bottom: 2rem; }
.contents h2 { margin: 2rem 0 0.5rem; font-size: 1.375rem; }
.contents h3 { margin: 1.75rem 0 0.5rem; font-size: 1.0625rem; }
.contents .volume { margin: 0 0 0.25rem; font-size: 1.125rem; }
.contents .note { margin: 0 0 1rem; font-family: var(--font-ui); font-size: 0.875rem; color: var(--ink-soft); }
.contents .volume-title { max-width: 40rem; color: var(--ink-soft); font-size: 0.95rem; }
.contents .volume-title p { margin: 0 0 0.5rem; }
.contents .volume-title ul { margin: 0 0 0.5rem; padding-left: 1.25rem; }

.toc { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.toc li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.2rem 0;
    line-height: 1.45;
}
.toc .toc-title { flex: 0 1 auto; color: var(--ink-soft); }
.toc li::after { content: none; }
.toc .toc-page {
    flex: 1 0 auto;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-faint);
    white-space: nowrap;
}
.toc .toc-page::before {
    content: "";
    flex: 1;
    min-width: 1.5rem;
    border-bottom: 1px dotted var(--rule);
    transform: translateY(-0.25em);
}
.toc a, .toc a * { color: var(--accent); }

.file-list { border-collapse: collapse; width: 100%; font-size: 1rem; }
.file-list th {
    text-align: left;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom: 1px solid var(--rule);
    padding: 0.4rem 0.5rem;
}
.file-list td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--rule-soft); }
.file-list td:last-child { white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* --- transcription ----------------------------------------------------- */

.transcription { overflow-wrap: break-word; }
.transcription p { margin: 0 0 0.9rem; }
.transcription h2, .transcription h3 {
    margin: 1.5rem 0 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
/* The overview is prose: its sections are headed as text, not as the
   labels of a transcription. */
.overview h2, .overview h3 {
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
}
.overview h2 { margin: 2.5rem 0 0.75rem; font-size: 1.375rem; }
.overview h3 { margin: 1.75rem 0 0.5rem; font-size: 1.0625rem; }

.page-mark {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2.25rem 0 1rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}
.page-mark::before { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.page-mark a { color: var(--link-faint); text-decoration: none; }
.page-mark a:hover, .page-mark:target a { color: var(--accent); }
.transcription > .page-mark:first-child { margin-top: 0; }

/* Lists of notes and apparatus: smaller, with the label hanging. */
.transcription ul { list-style: none; margin: 0 0 1rem; padding: 0; font-size: 0.9rem; line-height: 1.5; }
.transcription li { margin: 0 0 0.35rem; padding-left: 1.25rem; text-indent: -1.25rem; }
.transcription li strong { color: var(--accent); font-weight: 700; }

/* Tables */
.transcription table { border-collapse: collapse; width: 100%; margin: 0 0 1.25rem; font-size: 0.95rem; }

/* The overview is prose: its lists are bulleted and its tables of quoted
   verses are set in the size of the text, not as notes and apparatus. */
.overview ul { list-style: disc; padding-left: 1.5rem; font-size: inherit; line-height: inherit; }
.overview ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.overview ul ul, .overview ul ol { margin: 0.35rem 0 0; }
.overview ul ul { list-style: circle; }
.overview li { padding-left: 0; text-indent: 0; }
.overview li > p { margin: 0 0 0.35rem; }
.overview table { font-size: inherit; }
html[lang="ja"] .overview table { font-size: 0.9rem; }
.transcription th {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    color: var(--ink-faint);
}
.transcription td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }

/* Verse tables: the verse text stands out, the numbers recede. */
table.verses td { border-bottom: none; padding-top: 0.1rem; padding-bottom: 0.1rem; }
table.verses tr:target td { background: var(--accent-soft); }
table.verses td.col-text { font-size: 1.0625rem; width: 100%; }
table.verses td:not(.col-text):not(.col-translation):not(.col-book) {
    white-space: nowrap;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-faint);
    padding-top: 0.3rem;
}
table.verses td.col-verse { text-align: right; min-width: 2.5rem; }
/* Baehrens's book numbers in his margin, in the face of the text. */
table.verses td.col-book { white-space: nowrap; font-size: 1.0625rem; color: var(--ink-faint); }
/* The translation of each verse beside it, on the pages of the translations. */
table.verses.translated td.col-text { width: 50%; }
table.verses.translated td.col-translation { width: 50%; padding-left: 1rem; font-size: 0.9375rem; color: var(--ink-soft); }
/* A verse number printed in the book (every fifth verse). */
table.verses td.col-verse strong { color: var(--ink-soft); font-weight: 600; }
table.verses th.col-verse { text-align: right; }
table.verses td.col-verse a { color: var(--link-faint); text-decoration: none; }
table.verses td.col-verse a strong { color: var(--link-soft); }
table.verses td.col-verse a:hover, table.verses tr:target td.col-verse a { color: var(--accent); }
table.verses td.col-verse a:hover strong, table.verses tr:target td.col-verse a strong { color: inherit; }

/* The note on the landing pages that the translations are machine-generated. */
.notice {
    margin: 0 0 2rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--paper-raised);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--ink-soft);
}
html[lang="ja"] .notice { font-family: var(--font-ui), "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif; }

/* Added in the transcription, not printed in the book. */
.transcriber-note {
    margin: 0 0 1rem;
    padding: 0.5rem 0.75rem;
    border-left: 2px solid var(--rule);
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-style: italic;
    color: var(--ink-faint);
}
.book-title {
    margin: 0.5rem 0 1.5rem;
    text-align: center;
    letter-spacing: 0.05em;
    line-height: 1.5;
}

/* A word printed so in the original (misprint). */
.sic { background: var(--sic-bg); border-radius: 2px; padding: 0 0.1em; cursor: help; }

/* --- pager and footer ------------------------------------------------- */

.pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-ui);
    font-size: 0.875rem;
}

.page-footer {
    margin-top: 3rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--ink-faint);
}
.page-footer p { margin: 0.25rem 0; }
.page-footer a { color: var(--link-soft); }

/* --- narrow screens ---------------------------------------------------- */

@media (max-width: 860px) {
    .layout { display: block; }
    .sidebar {
        position: static;
        width: auto;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--rule);
        padding: 1rem 16px;
    }
    .sidebar-edition { display: inline-block; vertical-align: top; margin-right: 1.5rem; }
    .sidebar-edition.current, .sidebar-poem { display: block; }
    .sidebar-edition:not(.current) .sidebar-files { display: none; }
    .content { padding: 1.5rem 16px 2rem; }
    h1 { font-size: 1.75rem; }
    table.verses td.col-homer, table.verses th.col-homer { display: none; }
    /* The translation goes under its verse. */
    table.verses.translated thead { display: none; }
    table.verses.translated tr { display: grid; grid-template-columns: auto 1fr; }
    table.verses.translated td.col-book { grid-column: 1 / -1; }
    table.verses.translated td.col-book:empty { display: none; }
    table.verses.translated td.col-text, table.verses.translated td.col-translation { width: auto; }
    table.verses.translated td.col-translation { grid-column: 2; padding: 0 0.5rem 0.4rem; }
}

/* --- variants of a text: the transcription and its translations --------- */

/* The rule under the tabs is a shadow, which the current tab covers, so
   that a row of tabs too wide for a phone can scroll on its own. */
.variant-tabs { display: flex; gap: 0.25rem; margin: 1rem 0 0; font-family: var(--font-ui); font-size: 0.875rem; box-shadow: inset 0 -1px 0 var(--rule); overflow-x: auto; scrollbar-width: none; }
.variant-tabs a, .variant-tabs span { flex: none; white-space: nowrap; padding: 0.375rem 0.75rem; border: 1px solid transparent; border-bottom: none; border-radius: 4px 4px 0 0; text-decoration: none; }
.variant-tabs a { color: var(--link-soft); }
.variant-tabs a:hover { color: var(--accent); }
.variant-tabs span { color: var(--ink); font-weight: 600; background: var(--paper); border-color: var(--rule); }
.draft-note { margin: 0.75rem 0 0; font-family: var(--font-ui); font-size: 0.875rem; color: var(--ink-soft); }
html[lang="ja"] .variant-tabs, html[lang="ja"] .draft-note { font-family: var(--font-ui), "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif; }

/* --- the poem: the Latin of The Latin Library and its commentary ------- */

.sidebar-poem { margin-top: 1.5rem; }
.sidebar-poem + .sidebar-overview { margin-top: 0; }
.sidebar-poem + .sidebar-names { margin-top: 0; }
.sidebar-names + .sidebar-overview { margin-top: 0; }
.sidebar-poem .sidebar-books { margin-top: 0.4rem !important; }
.sidebar-books { margin: 0 0 0.5rem !important; }
.sidebar-books a.active { background: var(--accent-soft); }
.ll-sign { background: var(--sic-bg); border-radius: 2px; padding: 0 0.1em; cursor: help; }
.poem h2 {
    margin: 2.5rem 0 0.5rem;
    font-family: var(--font-text);
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
}
.poem h2.summary { margin-top: 0; }
.poem table.verses { margin-top: 0.5rem; }
.book-table { border-collapse: collapse; width: 100%; max-width: 48rem; }
.book-table th, .book-table td { padding: 0.4rem 0.75rem 0.4rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.book-table th { font-family: var(--font-ui); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.book-table td.col-book, .book-table td.col-verses { white-space: nowrap; font-variant-numeric: tabular-nums; }
.book-table td.col-verses { color: var(--ink-soft); }
.book-table .col-verses { padding-right: 1.25rem; }
/* The link from a section to the same section in the commentary or the
   reading, and the groups of verses of a reading. */
.poem h2 .section-link { margin-left: 0.5rem; font-family: var(--font-ui); font-size: 0.8125rem; font-weight: 400; color: var(--link-soft); text-decoration: none; white-space: nowrap; }
.poem h2 .section-link:hover { color: var(--accent); text-decoration: underline; }
.reading-group { margin-top: 1.25rem; }
.reading-group table.verses { margin: 0 0 0.6rem; }
/* The proper names: at the end of the commentary of a book, and all of
   them on a page of their own. */
.poem table.names { margin-top: 0.5rem; }
table.names { font-size: 0.875rem; }
table.names tr:target td { background: var(--accent-soft); }
table.names td.col-desc { width: 40%; }
table.names td.col-books { width: 12%; }
table.names td.col-loc, table.names td.col-books { font-family: var(--font-ui); font-size: 0.75rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
table.names td a { text-decoration: none; }
table.names td.col-loc a, table.names td.col-books a { white-space: nowrap; }
table.names td.col-loc { width: 35%; }
.poem table.names td.col-desc { width: 30%; }
table.names td a:hover { text-decoration: underline; }
@media (max-width: 860px) {
    /* A row is a block: the names on a line, then the description and the
       locations. */
    table.names thead { display: none; }
    table.names tr { display: block; padding: 0.4rem 0; border-bottom: 1px solid var(--rule-soft); }
    table.names td { display: inline; padding: 0 0.5rem 0 0; border: none; white-space: normal !important; }
    table.names td.col-desc, table.names td.col-loc, table.names td.col-books { display: block; width: auto !important; padding: 0.15rem 0 0; }
}
