/* ============================================================
   NewsDesk.Tech — Premium Newspaper Stylesheet
   ============================================================ */

/* === Article Typography === */
.article-body {
    font-size: 1.125rem;
    line-height: 1.8;
    max-width: 65ch;
    margin: 0 auto;
}
.article-body p {
    margin-bottom: 1.5em;
}
.article-body h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    margin: 2.5em 0 1em;
    font-weight: 700;
    line-height: 1.3;
    color: #1c1917;
}
.dark .article-body h2 {
    color: #f5f5f4;
}
.article-body h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.375rem;
    margin: 2em 0 0.75em;
    font-weight: 600;
    line-height: 1.35;
    color: #1c1917;
}
.dark .article-body h3 {
    color: #f5f5f4;
}
.article-body h4 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1.125rem;
    margin: 1.75em 0 0.5em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #44403c;
}
.dark .article-body h4 {
    color: #d6d3d1;
}
.article-body blockquote {
    border-left: 4px solid var(--brand-accent, #c70000);
    padding: 1em 1.5em;
    margin: 2em 0;
    font-style: italic;
    background: #fafaf9;
    border-radius: 0 0.25rem 0.25rem 0;
    color: #44403c;
}
.dark .article-body blockquote {
    background: #1c1917;
    color: #d6d3d1;
}
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 2em auto;
    display: block;
}
.article-body figure {
    margin: 2em 0;
}
.article-body figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: #78716c;
    margin-top: 0.5em;
    font-style: italic;
}
.article-body a {
    color: var(--brand-accent, #c70000);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: text-decoration-thickness 0.15s ease;
}
.article-body a:hover {
    text-decoration-thickness: 2px;
}
.article-body ul,
.article-body ol {
    margin: 1.5em 0;
    padding-left: 1.5em;
}
.article-body li {
    margin-bottom: 0.5em;
}
.article-body ul li {
    list-style-type: disc;
}
.article-body ol li {
    list-style-type: decimal;
}
.article-body pre {
    font-family: 'JetBrains Mono', monospace;
    background: #1c1917;
    color: #e7e5e4;
    padding: 1.5em;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 2em 0;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 1px solid #292524;
}
.article-body code {
    font-family: 'JetBrains Mono', monospace;
    background: #f5f5f4;
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: #c70000;
}
.dark .article-body code {
    background: #292524;
    color: #f87171;
}
.article-body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.article-body hr {
    border: none;
    border-top: 1px solid #e7e5e4;
    margin: 3em 0;
}
.dark .article-body hr {
    border-top-color: #44403c;
}
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.9375rem;
}
.article-body table th,
.article-body table td {
    padding: 0.75em 1em;
    border: 1px solid #e7e5e4;
    text-align: left;
}
.dark .article-body table th,
.dark .article-body table td {
    border-color: #44403c;
}
.article-body table th {
    background: #f5f5f4;
    font-weight: 600;
}
.dark .article-body table th {
    background: #292524;
}

/* === Pull Quotes === */
.pull-quote {
    position: relative;
    margin: 3em -2em;
    padding: 2em 3em;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    line-height: 1.4;
    font-style: italic;
    color: var(--brand-accent, #c70000);
    text-align: center;
}
.pull-quote::before {
    content: '\201C';
    font-size: 5rem;
    position: absolute;
    top: -0.5em;
    left: 0.25em;
    color: var(--brand-accent, #c70000);
    opacity: 0.15;
    font-family: 'Playfair Display', Georgia, serif;
    line-height: 1;
}
.pull-quote::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--brand-accent, #c70000);
    margin: 1.5em auto 0;
    opacity: 0.3;
}

@media (max-width: 768px) {
    .pull-quote {
        margin: 2em 0;
        padding: 1.5em;
        font-size: 1.25rem;
    }
}

/* === Breaking News Ticker === */
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-wrapper {
    overflow: hidden;
    position: relative;
}

.ticker-text {
    display: inline-block;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    padding-left: 100%;
}

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

/* === Breaking Badge Pulse === */
@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.breaking-badge {
    animation: pulse-badge 2s ease-in-out infinite;
}

/* === Section Colors === */
.section-news { border-color: #c70000; }
.section-news .section-accent { background-color: #c70000; }

.section-sports { border-color: #00b2ff; }
.section-sports .section-accent { background-color: #00b2ff; }

.section-opinion { border-color: #e05e00; }
.section-opinion .section-accent { background-color: #e05e00; }

.section-entertainment { border-color: #bb3b80; }
.section-entertainment .section-accent { background-color: #bb3b80; }

.section-business { border-color: #3d7b99; }
.section-business .section-accent { background-color: #3d7b99; }

.section-tech { border-color: #7d0068; }
.section-tech .section-accent { background-color: #7d0068; }

.section-technology { border-color: #7d0068; }
.section-technology .section-accent { background-color: #7d0068; }

.section-lifestyle { border-color: #43853d; }
.section-lifestyle .section-accent { background-color: #43853d; }

/* Generic section color support via CSS custom property */
.section-bar {
    height: 3px;
    width: 100%;
}

/* === Dark Mode Overrides === */
.dark .article-body pre {
    background: #0c0a09;
    border-color: #292524;
}

/* === Scroll Progress Bar === */
#scroll-progress {
    background: var(--brand-accent, #c70000);
}

/* === Article Card Hover Effects === */
.article-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
.article-card .card-image {
    overflow: hidden;
}
.article-card .card-image img {
    transition: transform 0.5s ease;
}
.article-card:hover .card-image img {
    transform: scale(1.05);
}

/* === Hero Card Overlay === */
.hero-overlay {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        transparent 100%
    );
}

/* === Skeleton Loaders === */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #e7e5e4 25%, #f5f5f4 50%, #e7e5e4 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.25rem;
}
.dark .skeleton {
    background: linear-gradient(90deg, #292524 25%, #44403c 50%, #292524 75%);
    background-size: 200% 100%;
}

/* === Numbered Most Read === */
.most-read-number {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #e7e5e4;
    line-height: 1;
    min-width: 2.5rem;
    text-align: center;
}
.dark .most-read-number {
    color: #44403c;
}

/* === Newsletter CTA === */
.newsletter-cta {
    background: linear-gradient(135deg, #1c1917 0%, #292524 50%, #1c1917 100%);
}
.dark .newsletter-cta {
    background: linear-gradient(135deg, #f5f5f4 0%, #e7e5e4 50%, #f5f5f4 100%);
}
.dark .newsletter-cta h2 {
    color: #1c1917;
}
.dark .newsletter-cta p {
    color: #57534e;
}

/* === Category Badge === */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 0.125rem;
    line-height: 1.6;
    text-decoration: none;
    transition: opacity 0.15s ease;
}
.category-badge:hover {
    opacity: 0.85;
}

/* === Sticky Share Sidebar === */
.share-sidebar {
    position: sticky;
    top: 120px;
}
.share-sidebar a,
.share-sidebar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}
.share-sidebar a:hover,
.share-sidebar button:hover {
    transform: scale(1.15);
}

/* === Masthead === */
.masthead-name {
    font-family: 'Playfair Display', Georgia, serif;
    letter-spacing: -0.02em;
}
.masthead-tagline {
    font-family: 'Inter', system-ui, sans-serif;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

/* === Safe area for mobile bottom nav === */
.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}
main {
    padding-bottom: 4rem;
}
@media (min-width: 768px) {
    main {
        padding-bottom: 0;
    }
}

/* === No Scrollbar (for horizontal scroll sections) === */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* === Line Clamp 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;
}

/* === Opinion Section Styling === */
.opinion-card {
    border-left: 3px solid #e05e00;
    padding-left: 1rem;
}
.opinion-card .author-photo {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    object-fit: cover;
}

/* === Smooth Section Transitions === */
.section-transition {
    transition: all 0.3s ease;
}

/* === Custom Scrollbar (desktop) === */
@media (min-width: 768px) {
    ::-webkit-scrollbar {
        width: 8px;
    }
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    ::-webkit-scrollbar-thumb {
        background: #a8a29e;
        border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover {
        background: #78716c;
    }
    .dark ::-webkit-scrollbar-thumb {
        background: #57534e;
    }
    .dark ::-webkit-scrollbar-thumb:hover {
        background: #78716c;
    }
}

/* === Focus Styles (Accessibility) === */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--brand-accent, #c70000);
    outline-offset: 2px;
    border-radius: 2px;
}

/* === Selection Color === */
::selection {
    background-color: var(--brand-accent, #c70000);
    color: white;
}

/* === Smooth Image Loading === */
img {
    transition: opacity 0.3s ease;
}
img.loaded {
    opacity: 1;
}
img.lazy {
    opacity: 0;
}

/* === Section Nav Tab Active State === */
.section-nav-tab[aria-current="page"],
.section-nav-tab.active {
    color: var(--tab-color, #1c1917);
    border-bottom-color: var(--tab-color, #1c1917);
}

/* === Print Styles === */
@media print {
    .print\:hidden,
    nav,
    footer,
    .share-sidebar,
    .share-sidebar-container,
    #scroll-progress,
    .breaking-ticker,
    .back-to-top,
    .mobile-bottom-nav,
    .newsletter-cta,
    [x-data],
    .safe-bottom {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    .article-body {
        max-width: 100%;
        font-size: 11pt;
        line-height: 1.6;
    }

    .article-body a {
        color: black;
        text-decoration: underline;
    }

    .article-body a::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        word-break: break-all;
    }

    .article-body img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    .category-badge {
        border: 1px solid #999;
        color: #333 !important;
        background: white !important;
    }

    @page {
        margin: 0.75in;
    }
}

/* === Drop Cap (optional usage with .drop-cap class) === */
.article-body .drop-cap::first-letter {
    float: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 4.5em;
    line-height: 0.85;
    padding-right: 0.1em;
    margin-top: 0.05em;
    font-weight: 700;
    color: var(--brand-accent, #c70000);
}

/* === Responsive Article Body === */
@media (max-width: 640px) {
    .article-body {
        font-size: 1rem;
        line-height: 1.7;
    }
    .article-body h2 {
        font-size: 1.5rem;
    }
    .article-body h3 {
        font-size: 1.25rem;
    }
    .article-body blockquote {
        padding: 0.75em 1em;
        margin: 1.5em 0;
    }
    .article-body pre {
        padding: 1em;
        font-size: 0.8rem;
    }
    .pull-quote {
        font-size: 1.125rem;
    }
}

/* === Toast Notification Enhancement === */
#toast-notification {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s ease;
}

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

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .article-card,
    .article-card .card-image img,
    .ticker-text,
    .breaking-badge,
    .skeleton,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
