/* =========================================================
   THE GAVEL INDEX — MASTER SITE STYLESHEET
   Unified CSS for:
   - base layout
   - home page
   - searchable index pages
   - records / statistics pages
   - episode detail pages
   - item detail pages
   - person detail pages
   - about / methodology / FAQ pages
   ========================================================= */


/* =========================================================
   1. ROOT / TOKENS / RESET
   ========================================================= */

:root {
    --bg: #f5f1e8;
    --bg-panel: #fbf8f1;
    --bg-panel-alt: #f0e9dc;
    --bg-accent: #e6dcc8;

    --ink: #2f2922;
    --ink-soft: #5f564a;
    --ink-muted: #7c7264;

    --line: #cdbfa8;
    --line-strong: #a99677;

    --profit: #1f6a3d;
    --loss: #8a2d2d;
    --neutral: #6d6254;
    --bonus: #5f4a88;

    --link: #4e3d23;
    --link-hover: #7b5f31;

    --shadow: 0 2px 8px rgba(60, 46, 28, 0.08);
    --radius: 12px;

    --site-max-width: 1400px;
    --content-padding: 32px;
    --section-gap: 32px;
    --card-gap: 24px;

    --font-body: Georgia, "Times New Roman", serif;
    --font-heading: Georgia, "Times New Roman", serif;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html {
    font-size: 16px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block;
}

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

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

h1,
h2,
h3,
h4 {
    margin: 0 0 0.75rem;
    font-family: var(--font-heading);
    line-height: 1.2;
    color: var(--ink);
}

p {
    margin: 0 0 1rem;
}

ul,
ol {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}

dl {
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    vertical-align: top;
}


/* =========================================================
   2. GLOBAL WIDTH / PAGE STRUCTURE
   ========================================================= */

.site-header,
.main-content,
.site-footer {
    width: min(var(--site-max-width), calc(100% - 2 * var(--content-padding)));
    margin-inline: auto;
}

.main-content {
    margin-top: 28px;
    margin-bottom: 40px;
}

.page-section + .page-section {
    margin-top: var(--section-gap);
}


/* =========================================================
   3. SITE HEADER / NAV / FOOTER
   ========================================================= */

.site-header {
    margin-top: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.site-branding {
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(to bottom, #fcfaf5, #f7f2e8);
}

.site-title {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.site-title a {
    color: var(--ink);
    text-decoration: none;
}

.site-tagline {
    margin: 0;
    color: var(--ink-soft);
    font-size: 1rem;
    margin-top: 6px;
}

.site-nav {
    background: var(--bg-panel-alt);
    border-top: 1px solid var(--line);
}

.site-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.site-nav-list li {
    margin: 0;
}

.site-nav-list a {
    display: block;
    padding: 14px 12px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    border-bottom: 2px solid transparent;
}

.site-nav-list a:hover,
.site-nav-list a:focus,
.site-nav-list a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.35);
    border-bottom-color: var(--line-strong);
    text-decoration: none;
}

.site-footer {
    margin-bottom: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 24px 16px;
    color: var(--ink-soft);
}

.site-footer__inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer-blurb {
    margin: 0;
    flex: 1;
    color: var(--ink-soft);
    font-size: 0.98rem;
    line-height: 1.45;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 16px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.footer-copyright {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: var(--ink-muted);
    text-align: right;
}

@media (max-width: 640px) {
    .footer-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-nav {
        justify-content: flex-start;
        width: 100%;
    }

    .footer-copyright {
        text-align: left;
    }
}


/* =========================================================
   4. COMMON HEADINGS / INTRO
   ========================================================= */

.section-heading {
    margin: 0 0 16px;
    font-size: clamp(1.4rem, 2vw, 1.9rem);
    line-height: 1.2;
}

.section-intro {
    margin: 0 0 20px;
    color: var(--ink-soft);
    max-width: 75ch;
}


/* =========================================================
   5. COMMON CARDS / PANELS
   ========================================================= */

.panel-grid {
    display: grid;
    gap: var(--card-gap);
}

.panel-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.card,
.summary-card,
.detail-card,
.data-card,
.filter-panel,
.table-shell,
.search-panel,
.hero {
    background: var(--bg-panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel,
.card,
.summary-card,
.detail-card,
.data-card,
.filter-panel,
.search-panel {
    padding: 22px 24px;
}

.panel > :first-child,
.card > :first-child,
.summary-card > :first-child,
.detail-card > :first-child,
.data-card > :first-child {
    margin-top: 0;
}

.panel > :last-child,
.card > :last-child,
.summary-card > :last-child,
.detail-card > :last-child,
.data-card > :last-child {
    margin-bottom: 0;
}

.card-title {
    margin: 0 0 14px;
    font-size: 1.3rem;
    line-height: 1.2;
}

.card-subtitle {
    margin: -4px 0 16px;
    color: var(--ink-soft);
    font-size: 0.98rem;
}

.card-note {
    margin-top: 14px;
    color: var(--ink-soft);
    font-size: 0.95rem;
}


/* =========================================================
   6. HERO / INTRO BLOCKS
   ========================================================= */

.hero {
    padding: 28px;
    margin-bottom: 0;
}

/* Ensure a consistent gap when a hero is followed by a page section */
.hero + .page-section {
    margin-top: var(--section-gap);
}

.hero-title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1.1;
}

.hero-subtitle {
    margin: 0;
    max-width: 75ch;
    color: var(--ink-soft);
    font-size: 1.05rem;
}

.hero-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}


/* =========================================================
   7. BUTTONS / TAGS / STATUS
   ========================================================= */

.button-link,
.button-link:visited,
.button {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--bg-accent);
    color: var(--ink);
    font-family: var(--font-ui);
    font-weight: 600;
    text-decoration: none;
}

.button-link:hover,
.button-link:focus,
.button:hover,
.button:focus {
    background: #efe5d2;
    text-decoration: none;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.tag {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7f1e4;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.status-pill {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-pill--profit {
    color: var(--profit);
    background: rgba(31, 106, 61, 0.12);
    border-color: rgba(31, 106, 61, 0.25);
}

.status-pill--loss {
    color: var(--loss);
    background: rgba(138, 45, 45, 0.12);
    border-color: rgba(138, 45, 45, 0.25);
}

.status-pill--neutral {
    color: var(--neutral);
    background: rgba(109, 98, 84, 0.12);
    border-color: rgba(109, 98, 84, 0.25);
}

.status-pill--bonus {
    color: var(--bonus);
    background: rgba(95, 74, 136, 0.12);
    border-color: rgba(95, 74, 136, 0.25);
}


/* =========================================================
   8. FACT LISTS / STAT LISTS
   ========================================================= */

.fact-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.fact-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.fact-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.fact-term {
    margin: 0;
    color: var(--ink-soft);
    font-weight: 700;
}

.fact-value {
    margin: 0;
}

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

.stat-list li + li {
    margin-top: 12px;
}

.stat-label {
    display: block;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}


/* =========================================================
   9. TABLES
   ========================================================= */

.table-shell {
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.98rem;
}

.data-table caption {
    display: none;
}

.data-table thead th {
    background: var(--bg-panel-alt);
    border-bottom: 1px solid var(--line-strong);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 14px 16px;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    text-align: center;
}

.data-table tbody td:first-child {
    text-align: left;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.35);
}

.data-table thead th:not(:first-child),
.data-table tbody td:not(:first-child) {
    text-align: center;
}

.data-table .numeric {
    white-space: nowrap;
}

.data-table .compact {
    white-space: nowrap;
}

.data-table .muted {
    color: var(--ink-muted);
}


/* =========================================================
   10. TEAM / ITEM TABLES WITHIN DETAIL CARDS
   ========================================================= */

.items-table {
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.items-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.96rem;
}

.items-table thead th {
    background: var(--bg-panel-alt);
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-ui);
    font-size: 0.88rem;
}

.items-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.items-table tbody tr:last-child td {
    border-bottom: 0;
}

.item-row--bonus {
    background: rgba(95, 74, 136, 0.05);
}


/* =========================================================
   11. SEARCH / FILTER BLOCKS
   ========================================================= */

.search-panel form {
    display: grid;
    gap: 16px;
}

.search-row {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.search-field {
    display: grid;
    gap: 6px;
}

.search-field label {
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fffdf8;
    font: inherit;
    color: var(--ink);
}

.search-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}


/* =========================================================
   12. HOME PAGE
   ========================================================= */

.home-layout {
    display: grid;
    gap: var(--section-gap);
}

.home-feature-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--card-gap);
}

.record-list,
.article-list,
.quick-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.record-list li,
.article-list li,
.quick-link-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.record-list li:last-child,
.article-list li:last-child,
.quick-link-list li:last-child {
    border-bottom: 0;
}


/* =========================================================
   13. SEARCH / INDEX PAGES
   ========================================================= */

.index-layout {
    display: grid;
    gap: var(--section-gap);
}

.index-header {
    display: grid;
    gap: 20px;
}

.index-summary {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--card-gap);
}


/* =========================================================
   14. RECORDS / STATISTICS PAGES
   ========================================================= */

.records-layout {
    display: grid;
    gap: var(--section-gap);
}

.record-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--card-gap);
}

/* On wide viewports show four cards side-by-side to match other index pages */
@media (min-width: 1100px) {
    .record-category-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


/* =========================================================
   15. EPISODE DETAIL PAGE
   ========================================================= */

.episode-layout {
    display: grid;
    gap: var(--section-gap);
}

.episode-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--card-gap);
}

.team-card header {
    margin-bottom: 16px;
}

.team-meta {
    margin: 8px 0 0;
    color: var(--ink-soft);
}

.team-totals {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}


/* =========================================================
   16. ITEM DETAIL PAGE
   ========================================================= */

.item-layout {
    display: grid;
    gap: var(--section-gap);
}

.item-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--card-gap);
}


/* =========================================================
   17. PERSON DETAIL PAGE
   ========================================================= */

.person-layout {
    display: grid;
    gap: var(--section-gap);
}

.person-summary {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--card-gap);
}

.person-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--card-gap);
}


/* =========================================================
   18. ABOUT / METHODOLOGY / FAQ PAGE
   ========================================================= */

.about-layout {
    display: grid;
    gap: var(--section-gap);
}

.content-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.page-aside {
    position: sticky;
    top: 24px;
    align-self: start;
}

.section-nav {
    background: var(--bg-panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.section-nav__title {
    margin: 0 0 14px;
    font-size: 1rem;
    color: var(--ink);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-family: var(--font-ui);
}

.section-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.section-nav__list a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
}

.section-nav__list a:hover,
.section-nav__list a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}

.content-stack {
    display: grid;
    gap: 24px;
}

.prose-card {
    background: var(--bg-panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}

.prose-flow > * + * {
    margin-top: 1rem;
}

.prose-flow h3 {
    margin: 1.5rem 0 0.6rem;
    color: var(--ink);
    font-size: 1.05rem;
}

.prose-flow p {
    margin: 0;
    line-height: 1.7;
    color: var(--ink);
}

.definition-list {
    display: grid;
    gap: 16px;
    margin: 0;
}

.definition-list__row,
.faq-item {
    display: grid;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.definition-list__row:first-child,
.faq-item:first-child {
    padding-top: 0;
    border-top: none;
}

.definition-list dt,
.faq-item h3 {
    margin: 0;
    font-weight: 700;
    color: var(--ink);
    font-size: 1rem;
}

.definition-list dd,
.faq-item p {
    margin: 0;
    color: var(--ink);
    line-height: 1.7;
}

.faq-list {
    display: grid;
    gap: 18px;
}

.plain-list {
    margin: 0;
    padding-left: 1.2rem;
}

.plain-list li + li {
    margin-top: 0.45rem;
}


/* =========================================================
   19. RELATED / ASIDE BLOCKS
   ========================================================= */

.related-links ul,
.related-pages ul {
    margin: 0;
    padding-left: 1.1rem;
}

.related-links li + li,
.related-pages li + li {
    margin-top: 8px;
}


/* =========================================================
   20. RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {
    .episode-summary,
    .item-summary,
    .panel-grid--3,
    .panel-grid--4,
    .person-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-feature-grid,
    .index-summary,
    .person-summary,
    .content-layout {
        grid-template-columns: 1fr;
    }

    .page-aside {
        position: static;
    }
}

@media (max-width: 900px) {
    :root {
        --content-padding: 18px;
        --section-gap: 24px;
        --card-gap: 18px;
    }

    .episode-summary,
    .item-summary,
    .record-category-grid,
    .panel-grid--2,
    .panel-grid--3,
    .panel-grid--4,
    .person-stats-grid {
        grid-template-columns: 1fr;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    .fact-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 640px) {
    .site-branding {
        padding: 20px 20px 16px;
    }

    .hero,
    .panel,
    .card,
    .summary-card,
    .detail-card,
    .data-card,
    .search-panel,
    .prose-card {
        padding: 18px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 12px;
    }
}

/* =========================================================
   Episode-detail specific tweaks
   ========================================================= */

/* Ensure card titles in episode summary are appropriately sized */
.episode-summary .card-title {
    font-size: 1.3rem;
}

/* Make the central episode overview panel visually stronger */
.detail-card.featured {
    background: linear-gradient(to bottom, #fffdfa, #fdf8f0);
    border-color: var(--line-strong);
    box-shadow: 0 6px 18px rgba(60,46,28,0.10);
}
.detail-card.featured .card-title {
    font-size: 1.45rem;
}

/* Distinct bonus pill states */
.status-pill--bonus-accepted {
    color: var(--profit);
    background: rgba(31,106,61,0.12);
    border-color: rgba(31,106,61,0.20);
}
.status-pill--bonus-rejected {
    color: var(--loss);
    background: rgba(138,45,45,0.12);
    border-color: rgba(138,45,45,0.20);
}
