/* ============================================================
   Edition title page  —  /texts/{sigil}  and  /preview/{sigil}
   ============================================================

   Applies to article.titlepage, which contains:
     section.title-credits    — hgroup, editor credits, contributor dl
     section.publication-info — publication paragraphs, ISBNs, rights
     section.edition-toc      — catalogue-driven table of contents

   Typography (font-family, base h1 centering) comes from main.css.
   This file handles layout, spacing, and title-page-specific elements
   only — nothing here belongs on any other page.
*/

/* ---- Outer container ---------------------------------------- */

/*
 * Flex column lets us use CSS order to place .edition-toc between
 * .title-credits and .contributors/.publication-info, even though
 * .edition-toc is a sibling of div.titlepage-meta in the DOM.
 * display:contents on the wrapper makes its children direct flex items.
 */
article.titlepage {
    max-width: 960px;
    margin: 0 auto;
    padding: 2em 1em 4em;
    text-align: center;
    display: flex;
    flex-direction: column;
}

div.titlepage-meta       { display: contents; }
section.title-credits    { order: 1; }
section.edition-toc      { order: 2; }
section.edition-credits  { order: 3; }
dl.contributors          { order: 4; }
div.titlepage-downloads  { order: 5; }
section.publication-info { order: 6; }

/* ---- Title and credits -------------------------------------- */

.title-credits {
    margin-bottom: 0.5em;
}

/* Explicit size overrides browser UA-stylesheet reductions for h1
   nested inside sectioning elements (article > section), which
   Chrome and Safari apply differently. 2.5rem ≈ 40px at 16px root.
   text-wrap: balance evens out line lengths when the title wraps. */
.title-credits h1 {
    font-size: 2.5rem;
    text-wrap: balance;
}

/* Series eyebrow: archive name + volume, above the shelfmark h1 */
.series-eyebrow {
    font-family: var(--font-heading);
    font-size: 1em;
    font-variant: small-caps;
    letter-spacing: 0.04em;
    color: var(--color-text-faint);
    margin: 0 0 0.3em;
}

/* Series designation (title[2]): below the shelfmark h1 */
.series-designation {
    font-family: var(--font-heading);
    font-size: 1em;
    color: var(--color-text-faint);
    margin: 0.4em 0 0;
}

/* ---- Edition credits (author + editors) -------------------- */

.edition-credits {
    margin-bottom: 2em;
}

.edition-author {
    font-size: 1.4em;
    margin: 1em 0 0.6em;
}

/* Main editors line — the "Edited by X, Y, and Z" paragraph.  Lives
   inside .title-credits (above the fold) and is sized larger than body
   text to give the edition's principal editorship the same visual
   weight as the other first-screen metadata.  Smaller than the author
   line so author > editors > body stays a clear hierarchy. */
p.main-editors {
    font-size: 1.2em;
    margin: 0.4em 0;
    text-wrap: balance;
}

dl.editor-credits {
    margin: 0;
    line-height: 1.8;
}

/* Render each dt/dd pair on one line: "Role: names" */
dl.editor-credits dt,
dl.editor-credits dd {
    display: inline;
    margin: 0;
}

dl.editor-credits dt::after {
    content: ": ";
}

/* Force a line break after each role+names pair */
dl.editor-credits dd::after {
    content: "";
    display: block;
}

/* respStmt contributor blocks as definition list */
dl.contributors {
    margin: 1.5em 0;
}

dl.contributors dt {
    font-weight: bold;
    margin-top: 1.25em;
}

dl.contributors dd {
    margin: 0.25em 0 0;
}

ul.contributor-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;       /* centers the block */
    text-align: left;     /* overrides article.titlepage text-align:center */
    columns: 10em;        /* auto column count: 4 cols at max-width → one row
                             for a 4-name list; 2 rows for 6 names.
                             max-width accounts for default 1em column gaps:
                             4 × 10em + 3 × 1em gap = 43em → round up to 44em */
    max-width: 44em;
}

ul.contributor-list li {
    padding: 0.1em 0;
    break-inside: avoid;
}

/* ---- Publication info -------------------------------------- */

.publication-info {
    margin-top: 2.5em;
    font-size: 0.9em;
}

.publication-info p {
    margin: 0.5em 0;
}

.pub-isbn {
    margin-top: 1em;
}

.image-rights,
.copyright {
    margin-top: 1em;
    font-style: italic;
}

/* ---- Table of contents ------------------------------------- */

.edition-toc {
    margin-top: 3em;
    text-align: left;
    border-top: 1px solid var(--color-border);
    padding-top: 1em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1em;
}

.edition-toc h2 {
    text-align: center;
    margin-bottom: 1em;
}

/* Details/summary mechanism and item styles are shared via
   details.text-nav in main.css. Only container-specific rules below. */

/* ---- Downloads --------------------------------------------- */

.titlepage-downloads {
    margin-top: 2em;
    text-align: center;
}

.titlepage-downloads a {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.9em;
    color: var(--color-link);
    text-decoration: none;
}

.titlepage-downloads a:hover {
    text-decoration: underline;
}

.titlepage-downloads .icon-download {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

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

/*
 * On narrow screens, move the TOC immediately after the title so
 * edition navigation is visible on the first screen. Author and
 * editor credits drop below the TOC. The order values here override
 * the desktop values set at the top of this file.
 */
/* At desktop the auto-margin centering already provides separation from
   viewport edges, so inline padding is not needed.  Without this override,
   the border-box sizing on article (main.css) would shrink the content
   area from 960px to 928px at desktop. */
@media (min-width: 900px) /* ≥ --bp-desktop */ {
    article.titlepage {
        padding-inline: 0;
    }
}

@media (max-width: 640px) {
    .title-credits h1       { font-size: 1.8rem; }
    section.edition-toc     { margin-top: 1em; }
    section.edition-credits { margin-top: 2em; }
}
