/* Newspaper Edition Styles */
/* This file extends the main styles.css with newspaper-specific styling */

/* Import newspaper fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Merriweather:wght@300;400;700&family=Old+Standard+TT:wght@400;700&display=swap');

/* Theme Variables */
:root {
    /* Light theme (default for newspaper) */
    --newspaper-bg: #fefefe;
    --newspaper-paper: #fdfdfd;
    --newspaper-text: #1a1a1a;
    --newspaper-text-light: #4a4a4a;
    --newspaper-text-muted: #6a6a6a;
    --newspaper-border: #d0d0d0;
    --newspaper-border-thick: #8a8a8a;
    --newspaper-accent: hsl(var(--base-hue), 40%, 35%);
    --newspaper-accent-light: hsl(var(--base-hue), 30%, 85%);
    --newspaper-shadow: rgba(0, 0, 0, 0.1);
    --newspaper-shadow-heavy: rgba(0, 0, 0, 0.2);
    
    /* Weather specific variables */
    --weather-bg: #f8f9fa;
    --weather-border: #e9ecef;
    --weather-text: #495057;
    --weather-icon: #6c757d;
    --weather-hover: #e9ecef;
}

/* Dark theme */
[data-theme="dark"] {
    --newspaper-bg: var(--bg-primary);
    --newspaper-paper: var(--bg-secondary);
    --newspaper-text: var(--text-primary);
    --newspaper-text-light: var(--text-secondary);
    --newspaper-text-muted: var(--text-muted);
    --newspaper-border: var(--border-primary);
    --newspaper-border-thick: var(--border-secondary);
    --newspaper-accent: var(--accent-primary);
    --newspaper-accent-light: var(--primary-800);
    --newspaper-shadow: var(--shadow-md);
    --newspaper-shadow-heavy: var(--shadow-lg);
    
    /* Dark theme weather variables */
    --weather-bg: #2c3e50;
    --weather-border: #34495e;
    --weather-text: #ecf0f1;
    --weather-icon: #bdc3c7;
    --weather-hover: #34495e;
}

/* Dark theme newspaper title - invert colors */
[data-theme="dark"] .newspaper-title {
    color: #151515;
    -webkit-text-stroke: 2px #FEFEFE;
    text-stroke: 1px #FEFEFE;
}

/* Enhanced Scrollbar Styling for Newspaper */
.newspaper-body * {
    scrollbar-width: thin;
    scrollbar-color: var(--newspaper-accent) var(--newspaper-paper);
}

.newspaper-body *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.newspaper-body *::-webkit-scrollbar-track {
    background: var(--newspaper-paper);
    border-radius: 4px;
    border: 1px solid var(--newspaper-border);
}

.newspaper-body *::-webkit-scrollbar-thumb {
    background: var(--newspaper-accent);
    border-radius: 4px;
    border: 1px solid var(--newspaper-border);
    transition: all 0.3s ease;
}

.newspaper-body *::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
    transform: scale(1.1);
}

.newspaper-body *::-webkit-scrollbar-thumb:active {
    background: var(--primary-600);
}

.newspaper-body *::-webkit-scrollbar-corner {
    background: var(--newspaper-paper);
    border: 1px solid var(--newspaper-border);
}

/* Special scrollbar styling for modal in newspaper */
.newspaper-body .modal-article-content::-webkit-scrollbar {
    width: 12px;
}

.newspaper-body .modal-article-content::-webkit-scrollbar-track {
    background: var(--newspaper-bg);
    border-radius: 6px;
    border: 2px solid var(--newspaper-border);
}

.newspaper-body .modal-article-content::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--newspaper-accent), var(--accent-primary));
    border-radius: 6px;
    border: 2px solid var(--newspaper-paper);
    box-shadow: inset 0 1px 3px var(--newspaper-shadow);
}

.newspaper-body .modal-article-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--accent-primary), var(--primary-400));
    box-shadow: inset 0 2px 6px var(--newspaper-shadow-heavy);
}

/* Body Overrides */
.newspaper-body {
    background: var(--newspaper-bg);
    color: var(--newspaper-text);
    font-family: 'Merriweather', Georgia, serif;
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Add newspaper texture effect */
.newspaper-body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            var(--newspaper-border) 1px,
            var(--newspaper-border) 2px
        );
    opacity: 0.03;
    pointer-events: none;
    z-index: -1;
}

/* Newspaper Header */
.newspaper-header {
    background: var(--newspaper-paper);
    border-bottom: 3px double var(--newspaper-border-thick);
    padding: 2rem 0 1rem 0;
    box-shadow: var(--newspaper-shadow-heavy);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.newspaper-masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    margin: 0;
    padding: 0 1rem;
}

.masthead-ornament {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Improved Weather Circle Styling */
.weather-circle {
    /* Circle sizing with responsive adjustments */
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    
    /* Enhanced theming support */
    background: var(--weather-bg);
    border: 2px solid var(--weather-border);
    box-shadow: var(--newspaper-shadow);
    
    /* Improved layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    
    /* Enhanced typography */
    font-family: 'Old Standard TT', serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--weather-text);
    text-align: center;
    line-height: 1.1;
    
    /* Smooth transitions */
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.weather-circle:hover {
    background: var(--weather-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--newspaper-shadow-heavy);
}

.weather-circle i {
    font-size: 1.1rem;
    color: var(--weather-icon);
    margin-bottom: 0.125rem;
    transition: color 0.3s ease;
}

.weather-circle span {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--weather-text);
    letter-spacing: 0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

/* Weather circle color coding for different data types */
.weather-circle:nth-child(1) {
    /* Temperature circle - warm colors */
    --weather-icon: #e74c3c;
}

.weather-circle:nth-child(2) {
    /* Humidity circle - blue colors */
    --weather-icon: #3498db;
}

.weather-circle:nth-child(3) {
    /* Precipitation circle - blue-grey */
    --weather-icon: #34495e;
}

.weather-circle:nth-child(4) {
    /* Rain chance circle - purple */
    --weather-icon: #9b59b6;
}

/* Dark theme icon adjustments */
[data-theme="dark"] .weather-circle:nth-child(1) {
    --weather-icon: #e67e22;
}

[data-theme="dark"] .weather-circle:nth-child(2) {
    --weather-icon: #5dade2;
}

[data-theme="dark"] .weather-circle:nth-child(3) {
    --weather-icon: #85929e;
}

[data-theme="dark"] .weather-circle:nth-child(4) {
    --weather-icon: #bb8fce;
}

/* Add tooltips for weather circles */
.weather-circle::after {
    content: attr(title);
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--newspaper-text);
    color: var(--newspaper-paper);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.weather-circle:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: -2rem;
}

.masthead-title {
    text-align: center;
    flex: 1;
    margin: 0 2rem;
}

.newspaper-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 900;
    color: #FEFEFE;
    margin: 0;
    -webkit-text-stroke: 2px #151515;
    text-stroke: 1px #151515;
    /*filter: drop-shadow(0.55rem 0px 0px #151515);*/
    letter-spacing: 3px;
    /*text-transform: uppercase;*/
    font-style: bold;
}

.newspaper-subtitle {
    font-family: 'Old Standard TT', serif;
    font-size: 1.1rem;
    color: var(--newspaper-text-light);
    margin: 0.5rem 0;
    font-style: italic;
    letter-spacing: 1px;
}

.newspaper-date {
    font-family: 'Old Standard TT', serif;
    font-size: 0.9rem;
    color: var(--newspaper-text-muted);
    margin-top: 0.5rem;
    border-top: 1px solid var(--newspaper-border);
    padding-top: 0.5rem;
}

.masthead-controls {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
}

.theme-toggle,
.newspaper-refresh {
    background: var(--newspaper-paper);
    border: 1px solid var(--newspaper-border);
    color: var(--newspaper-text);
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--newspaper-shadow);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.theme-toggle:hover,
.newspaper-refresh:hover {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    transform: scale(1.1);
    box-shadow: var(--newspaper-shadow-heavy);
}

.newspaper-refresh i {
    font-size: 1rem;
}

/* Ensure refresh button shows only the icon */
.newspaper-refresh {
    font-size: 0; /* Hide any text */
    line-height: 0;
}

.newspaper-refresh i {
    font-size: 1rem; /* Restore icon size */
    line-height: normal;
}

/* Refresh button spin animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.newspaper-divider {
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--newspaper-border-thick) 10%, 
        var(--newspaper-border-thick) 90%, 
        transparent 100%);
    margin-top: 1rem;
}

/* Main Content */
.newspaper-main {
    background: var(--newspaper-bg);
    min-height: calc(100vh - 200px);
    padding: 1rem 0;
}

.newspaper-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.newspaper-loading {
    text-align: center;
    padding: 4rem 0;
    color: var(--newspaper-text-light);
}

.newspaper-loading .loading-spinner {
    border: 3px solid var(--newspaper-border);
    border-top: 3px solid var(--newspaper-accent);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

/* Newspaper Columns Layout */
.newspaper-columns {
    display: grid;
    grid-template-columns: 1fr 200px; /* Main content + sidebar */
    gap: 15px;
    margin-top: 1rem;
    border: 2px solid var(--newspaper-border-thick);
    padding: 1rem;
}

/* Main newspaper grid for articles with images/descriptions */
.newspaper-main-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    grid-auto-rows: minmax(200px, auto);
    grid-auto-flow: dense; /* Fill gaps more intelligently */
}

/* Sidebar for text-only articles */
.newspaper-sidebar {
    border-left: 3px solid var(--newspaper-border-thick);
    padding-left: 1rem;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    transition: all 0.3s ease;
    scroll-behavior: smooth;
}

/* Responsive sidebar positioning */
.newspaper-sidebar.scrolled {
    top: 1rem;
    max-height: calc(100vh - 2rem);
}

.sidebar-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--newspaper-border-thick);
}

.sidebar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--newspaper-accent);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Article Styles for Grid Layout */
.newspaper-article {
    background: var(--newspaper-paper);
    border: 1px solid var(--newspaper-border);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--newspaper-shadow);
    position: relative;
    overflow: hidden;
}

.newspaper-article:hover {
    background: var(--newspaper-accent-light);
    box-shadow: var(--newspaper-shadow-heavy);
    transform: translateY(-2px);
}

/* Article direct link button - appears on hover */
.article-direct-link {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: var(--newspaper-shadow);
    transform: translateY(3rem);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.newspaper-article:hover .article-direct-link {
    transform: translateY(0);
    opacity: 1;
}

.article-direct-link:hover {
    background: var(--newspaper-text);
    transform: scale(1.1);
    box-shadow: var(--newspaper-shadow-heavy);
}

/* Grid size variants for visual interest */
.newspaper-article.size-small {
    grid-row: span 1;
    min-height: 200px;
}

.newspaper-article.size-medium {
    grid-row: span 2;
    min-height: 300px;
}

.newspaper-article.size-large {
    grid-row: span 2;
    grid-column: span 2;
    min-height: 300px;
}

/* Featured articles (large prominence) */
.newspaper-article.featured {
    border: 3px solid var(--newspaper-accent);
    background: var(--newspaper-accent-light);
    grid-row: span 3;
    grid-column: span 2;
    min-height: 400px;
}

.newspaper-article.featured .article-title {
    font-size: 1.5rem;
    color: var(--newspaper-accent);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.newspaper-article.featured .article-thumbnail {
    height: 200px;
    margin-bottom: 0.75rem;
}

.newspaper-article.featured .article-description {
    font-size: 1rem;
    line-height: 1.5;
}

/* Sidebar articles (text-only, compact) */
.newspaper-article.sidebar-article {
    background: transparent;
    border: none;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--newspaper-border);
    box-shadow: none;
    margin-bottom: 0.5rem;
}

.newspaper-article.sidebar-article:last-child {
    border-bottom: none;
}

.newspaper-article.sidebar-article:hover {
    background: var(--newspaper-accent-light);
    transform: none;
    margin: 0 -0.5rem 0.5rem -0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: 4px;
}

.newspaper-article.sidebar-article .article-title {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.newspaper-article.sidebar-article .article-meta {
    margin-bottom: 0.25rem;
}

.newspaper-article.sidebar-article .article-description {
    font-size: 0.75rem;
    line-height: 1.3;
}

/* Article with image - for main grid */
.article-with-image {
    display: flex;
    flex-direction: column;
}

.article-thumbnail {
    width: 100%;
    object-fit: cover;
    border: 1px solid var(--newspaper-border);
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

/* Dynamic thumbnail heights based on article size */
.newspaper-article.size-small .article-thumbnail {
    height: 120px;
}

.newspaper-article.size-medium .article-thumbnail {
    height: 160px;
}

.newspaper-article.size-large .article-thumbnail {
    height: 200px;
}

/* Typography and base styles */
.article-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--newspaper-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
    text-decoration: none;
    flex-shrink: 0;
}

.article-title:hover {
    color: var(--newspaper-accent);
}

/* Dynamic title sizes based on article size */
.newspaper-article.size-large .article-title {
    font-size: 1.3rem;
}

.newspaper-article.size-medium .article-title {
    font-size: 1.15rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-family: 'Old Standard TT', serif;
    font-size: 0.75rem;
    color: var(--newspaper-text-muted);
    flex-shrink: 0;
}

.article-source {
    font-weight: 700;
    color: var(--newspaper-accent);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.article-time {
    font-style: italic;
}

.article-description {
    font-family: 'Merriweather', serif;
    font-size: 0.85rem;
    color: var(--newspaper-text-light);
    line-height: 1.4;
    text-align: justify;
    hyphens: auto;
    flex-grow: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Dynamic description sizes */
.newspaper-article.size-large .article-description {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Add newspaper-style drop caps for featured articles */
.newspaper-article.featured .article-description::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 3em;
    line-height: 0.8;
    padding-right: 0.1em;
    padding-top: 0.05em;
    margin-right: 0.1em;
    color: var(--newspaper-accent);
    font-weight: 700;
}

/* Ensure proper clearfix for drop caps */
.newspaper-article.featured .article-description {
    overflow: hidden;
}

.newspaper-footer {
    background: var(--newspaper-paper);
    border-top: 3px double var(--newspaper-border-thick);
    margin-top: 3rem;
    padding: 2rem 0;
    box-shadow: var(--newspaper-shadow-heavy);
}

.footer-divider {
    height: 2px;
    background: var(--newspaper-border-thick);
    margin-bottom: 2rem;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

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

.footer-section h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--newspaper-accent);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--newspaper-border);
    padding-bottom: 0.5rem;
}

.footer-section p {
    margin: 0.5rem 0;
    color: var(--newspaper-text-light);
    font-size: 0.9rem;
}

.footer-link {
    color: var(--newspaper-accent);
    text-decoration: none;
    margin-right: 1rem;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-attribution {
    font-size: 0.8rem;
    color: var(--newspaper-text-muted);
    font-style: italic;
    margin-top: 0.5rem;
}

.settings-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--newspaper-text);
}

.settings-select {
    background: var(--newspaper-paper);
    border: 1px solid var(--newspaper-border);
    color: var(--newspaper-text);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    width: 100%;
}

/* Mobile and Tablet Responsive Design */
@media (max-width: 1200px) {
    .newspaper-columns {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .newspaper-main-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns for medium screens */
    }
    
    .newspaper-article.size-large,
    .newspaper-article.featured {
        grid-column: span 1; /* Reduce spanning on smaller screens */
        grid-row: span 2; /* Adjust height too */
    }
}

@media (max-width: 768px) {
    /* Dramatically reduce header size on mobile */
    .newspaper-header {
        padding: 0.75rem 0 0.5rem 0; /* Reduced from 2rem 0 1rem 0 */
        position: sticky;
        top: 0;
    }
    
    .newspaper-masthead {
        padding: 0 0.5rem;
        flex-direction: column;
        gap: 0.5rem; /* Reduced gap */
        align-items: center;
    }
    
    .masthead-title {
        margin: 0;
        order: 1; /* Title first */
    }
    
    .newspaper-title {
        font-size: 1.8rem; /* Significantly reduced from 2.5rem */
        font-family: 'Playfair Display', serif;
        font-weight: 900;
        letter-spacing: 2px;
        margin: 0;
        color: transparent;
        -webkit-text-stroke: 2px #151515;
        filter: drop-shadow(3px 3px 0px #151515);
        text-transform: uppercase;
    }
    
    .newspaper-subtitle {
        font-size: 0.9rem; /* Reduced */
        margin: 0.25rem 0;
    }
    
    .newspaper-date {
        font-size: 0.8rem; /* Reduced */
        margin-top: 0.25rem;
        padding-top: 0.25rem;
    }
    
    /* Weather and controls on same row, more compact */
    .masthead-ornament {
        gap: 0.5rem; /* Reduced gap */
        order: 2;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .weather-circle {
        width: 3rem; /* Reduced from 4rem */
        height: 3rem; /* Reduced from 4rem */
        font-size: 0.6rem; /* Smaller text */
    }
    
    .weather-circle i {
        font-size: 0.9rem; /* Smaller icon */
        margin-bottom: 0.1rem;
    }
    
    .weather-circle span {
        font-size: 0.55rem; /* Smaller label */
    }
    
    .masthead-controls {
        order: 3;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .theme-toggle,
    .newspaper-refresh {
        width: 40px; /* Reduced from 50px */
        height: 40px; /* Reduced from 50px */
        padding: 0.5rem; /* Reduced padding */
        font-size: 0.9rem; /* Smaller icons */
    }
    
    .newspaper-divider {
        margin-top: 0.5rem; /* Reduced margin */
    }
    
    /* Rest of mobile styles */
    .newspaper-columns {
        grid-template-columns: 1fr; /* Stack sidebar below on mobile */
        gap: 1rem;
    }
    
    .newspaper-main-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns for mobile */
        gap: 10px;
    }
    
    .newspaper-sidebar {
        border-left: none;
        border-top: 3px solid var(--newspaper-border-thick);
        padding-left: 0;
        padding-top: 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* All articles single column on mobile */
    .newspaper-article.size-large,
    .newspaper-article.featured {
        grid-column: span 1;
        grid-row: span 2;
    }
}

/* Dark theme override for 768px breakpoint */
@media (max-width: 768px) {
    [data-theme="dark"] .newspaper-title {
        color: transparent;
        -webkit-text-stroke: 2px #FEFEFE;
        filter: drop-shadow(3px 3px 0px #FEFEFE);
    }
}

@media (max-width: 480px) {
    /* Even more compact for very small screens */
    .newspaper-header {
        padding: 0.5rem 0 0.25rem 0; /* Even smaller */
    }
    
    .newspaper-masthead {
        gap: 0.25rem;
    }
    
    .newspaper-title {
        font-size: 1.5rem; /* Even smaller title */
        font-family: 'Playfair Display', serif;
        font-weight: 900;
        color: transparent;
        -webkit-text-stroke: 2px #151515;
        filter: drop-shadow(2px 2px 0px #151515);
        letter-spacing: 2px;
        text-transform: uppercase;
    }
    
    .newspaper-subtitle {
        font-size: 0.8rem;
        margin: 0.125rem 0;
    }
    
    .newspaper-date {
        font-size: 0.7rem;
        margin-top: 0.125rem;
        padding-top: 0.125rem;
    }
    
    .weather-circle {
        width: 2.5rem; /* Even smaller on tiny screens */
        height: 2.5rem;
        font-size: 0.55rem;
    }
    
    .weather-circle i {
        font-size: 0.8rem;
    }
    
    .weather-circle span {
        font-size: 0.5rem;
    }
    
    .theme-toggle,
    .newspaper-refresh {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
    
    .newspaper-container {
        padding: 0;
    }
    
    .newspaper-main-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .article-title {
        font-size: 1rem;
    }
    
    .article-description {
        font-size: 0.8rem;
    }
    
    .newspaper-columns {
        padding: 0.5rem;
    }
}

/* Dark theme override for 480px breakpoint */
@media (max-width: 480px) {
    [data-theme="dark"] .newspaper-title {
        color: transparent;
        -webkit-text-stroke: 2px #FEFEFE;
        filter: drop-shadow(2px 2px 0px #FEFEFE);
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .newspaper-header {
        padding: 0.5rem 0 0.25rem 0; /* Minimal height in landscape */
    }
    
    .newspaper-masthead {
        flex-direction: row; /* Horizontal layout in landscape */
        justify-content: space-between;
        align-items: center;
    }
    
    .masthead-title {
        flex: 1;
        margin: 0 1rem;
    }
    
    .newspaper-title {
        font-size: 1.4rem; /* Compact title in landscape */
        font-family: 'Playfair Display', serif;
        font-weight: 900;
        color: transparent;
        -webkit-text-stroke: 2px #151515;
        filter: drop-shadow(2px 2px 0px #151515);
        letter-spacing: 2px;
        text-transform: uppercase;
    }
    
    .newspaper-subtitle,
    .newspaper-date {
        display: none; /* Hide subtitle and date in landscape to save space */
    }
    
    .masthead-ornament {
        gap: 0.25rem;
        order: unset;
    }
    
    .weather-circle {
        width: 2.25rem;
        height: 2.25rem;
    }
    
    .masthead-controls {
        order: unset;
        gap: 0.25rem;
    }
}

/* Dark theme override for landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    [data-theme="dark"] .newspaper-title {
        color: transparent;
        -webkit-text-stroke: 2px #FEFEFE;
        filter: drop-shadow(2px 2px 0px #FEFEFE);
    }
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Loading States */
.loading-article {
    background: var(--newspaper-paper);
    border: 1px solid var(--newspaper-border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.loading-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent
    );
    animation: loading-shimmer 1.5s infinite;
    z-index: 1;
}

@keyframes loading-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.loading-thumbnail {
    height: 120px;
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.loading-content {
    padding: 0.75rem;
}

.loading-title {
    height: 1.2rem;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    animation: loading-pulse 1.5s ease-in-out infinite alternate;
}

.loading-title.sidebar-title {
    height: 1rem;
}

.loading-meta {
    height: 0.8rem;
    background: #e8e8e8;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    width: 60%;
    animation: loading-pulse 1.5s ease-in-out infinite alternate 0.2s;
}

.loading-description {
    height: 0.8rem;
    background: #e8e8e8;
    border-radius: 4px;
    margin-bottom: 0.3rem;
    animation: loading-pulse 1.5s ease-in-out infinite alternate 0.4s;
}

.loading-description:nth-child(4) {
    width: 80%;
}

.loading-description:nth-child(5) {
    width: 90%;
}

.loading-description:nth-child(6) {
    width: 70%;
}

@keyframes loading-pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Dark theme loading adjustments */
[data-theme="dark"] .loading-thumbnail {
    background: #3a3a3a;
}

[data-theme="dark"] .loading-title {
    background: #4a4a4a;
}

[data-theme="dark"] .loading-meta,
[data-theme="dark"] .loading-description {
    background: #404040;
}

/* Print styles for actual newspaper printing */
@media print {
    .newspaper-header,
    .newspaper-footer,
    .theme-toggle,
    .newspaper-refresh {
        display: none;
    }
    
    .newspaper-body {
        background: white;
        color: black;
    }
    
    .newspaper-columns {
        break-inside: avoid;
    }
    
    .newspaper-article {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Enhanced Modal Styles for Article Content */
.modal-article-content {
    padding: 2rem;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--newspaper-paper);
    border-radius: 8px;
    font-family: 'Merriweather', Georgia, serif;
}

.modal-article-image {
    margin-bottom: 2rem;
    text-align: center;
    width: 100%;
}

.modal-article-image img {
    width: 100%;
    height: auto;
    max-height: 500px; /* Increased from 300px for larger display */
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--newspaper-shadow);
    position: static; /* Ensure it's not sticky/fixed */
    display: block;
    margin: 0 auto;
}

.modal-article-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--newspaper-border);
    font-family: 'Old Standard TT', serif;
}

.modal-article-source {
    font-weight: 700;
    color: var(--newspaper-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.modal-article-date {
    color: var(--newspaper-text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

.modal-article-text {
    line-height: 1.8;
    color: var(--newspaper-text);
    font-size: 1.1rem;
}

.modal-article-text p {
    margin-bottom: 1.5rem;
    text-align: justify;
    text-indent: 1.5rem;
}

.modal-article-text p:first-child {
    text-indent: 0;
    font-weight: 500;
}

.modal-loading,
.modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 2rem;
    color: var(--newspaper-text-muted);
}

.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--newspaper-border);
    border-top: 3px solid var(--newspaper-accent);
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-error {
    color: var(--newspaper-text);
}

.modal-error p {
    margin: 0.5rem 0;
}

/* Responsive modal content */
@media (max-width: 768px) {
    .modal-article-content {
        padding: 1rem;
        max-height: 80vh;
    }
    
    .modal-article-text {
        font-size: 1rem;
    }
    
    .modal-article-text p {
        text-indent: 1rem;
        margin-bottom: 1rem;
    }
}

/* Share Menu Styles */
.share-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.share-menu {
    background: var(--newspaper-paper);
    border: 2px solid var(--newspaper-border);
    border-radius: 8px;
    padding: 0;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: var(--newspaper-shadow-heavy);
    animation: slideUp 0.3s ease;
}

.share-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--newspaper-border);
    background: var(--newspaper-accent-light);
}

.share-menu-header h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    color: var(--newspaper-text);
    font-size: 1.2rem;
}

.share-menu-close {
    background: none;
    border: none;
    color: var(--newspaper-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.share-menu-close:hover {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
}

.share-menu-options {
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--newspaper-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--newspaper-text);
    background: var(--newspaper-paper);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.share-option:hover {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    border-color: var(--newspaper-accent);
    transform: translateY(-1px);
    box-shadow: var(--newspaper-shadow);
}

.share-option i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Share Notification */
.share-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: var(--newspaper-shadow-heavy);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10001;
    animation: slideInRight 0.3s ease;
}

.share-notification i {
    font-size: 1.1rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(2rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile responsive for share menu */
@media (max-width: 480px) {
    .share-menu-options {
        grid-template-columns: 1fr;
    }
    
    .share-notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        font-size: 0.85rem;
    }
}

/* Load More Button */
.load-more-section {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: transparent;
    border: none;
    position: relative;
}

.load-more-button {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    border: 2px solid var(--newspaper-accent);
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--newspaper-shadow);
    position: relative;
    overflow: hidden;
}

.load-more-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transition: left 0.6s ease;
}

.load-more-button:hover::before {
    left: 100%;
}

.load-more-button:hover {
    background: var(--newspaper-text);
    border-color: var(--newspaper-text);
    color: var(--newspaper-paper);
    transform: translateY(-1px);
    box-shadow: var(--newspaper-shadow-heavy);
}

.load-more-button:active {
    transform: translateY(0);
    box-shadow: var(--newspaper-shadow);
}

.load-more-button:disabled {
    background: var(--newspaper-border);
    color: var(--newspaper-text-muted);
    border-color: var(--newspaper-border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-button .fas {
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.load-more-button:hover .fas {
    transform: translateY(2px);
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid var(--newspaper-text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark theme adjustments */
[data-theme="dark"] .load-more-button {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    border-color: var(--newspaper-accent);
}

[data-theme="dark"] .load-more-button:hover {
    background: var(--newspaper-text);
    color: var(--newspaper-bg);
    border-color: var(--newspaper-text);
}

/* ==========================================================================
   CROSSWORD PUZZLE STYLES
   ========================================================================== */

/* Crossword Article Container */
.crossword-article {
    background: var(--newspaper-paper);
    border: 2px solid var(--newspaper-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--newspaper-shadow);
    transition: all 0.3s ease;
}

.crossword-article:hover {
    box-shadow: var(--newspaper-shadow-heavy);
    border-color: var(--newspaper-accent);
}

.crossword-container {
    padding: 1.5rem;
    min-height: 600px; /* Prevent layout jumping */
}

.crossword-header {
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--newspaper-border);
    padding-bottom: 1rem;
}

.crossword-header .article-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--newspaper-text);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.crossword-header .article-title i {
    color: var(--newspaper-accent);
    font-size: 1.5rem;
}

.crossword-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--newspaper-text-muted);
}

.crossword-meta .article-source {
    font-weight: 600;
    color: var(--newspaper-accent);
}

/* Crossword Game Layout */
.crossword-game {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.crossword-grid-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.crossword-grid {
    display: grid;
    gap: 1px;
    background: var(--newspaper-text);
    border: 2px solid var(--newspaper-text);
    padding: 0;
    border-radius: 0;
    width: 450px;
    height: 450px;
    line-height: 0;
    box-shadow: var(--newspaper-shadow-heavy);
}

.crossword-cell {
    position: relative;
    background: var(--newspaper-paper);
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.crossword-cell.blocked {
    background: var(--newspaper-text);
}

.crossword-cell:not(.blocked):hover {
    background: var(--newspaper-accent-light);
}

.crossword-cell.selected {
    background: var(--newspaper-accent) !important;
    z-index: 2;
}

.crossword-cell.highlighted {
    background: var(--newspaper-accent-light);
    z-index: 1;
}

.crossword-cell.correct {
    background: #d4edda !important;
    border-color: #28a745;
}

.crossword-cell.incorrect {
    background: #f8d7da !important;
    border-color: #dc3545;
}

.cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 11px;
    font-weight: bold;
    color: var(--newspaper-text);
    line-height: 1;
    pointer-events: none;
    z-index: 3;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: var(--newspaper-text);
    text-transform: uppercase;
    outline: none;
    font-family: 'Old Standard TT', serif;
}

.cell-input:focus {
    background: rgba(255, 255, 255, 0.9);
}

/* Hint cells styling */
.cell-input[data-hint="true"] {
    background: #fffacd !important;
    color: var(--newspaper-text);
    font-weight: 900;
}

/* Clues Section */
.crossword-clues {
    background: var(--newspaper-bg);
    border: 1px solid var(--newspaper-border);
    border-radius: 6px;
    padding: 1rem;
    height: 450px; /* Fixed height instead of max-height */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.clues-section {
    flex: 1; /* Equal height for both sections */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex children */
    height: calc(50% - 0.5rem); /* Exactly 50% each minus gap */
}

.clues-section h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--newspaper-text);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--newspaper-border);
    flex-shrink: 0;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* Important for proper scrolling */
    padding-right: 0.5rem;
}

.clue-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    line-height: 1.4;
    user-select: none;
}

.clue-item:hover {
    background: var(--newspaper-accent-light);
    transform: translateX(2px);
}

.clue-item:active {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
}

.clue-number {
    font-weight: bold;
    color: var(--newspaper-accent);
    min-width: 25px;
}

.clue-text {
    color: var(--newspaper-text);
    flex: 1;
}

/* Crossword Controls */
.crossword-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.crossword-btn {
    background: var(--newspaper-paper);
    border: 2px solid var(--newspaper-accent);
    color: var(--newspaper-accent);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: 'Merriweather', serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Hide the New Puzzle button but keep its functionality */
.crossword-btn[onclick*="newPuzzle"] {
    display: none;
}

.crossword-btn:hover {
    background: var(--newspaper-accent);
    color: var(--newspaper-paper);
    transform: translateY(-2px);
    box-shadow: var(--newspaper-shadow);
}

.crossword-btn:active {
    transform: translateY(0);
}

.crossword-btn i {
    font-size: 0.8rem;
}

/* Crossword Messages */
.crossword-message {
    text-align: center;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 6px;
    font-family: 'Merriweather', serif;
    font-weight: 500;
    display: none;
}

.crossword-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.crossword-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.crossword-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design for Crossword */
@media (max-width: 768px) {
    .crossword-game {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        align-items: start;
    }
    
    .crossword-grid {
        width: 340px;
        height: 340px;
    }
    
    .crossword-clues {
        height: 300px; /* Fixed height on mobile too */
    }
    
    .cell-input {
        font-size: 16px;
    }
    
    .cell-number {
        font-size: 9px;
    }
    
    .crossword-controls {
        gap: 0.5rem;
    }
    
    .crossword-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .crossword-container {
        padding: 1rem;
    }
    
    .crossword-header .article-title {
        font-size: 1.5rem;
    }
    
    .crossword-grid {
        width: 280px;
        height: 280px;
    }
    
    .cell-input {
        font-size: 14px;
    }
    
    .cell-number {
        font-size: 8px;
    }
    
    .crossword-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Dark Theme Crossword Adjustments */
[data-theme="dark"] .crossword-cell.correct {
    background: #1e4620 !important;
    border-color: #28a745;
}

[data-theme="dark"] .crossword-cell.incorrect {
    background: #4a1e1e !important;
    border-color: #dc3545;
}

[data-theme="dark"] .crossword-message.success {
    background: #1e4620;
    color: #a8d8a8;
    border-color: #28a745;
}

[data-theme="dark"] .crossword-message.info {
    background: #1e3a4a;
    color: #a8c8d8;
    border-color: #17a2b8;
}

[data-theme="dark"] .crossword-message.error {
    background: #4a1e1e;
    color: #d8a8a8;
    border-color: #dc3545;
}

/* Crossword Loading States */
.crossword-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    min-height: 200px;
}

.crossword-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--newspaper-border);
    border-top: 4px solid var(--newspaper-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.crossword-loading p {
    color: var(--newspaper-text-muted);
    font-style: italic;
    margin: 0;
}

/* Crossword Animation Effects */
@keyframes crossword-correct {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes crossword-incorrect {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.crossword-cell.correct {
    animation: crossword-correct 0.5s ease;
}

.crossword-cell.incorrect {
    animation: crossword-incorrect 0.5s ease;
}

/* Print Styles for Crossword */
@media print {
    .crossword-article {
        break-inside: avoid;
        border: 2px solid #000;
        background: white;
    }
    
    .crossword-controls {
        display: none;
    }
    
    .crossword-message {
        display: none;
    }
    
    .crossword-grid {
        border: 2px solid #000;
        background: #000;
    }
    
    .crossword-cell {
        border: 1px solid #000;
        background: white;
    }
    
    .crossword-cell.blocked {
        background: #000;
    }
    
    .cell-input {
        color: #000;
        background: transparent;
    }
}