/* ==========================================================================
   1. REAL-PAPER FLUID DOCUMENT FRAMEWORK BASELINE
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: #fbfbfb; /* Warm premium paper vintage layout tint */
    color: #111111;
    font-family: "Merriweather", serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Prevent erratic layout horizontal breaks */
}

/* Base Flexible Structural Grid */
.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    box-sizing: border-box;
    min-height: 450px;
}

/* Adjust fluid content sizing scaling rules safely for mobile view */
@media (max-width: 768px) {
    .main-container {
        padding: 0 15px;
        margin: 20px auto;
    }
}

/* ==========================================================================
   2. MASTER INTERACTIVE BRAND HEADER & TIMESTAMPS
   ========================================================================== */
.masthead { 
    text-align: center; 
    padding: 25px 20px 10px 20px; 
    max-width: 1200px; 
    margin: 0 auto; 
    box-sizing: border-box; 
}

.masthead h1 { 
    font-family: "Chivo", sans-serif; 
    font-size: 3.5rem; 
    font-weight: 700; 
    margin: 5px 0 0 0; 
    letter-spacing: -2px; 
    text-transform: uppercase; 
}

.masthead h1 a { 
    color: #000000; 
    text-decoration: none; 
}

.date-badge-container { 
    font-family: "Chivo", sans-serif; 
    font-size: 0.8rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: #555555; 
    font-weight: 700; 
    display: flex; 
    justify-content: center; 
    gap: 6px; 
    flex-wrap: wrap;
    align-items: center;
}

/* Fluid design adjustment for mobile logos to fit clean screens gracefully */
@media (max-width: 768px) {
    .masthead h1 { 
        font-size: 2.2rem; 
        letter-spacing: -1px; 
    }
}

/* ==========================================================================
   3. MOBILE-RESPONSIVE WRAPPING NAVBAR (Editorial Multi-Row Layout)
   ========================================================================== */
.nyt-navbar { 
    width: 100%; 
    margin-top: 5px; 
}

.nav-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
    box-sizing: border-box; 
}

.nav-links { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    flex-wrap: wrap; /* Enables items to move to a new row if needed */
    gap: 15px 30px;  /* Row gap: 15px, Column gap: 30px */
    width: 100%; 
    padding: 10px 0;
}

.nav-item { 
    font-family: "Chivo", sans-serif; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    text-decoration: none; 
    color: #444444; 
    font-weight: 700; 
    letter-spacing: 0.5px; 
    padding: 4px 0; 
    white-space: nowrap; 
    transition: all 0.3s ease; /* Smooth transition for hover effect */
    position: relative; /* Required for the underline effect */
}

/* Sophisticated Underline Hover Effect */
.nav-item::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: #000;
    transition: width 0.3s ease;
}

.nav-item:hover::after, 
.nav-item.active::after {
    width: 100%;
}

.nav-item:hover, .nav-item.active { 
    color: #000000; 
}

.nav-divider { 
    border: none; 
    border-top: 1px solid #111111; 
    width: 95%; 
    max-width: 1200px; 
    margin: 10px auto 0 auto; 
}

/* Updated Responsive Layout: Stacked and centered */
@media (max-width: 768px) {
    .nav-container { 
        padding: 0 15px; 
    }
    .nav-links { 
        justify-content: center; 
        gap: 10px 20px; 
        padding: 10px 0;
    }
    .nav-item { 
        font-size: 0.75rem; 
    }
}
/* ==========================================================================
   4. EDITORIAL HOMEPAGE SHOWCASE HERO SIZING RULES
   ========================================================================== */
.homepage-layout {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.section-headline {
    font-family: "Chivo", sans-serif;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 2px;
    border-bottom: 1px solid #111111;
    padding-bottom: 4px;
    margin-bottom: 30px;
    color: #000000;
    text-align: center;
}

.editorial-hero {
    text-align: center;
    width: 100%;
}

.hero-headline {
    font-family: "Merriweather", serif;
    font-size: 3.25rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 12px 0;
    color: #000000;
    letter-spacing: -0.5px;
}

.hero-byline {
    font-family: "Chivo", sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #666666;
    letter-spacing: 1px;
    margin: 0 0 20px 0;
}

.editorial-divider {
    width: 80px;
    height: 1px;
    background-color: #b0b0b0;
    margin: 0 auto 25px auto;
}

.article-body-text {
    font-family: "Merriweather", serif;
    font-size: 1.15rem;
    line-height: 1.7;
    text-align: left;
    color: #222222;
    word-wrap: break-word;
}

.article-body-text p {
    margin-bottom: 20px;
}

/* Gracefully downscales oversized news headlines on mobile to avoid zoom breaking */
@media (max-width: 768px) {
    .hero-headline {
        font-size: 2.15rem;
        line-height: 1.2;
    }
    .section-headline {
        margin-bottom: 20px;
    }
    .article-body-text {
        font-size: 1.05rem;
        line-height: 1.65;
    }
}

/* ==========================================================================
   5. CLEAN UNIVERSAL EDITORIAL FOOTER
   ========================================================================== */
.nyt-footer { 
    width: 100%; 
    padding-bottom: 40px; 
    margin-top: 60px; 
    box-sizing: border-box; 
}

.footer-divider { 
    border: none; 
    border-top: 4px double #111111; 
    width: 95%; 
    max-width: 1200px; 
    margin-bottom: 20px; 
}

.footer-container { 
    text-align: center; 
    padding: 0 20px; 
}

.footer-brand { 
    font-family: "Chivo", sans-serif; 
    font-size: 1.1rem; 
    font-weight: 700; 
    letter-spacing: -0.5px; 
    margin: 0 0 8px 0; 
    color: #000000; 
}

.footer-copyright { 
    font-size: 0.75rem; 
    color: #666666; 
    margin: 0; 
    font-family: "Chivo", sans-serif; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* ==========================================================================
   6. GRID LAYOUT & CARD COMPONENT (NYT Editorial "Brick" Style)
   ========================================================================== */

/* The responsive grid container */
.nyt-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 20px;
    margin: 20px auto;
    padding: 0 10px;
    max-width: 1200px;
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
    .nyt-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on desktop */
        gap: 30px;
    }
}

/* Card: Uniform styling with top-border for structural integrity */
.nyt-card {
    display: flex;
    flex-direction: column;
    border-top: 2px solid #000;
    padding-top: 15px;
    height: 100%;
}

/* Image Uniformity: Allow images to maintain their natural proportions */
.card-img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 12px;
    transition: transform 0.3s ease;
}

/* Image scaling limits for desktop to prevent oversized cards */
@media (min-width: 768px) {
    .card-img {
        max-height: 250px;
        object-fit: cover;
    }
}

/* Hover effect on card images */
.nyt-card a:hover .card-img {
    transform: scale(1.03);
}

/* Typography: The "New York Times" Look */
.nyt-card h3 {
    font-family: 'Merriweather', serif;
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0 0 10px 0;
    color: #111;
}

.nyt-card .summary {
    font-family: sans-serif;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

/* Grid Links: Clean hover effect instead of default blue */
.nyt-card a {
    text-decoration: none;
    color: inherit;
}

.nyt-card h3 a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Responsive adjustment for Mobile grid */
@media (max-width: 768px) {
    .nyt-grid {
        grid-template-columns: 1fr; /* Stack vertically on small phones */
        gap: 40px;
        padding: 15px;
    }
}

/* Filter Bar: Center alignment and spacing */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 30px 0 40px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

/* Refined editorial UI buttons */
.filter-button {
    text-decoration: none;
    color: #111;
    font-family: "Chivo", sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 8px 16px;
    border: 1px solid #111;
    transition: background 0.2s ease, color 0.2s ease;
}

/* Active and Hover states */
.filter-button:hover, 
.filter-button.active {
    background-color: #111;
    color: #fff;
    cursor: pointer;
}

/* ==========================================================================
   7. RESPONSIVE VIDEO EMBEDS (Centered & Medium Size)
   ========================================================================== */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ==========================================================================
   8. EDITORIAL SOCIAL SHARING COMPONENTS
   ========================================================================== */

.share-container {
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid #111;
    border-bottom: 1px solid #111;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.share-title {
    font-family: "Chivo", sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #555;
}

.share-buttons-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.share-btn {
    font-family: "Chivo", sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #111;
    color: #111;
    background: #fff;
    transition: all 0.2s ease;
    display: inline-block;
}

.share-btn:hover {
    background: #111;
    color: #fff;
}

/* Responsive adjustment: Center on mobile */
@media (max-width: 768px) {
    .share-container {
        align-items: center;
        text-align: center;
    }
}

/* Compact modifier for Header/Author placement */

.author-avatar img {
    border-radius: 50%;
    margin: 0 !important; /* Forces removal of any default paragraph margins */
    padding: 0 !important;
}

.share-container.compact {
    margin: 10px 0 0 0;
    padding: 0;
    border: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.share-container.compact .share-title { margin-bottom: 0; font-size: 0.6rem; }
.share-container.compact .share-btn { padding: 4px 8px; font-size: 0.6rem; }

/* Force all hero and body image wrappers to display vertically */
.hero-wrapper, 
.richtext-image-wrapper {
    display: block; 
    width: 100%;
    margin: 30px 0;
}

/* Ensure images maintain aspect ratio without distortion */
.hero-wrapper img, 
.article-body-text img, 
.gallery-item img,
.richtext-image-wrapper img {
    width: 100% !important;
    height: auto !important;
    display: block;
    object-fit: contain; /* Keeps the whole image visible */
    background-color: #fbfbfb;
}

/* Properly style the caption below the image */
.hero-wrapper figcaption,
.richtext-image-wrapper figcaption {
    display: block;
    width: 100%;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #555;
    font-style: italic;
    border-left: 2px solid #000;
    padding-left: 10px;
}

/* Review Page Specific Layout */
.review-grid-layout {
    display: grid;
    grid-template-columns: 1fr; /* Default: Single column for mobile */
    gap: 40px;
    margin-top: 40px;
}

@media (min-width: 900px) {
    .review-grid-layout {
        grid-template-columns: 1fr 300px; /* Sidebar on right for desktop */
    }
}

.review-section {
    margin: 30px 0;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    font-size: 0.9rem;
}

/* Ensure the figure wrapper matches your responsive needs */
.richtext-image-wrapper {
    display: block;
    width: 100%;
    margin: 20px 0;
    overflow: hidden;
    background: #fbfbfb;
    aspect-ratio: 16 / 9; /* Matches your hero wrapper */
}

/* Ensure the image inside fills the figure */
.richtext-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Keeps the whole image visible */
    display: block;
}

/* ==========================================================================
   9. HOMEPAGE STYLING AND CARDS (Swiper Integration)
   ========================================================================== */
.home-section { margin-bottom: 60px; }

.section-headline {
    font-family: 'Merriweather', serif;
    font-size: 1.8rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
}

.swiper {
    position: relative; /* Essential for absolute positioning of arrows */
    width: 100%;
    padding: 10px 0 40px 0;
}

.swiper-wrapper { display: flex; }

.swiper-slide { height: 100%; }

.swiper-slide .nyt-card {
    border-top: 2px solid #000;
    padding-top: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Navigation Arrow Customization */
:root {
    --swiper-navigation-color: #111;
    --swiper-navigation-size: 20px;
}

.swiper-button-next, .swiper-button-prev {
    color: #000 !important;
    background: rgba(255, 255, 255, 0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #000;
}

/* Hide arrows on mobile for a cleaner look */
@media (max-width: 767px) {
    .swiper-button-next, .swiper-button-prev { display: none; }
}