/**
 * NewsPress Premium Styles
 * Mega menu, shrink header, lazy reveal, TOC, micro-interactions,
 * premium card designs, ad zones, Google Discover optimizations.
 *
 * Loaded as a separate non-blocking stylesheet.
 * All values use CSS custom properties from :root.
 */

/* ============================================================
   MEGA MENU
   ============================================================ */
.np-mega-item { position: static !important; } /* full-width panel relative to nav */

.np-mega-panel {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--np-bg, #fff);
    border-top: 3px solid var(--np-primary, #d32f2f);
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    z-index: 450;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
.np-mega-item.np-mega-open .np-mega-panel {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.np-mega-inner {
    max-width: var(--np-container, 1200px);
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}
.np-mega-inner .widget { margin: 0; }
.np-mega-inner .widget-title {
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--np-text-muted, #757575);
    margin-bottom: .75rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--np-primary, #d32f2f);
}
.np-mega-inner ul { list-style: none; padding: 0; margin: 0; }
.np-mega-inner ul li { border-bottom: 1px solid var(--np-border, #e0e0e0); }
.np-mega-inner ul li:last-child { border-bottom: 0; }
.np-mega-inner ul li a {
    display: block;
    padding: .4em 0;
    font-size: .875rem;
    color: var(--np-text, #212121);
    text-decoration: none;
    transition: color .12s;
}
.np-mega-inner ul li a:hover { color: var(--np-primary, #d32f2f); padding-left: .3em; transition: padding .12s, color .12s; }

/* Mobile: disable mega panel */
@media (max-width: 768px) {
    .np-mega-panel { display: none !important; }
}

/* ============================================================
   SHRINK HEADER — transition-ready classes (no inline duplication)
   ============================================================ */
.np-site-header {
    transition: box-shadow .25s ease;
}
.np-site-header.np-shrunk .np-header-inner {
    padding-block: .375rem;
}
.np-site-header.np-shrunk .np-site-logo img {
    max-height: 36px;
}
.np-site-header.np-shrunk .np-site-title {
    font-size: 1.1rem;
}
.np-site-header.np-shrunk .np-site-tagline,
.np-site-header.np-shrunk .np-header-search { display: none; }

/* ============================================================
   LAZY IMAGE REVEAL
   ============================================================ */
.np-img-lazy-reveal {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .35s ease, transform .35s ease;
}
.np-img-lazy-reveal.np-img-visible {
    opacity: 1;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .np-img-lazy-reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   TOC AUTO-HIGHLIGHT
   ============================================================ */
.np-toc a.np-toc-active,
.ez-toc-list a.np-toc-active,
.rank-math-toc a.np-toc-active,
[class*="table-of-contents"] a.np-toc-active {
    color: var(--np-primary, #d32f2f);
    font-weight: 700;
    padding-left: .5em;
    border-left: 3px solid var(--np-primary, #d32f2f);
    transition: all .15s;
}

/* ============================================================
   AD ZONES — standardised containers
   ============================================================ */
.np-ad-infeed {
    text-align: center;
    margin: 1.75rem auto;
    padding: .5rem 0;
    max-width: 100%;
    clear: both;
    /* Label for ad clarity */
    position: relative;
}
.np-ad-infeed::before {
    content: 'Advertisement';
    display: block;
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--np-text-muted, #9e9e9e);
    margin-bottom: .4rem;
}

.np-ad-sidebar {
    margin-bottom: 1.5rem;
    text-align: center;
    position: sticky;
    top: calc(var(--np-header-h, 60px) + 16px);
}

/* ============================================================
   PREMIUM CARD MICRO-INTERACTIONS
   ============================================================ */
.np-card {
    transition: transform .2s ease, box-shadow .2s ease;
    transform-origin: center bottom;
}
.np-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.np-card-thumb img {
    transition: transform .35s ease;
}
.np-card:hover .np-card-thumb img {
    transform: scale(1.04);
}

/* ============================================================
   CATEGORY BADGE — colour-coded by term slug
   ============================================================ */
.np-category-badge {
    display: inline-block;
    padding: .2em .65em;
    font-size: .6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-radius: 3px;
    background: var(--np-primary, #d32f2f);
    color: #fff;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    transition: opacity .15s;
}
.np-category-badge:hover { opacity: .85; color: #fff; text-decoration: none; }

/* Category-specific colours via data attribute set by JS */
[data-cat-color] .np-category-badge { background: attr(data-cat-color); }

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.np-breadcrumbs {
    margin-bottom: 1rem;
    font-size: .8125rem;
    color: var(--np-text-muted, #757575);
}
.np-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    list-style: none;
    padding: 0; margin: 0;
}
.np-breadcrumb-item + .np-breadcrumb-item::before {
    content: '›';
    margin: 0 .4em;
    color: var(--np-text-muted, #9e9e9e);
    font-size: 1em;
}
.np-breadcrumb-item a {
    color: var(--np-text-muted, #757575);
    text-decoration: none;
}
.np-breadcrumb-item a:hover { color: var(--np-primary, #d32f2f); text-decoration: underline; }
.np-breadcrumb-current { color: var(--np-text, #212121); font-weight: 500; }

/* ============================================================
   READING PROGRESS BAR (premium gradient)
   ============================================================ */
#np-read-progress {
    background: linear-gradient(90deg, var(--np-primary, #d32f2f), var(--np-accent, #f57c00));
    height: 3px;
}

/* ============================================================
   POST NAVIGATION — premium layout
   ============================================================ */
.np-post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin: 2rem 0;
    border: 1px solid var(--np-border, #e0e0e0);
    border-radius: var(--np-radius, 4px);
    overflow: hidden;
}
.np-post-nav-item {
    padding: 1.25rem;
    background: var(--np-bg-alt, #f5f5f5);
    transition: background .15s;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.np-post-nav-item:hover { background: var(--np-bg, #fff); }
.np-post-nav.np-prev { border-right: 1px solid var(--np-border, #e0e0e0); }
.np-post-nav-item.np-next { text-align: right; align-items: flex-end; }
.np-post-nav-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--np-text-muted, #757575);
}
.np-post-nav-title {
    font-size: .9375rem;
    font-weight: 700;
    font-family: var(--np-font-heading, Arial, sans-serif);
    color: var(--np-text, #212121);
    text-decoration: none;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.np-post-nav-title:hover { color: var(--np-primary, #d32f2f); }
@media (max-width: 600px) {
    .np-post-nav { grid-template-columns: 1fr; }
    .np-post-nav-item.np-next { text-align: left; align-items: flex-start; }
}

/* ============================================================
   SEARCH BAR — expand on click (mobile)
   ============================================================ */
@media (max-width: 900px) {
    .np-header-search input[type="search"] {
        width: 0;
        padding-left: 0;
        padding-right: 0;
        border-color: transparent;
        transition: width .3s ease, padding .3s, border-color .3s;
    }
    .np-header-search input[type="search"].np-search-expanded,
    .np-header-search input[type="search"]:focus {
        width: clamp(120px, 32vw, 200px);
        padding-left: .6em;
        padding-right: .6em;
        border-color: var(--np-border, #e0e0e0);
    }
}

/* ============================================================
   PREMIUM SECTION HEADINGS
   ============================================================ */
.np-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}
.np-section-heading h2 {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding-bottom: .35rem;
    border-bottom: 3px solid var(--np-primary, #d32f2f);
    white-space: nowrap;
}
.np-section-heading h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.1em;
    background: var(--np-primary, #d32f2f);
    border-radius: 2px;
    flex-shrink: 0;
}
.np-section-heading a {
    font-size: .8rem;
    font-weight: 600;
    color: var(--np-text-muted, #757575);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s;
}
.np-section-heading a:hover { color: var(--np-primary, #d32f2f); }

/* ============================================================
   GOOGLE DISCOVER — ensure large featured images
   ============================================================ */
.np-single-article .np-featured-image img {
    width: 100%;
    min-height: 200px; /* prevents tiny discover images */
    object-fit: cover;
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */
:focus-visible {
    outline: 3px solid var(--np-primary, #d32f2f);
    outline-offset: 3px;
}
/* Skip link — visible on focus */
.skip-link:focus {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 99999;
    padding: .75rem 1.5rem;
    background: var(--np-primary, #d32f2f);
    color: #fff;
    font-weight: 700;
    border-radius: var(--np-radius, 4px);
    text-decoration: none;
}

/* ============================================================
   LAYOUT SHIFT PREVENTION
   ============================================================ */
/* Reserve space for above-fold images to prevent CLS */
.np-featured-image, .np-hero-main, .np-hero-side {
    contain: layout style;
}
.np-card-thumb {
    contain: layout style paint;
}

