@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&display=swap');

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

:root {
    --bg-color: #f4f1ea;
    --container-bg: #fff;
    --text-color: #222;
    --secondary-text: #555;
    --border-color: #000;
    --side-border: #ccc;
    --sep-border: #ddd;
    font-size: 16px; 
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e4e4e4;
    --secondary-text: #a0a0a0;
    --border-color: #e4e4e4;
    --side-border: #333;
    --sep-border: #222;
}

body {
    background-color: var(--bg-color);
    font-family: 'Times New Roman', Times, serif;
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    line-height: 1.35;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

.container {
    max-width: 1200px;
    width: 96%;
    margin: 10px auto;
    border: 1px solid var(--border-color);
    padding: 12px;
    background: var(--container-bg);
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    position: relative;
}

/* Skybox - Top strip for sports scores */
.skybox {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.skybox-item {
    white-space: nowrap;
}

/* Header - Ultra Tight */
header {
    border-bottom: 5px double var(--border-color);
    margin-bottom: 0.5rem;
    padding: 0.2rem 0;
}

.masthead-container {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 0;
}

.masthead {
    flex: 1;
    text-align: center;
}

.masthead h1 {
    font-size: clamp(2.5rem, 9vw, 5.8rem);
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    letter-spacing: -3px;
    line-height: 0.9;
    margin: 0;
}

.ear {
    flex: 0 0 180px;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: bold;
    line-height: 1.2;
}

.ear-left { text-align: left; }
.ear-right { text-align: right; visibility: hidden; }

.folio {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1px 8px;
    margin-top: 0.2rem;
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-marker {
    font-style: italic;
    font-weight: normal;
}

/* Menu Trigger - Absolute Top Right */
.menu-trigger {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.5;
    z-index: 100;
    display: block;
}

.menu-trigger:hover {
    opacity: 1;
    transform: rotate(45deg);
}

/* News Grid Layout */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

@media (min-width: 950px) {
    .news-grid { grid-template-columns: 3fr 1fr; }
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

/* Section Styling */
.section-header {
    border-top: 3px double var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 2px 0;
    margin-bottom: 10px;
    text-align: center;
}

.section-header h2 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    font-family: 'Playfair Display', serif;
    letter-spacing: 2px;
}

/* Article Styling */
.main-story .headline h2 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin-bottom: 0.3rem;
    line-height: 1.05;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.main-story .headline h3 {
    font-size: 1.05rem;
    font-style: italic;
    margin-bottom: 0.8rem;
    color: var(--secondary-text);
}

.main-story .content {
    column-width: 240px;
    column-gap: 30px;
    column-rule: 1px solid var(--sep-border);
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    font-size: 1rem;
}

.first-letter {
    float: left;
    font-size: 4.2rem;
    line-height: 0.75;
    padding-right: 8px;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
}

.sub-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    border-top: 1px solid var(--sep-border);
    padding-top: 15px;
}

.story-small h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.story-small p {
    font-size: 0.95rem;
    text-align: justify;
    hyphens: auto;
}

/* Sidebar Styling */
.sidebar-content { min-width: 0; }
@media (min-width: 950px) {
    .sidebar-content {
        border-left: 1px solid var(--side-border);
        padding-left: 20px;
    }
}

.sidebar-section { margin-bottom: 20px; }
.sidebar-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 3px double var(--border-color); 
    margin-bottom: 8px;
    padding-bottom: 2px;
}

/* Index Box */
.index-box {
    border: 1px solid var(--border-color);
    padding: 8px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.02);
}

.index-box h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
    text-align: center;
}

.index-list {
    list-style: none;
    font-size: 0.7rem;
    font-weight: bold;
}

.index-list li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dotted var(--sep-border);
    padding: 2px 0;
}

/* Market Glance */
.market-glance {
    margin-top: 10px;
    padding: 8px;
    border: 1px solid var(--sep-border);
    background: rgba(0,0,0,0.01);
}

.market-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    font-weight: bold;
    border-bottom: 1px dotted var(--sep-border);
    padding: 2px 0;
}

.market-item span:last-child {
    color: #2e7d32; /* Green for gain */
}

.sidebar-story {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sep-border);
}
.sidebar-story h5 { font-family: 'Playfair Display', serif; font-size: 0.95rem; margin-bottom: 3px; }
.sidebar-story p { font-size: 0.85rem; }

/* Navigation Drawer */
.drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--container-bg);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
    transition: right 0.3s ease;
    padding: 20px;
}
.drawer.open { right: 0; }
.drawer-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.drawer h2 { font-family: 'Playfair Display', serif; font-size: 1.3rem; }
.drawer button {
    width: 100%;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.75rem;
}
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.2);
    display: none;
    z-index: 999;
}
.overlay.active { display: block; }

footer {
    text-align: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 5px double var(--border-color); 
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

@media (max-width: 650px) {
    .masthead-container { flex-direction: column; align-items: center; gap: 5px; }
    .ear { flex: none; width: 100%; text-align: center; order: initial; }
    .masthead { order: initial; }
    .folio { flex-direction: column; align-items: center; gap: 2px; }
    .skybox { gap: 10px; }
}
