/* ═══════════════════════════════════════════════════
   TDN MAGAZINE — HOMEPAGE LAYOUT v1.3
═══════════════════════════════════════════════════ */

/* ─── Hero ───────────────────────────────────────── */
.tdn-hero {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--tdn-bg-soft);
}
.tdn-hero-img-link { display: block; }
.tdn-hero-img {
    width: 100%;
    height: 540px;
    object-fit: cover;
    display: block;
    opacity: .82;
    transition: opacity .5s ease;
    transform: scale(1.01); /* tiny scale prevents edge flash on hover */
    transition: opacity .5s ease, transform .6s ease;
}
.tdn-hero:hover .tdn-hero-img { opacity: .72; transform: scale(1.03); }
.tdn-hero-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,.95) 0%,
        rgba(0,0,0,.72) 45%,
        rgba(0,0,0,.2) 80%,
        transparent 100%
    );
    padding: 72px var(--gutter) 40px;
}
.tdn-hero-inner { max-width: var(--container); margin: 0 auto; }
.tdn-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.tdn-hero-date {
    font-size: .8rem;
    color: rgba(255,255,255,.55);
    font-weight: 500;
    letter-spacing: .3px;
}
.tdn-hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.85rem, 3.6vw, 2.75rem);
    font-weight: 700;
    line-height: 1.18;
    color: var(--tdn-white);
    margin-bottom: 16px;
    max-width: 800px;
    letter-spacing: -.025em;
}
.tdn-hero-title a { color: inherit; text-decoration: none; }
.tdn-hero-title a:hover { color: rgba(255,255,255,.88); }
.tdn-hero-excerpt {
    font-size: .95rem;
    color: rgba(255,255,255,.72);
    line-height: 1.68;
    max-width: 620px;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tdn-hero-byline {
    font-size: .82rem;
    color: rgba(255,255,255,.48);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tdn-hero-byline::before {
    content: '';
    width: 20px;
    height: 1.5px;
    background: var(--tdn-red);
    display: inline-block;
    flex-shrink: 0;
}
.tdn-hero-byline .tdn-author { color: rgba(255,255,255,.78); }

/* ─── Mag container ──────────────────────────────── */
.tdn-mag-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.tdn-mag-section { margin-bottom: 52px; }

/* ─── Spotlight (3-col featured) ─────────────────── */
.tdn-spotlight-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.tdn-spotlight-card { display: flex; flex-direction: column; }
.tdn-spotlight-thumb {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    aspect-ratio: 16/9;
    background: var(--tdn-bg-soft);
    margin-bottom: 14px;
}
.tdn-spotlight-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.tdn-spotlight-thumb:hover .tdn-spotlight-img { transform: scale(1.04); }
.tdn-spotlight-thumb .tdn-badge {
    position: absolute;
    top: 10px; left: 10px;
    z-index: 1;
}
.tdn-spotlight-body { display: flex; flex-direction: column; gap: 8px; }
.tdn-spotlight-headline {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--tdn-black);
}
.tdn-spotlight-headline a { color: inherit; text-decoration: none; }
.tdn-spotlight-headline a:hover { color: var(--tdn-red); }
.tdn-spotlight-excerpt {
    font-size: .875rem;
    color: var(--tdn-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── News River ──────────────────────────────────── */
.tdn-river-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 28px;
}
.tdn-river-item {
    display: flex;
    gap: 14px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tdn-border-lt);
}
.tdn-river-thumb {
    display: block;
    width: 100px;
    min-width: 100px;
    height: 70px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--tdn-bg-soft);
    flex-shrink: 0;
}
.tdn-river-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .35s;
}
.tdn-river-thumb:hover .tdn-river-img { transform: scale(1.06); }
.tdn-river-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tdn-river-top { display: flex; align-items: center; gap: 8px; }
.tdn-river-headline {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--tdn-black);
    flex: 1;
}
.tdn-river-headline a { color: inherit; text-decoration: none; }
.tdn-river-headline a:hover { color: var(--tdn-red); }
.tdn-river-excerpt {
    font-size: .8rem;
    color: var(--tdn-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
}

/* ─── Trending ───────────────────────────────────── */
.tdn-section-title--trending {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tdn-trending-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--tdn-red);
    display: inline-block;
    animation: tdnPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
.tdn-trending-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
}
.tdn-trending-card { display: flex; gap: 20px; }
.tdn-trending-thumb {
    position: relative;
    display: block;
    width: 200px;
    min-width: 200px;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--tdn-bg-soft);
    flex-shrink: 0;
}
.tdn-trending-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s;
}
.tdn-trending-thumb:hover .tdn-trending-img { transform: scale(1.05); }
.tdn-trending-rank {
    position: absolute;
    top: 8px; left: 8px;
    background: var(--tdn-red);
    color: var(--tdn-white);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.tdn-trending-body { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.tdn-cat-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--tdn-red);
    text-decoration: none;
}
.tdn-cat-badge:hover { color: var(--tdn-red-dark); }
.tdn-trending-headline {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--tdn-black);
}
.tdn-trending-headline a { color: inherit; text-decoration: none; }
.tdn-trending-headline a:hover { color: var(--tdn-red); }

/* ─── Category sections (TV / Film / Music) ──────── */
.tdn-cat-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

/* Lead article */
.tdn-cat-lead-thumb {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    aspect-ratio: 16/9;
    background: var(--tdn-bg-soft);
    margin-bottom: 14px;
}
.tdn-cat-lead-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s;
}
.tdn-cat-lead-thumb:hover .tdn-cat-lead-img { transform: scale(1.04); }
.tdn-cat-lead-thumb .tdn-badge {
    position: absolute;
    top: 10px; left: 10px;
}
.tdn-cat-lead-body { display: flex; flex-direction: column; gap: 8px; }
.tdn-cat-lead-headline {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--tdn-black);
}
.tdn-cat-lead-headline a { color: inherit; text-decoration: none; }
.tdn-cat-lead-headline a:hover { color: var(--tdn-red); }
.tdn-cat-lead-excerpt {
    font-size: .9rem;
    color: var(--tdn-muted);
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar sub-articles */
.tdn-cat-sidebar { display: flex; flex-direction: column; gap: 0; }
.tdn-cat-sub {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--tdn-border-lt);
}
.tdn-cat-sub:first-child { padding-top: 0; }
.tdn-cat-sub:last-child { border-bottom: none; }
.tdn-cat-sub-thumb {
    display: block;
    width: 80px; min-width: 80px;
    height: 60px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--tdn-bg-soft);
    flex-shrink: 0;
}
.tdn-cat-sub-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .35s;
}
.tdn-cat-sub-thumb:hover .tdn-cat-sub-img { transform: scale(1.06); }
.tdn-cat-sub-body { flex: 1; min-width: 0; }
.tdn-cat-sub-headline {
    font-family: var(--font-display);
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--tdn-black);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tdn-cat-sub-headline a { color: inherit; text-decoration: none; }
.tdn-cat-sub-headline a:hover { color: var(--tdn-red); }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 1024px) {
    .tdn-spotlight-grid { grid-template-columns: repeat(2, 1fr); }
    .tdn-river-grid { grid-template-columns: repeat(2, 1fr); }
    .tdn-cat-layout { grid-template-columns: 1fr; }
    .tdn-cat-sidebar { 
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    .tdn-cat-sub { flex-direction: column; padding: 0; }
    .tdn-cat-sub-thumb { width: 100%; height: 120px; }
}

@media (max-width: 768px) {
    .tdn-spotlight-grid { grid-template-columns: 1fr; }
    .tdn-river-grid { grid-template-columns: 1fr; }
    .tdn-trending-grid { grid-template-columns: 1fr; }
    .tdn-cat-sidebar { grid-template-columns: 1fr; }
    .tdn-cat-sub { flex-direction: row; padding: 14px 0; }
    .tdn-cat-sub-thumb { width: 80px; height: 60px; }

    /* ── Hero: stacked layout on mobile ── */
    /* Remove fixed height so image scales naturally */
    .tdn-hero-img {
        height: auto;
        max-height: 56vw; /* ~16:9 ratio */
        width: 100%;
        object-fit: cover;
        opacity: 1; /* Full opacity — content is below, not on top */
    }
    .tdn-hero:hover .tdn-hero-img { opacity: 1; }

    /* Detach content from absolute overlay → flow below the image */
    .tdn-hero-content {
        position: static;
        background: #ffffff;
        padding: 20px 16px 24px;
    }

    /* Flip text colors for white background on mobile */
    .tdn-hero-title {
        color: var(--tdn-black);
        text-shadow: none;
    }
    .tdn-hero-title a { color: var(--tdn-black); }
    .tdn-hero-title a:hover { color: var(--tdn-red); }
    .tdn-hero-excerpt { color: var(--tdn-muted); }
    .tdn-hero-date { color: var(--tdn-muted); }
    .tdn-hero-byline { color: var(--tdn-muted); }
    .tdn-hero-byline .tdn-author { color: var(--tdn-red); }

    /* Kill gradient overlays — not needed when content is below image */
    .tdn-hero-content::before { display: none; }
    .tdn-hero::before { display: none; }
    .tdn-hero::after { display: none; }

    .tdn-hero-title {
        font-size: 1.35rem;
        margin-bottom: 10px;
    }

    .tdn-hero-excerpt {
        font-size: .9rem;
        -webkit-line-clamp: 3;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .tdn-hero-img {
        max-height: 58vw;
    }
    .tdn-hero-title { font-size: 1.25rem; }
    .tdn-trending-card { flex-direction: column; }
    .tdn-trending-thumb { width: 100%; min-width: unset; }
}

/* ─── Hero portrait mode (movie posters / tall images as featured story)
   ─────────────────────────────────────────────────────────────────────
   Strategy: completely restructure the portrait hero so it works like
   the single-post featured image block — a framed box with blur bg,
   the full image shown via contain, and the text overlay below.

   The hero section is rearchitected into:
     [.tdn-hero--portrait]
       [.tdn-hero-frame]          ← sized box, clips blur bleed
         [.tdn-hero-blur-bg]      ← absolute blurred image fills frame
         [.tdn-hero-img-link]     ← flex center, holds the real image
           [img.tdn-hero-img]     ← object-fit:contain, full poster shown
       [.tdn-hero-content]        ← text below the frame (not overlaid)
   ──────────────────────────────────────────────────────────────────── */

/* Outer section: stacks frame + text content vertically */
.tdn-hero--portrait {
    background: var(--tdn-white);
    display: flex;
    flex-direction: column;
    overflow: visible; /* let children manage their own overflow */
}

/* The frame: a constrained box that clips the blur bleed edges */
.tdn-hero-frame {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--tdn-bg-soft);
    /* Height driven by image — we cap but never force a crop */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Blurred backdrop — covers the whole frame behind the real image */
.tdn-hero-blur-bg {
    position: absolute;
    inset: -5%; /* slightly oversized to hide blur edge bleed */
    background-size: cover;
    background-position: center;
    filter: blur(36px) brightness(.85) saturate(.3);
    z-index: 0;
    opacity: .25;
}

/* Image link: flex center so contain works correctly */
.tdn-hero--portrait .tdn-hero-img-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 0; /* remove any inherited padding */
}

/* The image itself — shown in full, zero cropping */
.tdn-hero--portrait .tdn-hero-img {
    /* Override every fixed-height rule — height must follow the image */
    height: auto !important;
    max-height: 82vh !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    /* Keep it crisp and fully visible */
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    /* Disable hover scale on portrait — it would push outside the frame */
    transition: opacity .4s ease !important;
    display: block;
    position: relative;
    z-index: 1;
}

/* No hover scale on portrait hero images */
.tdn-hero--portrait:hover .tdn-hero-img {
    transform: none !important;
    opacity: .96 !important;
    filter: none !important;
}

/* Text content: sits below the image frame with light background */
.tdn-hero--portrait .tdn-hero-content {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    background: #ffffff !important;
    padding: 28px var(--gutter) 36px !important;
    z-index: 2;
}

/* Dark text for portrait hero content panel on white background */
.tdn-hero--portrait .tdn-hero-title {
    color: var(--tdn-black) !important;
    text-shadow: none !important;
}
.tdn-hero--portrait .tdn-hero-title a { color: var(--tdn-black) !important; }
.tdn-hero--portrait .tdn-hero-title a:hover { color: var(--tdn-red) !important; }
.tdn-hero--portrait .tdn-hero-excerpt { color: var(--tdn-muted) !important; }
.tdn-hero--portrait .tdn-hero-date { color: var(--tdn-muted) !important; }
.tdn-hero--portrait .tdn-hero-byline { color: var(--tdn-muted) !important; }
.tdn-hero--portrait .tdn-hero-byline .tdn-author { color: var(--tdn-red) !important; }

/* Grain texture still shows on portrait hero */
.tdn-hero--portrait.tdn-hero::after { z-index: 3; }

@media (max-width: 768px) {
    .tdn-hero--portrait .tdn-hero-img { max-height: 70vh !important; }
    .tdn-hero--portrait .tdn-hero-content { padding: 20px var(--gutter) 28px !important; }
}
@media (max-width: 480px) {
    .tdn-hero--portrait .tdn-hero-img { max-height: 65vh !important; }
}
