/* ══════════════════════════════════════════════════════════════════════════════
   Materials Pages — Stylesheet
   ══════════════════════════════════════════════════════════════════════════════
   Styles for /materials/ index and per-manuscript materials pages.
   Loaded via <link> in templates/materials.html and html/materials/index.html.
   Uses design tokens from main.css.
   ══════════════════════════════════════════════════════════════════════════════ */


/* ── §1  Page Layout ─────────────────────────────────────────────────────── */

.materials-page {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 1rem;
}

.materials-page h1 {
    margin-bottom: 0.25rem;
}

.materials-page > a {
    display: inline-block;
    margin-bottom: 1.5rem;
}


/* ── §2  Status Indicators ───────────────────────────────────────────────── */

/*
 * Status shapes encode status via both color AND shape (WCAG 1.4.1):
 *   published  → circle (green)
 *   preview    → diamond (orange)
 *   restricted → diamond (orange)
 *   unrefined  → square (grey)
 */

/* Inline indicator used in the index listing */
.status-dot {
    display: inline-block;
    width: 0.75em;
    height: 0.75em;
    margin-right: 0.35em;
    vertical-align: baseline;
    flex-shrink: 0;
}

/* Published: circle */
.status-dot-published {
    background-color: light-dark(#4caf50, #66bb6a);
    border-radius: 50%;
}

/* Preview / Restricted: diamond */
.status-dot-preview,
.status-dot-restricted {
    background-color: light-dark(#ff9800, #ffa726);
    border-radius: 0;
    transform: rotate(45deg);
    /* Scale down slightly so rotated square fits the same visual space */
    width: 0.6em;
    height: 0.6em;
    margin-right: 0.45em;
    margin-left: 0.05em;
}

/* Unrefined: square */
.status-dot-unrefined {
    background-color: light-dark(#9e9e9e, #bdbdbd);
    border-radius: 0;
}

/* Banner used on individual materials pages */
.materials-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 1rem 0;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.materials-status .status-indicator {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* Banner shapes mirror the inline shapes */
.materials-status-published .status-indicator {
    background-color: light-dark(#4caf50, #66bb6a);
    border-radius: 50%;
}

.materials-status-preview .status-indicator,
.materials-status-restricted .status-indicator {
    background-color: light-dark(#ff9800, #ffa726);
    border-radius: 0;
    transform: rotate(45deg);
    width: 0.8em;
    height: 0.8em;
}

.materials-status-unrefined .status-indicator {
    background-color: light-dark(#9e9e9e, #bdbdbd);
    border-radius: 0;
}

.materials-status-published  .status-indicator { background-color: light-dark(#4caf50, #66bb6a); }
.materials-status-preview    .status-indicator,
.materials-status-restricted .status-indicator { background-color: light-dark(#ff9800, #ffa726); }
.materials-status-unrefined  .status-indicator { background-color: light-dark(#9e9e9e, #bdbdbd); }


/* ── §3  Status Key (index page) ─────────────────────────────────────────── */

.materials-status-key ul {
    list-style: none;
    padding-left: 0;
}

.materials-status-key li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.materials-status-key .status-dot {
    margin-top: 0.25em;
}


/* ── §4  Materials Listing (index page) ──────────────────────────────────── */

.materials-listing h2 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.materials-listing h3 {
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    color: var(--color-text-strong);
}

ul.materials-list {
    list-style: none;
    padding-left: 0;
}

ul.materials-list li {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.materials-counts {
    color: var(--color-text-muted);
    font-size: 0.9em;
}


/* ── §5  Data Files Section ──────────────────────────────────────────────── */

.materials-data {
    margin: 1.5rem 0;
}

.materials-data ul {
    list-style: none;
    padding-left: 0;
}

.materials-data li {
    padding: 0.25rem 0;
}


/* ── §6  Image Gallery ───────────────────────────────────────────────────── */

.materials-images {
    margin: 1.5rem 0;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, auto));
    gap: 0.5rem;
}

.image-thumb {
    text-align: center;
}

.image-thumb img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.image-thumb a {
    text-decoration: none;
    color: inherit;
}

.image-thumb a:hover img,
.image-thumb a:focus img {
    border-color: var(--color-link);
    box-shadow: 0 0 0 2px var(--color-accent-ring);
}

.image-label {
    display: block;
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}


/* ── §7  Credits ─────────────────────────────────────────────────────────── */

.materials-credits {
    color: var(--color-text-secondary);
    margin: 0.5rem 0 1rem;
}
