/* Topnav Brand Logo & Illuminated Wordmark */
.topnav a.logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.topnav a.logo .brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.topnav a.logo:hover .brand-logo,
.topnav a.logo:focus-visible .brand-logo,
.topnav a.logo:active .brand-logo {
    transform: scale(1.06);
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.5);
}

body.light-mode .topnav a.logo .brand-logo {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 107, 255, 0.18);
}

.topnav a.logo .brand-title {
    display: inline-flex;
    align-items: baseline;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    background: linear-gradient(135deg, #00f0ff 0%, #2b8cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.35));
    transition: filter 0.3s ease;
}

body.light-mode .topnav a.logo .brand-title {
    background: linear-gradient(135deg, #006bff 0%, #0095ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 0 8px rgba(0, 107, 255, 0.22));
}

.topnav a.logo:hover .brand-title,
.topnav a.logo:focus-visible .brand-title,
.topnav a.logo:active .brand-title {
    filter: drop-shadow(0 0 14px rgba(0, 240, 255, 0.65));
}

.topnav a.logo .brand-tagline {
    background: linear-gradient(90deg, #9beeff 0%, #7bb8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.4px;
    margin-left: 10px;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.25));
    transition: filter 0.3s ease;
}

body.light-mode .topnav a.logo .brand-tagline {
    background: linear-gradient(90deg, #1f5fa8 0%, #006bff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: none;
}

.topnav a.logo:hover .brand-tagline,
.topnav a.logo:focus-visible .brand-tagline {
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.55));
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 60px;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Section Titles */
.section-title {
    margin: 40px 0 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.section-title h2 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 5px;
}

.section-title p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Carousel Header & Controls */
.carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin: 40px 0 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.carousel-header-text h2 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 5px;
}

.carousel-header-text p {
    color: var(--text-muted);
    font-size: 1rem;
}

.carousel-controls {
    display: flex;
    gap: 12px;
}

.carousel-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-btn:hover, .carousel-btn:focus-visible, .carousel-btn:active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    transform: scale(1.05);
}

/* Grids */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.carousel-grid {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    padding: 16px 12px 24px;
    margin: -16px -12px 40px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.carousel-grid::-webkit-scrollbar { display: none; }

.carousel-grid.grabbing {
    scroll-behavior: auto;
    cursor: grabbing;
}

/* News Cards */
.news-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.carousel-grid .news-card {
    min-width: 350px;
    max-width: 350px;
    flex: 0 0 auto;
    user-select: none;
}

.news-card:hover, .news-card:focus-visible, .news-card:active {
    transform: scale(1.02);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    z-index: 2;
}

.thumb-container {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background-color: var(--terminal-bg);
}

.thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.5s ease;
    pointer-events: none;
}

.news-card:hover .thumb-container img,
.news-card:focus-visible .thumb-container img,
.news-card:active .thumb-container img {
    transform: scale(1.05);
}

.summary-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(13, 17, 23, 0.95);
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
}

body.light-mode .summary-overlay {
    background-color: rgba(255, 255, 255, 0.95);
}

.news-card:hover .summary-overlay,
.news-card:focus-visible .summary-overlay,
.news-card:active .summary-overlay {
    opacity: 1;
}

.summary-text {
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.news-card:hover .summary-text,
.news-card:focus-visible .summary-text,
.news-card:active .summary-text {
    transform: translateY(0);
}

.card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.card-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.card-category {
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge-breaking {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 77, 79, 0.14);
    color: #ff4d4f;
    border: 1px solid #ff4d4f;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

body.light-mode .badge-breaking {
    background-color: rgba(207, 34, 46, 0.1);
    color: #cf222e;
    border-color: #cf222e;
}

.card-date {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.card-title {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 15px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.news-card:hover .card-title,
.news-card:focus-visible .card-title,
.news-card:active .card-title {
    color: var(--accent-blue);
}

.read-more {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    transition: color 0.3s ease;
}

.news-card:hover .read-more,
.news-card:focus-visible .read-more,
.news-card:active .read-more {
    color: var(--accent-blue);
}

.read-more i { transition: transform 0.3s ease; }

.news-card:hover .read-more i,
.news-card:focus-visible .read-more i,
.news-card:active .read-more i {
    transform: translateX(5px);
}

/* HistoryOps Tile Entrance Animation */
@keyframes tileReveal {
    0% {
        opacity: 0;
        transform: translateY(28px) scale(0.95);
        filter: blur(4px);
    }
    65% {
        opacity: 1;
        transform: translateY(-4px) scale(1.01);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.news-card.tile-enter {
    opacity: 0;
    animation: tileReveal 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--stagger-delay, 0ms);
}

.news-card.tile-enter::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    box-shadow: inset 0 0 18px rgba(0, 240, 255, 0.25);
    opacity: 0;
    animation: tilePulse 0.7s ease-out forwards;
    animation-delay: var(--stagger-delay, 0ms);
}

@keyframes tilePulse {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.history-sentinel {
    height: 40px;
    margin-bottom: 40px;
}

@media (prefers-reduced-motion: reduce) {
    .news-card.tile-enter {
        opacity: 1;
        animation: none;
    }
    .news-card.tile-enter::after {
        display: none;
    }
    .topnav .brand-logo {
        animation: none !important;
    }
}

@media (max-width: 900px) {
    .topnav {
        flex-direction: column;
        align-items: center;
        padding: 15px 14px;
        gap: 12px;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    }

    body.light-mode .topnav {
        box-shadow: 0 6px 20px rgba(31, 35, 40, 0.08);
    }

    .topnav a.logo {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 14px !important;
    }

    /* +32% larger mobile logo (44px -> 58px) with subtle ambient glow */
    .topnav a.logo .brand-logo {
        width: 58px !important;
        height: 58px !important;
        border-radius: 13px !important;
        animation: mobileLogoPulse 4s ease-in-out infinite;
    }

    .topnav a.logo .brand-logo:active {
        transform: scale(0.95);
    }

    .topnav a.logo .brand-title {
        display: inline-flex !important;
        font-size: 1.55rem !important;
        letter-spacing: 1.4px !important;
    }

    .topnav a.logo .brand-tagline {
        display: none !important;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 14px;
    }

    .carousel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .news-grid { grid-template-columns: 1fr; }
    .summary-overlay { display: none; }
}