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

:root {
    --bg: #f5f0e8;
    --bg-card: #fff;
    --text: #2c2418;
    --text-muted: #6b5d4d;
    --accent: #8b4513;
    --accent-light: #d4a574;
    --border: #d4c5a9;
    --shadow: rgba(44, 36, 24, 0.1);
    --header-bg: #2c2418;
    --header-text: #f5f0e8;
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

/* ===== Header ===== */
header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 4rem 2rem 3rem;
    text-align: center;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.4rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

header h1 em {
    font-style: italic;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--accent-light);
    margin-bottom: 0.5rem;
    font-family: var(--font-sans);
}

.attribution {
    font-size: 0.9rem;
    color: #9a8c7a;
    font-family: var(--font-sans);
}

/* ===== Intro ===== */
.intro {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.intro-content p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.intro-content p:last-child {
    margin-bottom: 0;
}

/* ===== Stats ===== */
.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    flex: 1;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

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

/* ===== Filters ===== */
.filters {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ===== Gallery ===== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 2rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow);
}

.card-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    background: #e8e0d0;
}

.card-body {
    padding: 1rem 1.2rem;
}

.card-sig {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.card-ms {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    margin-bottom: 0.5rem;
}

.card-hand {
    font-size: 0.78rem;
    color: var(--accent);
    font-family: var(--font-sans);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.card-desc {
    font-size: 0.82rem;
    color: #5a4e42;
    line-height: 1.55;
    margin-bottom: 0.4rem;
    max-height: 4.7em;
    overflow: hidden;
}

.card-marginal {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text);
    line-height: 1.5;
    max-height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid var(--border);
    padding-top: 0.3rem;
    margin-top: 0.3rem;
}

.card-ms .badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-bl {
    background: #e8d5c0;
    color: #6b4423;
}

.badge-siena {
    background: #c0d4e8;
    color: #234568;
}

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.96);
    z-index: 1000;
    overflow-y: auto;
}

.lightbox.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: #ccc;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
}

.lightbox-close:hover {
    color: white;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: #ccc;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 1rem;
}

.lightbox-nav:hover {
    color: white;
}

.lightbox-prev {
    left: 0.5rem;
}

.lightbox-next {
    right: 0.5rem;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 3rem;
}

.lightbox-image-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}

.lightbox-image-wrap img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border: 2px solid #444;
}

.lightbox-details {
    color: #e8e0d0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.lightbox-details h3 {
    font-size: 1.4rem;
    color: var(--accent-light);
    margin-bottom: 0.5rem;
}

.lightbox-ms {
    font-size: 0.9rem;
    color: #9a8c7a;
    font-family: var(--font-sans);
    margin-bottom: 1rem;
}

.lightbox-marginal {
    font-style: italic;
    font-size: 1.1rem;
    color: #e8d5c0;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-left: 3px solid var(--accent-light);
}

.lightbox-context {
    font-size: 0.9rem;
    color: #b0a090;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.lightbox-page {
    font-size: 0.8rem;
    color: #7a6c5a;
    font-family: var(--font-sans);
    margin-top: 1rem;
}

/* ===== Footer ===== */
footer {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 3rem 2rem;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    color: var(--accent-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    font-family: var(--font-sans);
}

.footer-section p {
    font-size: 0.85rem;
    color: #9a8c7a;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.6rem;
    }

    .stats {
        flex-direction: column;
        gap: 1rem;
    }

    .gallery {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .lightbox-content {
        padding: 0 1rem;
    }

    .lightbox-nav {
        font-size: 2rem;
    }

    .filters {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    header {
        padding: 2rem 1rem;
    }

    header h1 {
        font-size: 1.3rem;
    }
}


/* ===== Site Navigation ===== */
.site-nav {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.site-nav a {
    color: #9a8c7a;
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
    border-radius: 3px;
    transition: all 0.2s;
}

.site-nav a:hover {
    color: var(--accent-light);
    background: rgba(255,255,255,0.05);
}

.site-nav a.active {
    color: var(--header-text);
    background: rgba(255,255,255,0.1);
}

/* ===== Review & Confidence Badges ===== */
.review-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: #e8dcc8;
    color: #6b5420;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-left: 0.3rem;
}

.confidence-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-left: 0.3rem;
}

.confidence-high { background: #dce8d4; color: #3d5a2d; }
.confidence-medium { background: #e8dcc8; color: #6b5420; }
.confidence-low { background: #e8d4d0; color: #6b3028; }
.confidence-provisional { background: #e0dcd4; color: #4a4438; }
