/* ==============================================================================
   newspaper.css — TNW-inspired newspaper layout for News Literacy
   2026-04-06 Build:1
   ============================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-secondary: #64748b;
    --color-accent: #0ea5e9;
    --color-accent-dark: #0284c7;
    --color-border: #e2e8f0;
    --color-card-bg: #ffffff;
    --color-hero-overlay: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.85) 100%);
    --color-footer-bg: #0f172a;
    --shadow-card: 0 1px 3px rgba(0,0,0,.08);
    --shadow-card-hover: 0 8px 24px rgba(0,0,0,.12);
    --radius: 6px;
    --max-width: 1280px;
    --transition: .2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ==============================================================================
   HEADER
   ============================================================================== */
.np-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    box-shadow: 0 1px 0 var(--color-border);
}
.np-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 120px;
}
.np-header__logo { display: flex; align-items: center; }
.np-header__logo-img { height: 108px; width: auto; }
.np-header__nav {
    margin-left: auto;
    display: flex;
    gap: 0;
}
.np-header__link {
    padding: .75rem 1rem;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    letter-spacing: .01em;
    transition: color var(--transition);
    white-space: nowrap;
}
.np-header__link:hover { color: var(--color-text); }
.np-header__link--active {
    color: var(--color-text);
    box-shadow: inset 0 -2px 0 var(--color-accent);
}
.np-header__link--muted {
    font-size: .75rem;
    opacity: .5;
}
.np-header__hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}
.np-header__hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
}

/* --- Topic Bar --- */
.np-topicbar {
    border-top: 1px solid var(--color-border);
    background: #fafbfc;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.np-topicbar::-webkit-scrollbar { display: none; }
.np-topicbar__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 0;
    white-space: nowrap;
}
.np-topicbar__link {
    padding: .5rem 1rem;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-text-secondary);
    transition: color var(--transition);
    cursor: pointer;
}
.np-topicbar__link:hover { color: var(--color-accent); }

/* --- Mobile Nav --- */
.np-mobile-nav {
    position: fixed;
    top: 120px;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 99;
    flex-direction: column;
    padding: 2rem 1.5rem;
    gap: .5rem;
}
.np-mobile-nav[hidden] { display: none; }
.np-mobile-nav:not([hidden]) { display: flex; }
@media (min-width: 769px) {
    .np-mobile-nav { display: none !important; }
}
.np-mobile-nav a {
    font-size: 1.125rem;
    font-weight: 500;
    padding: .75rem 0;
    border-bottom: 1px solid var(--color-border);
}

/* ==============================================================================
   HERO GRID
   ============================================================================== */
.np-hero {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: .5rem 1.5rem 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: .5rem;
    height: clamp(400px, 65vh, 700px);
}
.np-hero__cell {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #111;
    cursor: pointer;
}
.np-hero__cell:first-child {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}
.np-hero__cell:nth-child(2) {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
}
.np-hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s cubic-bezier(0,0,.2,1);
}
.np-hero__cell:hover .np-hero__img { transform: scale(1.03); }
.np-hero__overlay {
    position: absolute;
    inset: 0;
    background: var(--color-hero-overlay);
    z-index: 1;
}
.np-hero__content {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    padding: 1.5rem;
    z-index: 2;
    color: #fff;
}
.np-hero__badge {
    display: inline-block;
    background: var(--color-accent);
    color: #fff;
    font-size: .625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: .2em .6em;
    border-radius: 2px;
    margin-bottom: .5rem;
}
.np-hero__headline {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: .375rem;
}
/* Lead story headline */
.np-hero__cell:first-child .np-hero__headline { font-size: clamp(1.5rem, 2.5vw, 2.5rem); }
/* Second story */
.np-hero__cell:nth-child(2) .np-hero__headline { font-size: clamp(1.125rem, 1.8vw, 1.5rem); }
/* Third and fourth */
.np-hero__cell:nth-child(3) .np-hero__headline,
.np-hero__cell:nth-child(4) .np-hero__headline { font-size: clamp(.9rem, 1.2vw, 1.125rem); }

.np-hero__summary {
    font-size: .875rem;
    opacity: .85;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Hide summary on small hero cells */
.np-hero__cell:nth-child(3) .np-hero__summary,
.np-hero__cell:nth-child(4) .np-hero__summary { display: none; }
.np-hero__meta {
    margin-top: .5rem;
    font-size: .75rem;
    opacity: .7;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.np-hero__sources {
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(4px);
    padding: .15em .5em;
    border-radius: 3px;
    font-weight: 600;
}

/* ==============================================================================
   STATS STRIP
   ============================================================================== */
.np-strip {
    border-bottom: 1px solid var(--color-border);
    background: #fafbfc;
}
.np-strip__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: .625rem 1.5rem;
    display: flex;
    gap: 2rem;
    font-size: .75rem;
    color: var(--color-text-secondary);
}
.np-strip__inner span { white-space: nowrap; }

/* ==============================================================================
   MAIN CONTENT
   ============================================================================== */
.np-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* --- Section --- */
.np-section {
    padding-top: 2rem;
}
.np-section__title {
    font-family: var(--font-sans);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-accent);
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--color-accent);
    margin-bottom: 1.25rem;
}

/* --- Card Grid --- */
.np-grid {
    display: grid;
    gap: 1.25rem;
}
.np-grid--3 { grid-template-columns: repeat(3, 1fr); }
.np-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* --- Article Card --- */
.np-card {
    display: flex;
    flex-direction: column;
    background: var(--color-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.np-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}
.np-card__img-wrap {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: #e2e8f0;
}
.np-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.np-card:hover .np-card__img { transform: scale(1.04); }
.np-card__topic {
    position: absolute;
    bottom: .5rem;
    left: .5rem;
    background: var(--color-accent);
    color: #fff;
    font-size: .5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .15em .5em;
    border-radius: 2px;
}
.np-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.np-card__headline {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: .5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.np-card__summary {
    font-size: .8125rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .75rem;
}
.np-card__footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .6875rem;
    color: var(--color-text-secondary);
}
.np-card__source-count {
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
    padding: .15em .45em;
    border-radius: 3px;
    font-size: .625rem;
}
.np-card__cta {
    font-weight: 600;
    color: var(--color-accent);
}

/* --- Topic Section --- */
.np-topic-section {
    padding-top: 2.5rem;
}
.np-topic-section__header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--color-text);
    margin-bottom: 1.25rem;
}
.np-topic-section__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
}
.np-topic-section__count {
    font-size: .75rem;
    color: var(--color-text-secondary);
}

/* --- Topic Section: Lead + List layout --- */
.np-topic-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.np-topic-lead {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #111;
    cursor: pointer;
    min-height: 320px;
}
.np-topic-lead__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.np-topic-lead:hover .np-topic-lead__img { transform: scale(1.03); }
.np-topic-lead__overlay {
    position: absolute;
    inset: 0;
    background: var(--color-hero-overlay);
}
.np-topic-lead__content {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    padding: 1.25rem;
    z-index: 2;
    color: #fff;
}
.np-topic-lead__headline {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: .375rem;
}
.np-topic-lead__summary {
    font-size: .8125rem;
    opacity: .85;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.np-topic-lead__meta {
    margin-top: .5rem;
    font-size: .6875rem;
    opacity: .7;
}

/* Side list items */
.np-topic-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.np-topic-list__item {
    display: flex;
    gap: .875rem;
    padding: .875rem 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background var(--transition);
}
.np-topic-list__item:first-child { padding-top: 0; }
.np-topic-list__item:last-child { border-bottom: none; }
.np-topic-list__item:hover { background: #f8fafc; }
.np-topic-list__img {
    width: 100px;
    height: 72px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.np-topic-list__content { flex: 1; min-width: 0; }
.np-topic-list__headline {
    font-family: var(--font-display);
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .25rem;
}
.np-topic-list__meta {
    font-size: .6875rem;
    color: var(--color-text-secondary);
}

/* ==============================================================================
   FOOTER
   ============================================================================== */
.np-footer {
    background: var(--color-footer-bg);
    color: #94a3b8;
    margin-top: 3rem;
}
.np-footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
}
.np-footer h4 {
    color: #fff;
    font-size: .875rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.np-footer p {
    font-size: .8125rem;
    line-height: 1.6;
}
.np-footer__col {
    display: flex;
    flex-direction: column;
}
.np-footer__col a {
    font-size: .8125rem;
    padding: .25rem 0;
    transition: color var(--transition);
}
.np-footer__col a:hover { color: var(--color-accent); }
.np-footer__bottom {
    border-top: 1px solid rgba(148,163,184,.2);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    font-size: .75rem;
    text-align: center;
}

/* ==============================================================================
   RESPONSIVE
   ============================================================================== */
@media (max-width: 1024px) {
    .np-hero {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto auto;
        height: auto;
    }
    .np-hero__cell:first-child {
        grid-column: 1 / 3;
        grid-row: auto;
        min-height: 350px;
    }
    .np-hero__cell:nth-child(2) {
        grid-column: 1 / 3;
        min-height: 240px;
    }
    .np-hero__cell:nth-child(3),
    .np-hero__cell:nth-child(4) { min-height: 200px; }
    .np-grid--3 { grid-template-columns: repeat(2, 1fr); }
    .np-grid--4 { grid-template-columns: repeat(2, 1fr); }
    .np-topic-layout { grid-template-columns: 1fr; }
    .np-footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .np-header__nav { display: none; }
    .np-header__hamburger { display: flex; }
    .np-hero {
        grid-template-columns: 1fr;
        padding: .5rem 1rem 0;
    }
    .np-hero__cell:first-child {
        grid-column: auto;
        min-height: 280px;
    }
    .np-hero__cell:nth-child(2) { grid-column: auto; min-height: 200px; }
    .np-hero__cell:nth-child(3) { min-height: 180px; }
    .np-hero__cell:nth-child(4) { display: none; } /* hide 4th on mobile */
    .np-grid--3, .np-grid--4 { grid-template-columns: 1fr; }
    .np-main { padding: 0 1rem 2rem; }
    .np-strip__inner { gap: 1rem; font-size: .6875rem; }
    .np-footer__inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .np-hero__cell:first-child .np-hero__headline { font-size: 1.5rem; }
    .np-topicbar { display: none; }
}

@media (max-width: 480px) {
    .np-hero__cell:first-child { min-height: 240px; }
    .np-card__img-wrap { height: 140px; }
    .np-topic-lead { min-height: 240px; }
}

/* --- Flags --- */
.np-flag {
    height: 20px;
    width: auto;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.np-flags {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.np-hero__flags {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 3;
}
.np-hero__flags .np-flag { height: 24px; }
.np-card__flags {
    position: absolute;
    top: .5rem;
    right: .5rem;
}
.np-card__flags .np-flag { height: 18px; }

/* --- Skeleton loading --- */
.np-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: np-shimmer 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes np-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
