/**
 * Stone Soup — Contents Page Styles (V3 Typographic Hybrid)
 *
 * Book-style table-of-contents layout for navigation landing pages.
 * Loaded conditionally on pages using the "Table of Contents" template.
 *
 * Design: Large colored section headings, per-entry Orphist color cycling,
 * dot leaders, EB Garamond italic descriptions, indented entry blocks.
 * Inspired by Stone Soup magazine print contents pages.
 *
 * Uses --stonesoup-* CSS variables from style.css :root.
 *
 * @package StoneSoup
 * @version 5.5.1
 */


/* ════════════════════════════════════════════
   PAPER CONTAINER
   White page on linen surface, classical book margins.
   .sss-tint-block provides the linen background.
   ════════════════════════════════════════════ */

/* .contents-paper is now a transparent inner wrapper — all paper framing
   (background, width, shadow, margins) comes from .sss-tint-block,
   same as listing/archive pages. One book, one page width. */
.contents-paper {
    max-width: var(--stonesoup-content-max-width, 62rem);
}


/* ════════════════════════════════════════════
   PAGE HEADING — Approach B: Inline Header
   Thumbnail next to title, compact. Same image appears
   on the listing page for visual continuity.
   ════════════════════════════════════════════ */

/* No rule between header and content — classical "sink" (4rem).
   The first section heading's colored rule is the first horizontal
   line on the page. Matches Tschichold's 3–4 line-height guidance. */

.contents-header-row {
    display: flex;
    align-items: flex-start;
    gap: 1.8rem;
    margin-bottom: 4rem;
}

.contents-hero-thumb {
    width: 210px;
    height: 210px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.contents-header-text {
    flex: 1;
    padding-top: 0.3rem;
}

/* .contents-formal-label removed v4.16.0 — classical books don't label the contents page */

.contents-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 3.6rem;
    line-height: 1.05;
    margin: 0 0 0.15rem;
    /* Color set inline via accent color in page-contents.php */
}

.contents-subtitle {
    font-family: 'EB Garamond', serif;
    font-size: 1.15rem;
    font-style: italic;
    color: var(--stonesoup-text-muted, #736a5e);
    margin: 0;
}

/* .contents-rule removed v4.16.0 — replaced by 4rem sink whitespace */


/* ════════════════════════════════════════════
   SECTION GROUPS
   Large Cormorant headings, colored, with colored underline.
   Generous spacing between sections.
   ════════════════════════════════════════════ */

.contents-section {
    margin-bottom: 3.2rem;
}

.contents-section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 0.3rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid currentColor;
}

/* Cycle section heading colors through the 6 Orphist colors */
/* !important needed: site-wide critical CSS sets h2 { color: #2a2520 !important } */
.contents-section:nth-child(6n+1) .contents-section-heading { color: var(--stonesoup-color-story, #c04a25) !important; }
.contents-section:nth-child(6n+2) .contents-section-heading { color: var(--stonesoup-color-poetry, #2560a0) !important; }
.contents-section:nth-child(6n+3) .contents-section-heading { color: var(--stonesoup-color-art, #5c3db8) !important; }
.contents-section:nth-child(6n+4) .contents-section-heading { color: var(--stonesoup-color-review, #9a6b1e) !important; }
.contents-section:nth-child(6n+5) .contents-section-heading { color: var(--stonesoup-color-memoir, #1a826a) !important; }
.contents-section:nth-child(6n+6) .contents-section-heading { color: var(--stonesoup-color-editorial, #a03058) !important; }


/* ════════════════════════════════════════════
   TOC ENTRIES
   Indented under section headings.
   Title — dot leader — description (EB Garamond italic).
   Per-entry Orphist color cycling for the rainbow effect.
   ════════════════════════════════════════════ */

.contents-entries {
    padding-left: 1.8rem;
}

.contents-entry {
    display: flex;
    align-items: baseline;
    padding: 0.55rem 0;
    text-decoration: none;
    transition: opacity 0.15s;
}

.contents-entry:hover {
    opacity: 0.65;
}

/* No visited-link color change */
.contents-entry:visited .entry-title,
.contents-entry:visited .entry-desc {
    color: inherit;
}

.entry-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.55rem;
    line-height: 1.3;
    flex-shrink: 0;
}

/* Rainbow: cycle each ENTRY through the 6 Orphist colors.
   Color is on the entry itself so both title AND description inherit it. */
.contents-entry:nth-child(6n+1) { color: var(--stonesoup-color-story, #c04a25); }
.contents-entry:nth-child(6n+2) { color: var(--stonesoup-color-poetry, #2560a0); }
.contents-entry:nth-child(6n+3) { color: var(--stonesoup-color-art, #5c3db8); }
.contents-entry:nth-child(6n+4) { color: var(--stonesoup-color-review, #9a6b1e); }
.contents-entry:nth-child(6n+5) { color: var(--stonesoup-color-memoir, #1a826a); }
.contents-entry:nth-child(6n+6) { color: var(--stonesoup-color-editorial, #a03058); }

.entry-dots {
    flex: 1;
    border-bottom: 1px dotted #d0ccc6;
    margin: 0 0.8rem;
    min-width: 1.5rem;
    position: relative;
    top: -0.25rem;
}

.entry-desc {
    font-family: 'EB Garamond', serif;
    font-size: 1.05rem;
    font-style: italic;
    /* Color inherited from .contents-entry — matches the title's Orphist color */
    text-align: right;
}

/* Arrow indicator for entries linking to sub-contents pages */
.entry-arrow {
    color: #bbb;
    margin-left: 0.4rem;
    font-style: normal;
}


/* ════════════════════════════════════════════
   BACK LINK
   ← arrow + text to homepage
   ════════════════════════════════════════════ */

.contents-back-link {
    display: inline-block;
    margin-top: 3rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    color: #999;
    text-decoration: none;
    letter-spacing: 0.05em;
}

.contents-back-link::before {
    content: '\2190\00a0';
}

.contents-back-link:hover {
    color: var(--stonesoup-text-dark, #2a2520);
}


/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */

/* Responsive padding now handled by .sss-tint-block (sss-listing.css) */

@media (max-width: 600px) {
    .contents-header-row {
        gap: 1.2rem;
        margin-bottom: 2.5rem;
    }

    .contents-hero-thumb {
        width: 120px;
        height: 120px;
    }

    .contents-title {
        font-size: 2.4rem;
    }

    .contents-section-heading {
        font-size: 1.6rem;
    }

    .entry-title {
        font-size: 1.3rem;
    }

    .contents-entries {
        padding-left: 1rem;
    }

    /* Stack entry on narrow screens — title above, desc below */
    .contents-entry {
        flex-wrap: wrap;
    }

    .entry-dots {
        display: none;
    }

    .entry-desc {
        width: 100%;
        text-align: left;
        margin-top: 0.1rem;
        font-size: 0.9rem;
    }
}
