/* ================================================================
   TDN Magazine Homepage — magazine.css
   Inherits site variables (Inter, Playfair Display, TDN red #e51a3e)
   ================================================================ */

/* ── Reset / base ── */
#tdn-magazine *,
#tdn-magazine *::before,
#tdn-magazine *::after {
    box-sizing: border-box;
}

#tdn-magazine {
    background: #f8f9fb;
    font-family: var(--font-body, "Inter", system-ui, sans-serif);
    color: #1e1e1e;
}

#tdn-magazine a {
    text-decoration: none;
    color: inherit;
}

#tdn-magazine img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.mag-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Shared typography ── */
.mag-badge {
    display: inline-block;
    background: var(--wp--preset--color--tdn-red, #e51a3e);
    color: #fff !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 2px;
    line-height: 1.4;
    transition: background 0.2s;
}
.mag-badge:hover {
    background: var(--wp--preset--color--tdn-red-dark, #b0102d);
}

.mag-meta {
    font-size: 11.5px;
    color: #888;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.mag-author {
    font-size: 12.5px;
    font-weight: 600;
    color: #444;
}
.mag-author:hover { color: #e51a3e; }

.mag-byline {
    font-size: 12px;
    color: #888;
}

/* ── Placeholder (no featured image) ── */
.mag-placeholder {
    background: linear-gradient(135deg, #1e1e1e, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.mag-placeholder span {
    color: rgba(255,255,255,0.25);
    font-size: 2rem;
    font-weight: 900;
    font-family: "Playfair Display", Georgia, serif;
    letter-spacing: 4px;
}

/* ================================================================
   HERO
   ================================================================ */
.mag-hero {
    position: relative;
    width: 100%;
    height: 580px;
    overflow: hidden;
    background: #111;
}

/* Full-bleed image layer — sits behind, entire area is a click target */
.mag-hero__image-link {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 0;
}

.mag-hero__image {
    width: 100%;
    height: 100%;
}

.mag-hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.6s ease;
}
.mag-hero__image-link:hover .mag-hero__img {
    transform: scale(1.03);
}

.mag-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.92) 0%,
        rgba(0,0,0,0.55) 45%,
        rgba(0,0,0,0.12) 100%
    );
}

/* Text layer — sits on top of the image, z-index above image link */
.mag-hero__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 48px 56px;
    max-width: 860px;
    z-index: 1;
    pointer-events: none; /* let clicks fall through to image link by default */
}

/* Re-enable pointer events on all interactive children */
.mag-hero__content .mag-badge,
.mag-hero__content .mag-hero__title a,
.mag-hero__content .mag-hero__excerpt,
.mag-hero__content .mag-author,
.mag-hero__content .mag-hero__cta {
    pointer-events: auto;
}

.mag-hero__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mag-hero__date {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.mag-hero__title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.9rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.12;
    margin: 0 0 14px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    letter-spacing: -0.3px;
}

.mag-hero__title a {
    color: #fff;
    text-decoration: none;
    transition: color 0.18s;
}
.mag-hero__title a:hover {
    color: #ffcdd8;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.mag-hero__excerpt {
    font-size: 1rem;
    color: rgba(255,255,255,0.82);
    line-height: 1.6;
    margin: 0 0 20px;
    max-width: 640px;
}

.mag-hero__footer {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.mag-hero__byline {
    font-size: 12.5px;
    color: rgba(255,255,255,0.65);
}
.mag-hero__byline .mag-author {
    color: rgba(255,255,255,0.85);
}
.mag-hero__byline .mag-author:hover {
    color: #ffc;
}

/* "Read Story" CTA button */
.mag-hero__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e51a3e;
    color: #fff !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 9px 20px;
    border-radius: 4px;
    text-decoration: none !important;
    transition: background 0.18s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(229,26,62,0.45);
}
.mag-hero__cta:hover {
    background: #b0102d;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(229,26,62,0.5);
}

/* ================================================================
   SECTION HEADER
   ================================================================ */
.mag-section {
    margin: 48px 0;
}

.mag-section__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    border-bottom: 3px solid #e51a3e;
    padding-bottom: 10px;
}

.mag-section__title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e1e1e;
    margin: 0;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.mag-section__rule {
    flex: 1;
    height: 1px;
    background: #e8e8e8;
}

.mag-section__more {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #e51a3e;
    white-space: nowrap;
}
.mag-section__more:hover { color: #b0102d; }

/* ================================================================
   SPOTLIGHT  (3-col)
   ================================================================ */
.mag-spotlight__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.mag-spotlight__card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}
.mag-spotlight__card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 36px rgba(0,0,0,0.14);
}

.mag-spotlight__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    flex-shrink: 0;
}

.mag-spotlight__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.mag-spotlight__card:hover .mag-spotlight__img {
    transform: scale(1.06);
}

.mag-spotlight__thumb .mag-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
}

.mag-spotlight__body {
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.mag-spotlight__headline {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #1e1e1e;
}
.mag-spotlight__headline a:hover { color: #e51a3e; }

.mag-spotlight__excerpt {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.55;
    margin: 0;
    flex: 1;
}

/* ================================================================
   CATEGORY SECTION  (lead + sidebar)
   ================================================================ */
.mag-cat__layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

/* Lead */
.mag-cat__lead {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.07);
    transition: box-shadow 0.25s;
}
.mag-cat__lead:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.13);
}

.mag-cat__lead-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.mag-cat__lead-img {
    transition: transform 0.45s ease;
}
.mag-cat__lead:hover .mag-cat__lead-img {
    transform: scale(1.05);
}
.mag-cat__lead-thumb .mag-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
}

.mag-cat__lead-body {
    padding: 22px 24px 26px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mag-cat__lead-headline {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: #1e1e1e;
}
.mag-cat__lead-headline a:hover { color: #e51a3e; }

.mag-cat__lead-excerpt {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Sidebar sub-stories */
.mag-cat__sidebar {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mag-cat__sub {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}
.mag-cat__sub:first-child { padding-top: 0; }
.mag-cat__sub:last-child  { border-bottom: none; padding-bottom: 0; }

.mag-cat__sub-thumb {
    display: block;
    width: 88px;
    height: 62px;
    flex-shrink: 0;
    border-radius: 5px;
    overflow: hidden;
}
.mag-cat__sub-img {
    width: 88px !important;
    height: 62px !important;
    transition: transform 0.3s ease;
}
.mag-cat__sub-thumb:hover .mag-cat__sub-img {
    transform: scale(1.08);
}

.mag-cat__sub-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mag-cat__sub-headline {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    color: #1e1e1e;
}
.mag-cat__sub-headline a:hover { color: #e51a3e; }

/* ================================================================
   LATEST NEWS RIVER
   ================================================================ */
.mag-river__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.mag-river__item {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 14px rgba(0,0,0,0.07);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    display: flex;
    flex-direction: column;
}
.mag-river__item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.13);
}

.mag-river__thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    flex-shrink: 0;
}
.mag-river__img {
    transition: transform 0.38s ease;
}
.mag-river__item:hover .mag-river__img {
    transform: scale(1.06);
}

.mag-river__body {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.mag-river__top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mag-river__headline {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #1e1e1e;
    flex: 1;
}
.mag-river__headline a:hover { color: #e51a3e; }

.mag-river__excerpt {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* ================================================================
   PAGINATION
   ================================================================ */
.mag-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 40px 0 60px;
    flex-wrap: wrap;
}

.mag-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: #333;
    transition: all 0.18s;
}
.mag-pagination .page-numbers:hover {
    background: #e51a3e;
    border-color: #e51a3e;
    color: #fff;
}
.mag-pagination .page-numbers.current {
    background: #e51a3e;
    border-color: #e51a3e;
    color: #fff;
}

/* ================================================================
   DARK MODE  (inherits from site)
   ================================================================ */
html[data-theme="dark"] #tdn-magazine {
    background: #121212;
    color: #f0f0f0;
}
html[data-theme="dark"] .mag-spotlight__card,
html[data-theme="dark"] .mag-cat__lead,
html[data-theme="dark"] .mag-river__item {
    background: #1a1a1a;
    box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}
html[data-theme="dark"] .mag-section__title,
html[data-theme="dark"] .mag-spotlight__headline,
html[data-theme="dark"] .mag-cat__lead-headline,
html[data-theme="dark"] .mag-cat__sub-headline,
html[data-theme="dark"] .mag-river__headline {
    color: #f0f0f0;
}
html[data-theme="dark"] .mag-cat__sub { border-color: #2a2a2a; }
html[data-theme="dark"] .mag-section__rule { background: #2a2a2a; }
html[data-theme="dark"] .mag-pagination .page-numbers {
    background: #1a1a1a;
    border-color: #333;
    color: #ddd;
}
html[data-theme="dark"] .mag-hero__overlay {
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.96) 0%,
        rgba(0,0,0,0.6) 45%,
        rgba(0,0,0,0.2) 100%
    );
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablet landscape */
@media (max-width: 1024px) {
    .mag-river__grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .mag-cat__layout {
        grid-template-columns: 1fr 260px;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    .mag-hero { height: 420px; }
    .mag-hero__content { padding: 32px 24px; max-width: 100%; }
    .mag-hero__title { font-size: 1.7rem; }

    .mag-spotlight__grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .mag-cat__layout {
        grid-template-columns: 1fr;
    }
    .mag-cat__sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .mag-cat__sub {
        padding: 0;
        border: none;
    }

    .mag-river__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .mag-hero { height: 320px; }
    .mag-hero__content { padding: 24px 16px; max-width: 100%; }
    .mag-hero__title { font-size: 1.4rem; }
    .mag-hero__excerpt { display: none; }
    .mag-hero__cta { font-size: 11px; padding: 7px 14px; }

    .mag-river__grid {
        grid-template-columns: 1fr;
    }

    .mag-cat__sidebar {
        grid-template-columns: 1fr;
    }

    .mag-section { margin: 32px 0; }
}
