/* ============================================================
   Comics Interview Database — Wiki/Reference Style
   Dark mode (forced)
   ============================================================ */

/* ---- CSS Custom Properties (Dark Mode — forced) ---- */
:root {
    --bg: #1a1a1a;
    --bg-secondary: #242424;
    --bg-sidebar: #1e1e1e;
    --text: #e0e0e0;
    --text-muted: #aaaaaa;
    --text-light: #777777;
    --link: #6b9eff;
    --link-hover: #9dbfff;
    --border: #3a3a3a;
    --border-light: #2e2e2e;
    --accent: #5588dd;
    --mark-bg: #5a4a00;
    --mark-text: #ffffff;
    --tag-bg: #333333;
    --tag-text: #cccccc;
    --missing-bg: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.3);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --max-width: 1200px;
    --sidebar-width: 280px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- Base ---- */
html {
    font-size: 15px;
    line-height: 1.6;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

mark {
    background: var(--mark-bg);
    color: var(--mark-text);
    padding: 0.1em 0;
    border-radius: 2px;
    box-decoration-break: clone;
}

img { max-width: 100%; height: auto; }

/* ---- Site Header ---- */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-nav__home {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    white-space: nowrap;
}
.site-nav__home:hover { text-decoration: none; color: var(--accent); }

.site-nav__search {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 0;
}

.search-input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.search-input:focus {
    border-color: var(--accent);
}

.search-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0 4px 4px 0;
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
}
.search-btn:hover { background: var(--border-light); }

/* ---- Main Content ---- */
.site-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
    width: 100%;
    flex: 1;
}

/* ---- Site Footer ---- */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================================
   Home Page — Magazine Grid
   ============================================================ */

.magazine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.magazine-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.magazine-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
}

.magazine-card__title {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.magazine-card__meta {
    padding: 0 1rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================================
   Magazine Landing — Issue Grid/List
   ============================================================ */

.magazine-header {
    margin-bottom: 1.5rem;
}

.magazine-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.magazine-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.magazine-controls label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.magazine-controls select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.view-toggle__btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
}
.view-toggle__btn:first-child { border-radius: 4px 0 0 4px; }
.view-toggle__btn:last-child { border-radius: 0 4px 4px 0; }
.view-toggle__btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Issue Grid View */
.issue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.issue-grid__item {
    text-align: center;
}

.issue-grid__cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border: 1px solid var(--border-light);
    border-radius: 3px;
    transition: transform 0.15s;
}
.issue-grid__item:hover .issue-grid__cover {
    transform: scale(1.03);
}

.issue-grid__item.is-missing .issue-grid__cover {
    opacity: 0.4;
}

.issue-grid__magazine {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.issue-grid__label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.issue-grid__date {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Issue List View */
.issue-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.issue-list__item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    align-items: flex-start;
    transition: background 0.15s;
}
.issue-list__item:hover {
    background: var(--bg-secondary);
}

.issue-list__item.is-missing {
    opacity: 0.5;
}

.issue-list__cover {
    width: 60px;
    flex-shrink: 0;
    border-radius: 2px;
}

.issue-list__info {
    flex: 1;
    min-width: 0;
}

.issue-list__title {
    font-weight: 600;
    font-size: 0.95rem;
}

.issue-list__date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.issue-list__topics {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.issue-list__people {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ============================================================
   Issue Detail Page — Wiki-Style Layout
   ============================================================ */

.issue-detail {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 2rem;
}

/* Sidebar */
.issue-sidebar {
    /* This stretches to full grid row height — needed for sticky child */
}

.issue-sidebar__inner {
    position: sticky;
    top: 73px; /* overridden by JS to match exact position */
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-sidebar);
}

.issue-sidebar__cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    display: block;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}

.issue-sidebar__section {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}
.issue-sidebar__section:last-child {
    border-bottom: none;
}

.issue-sidebar__title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.issue-sidebar__date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.issue-sidebar__date .estimated {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.8rem;
}

.issue-sidebar__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.3rem;
    margin-top: 0.5rem;
}

/* Prev/Next navigation */
.issue-nav {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
}

.issue-nav a {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* People list in sidebar */
.sidebar-people {
    list-style: none;
    font-size: 0.85rem;
}

.sidebar-people li {
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-people li:last-child { border-bottom: none; }

.sidebar-people__role {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Tags in sidebar */
.sidebar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 3px;
    font-size: 0.75rem;
    text-decoration: none;
}
.tag:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

/* Archive.org link */
.archive-link {
    display: block;
    padding: 0.5rem 0.75rem;
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0.5rem 0.75rem 0.75rem;
}
.archive-link:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-color: var(--accent);
}

/* Content area */
.issue-content {
    min-width: 0;
}

.issue-content h1 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.issue-content__topics {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* People table */
.people-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.people-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.people-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.people-table tr:hover {
    background: var(--bg-secondary);
}

/* Table of contents */
.issue-toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.issue-toc__title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.issue-toc__list {
    list-style: none;
    font-size: 0.9rem;
}
.issue-toc__list li { padding: 0.15rem 0; }
.issue-toc__list .toc-interview::before { content: ""; }
.issue-toc__list .toc-article::before {
    content: "Article: ";
    color: var(--text-light);
    font-size: 0.8rem;
}

/* Entry (interview or article) */
.entry {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}
.entry:last-child { border-bottom: none; }

.entry__header {
    margin-bottom: 0.5rem;
}

.entry__title {
    font-size: 1.2rem;
    font-weight: 700;
}

.entry__meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.entry__type-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.3rem;
}

.entry__type-badge.interview {
    background: #1a3a5c;
    color: #90caf9;
}
.entry__type-badge.article {
    background: #3a1a4a;
    color: #ce93d8;
}

.entry__people {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}

.entry__person {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.2rem 0;
}

.entry__person + .entry__person {
    border-top: 1px solid var(--border-light);
    padding-top: 0.4rem;
    margin-top: 0.2rem;
}

.entry__person-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.entry__person-role {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.entry__person-working {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    flex-basis: 100%;
}

.entry__summary {
    font-size: 0.95rem;
    line-height: 1.7;
}

.entry__tags {
    margin-top: 0.5rem;
}

/* ============================================================
   Missing Issue Page
   ============================================================ */

.missing-notice {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.missing-notice h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.missing-notice p {
    font-size: 0.95rem;
}

/* ============================================================
   Search Results Page
   ============================================================ */

.search-header {
    margin-bottom: 1.5rem;
}

.search-header h1 {
    font-size: 1.4rem;
}

.search-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.search-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.search-controls label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-controls select,
.search-controls input[type="date"] {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-result {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    transition: background 0.15s;
}
.search-result:hover {
    background: var(--bg-secondary);
}

.search-result__cover {
    width: 60px;
    height: auto;
    flex-shrink: 0;
    border-radius: 2px;
    object-fit: contain;
    align-self: start;
}

.search-result__link {
    text-decoration: none;
    color: inherit;
}
.search-result__link:hover .search-result__title {
    color: var(--link);
}

.search-result__body {
    flex: 1;
    min-width: 0;
}

.search-result__source {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.15rem;
}

.search-result__title {
    font-weight: 600;
    font-size: 1rem;
}

.search-result__snippet {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.5;
}

.search-expand-toggle {
    margin-bottom: 0.75rem;
    text-align: right;
}

.search-result__full {
    font-size: 0.9rem;
    color: var(--text);
    margin-top: 0.25rem;
    line-height: 1.6;
}

.search-result__toggle {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--accent);
    cursor: pointer;
}
.search-result__toggle:hover {
    text-decoration: underline;
}

.search-result__tags {
    margin-top: 0.3rem;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.lightbox.active {
    display: flex;
}
.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   404 Page
   ============================================================ */

.not-found {
    text-align: center;
    padding: 4rem 1rem;
}

.not-found h1 {
    font-size: 3rem;
    color: var(--text-light);
}

.not-found p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) and (min-width: 769px) {
    .issue-detail {
        grid-template-columns: 200px 1fr;
        gap: 1rem;
    }

    .issue-sidebar__cover {
        max-width: 100%;
    }

    .sidebar-people__role {
        display: block;
    }
}

@media (max-width: 768px) {
    .issue-detail {
        grid-template-columns: 1fr;
    }

    .issue-sidebar__inner {
        position: static;
    }

    .issue-sidebar__cover {
        max-width: 200px;
        margin: 0 auto;
        display: block;
    }

    .site-nav {
        flex-wrap: wrap;
    }

    .site-nav__search {
        max-width: 100%;
        order: 3;
        flex-basis: 100%;
    }

    .issue-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .search-result {
        flex-direction: column;
    }

    .search-result__cover {
        width: 80px;
    }

    .people-table {
        font-size: 0.8rem;
    }

    .people-table th,
    .people-table td {
        padding: 0.3rem 0.4rem;
    }

    .search-controls {
        gap: 0.4rem 0.8rem;
    }

}
