/* =============================================================
   WEB ENGINE OS — Master Stylesheet (Themed)
   Author:  Palash Jain
   (c) 2026 Palash Jain. All Rights Reserved.
   ============================================================= */

/* ── Typography ───────────────────────────────────────── */

h1, h2, h3, h4 {
    font-family: var(--font-headline);
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
}

.article-body {
    font-size: 1.125rem;
    line-height: 1.85;
    color: #1A1A1A;
}

.dark .article-body {
    color: #F0F0F0;
}

.article-body p {
    margin-bottom: 1.5rem;
    color: inherit;
}

.article-body h2 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #1A1A1A;
}

.dark .article-body h2 {
    color: #F0F0F0;
}

.article-body h3 {
    font-family: var(--font-headline);
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #1A1A1A;
}

.dark .article-body h3 {
    color: #F0F0F0;
}

.article-body li {
    color: #1A1A1A;
}

.dark .article-body li {
    color: #E8E8E8;
}

.article-body strong, .article-body b {
    color: inherit;
}

.article-body blockquote {
    border-left: 4px solid var(--color-border);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: #4b5563;
    font-style: italic;
}

.dark .article-body blockquote {
    color: #d1d5db;
}

.article-body ul, .article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body a:hover {
    color: var(--color-link);
    opacity: 0.8;
}

.article-body img {
    border-radius: 0.25rem;
    margin: 1.5rem 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-body th,
.article-body td {
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.article-body th {
    background: var(--color-surface);
    font-weight: 600;
}

/* ── Cards ────────────────────────────────────────────── */

.article-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 0.25rem;
    padding: 0.5rem;
    margin: -0.5rem;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    background-color: var(--color-surface);
}

/* Ensure card text stays high-contrast on hover */
.article-card:hover h3,
.article-card:hover h4 {
    color: var(--color-card-hover-text) !important;
}

.article-card:hover p,
.article-card:hover time,
.article-card:hover span:not(.section-tag) {
    color: var(--color-text-secondary);
}

.article-card img {
    transition: transform 0.3s ease;
}

.article-card:hover img {
    transform: scale(1.03);
}

/* Dark mode card hover */
.dark .article-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    background-color: var(--color-surface);
}

/* ── Section Tag ──────────────────────────────────────── */

.section-tag {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 2px;
}

/* ── Breaking News Ticker ─────────────────────────────── */

.ticker-bar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #E24B4A;
    flex-shrink: 0;
    z-index: 1;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E24B4A;
    animation: live-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

.ticker-scroll-wrap {
    flex: 1;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

.ticker-scroll {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    animation: ticker-scroll 30s linear infinite;
}

.ticker-scroll:hover {
    animation-play-state: paused;
}

.ticker-scroll a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    font-size: 14px;
}

.ticker-sep {
    opacity: 0.4;
}

.ticker-ago {
    font-size: 11px;
    opacity: 0.45;
    margin-left: 6px;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.byline-relative {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.byline-location {
    color: var(--color-text-secondary);
}

/* ── Ad Slots ─────────────────────────────────────────── */

.ad-slot {
    display: none; /* Hidden until AdSense is approved */
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* Activate when AdSense script is present */
.adsense-active .ad-slot {
    display: flex;
}

.ad-leaderboard {
    width: 100%;
    max-width: 728px;
    height: 90px;
}

.ad-rectangle {
    width: 300px;
    height: 250px;
}

.ad-sidebar {
    width: 300px;
    height: 600px;
}

@media (max-width: 768px) {
    .ad-leaderboard {
        max-width: 320px;
        height: 50px;
    }

    .ad-sidebar {
        height: 250px;
    }
}

/* ── Breadcrumb ───────────────────────────────────────── */

.breadcrumb a {
    transition: color 0.15s ease;
}

/* ── Cookie Consent ───────────────────────────────────── */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cookie-banner.visible {
    transform: translateY(0);
}

/* ── Share Buttons ────────────────────────────────────── */

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: opacity 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    border: none;
}

.share-btn:hover {
    opacity: 0.85;
    transform: scale(1.1);
}

/* ── Pagination ───────────────────────────────────────── */

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.pagination a:hover {
    background-color: var(--color-surface);
}

/* ── Dark Mode Toggle ─────────────────────────────────── */

.dark-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    transition: background-color 0.15s ease, transform 0.15s ease;
    padding: 0;
}

.dark-mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Non-dark header button needs different hover */
header:not([class*="bg-"]) .dark-mode-btn:hover,
.bg-gray-900 .dark-mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ── Affiliate Links ─────────────────────────────────── */

.affiliate-link {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.dark .affiliate-link {
    color: var(--color-accent, #93c5fd);
}

.affiliate-disclosure {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
    border-left: 3px solid var(--color-primary);
    color: #555;
}

.dark .affiliate-disclosure {
    background: rgba(255,255,255,0.04);
    border-left-color: var(--color-accent, #93c5fd);
    color: #999;
}

.affiliate-note {
    display: block;
    font-size: 12px;
    line-height: 1.4;
    margin: 4px 0 16px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f0f4ff;
    color: #555;
    font-style: italic;
}

.dark .affiliate-note {
    background: rgba(255,255,255,0.05);
    color: #999;
}

/* ── Scrollable Nav (hide scrollbar) ──────────────────── */
nav#main-nav::-webkit-scrollbar { display: none; }

/* ── Utilities ────────────────────────────────────────── */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* ── Dark Mode Overrides ──────────────────────────────── */

/* ── Dark mode: forced high-contrast overrides ────────── */
.dark body {
    background-color: var(--color-bg);
    color: #E0E0E0;
}
/* Nav active section — bold header (white text on dark bg) */
header nav a[class*="font-bold"][class*="text-white"] {
    color: #ffffff !important;
    background: rgba(255,255,255,0.2) !important;
    border-bottom: 3px solid #ffffff !important;
}
/* Nav active section — classic header (primary color on light bg) */
header nav a[class*="font-bold"][class*="text-\[var"] {
    font-weight: 700 !important;
    border-bottom: 3px solid var(--color-primary) !important;
}
.dark h1, .dark h2, .dark h3, .dark h4, .dark h5 {
    color: #F0F0F0 !important;
}
.dark .article-card h3, .dark .article-card h4, .dark .article-card h5 {
    color: #F0F0F0 !important;
}
.dark .article-card p, .dark .article-card .line-clamp-2 {
    color: #cbd5e1 !important;
}
.dark time, .dark .text-xs {
    color: #94a3b8 !important;
}
.dark .section-tag {
    color: #ffffff !important;
    background-color: var(--color-primary) !important;
    opacity: 0.9;
}
.dark .article-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.dark main a:not(.section-tag):not([class*="text-white"]) {
    color: var(--color-accent, #93c5fd);
}

/* Prose/typography dark overrides for Tailwind prose */
.dark .prose {
    color: var(--color-text);
}

.dark .prose h1,
.dark .prose h2,
.dark .prose h3,
.dark .prose h4 {
    color: var(--color-text);
}

.dark .prose p {
    color: var(--color-text);
}

.dark .prose strong {
    color: var(--color-text);
}

.dark .prose a,
.dark main a,
.dark footer a {
    color: var(--color-link) !important;
}

.dark .prose blockquote {
    color: var(--color-text-secondary);
    border-left-color: var(--color-border);
}

.dark .prose code {
    color: var(--color-text);
    background-color: var(--color-surface);
}

.dark .prose pre {
    background-color: #0d1117;
    color: #e6edf3;
}

.dark .prose th {
    background-color: var(--color-surface);
    color: var(--color-text);
}

.dark .prose td,
.dark .prose th {
    border-color: var(--color-border);
}

.dark .prose li::marker {
    color: var(--color-text-secondary);
}

.dark .prose hr {
    border-color: var(--color-border);
}

/* Dark mode image placeholders */
.dark .bg-gray-100 {
    background-color: var(--color-surface);
}

/* Dark mode footer stays dark */
.dark footer {
    background-color: #030712;
}

/* ── Responsive Breakpoints ──────────────────────────── */

@media (max-width: 640px) {
    .article-body {
        font-size: 1rem;
        line-height: 1.75;
    }

    .article-body h2 {
        font-size: 1.25rem;
    }

    .article-body h3 {
        font-size: 1.125rem;
    }
}

@media (min-width: 1024px) {
    .article-body {
        font-size: 1.1875rem;
        line-height: 1.9;
    }
}

/* ── Print styles ─────────────────────────────────────── */

@media print {
    header, footer, nav, .ad-slot, .share-btn, .cookie-banner, .dark-mode-btn, .ticker-wrap {
        display: none !important;
    }

    .article-body {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }
}


/* ── Article hero (YouTube-style blur fill) ────────────────────── */
.article-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--color-bg-secondary, #1a1a1a);
    border-radius: 0.25rem;
    margin: 0 0 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.article-hero .blur-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    transform: scale(1.1);
    opacity: 0.7;
    z-index: 0;
}
.article-hero .main-img {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    z-index: 1;
    display: block;
    margin: 0 auto;
}
.article-hero .hero-caption {
    position: absolute;
    bottom: 4px;
    right: 6px;
    z-index: 2;
    font-size: 9px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 5px;
    border-radius: 2px;
    margin: 0;
    max-width: 45%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
