/*
Theme Name: Yashasvi Pro
Description: Professional BBC-inspired news portal for Yashasvi Duniya.
Version: 24.0.0
Author: Codex
*/

:root {
    --red: #b80000;
    --ink: #141414;
    --muted: #5f5f5f;
    --line: #d8d8d8;
    --soft: #f5f5f5;
    --white: #ffffff;
    --dark: #111111;
    --container: 1280px;
    --font-body: "Hind", "Noto Sans Devanagari", Arial, sans-serif;
    --font-head: "Noto Serif Devanagari", Georgia, serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: clip; /* clip ≠ hidden: does NOT create scroll container, sticky still works */
}

body {
    margin: 0;
    overflow-x: clip; /* Belt-and-suspenders: clip on both html+body kills side scroll */
    position: relative;
    background: var(--white);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--red);
}

img,
svg {
    display: block;
}

img {
    max-width: 100%;
}

/* ── Ad Overflow Guard ────────────────────────────────────────────
   AdSense iframes can be wider than the viewport on mobile, causing
   horizontal drift. This rule hard-clamps every ad unit to the screen. */
.adsbygoogle,
ins.adsbygoogle,
.in-article-ad,
.ad-band {
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

iframe {
    max-width: 100% !important;
}

/* ── Empty Ad Band Guard ───────────────────────────────────────────
   Hides the entire ad section if AdSense hasn't loaded an ad into it.
   Prevents ugly grey empty boxes on login, register, e-paper, etc.   */
.ad-band:not(:has(iframe)):not(:has(ins[data-adsbygoogle-status])) {
    display: none !important;
}

/* Remove old placeholder divs completely — they are replaced by real ads */
.ad-placeholder {
    display: none !important;
}
/* ────────────────────────────────────────────────────────────────── */

button,
input,
textarea {
    font: inherit;
}

.container {
    width: min(100%, var(--container));
    margin: 0 auto;
    padding: 0 24px;
}

.screen-reader-text {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--white);
    border-bottom: 0;
    /* Force GPU compositing layer — fixes Chrome Android sticky glitch */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.masthead {
    background: var(--white);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    transition: box-shadow 180ms ease, border-color 180ms ease;
}

.site-header.is-compact .masthead {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.masthead-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 110px;
    gap: 20px;
    transition: min-height 250ms ease;
}

.site-header.is-compact .masthead-inner {
    min-height: 64px;
}

.masthead-left,
.masthead-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.masthead-actions {
    justify-content: flex-end;
}

.auth-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu,
.mobile-search {
    display: none !important;
}

.desktop-menu,
.desktop-search {
    display: inline-grid;
}

.menu-button,
.search-toggle {
    display: inline-grid;
}

.menu-button:hover,
.search-toggle:hover {
    background: var(--soft);
    color: var(--ink);
}

.icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    background: transparent;
    color: currentColor;
    cursor: pointer;
}

.icon-button svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: square;
}

.site-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
}

.brand-logo {
    display: block;
    width: auto;
    max-width: min(450px, 52vw);
    height: 96px;
    object-fit: contain;
    transition: height 180ms ease, transform 180ms ease;
}

.brand-logo-text {
    display: inline-flex;
    align-items: center;
    color: #000;
    font-family: Georgia, serif;
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.site-header.is-compact .brand-logo {
    height: 50px;
}

.site-header.is-compact .brand-logo-text {
    font-size: 30px;
}

.search-toggle svg,
.overlay-search button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.header-search-panel {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    border-top: 0 solid var(--line);
    background: var(--white);
    transition: grid-template-rows 180ms ease, border-top-width 180ms ease;
}

.header-search-panel.is-open {
    grid-template-rows: 1fr;
    border-top-width: 1px;
}

.header-search-form {
    display: flex;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.header-search-form input {
    flex: 1;
    min-width: 0;
    height: 54px;
    border: 0;
    background: transparent;
    color: var(--ink);
    outline: none;
}

.header-search-form button {
    width: 92px;
    border: 0;
    background: var(--ink);
    color: var(--white);
    font-weight: 800;
    cursor: pointer;
}

.auth-link,
.auth-button,
.button-dark,
.epaper-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.auth-link {
    color: var(--ink);
}

.epaper-action {
    border: 1px solid var(--red);
    background: var(--red);
    color: var(--white);
}

.epaper-action:hover {
    background: #8f0000;
    border-color: #8f0000;
    color: var(--white);
}

.auth-button,
.button-dark {
    padding: 14px 28px;
    background: var(--ink);
    color: var(--white);
    border: none;
    border-radius: 2px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.button-dark:hover {
    background: var(--red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.category-bar {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
}

.category-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    /* Custom Scrollbar for top categories */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

@media (max-width: 1024px) {
    .category-inner {
        justify-content: flex-start;
    }
}

.category-inner::-webkit-scrollbar {
    height: 4px;
}

.category-inner::-webkit-scrollbar-track {
    background: transparent;
}

.category-inner::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}

.category-inner::-webkit-scrollbar-thumb:hover {
    background-color: #b80000;
}

.category-inner a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.category-inner a:hover {
    color: var(--red);
}

.category-inner a:first-child {
    border-left: 0;
}

.breaking-ticker {
    background: var(--dark);
    color: var(--white);
}

.ticker-inner {
    display: flex;
    align-items: center;
    min-height: 38px;
    gap: 18px;
    overflow: hidden;
    font-size: 14px;
}

.ticker-inner strong {
    color: #ffdfdf;
    text-transform: uppercase;
}

.ticker-track {
    overflow: hidden;
    flex: 1;
}

.ticker-track span {
    display: inline-block;
    min-width: 100%;
    white-space: nowrap;
    animation: tickerMove 24s linear infinite;
}

@keyframes tickerMove {
    from { transform: translateX(100%); }
    to { transform: translateX(-100%); }
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
    visibility: hidden;
    background: rgba(0, 0, 0, 0);
    transition: visibility 300ms ease, background 300ms ease;
}

.mobile-overlay.is-open {
    visibility: visible;
    background: rgba(0, 0, 0, 0.5);
}

.mobile-overlay-panel {
    position: absolute;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    overflow-y: auto;
    background: var(--white);
    color: var(--ink);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-overlay.is-open .mobile-overlay-panel {
    transform: translateX(320px);
}

.mobile-overlay-head {
    display: grid;
    place-items: center;
    min-height: 104px;
    padding: 0 22px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.overlay-brand {
    height: 70px;
    max-width: 300px;
}

.overlay-search {
    display: flex;
    margin: 18px 22px 4px;
    border: 2px solid var(--ink);
}

.overlay-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 12px 14px;
    outline: none;
}

.overlay-search button {
    width: 52px;
    border: 0;
    border-left: 1px solid var(--line);
    background: var(--soft);
    cursor: pointer;
}

.mobile-overlay-nav {
    display: grid;
    padding: 12px 22px 40px;
}

.mobile-overlay-nav a {
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
    font-size: 21px;
    font-weight: 800;
    line-height: 1.15;
}

.section,
.lead-module {
    padding: 32px 0;
    border-bottom: 1px solid var(--line);
}

.lead-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
    gap: 28px;
}

.lead-main {
    display: block;
}

.image-ratio {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--soft);
}

.image-ratio img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lead-main h1,
.section-title,
.card-title,
.list-title,
.sidebar-title,
.auth-copy h1,
.epaper-hero h1,
.epaper-reader h2,
.epaper-archive h2 {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-head);
    line-height: 1.18;
    letter-spacing: 0;
}

.lead-main h1 {
    margin-top: 14px;
    font-size: clamp(30px, 3vw, 48px);
    font-weight: 800;
}

.lead-main p {
    max-width: 780px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 18px;
}

.category-label,
.eyebrow {
    display: block;
    margin-top: 12px;
    margin-bottom: 8px;
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.lead-side,
.story-grid,
.video-grid,
.category-row {
    display: grid;
    gap: 22px;
}

.lead-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.story-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.story-card,
.video-card {
    display: block;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.story-card .image-ratio,
.video-card .image-ratio {
    margin-bottom: 12px;
}

.card-title,
.video-card h3 {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--ink);
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.meta {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.section-title {
    padding-bottom: 9px;
    border-bottom: 3px solid var(--red);
    font-size: 24px;
    font-weight: 800;
}

.section-link {
    margin-bottom: 10px;
    color: var(--red);
    font-size: 15px;
    font-weight: 800;
}

.ad-band {
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.article-shell {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.breadcrumb {
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.breadcrumb a {
    color: var(--red);
}

.article-title {
    margin: 0 0 16px;
    font-family: var(--font-head);
    font-size: clamp(32px, 4vw, 52px);
    font-weight: 800;
    line-height: 1.12;
}

.article-deck {
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 20px;
    line-height: 1.45;
}

.article-byline {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.share-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.share-button {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-button:hover {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--white);
}

.article-featured {
    margin: 0 0 32px;
}

.article-featured img {
    width: 100%;
    height: auto;
}

.article-featured .caption {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.article-body {
    margin-bottom: 64px;
    font-size: 19px;
    line-height: 1.7;
}

.article-body p {
    margin: 0 0 24px;
}

.related-articles {
    padding-top: 48px;
    border-top: 3px solid var(--red);
}

.related-title {
    margin-bottom: 24px;
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 800;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.ad-placeholder,
.ad-slot-widget {
    display: grid;
    min-height: 96px;
    place-items: center;
    border: 1px dashed #b7b7b7;
    background: #fafafa;
    color: #777;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
}

.content-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 336px;
    gap: 32px;
    align-items: start;
}

.single-article-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 200px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1024px) {
    .single-article-layout {
        grid-template-columns: minmax(0, 1fr) 300px; /* Drop left wing on tablets */
    }
    .left-ad-rail {
        display: none;
    }
}

.category-module {
    margin-bottom: 38px;
}

.category-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sidebar-rail {
    position: sticky;
    top: 148px;
}

.sidebar-box {
    margin-bottom: 24px;
    padding: 22px;
    background: var(--soft);
}

.sidebar-title {
    margin-bottom: 16px;
    font-size: 22px;
}

.most-read-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: mostRead;
}

.most-read-list li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    counter-increment: mostRead;
    word-break: break-word;
    overflow-wrap: break-word;
    align-items: start;
}

.most-read-list li a {
    display: block;
    line-height: 1.4;
}

.most-read-list li::before {
    content: counter(mostRead);
    color: var(--red);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

.subscribe-box p {
    margin-top: 0;
    color: var(--muted);
}

.video-section {
    padding: 46px 0 58px;
    background: var(--dark);
    color: var(--white);
}

.video-section .section-heading {
    border-bottom-color: #333;
}

.video-section .section-title,
.video-section .video-card h3 {
    color: var(--white);
}

.video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.play-wrap {
    position: relative;
}

.play-icon {
    position: absolute;
    inset: 50% auto auto 50%;
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 50%;
    background: var(--white);
    color: var(--red);
    transform: translate(-50%, -50%);
}

.play-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.video-empty {
    grid-column: 1 / -1;
    color: #ccc;
}

.site-footer {
    padding: 42px 0 28px;
    background: var(--white);
    color: var(--ink);
    border-top: 1px solid var(--line);
}

.footer-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--line);
}

.footer-brand {
    height: 58px;
    max-width: 280px;
}

.footer-actions,
.footer-social,
.footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
}

.footer-actions a {
    font-weight: 800;
}

.footer-category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.footer-category-grid a {
    font-weight: 700;
}

.footer-social {
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.footer-social span {
    font-weight: 900;
}

.footer-legal {
    padding-top: 20px;
    color: var(--muted);
    font-size: 13px;
}

.copyright {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-shell {
    padding: 64px 24px 96px;
    background: #f4f4f4;
    background-image: radial-gradient(var(--line) 0.6px, transparent 0.6px);
    background-size: 24px 24px;
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1fr);
    max-width: 980px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--white);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
}

.auth-panel-wide {
    max-width: 1120px;
}

.auth-copy {
    padding: 48px;
    background: linear-gradient(145deg, #121212, #2a2a2a);
    color: var(--white);
}

.auth-logo {
    display: block;
    margin-bottom: 40px;
}

.auth-panel-logo {
    height: 72px;
    width: auto;
    filter: brightness(0) invert(1);
}

.auth-copy h1 {
    margin: 0 0 16px;
    color: var(--white);
    font-size: 38px;
    font-weight: 800;
}

.auth-copy p {
    color: #d7d7d7;
}

.auth-form {
    display: grid;
    gap: 16px;
    padding: 42px;
}

.auth-form label,
.auth-form legend {
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 800;
}

.auth-form input,
.auth-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    padding: 12px 13px;
    background: var(--white);
    outline: none;
}

.auth-form input:focus,
.auth-form textarea:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px rgba(20, 20, 20, 0.08);
}

.check-row,
.role-options label {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-row input,
.role-options input {
    width: auto;
}

.role-options {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
}

.form-alert,
.form-success {
    padding: 12px 14px;
    font-weight: 800;
}

.form-alert {
    background: #ffe9e9;
    color: #8a0000;
}

.form-success {
    background: #e8f6ec;
    color: #106b28;
}

.auth-note {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-note a {
    color: var(--red);
    font-weight: 800;
}

.epaper-hero {
    padding: 46px 0;
    background: var(--ink);
    color: var(--white);
}

.epaper-hero h1 {
    color: var(--white);
    font-size: 48px;
}

.epaper-hero p {
    max-width: 760px;
    margin: 12px 0 0;
    color: #ddd;
}

.epaper-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 32px;
    padding-top: 34px;
    padding-bottom: 60px;
}

.reader-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.flip-reader {
    position: relative;
    overflow: hidden;
    min-height: 720px;
    border: 1px solid var(--line);
    background: #e9e9e9;
    perspective: 1800px;
}

.flip-reader::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 50%;
    width: 34px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0,0,0,0.1), rgba(255,255,255,0.35), rgba(0,0,0,0.08));
    transform: translateX(-50%);
    z-index: 1;
}

.flip-reader iframe {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 720px;
    border: 0;
    background: var(--white);
}

.empty-reader {
    display: grid;
    min-height: 720px;
    place-items: center;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

.epaper-archive h2 {
    margin-bottom: 16px;
    font-size: 24px;
}

.epaper-grid {
    display: grid;
    gap: 18px;
}

.epaper-card {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
    padding: 10px 0 18px;
    border-bottom: 1px solid var(--line);
}

.epaper-card.is-active {
    padding-left: 10px;
    border-left: 4px solid var(--red);
}

.epaper-cover {
    display: grid;
    min-height: 140px;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff, #eeeeee);
    border: 1px solid var(--line);
    box-shadow: 8px 8px 0 #dedede;
    transform-origin: left center;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.epaper-card:hover .epaper-cover {
    box-shadow: 12px 10px 0 #d0d0d0;
    transform: rotateY(-8deg);
}

.epaper-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.epaper-cover span {
    color: var(--red);
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 900;
}

.epaper-card h3 {
    margin: 0 0 6px;
    font-family: var(--font-head);
    font-size: 20px;
    line-height: 1.25;
}

.epaper-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.list-item {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.list-thumb {
    width: 108px;
    height: 70px;
}

.list-title {
    font-size: 18px;
}

@media (max-width: 1100px) {
    .story-grid,
    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .category-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 0 16px;
    }

    .masthead-inner {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        min-height: 80px;
        gap: 8px;
    }

    .site-header.is-compact .masthead-inner {
        min-height: 60px;
    }

    .masthead-left {
        order: 1;
    }

    .site-logo {
        order: 2;
        justify-content: center;
    }

    .masthead-actions {
        order: 3;
        justify-content: flex-end;
        gap: 0;
    }

    .desktop-menu,
    .desktop-search,
    .auth-wrap,
    .epaper-action {
        display: none !important;
    }

    .mobile-menu,
    .mobile-search {
        display: inline-grid !important;
    }

    .epaper-action {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .brand-logo {
        height: 68px;
        max-width: 52vw;
    }

    .brand-logo-text {
        font-size: 28px;
    }

    .site-header.is-compact .brand-logo {
        height: 42px;
    }

    .site-header.is-compact .brand-logo-text {
        font-size: 22px;
    }

    .category-bar {
        display: none;
    }

    .breaking-ticker {
        display: none;
    }

    .sidebar-box {
        padding: 16px;
        margin-bottom: 16px;
    }

    .lead-grid,
    .content-sidebar,
    .single-article-layout,
    .auth-panel,
    .epaper-layout {
        grid-template-columns: 1fr;
    }

    .lead-side,
    .story-grid,
    .video-grid,
    .footer-category-grid {
        grid-template-columns: 1fr;
    }

    .category-row {
        display: flex;
        overflow-x: auto;
        padding-bottom: 15px;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
    }
    
    .category-row::-webkit-scrollbar {
        height: 6px;
    }
    
    .category-row::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.02);
        border-radius: 6px;
    }
    
    .category-row::-webkit-scrollbar-thumb {
        background-color: #ddd;
        border-radius: 6px;
    }
    
    .category-row::-webkit-scrollbar-thumb:hover {
        background-color: #b80000;
    }

    .category-row .story-card {
        min-width: 78vw;
        scroll-snap-align: start;
    }

    .sidebar-rail {
        position: static;
    }

    .footer-brand-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .auth-shell {
        padding: 28px 16px 48px;
    }

    .auth-copy,
    .auth-form {
        padding: 28px;
    }

    .auth-copy h1,
    .epaper-hero h1 {
        font-size: 34px;
    }

    .flip-reader,
    .flip-reader iframe,
    .empty-reader {
        min-height: 520px;
        height: 520px;
    }

    .article-shell {
        padding: 20px 16px 48px;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Force article content to wrap properly on mobile */
    .article-title {
        font-size: clamp(22px, 6vw, 30px);
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .article-deck {
        font-size: 16px;
    }

    /* Fully hide both ad wing sidebars on mobile */
    .left-ad-rail,
    .right-ad-rail {
        display: none !important;
    }

    /* Force single column no matter what on mobile */
    .single-article-layout {
        grid-template-columns: 1fr !important;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .masthead-inner {
        grid-template-columns: 44px minmax(0, 1fr) 88px;
    }

    .masthead-actions .auth-button {
        display: none;
    }

    .search-toggle {
        width: 38px;
        height: 38px;
    }

    .epaper-action {
        padding: 7px 8px;
        font-size: 12px;
    }

    .mobile-overlay-nav a {
        font-size: 19px;
    }

    .lead-main h1 {
        font-size: 29px;
    }

    .epaper-card {
        grid-template-columns: 92px minmax(0, 1fr);
    }
/* Global Skeleton Loader System */
.skeleton-box {
    background: #eee;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    border-radius: 4px;
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}

@keyframes shine {
    to { background-position-x: -200%; }
}

/* Apply Skeleton while images load */
.image-ratio {
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
    border-radius: 4px;
}

.image-ratio::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(110deg, #f0f0f0 8%, #f8f8f8 18%, #f0f0f0 33%);
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
    z-index: 1;
    transition: opacity 0.4s ease;
}

.image-ratio.loaded::before {
    opacity: 0;
    pointer-events: none;
}

/* Fast Scroll & GPU Boost */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.story-card, .lead-main, .recruit-ultra-card {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Staggered Entrance */
.story-card {
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ticker Speed Optimization */
.ticker-content {
    display: flex;
    white-space: nowrap;
    will-change: transform;
}

/* Ultra-Red Highlight Recruit Section */
.ultra-highlight-recruit {
    padding: 80px 0;
    margin: 40px 0;
}

.recruit-ultra-card {
    background: var(--red);
    padding: 60px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--white);
    box-shadow: 0 15px 35px rgba(184, 0, 0, 0.25);
}

.recruit-text-wrap {
    max-width: 600px;
}

.recruit-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.recruit-text-wrap h2 {
    font-size: 38px;
    font-weight: 800;
    margin: 0 0 10px;
    line-height: 1.2;
    color: var(--white);
}

.recruit-text-wrap p {
    font-size: 18px;
    margin: 0;
    opacity: 0.9;
}

.recruit-buttons {
    display: flex;
    gap: 15px;
}

.btn-white-solid {
    padding: 16px 32px;
    background: var(--white);
    color: var(--red);
    font-weight: 800;
    text-decoration: none;
    border-radius: 4px;
}

.btn-white-solid:hover {
    background: #f0f0f0;
}

.btn-white-outline {
    padding: 14px 30px;
    border: 2px solid var(--white);
    color: var(--white);
    font-weight: 800;
    text-decoration: none;
    border-radius: 4px;
}

.btn-white-outline:hover {
    background: rgba(255,255,255,0.1);
}

@media (max-width: 900px) {
    .recruit-ultra-card {
        flex-direction: column;
        text-align: center;
        padding: 40px 24px;
    }
    .recruit-buttons {
        flex-direction: column;
        width: 100%;
        margin-top: 30px;
    }
    .btn-white-solid, .btn-white-outline {
        width: 100%;
    }
}

    .epaper-cover {
        min-height: 122px;
    }
}

/* App-Like Mobile UX Enhancements */
.masthead {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.mobile-bottom-nav,
.mobile-sticky-ad {
    display: none;
}

@media (max-width: 768px) {
    body {
        /* Account for bottom nav + iOS safe area (home indicator) */
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 -2px 15px rgba(0,0,0,0.08);
        z-index: 9999;
        justify-content: space-around;
        padding: 10px 0 0 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        /* GPU layer: stops Chrome Android URL-bar resize from causing floating glitch */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
        backface-visibility: hidden;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #555;
        text-decoration: none;
        font-size: 11px;
        font-weight: 700;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        width: 25%;
    }
    
    .nav-item svg {
        width: 24px;
        height: 24px;
        stroke: #555;
    }

    .nav-item:active svg, .nav-item:active span, .nav-item:hover svg, .nav-item:hover span {
        color: var(--red);
        stroke: var(--red);
    }
    
    .mobile-center {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
}
