/* =========================================
   1. VARIABLES & NEWSPAPER THEME RESET
   ========================================= */
:root {
    --bg-paper: #f9f7f2;
    --bg-card: #fcfbf8;
    --bg-warm: #f3efe6;
    --ink-primary: #111111;
    --ink-secondary: #262626;
    --ink-muted: #555555;
    --border-ink: #111111;
    --border-subtle: #d6d1c4;
    --accent-culinary: #7c2d12;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-paper);
    color: var(--ink-primary);
    font-family: 'Source Serif 4', Georgia, serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   2. CONTAINER & MASTHEAD
   ========================================= */
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

header {
    text-align: center;
    border-top: 4px double var(--border-ink);
    border-bottom: 2px solid var(--border-ink);
    padding: 14px 10px 18px;
    margin-bottom: 14px;
}

.top-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.masthead-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 900;
    letter-spacing: 0.03em;
    line-height: 1.1;
    cursor: pointer;
    color: var(--ink-primary);
}

.masthead-subtitle {
    font-style: italic;
    color: var(--ink-secondary);
    font-size: 0.98rem;
    margin-top: 6px;
}

/* =========================================
   3. NAVIGATION BAR
   ========================================= */
nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 18px;
    border-bottom: 2px solid var(--border-ink);
    margin-bottom: 26px;
}

nav button {
    background: transparent;
    border: 1px solid var(--border-ink);
    color: var(--ink-primary);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

nav button:hover,
nav button.active {
    background-color: var(--ink-primary);
    color: #ffffff;
}

/* =========================================
   4. FRONT PAGE GRID & CARDS
   ========================================= */
.newspaper-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr 0.95fr;
    gap: 24px;
    margin-bottom: 42px;
}

.col-divider {
    border-right: 1px solid var(--border-subtle);
    padding-right: 22px;
}

.category-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent-culinary);
    margin-bottom: 6px;
}

.lead-article img,
.story-card img,
.plant-card img {
    width: 100%;
    height: 210px;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    margin-bottom: 10px;
    cursor: zoom-in;
}

.lead-article img {
    height: 290px;
}

.lead-article h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 8px;
}

.story-card {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.story-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.story-card h3,
.plant-card h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.22rem;
    line-height: 1.25;
    margin-bottom: 6px;
}

.article-meta {
    font-size: 0.82rem;
    color: var(--ink-muted);
    margin-bottom: 8px;
}

.lead-excerpt,
.story-card p,
.plant-card p {
    font-size: 0.94rem;
    color: var(--ink-secondary);
    margin-bottom: 10px;
}

.read-more-btn {
    background: var(--ink-primary);
    color: #ffffff;
    border: none;
    padding: 7px 14px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.84rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.read-more-btn:hover {
    background: var(--accent-culinary);
}

/* =========================================
   5. SIDEBAR BOXES
   ========================================= */
.sidebar-box {
    background-color: var(--bg-warm);
    border: 1px solid var(--border-subtle);
    padding: 16px;
    margin-bottom: 20px;
}

.sidebar-box h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    border-bottom: 1px solid var(--border-ink);
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.brief-item {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px dashed var(--border-subtle);
}

.brief-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.brief-item h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.brief-item p {
    font-size: 0.86rem;
    color: var(--ink-secondary);
    margin-bottom: 6px;
}

/* =========================================
   6. RECIPE DIRECTORY SECTION
   ========================================= */
.encyclopedia-section {
    border-top: 2px solid var(--border-ink);
    padding-top: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.section-header h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.7rem;
}

.section-header span {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}

.plant-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    gap: 20px;
}

.plant-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.scientific-name {
    display: block;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--ink-muted);
    margin-bottom: 8px;
}

/* =========================================
   7. FULL RECIPE & INFO VIEWS
   ========================================= */
.full-page-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 28px;
    margin-bottom: 32px;
}

.back-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 14px;
    margin-bottom: 22px;
}

.back-btn,
.accent-btn {
    background: var(--ink-primary);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.88rem;
    cursor: pointer;
}

.accent-btn {
    background: var(--accent-culinary);
    margin-left: 10px;
}

.article-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
    line-height: 1.18;
    margin-bottom: 6px;
}

.scientific-subtitle {
    font-style: italic;
    color: var(--accent-culinary);
    margin-bottom: 8px;
}

.featured-figure {
    margin: 18px 0 22px;
}

.featured-figure img {
    width: 100%;
    max-height: 440px;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    cursor: zoom-in;
}

.featured-figure figcaption {
    font-size: 0.86rem;
    font-style: italic;
    color: var(--ink-muted);
    margin-top: 6px;
}

.botanical-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    background: var(--bg-warm);
    border: 1px solid var(--border-subtle);
    padding: 14px;
    margin-bottom: 24px;
}

.spec-box {
    text-align: center;
}

.spec-label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}

.article-body-text h2,
.article-body-text h3 {
    font-family: 'Playfair Display', Georgia, serif;
    margin-top: 18px;
    margin-bottom: 8px;
}

.article-body-text p {
    margin-bottom: 12px;
    color: var(--ink-secondary);
}

.bottom-nav {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}

/* =========================================
   8. COMMENT POPUP BOX (WITH TOP-RIGHT ×)
   ========================================= */
.popup-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
}

.popup-box {
    position: relative;
    background-color: var(--bg-card);
    border: 2px solid var(--border-ink);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px 24px 24px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.popup-close-x {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: var(--ink-primary);
    color: #ffffff;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close-x:hover {
    background: var(--accent-culinary);
}

.popup-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.55rem;
    margin-bottom: 4px;
    padding-right: 34px;
}

.popup-subtitle {
    font-size: 0.88rem;
    color: var(--ink-muted);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 13px;
}

.form-group label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-ink);
    background: #ffffff;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.92rem;
    color: var(--ink-primary);
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.submit-btn {
    background: var(--ink-primary);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.submit-btn:hover {
    background: var(--accent-culinary);
}

.status-text {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--accent-culinary);
}

/* =========================================
   9. PHOTO LIGHTBOX POPUP
   ========================================= */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    cursor: zoom-out;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2.4rem;
    cursor: pointer;
}

.lightbox-img {
    max-width: 92vw;
    max-height: 80vh;
    object-fit: contain;
    border: 3px solid #fcfbf8;
    cursor: default;
}

.lightbox-caption {
    color: #f3efe6;
    font-style: italic;
    margin-top: 12px;
    text-align: center;
}

/* =========================================
   10. FOOTER & RESPONSIVE
   ========================================= */
footer {
    border-top: 2px solid var(--border-ink);
    padding-top: 18px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--ink-secondary);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.footer-links button {
    background: transparent;
    border: 1px solid var(--border-subtle);
    padding: 5px 12px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.82rem;
    cursor: pointer;
}

.footer-links button:hover {
    border-color: var(--border-ink);
    background: var(--bg-warm);
}

.copyright {
    font-size: 0.8rem;
    color: var(--ink-muted);
}

@media (max-width: 900px) {
    .newspaper-grid {
        grid-template-columns: 1fr;
    }

    .col-divider {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px solid var(--border-subtle);
        padding-bottom: 20px;
    }
}