/**
 * Last Update: 2026-04-28
 * File: assets/frontend/css/news-frontend.css
 * Description: News index, list-by-type, hero carousel, card, grid, pagination
 *
 * v3 changes (2026-04-28):
 *   - Hero is now a CAROUSEL (1 visible slide, fades) with side panel of all 4 rows
 *   - Side panel shows ALL 4 rows with active highlight that syncs with carousel
 *   - Removed split layout from "first section" — every section now uses 4-col grid
 *   - Added .fe-news-feature__* family for the carousel + side panel
 *   - Removed: .fe-news-section__split, .fe-news-section__main,
 *              .fe-news-section__aside, .fe-news-grid--3, .fe-news-card-compact*
 *
 * Design rules:
 *   - No hex colors — use CSS variables from tokens-frontend.css
 *   - Mobile-first responsive
 */

/* ══════════════════════════════════════════════════════════════════════════
 * SECTION SPACING (page wrappers)
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-index,
.fe-news-list {
    padding-top: 24px;
    padding-bottom: 80px;
}

/* ══════════════════════════════════════════════════════════════════════════
 * FEATURE BLOCK — hero carousel (left) + side panel (right)
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-feature {
    margin-bottom: 40px;
}

.fe-news-feature__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 900px) {
    .fe-news-feature__grid {
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1200px) {
    .fe-news-feature__grid {
        grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
        gap: 24px;
    }
}

/* ── Carousel container ─────────────────────────────────────────────────── */
.fe-news-feature__hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: var(--fe-radius-lg);
    overflow: hidden;
    background-color: var(--fe-bg-alt);
    box-shadow: var(--fe-shadow-md);
}

/* Each slide stacks; only .is-active is visible (others fade out) */
.fe-news-feature__slide {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
    color: var(--fe-text-on-gold);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--fe-transition-slow),
        visibility 0s linear var(--fe-transition-slow);
}

.fe-news-feature__slide.is-active {
    opacity: 1;
    visibility: visible;
    transition:
        opacity var(--fe-transition-slow),
        visibility 0s linear 0s;
    z-index: 1;
}

.fe-news-feature__slide:focus-visible {
    outline: 3px solid var(--fe-primary);
    outline-offset: -3px;
}

/* Backdrop layer — same image, scaled to cover, blurred → fills any gaps
 * left by the contained foreground image. Sits at z-index 0.
 */
.fe-news-feature__slide-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Blur amount + slight darken for caption readability */
    filter: blur(24px) brightness(0.75) saturate(1.1);
    /* Scale up so blur edges don't show inside the frame */
    transform: scale(1.1);
    transform-origin: center;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* Foreground image — fully visible, never cropped */
.fe-news-feature__slide-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fe-news-feature__slide-img--placeholder {
    background:
        linear-gradient(135deg,
            var(--fe-gold-100) 0%,
            var(--fe-warm-200) 100%);
}

/* Caption overlay — gradient from transparent → semi-dark at bottom
 * Sits on top of both backdrop (z=0) and foreground image (z=1).
 */
.fe-news-feature__slide-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 24px 24px 56px;       /* extra bottom padding to clear dots */
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0)     0%,
        rgba(0, 0, 0, 0.55) 60%,
        rgba(0, 0, 0, 0.75) 100%
    );
}

.fe-news-feature__slide-title {
    margin: 0 0 6px;
    font-size: clamp(1.05rem, 2vw, 1.45rem);
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.35;
    /* Clamp to 2 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.fe-news-feature__slide-meta {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

/* ── Dots ───────────────────────────────────────────────────────────────── */
.fe-news-feature__dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;          /* let buttons re-enable themselves */
}

.fe-news-feature__dot {
    pointer-events: auto;
    width: 28px;
    height: 18px;
    padding: 4px;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fe-news-feature__dot-inner {
    display: block;
    width: 100%;
    height: 6px;
    border-radius: var(--fe-radius-pill);
    background-color: rgba(255, 255, 255, 0.55);
    transition: background-color var(--fe-transition), width var(--fe-transition);
}

.fe-news-feature__dot.is-active .fe-news-feature__dot-inner {
    background-color: #FFFFFF;
}

.fe-news-feature__dot:hover .fe-news-feature__dot-inner,
.fe-news-feature__dot:focus-visible .fe-news-feature__dot-inner {
    background-color: #FFFFFF;
}

.fe-news-feature__dot:focus-visible {
    outline: 2px solid var(--fe-primary);
    outline-offset: 2px;
    border-radius: var(--fe-radius-sm);
}

/* ══════════════════════════════════════════════════════════════════════════
 * SIDE PANEL — list of compact cards next to hero (or below on mobile)
 *
 * Mobile (< 900px):
 *   - Cards stack vertically below hero
 *   - Cards have natural intrinsic height (no forced equal height)
 *   - Thumbnail is wider (140px) for better readability
 *
 * Desktop (≥ 900px):
 *   - Cards fill the side column with equal heights (sync with hero height)
 *   - Thumbnail 100x100 square
 *
 * Thumb uses two-layer technique: blurred backdrop + contained foreground
 * (same as hero, so portraits/squares aren't cropped).
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-feature__side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fe-news-feature__side-card {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
    padding: 10px;
    background-color: var(--fe-bg-card);
    border: 2px solid var(--fe-border);
    border-radius: var(--fe-radius-md);
    text-decoration: none;
    color: var(--fe-text);
    transition:
        transform var(--fe-transition-med),
        box-shadow var(--fe-transition-med),
        border-color var(--fe-transition-med),
        background-color var(--fe-transition-med);
}

.fe-news-feature__side-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--fe-shadow-sm);
    border-color: var(--fe-border-gold);
}

.fe-news-feature__side-card:focus-visible {
    outline: none;
    border-color: var(--fe-primary);
    box-shadow: 0 0 0 3px var(--fe-primary);
}

/* Active — synced with hero carousel position */
.fe-news-feature__side-card.is-active {
    border-color: var(--fe-primary);
    background-color: var(--fe-bg-alt);
    box-shadow: var(--fe-shadow-sm);
}

/* ── Thumbnail (square, two-layer) ──────────────────────────────────────── */
.fe-news-feature__side-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--fe-bg-alt);
    border-radius: var(--fe-radius-sm);
    overflow: hidden;
    line-height: 0;
}

/* Backdrop layer — same image, blurred, fills any leftover space */
.fe-news-feature__side-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(12px) brightness(0.85) saturate(1.1);
    transform: scale(1.15);
    transform-origin: center;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* Foreground — full image always visible (never cropped) */
.fe-news-feature__side-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fe-news-feature__side-img--placeholder {
    background:
        linear-gradient(135deg,
            var(--fe-gold-100) 0%,
            var(--fe-warm-200) 100%);
}

/* ── Body (title + type badge) ──────────────────────────────────────────── */
.fe-news-feature__side-body {
    align-self: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fe-news-feature__side-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--fe-text);
    /* Clamp to 2 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.fe-news-feature__side-card.is-active .fe-news-feature__side-title,
.fe-news-feature__side-card:hover .fe-news-feature__side-title {
    color: var(--fe-primary-dark);
}

.fe-news-feature__side-type {
    align-self: flex-start;
    padding: 3px 12px;
    border-radius: var(--fe-radius-pill);
    background-color: var(--fe-primary);
    color: var(--fe-text-on-gold);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.5;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Desktop (≥ 900px): equal-height cards, fill column ─────────────────── */
@media (min-width: 900px) {
    .fe-news-feature__side {
        align-self: stretch;
        gap: 12px;
    }
    .fe-news-feature__side-card {
        grid-template-columns: 100px 1fr;
        gap: 12px;
        padding: 8px;
        flex: 1 1 0;
        min-height: 0;
    }
}

/* ── Small phones (< 480px): tighter thumb ──────────────────────────────── */
@media (max-width: 479px) {
    .fe-news-feature__side-card {
        grid-template-columns: 110px 1fr;
        gap: 12px;
        padding: 8px;
    }
    .fe-news-feature__side-title {
        font-size: 0.9rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * GROUPED SECTION (per news_type) — uniform 4-col grid
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-section {
    margin-bottom: 48px;
    background-color: var(--fe-bg-section);
    padding: 24px;
    border-radius: var(--fe-radius-lg);
}

.fe-news-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--fe-border);
}

.fe-news-section__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--fe-text);
    margin: 0;
}

.fe-news-section__more {
    display: inline-block;
    padding: 6px 16px;
    background-color: var(--fe-primary);
    color: var(--fe-text-on-gold);
    border-radius: var(--fe-radius-pill);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--fe-transition);
    white-space: nowrap;
}

.fe-news-section__more:hover,
.fe-news-section__more:focus-visible {
    background-color: var(--fe-primary-hover);
    color: var(--fe-text-on-gold);
}

/* ══════════════════════════════════════════════════════════════════════════
 * GRID — main news cards (1 → 2 → 3 → 4 columns)
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .fe-news-grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 900px) {
    .fe-news-grid--4 {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1100px) {
    .fe-news-grid--4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * CARD — main (vertical: thumb top, title below)
 * Thumb: width:100%, height:auto (natural aspect ratio)
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-card {
    display: flex;
    flex-direction: column;
    background-color: var(--fe-bg-card);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius-md);
    overflow: hidden;
    text-decoration: none;
    color: var(--fe-text);
    transition:
        transform var(--fe-transition-med),
        box-shadow var(--fe-transition-med),
        border-color var(--fe-transition-med);
}

.fe-news-card:hover,
.fe-news-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: var(--fe-shadow-md);
    border-color: var(--fe-border-gold);
    outline: none;
}

.fe-news-card:focus-visible {
    box-shadow: 0 0 0 3px var(--fe-primary);
}

.fe-news-card__thumb {
    position: relative;
    width: 100%;
    background-color: var(--fe-bg-alt);
    overflow: hidden;
    line-height: 0;
}

.fe-news-card__img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform var(--fe-transition-slow);
}

.fe-news-card:hover .fe-news-card__img {
    transform: scale(1.04);
}

.fe-news-card__img--placeholder {
    aspect-ratio: 16 / 9;
    background:
        linear-gradient(135deg,
            var(--fe-gold-100) 0%,
            var(--fe-warm-200) 100%);
}

.fe-news-card__body {
    padding: 14px 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.fe-news-card__title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--fe-text);
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.fe-news-card:hover .fe-news-card__title,
.fe-news-card:focus-visible .fe-news-card__title {
    color: var(--fe-primary-dark);
}

/* ══════════════════════════════════════════════════════════════════════════
 * LIST PAGE — top bar (breadcrumb + page indicator)
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-list__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.fe-news-list__topbar .fe-breadcrumb {
    padding: 0;
}

.fe-news-list__page-indicator {
    color: var(--fe-text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.fe-news-list__body {
    background-color: var(--fe-bg-section);
    padding: 24px;
    border-radius: var(--fe-radius-lg);
    margin-bottom: 28px;
}

.fe-news-list__empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--fe-text-muted);
    font-size: 1rem;
}

/* ══════════════════════════════════════════════════════════════════════════
 * PAGINATION
 * ════════════════════════════════════════════════════════════════════════ */
.fe-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.fe-pagination__list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.fe-pagination__item {
    display: inline-flex;
}

.fe-pagination__item--gap {
    padding: 0 6px;
    color: var(--fe-text-muted);
    user-select: none;
}

.fe-pagination__page,
.fe-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background-color: var(--fe-bg-card);
    color: var(--fe-text);
    border: 1px solid var(--fe-border);
    border-radius: var(--fe-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition:
        background-color var(--fe-transition),
        border-color var(--fe-transition),
        color var(--fe-transition);
}

.fe-pagination__page:hover,
.fe-pagination__page:focus-visible,
.fe-pagination__btn:not(.fe-pagination__btn--disabled):hover,
.fe-pagination__btn:not(.fe-pagination__btn--disabled):focus-visible {
    background-color: var(--fe-bg-alt);
    border-color: var(--fe-primary);
    color: var(--fe-primary-dark);
    outline: none;
}

.fe-pagination__page--active {
    background-color: var(--fe-primary);
    color: var(--fe-text-on-gold);
    border-color: var(--fe-primary);
    cursor: default;
}

.fe-pagination__page--active:hover,
.fe-pagination__page--active:focus-visible {
    background-color: var(--fe-primary);
    color: var(--fe-text-on-gold);
    border-color: var(--fe-primary);
}

.fe-pagination__btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════════
 * BREADCRUMB OVERRIDE — base styles defined in content-body.css
 * ════════════════════════════════════════════════════════════════════════ */
.fe-news-index .fe-breadcrumb,
.fe-news-list  .fe-breadcrumb {
    padding-top: 0;
    padding-bottom: 16px;
    font-size: 0.875rem;
}

/* ══════════════════════════════════════════════════════════════════════════
 * MOTION SAFETY
 * ════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .fe-news-card,
    .fe-news-card__img,
    .fe-news-feature__slide,
    .fe-news-feature__side-card,
    .fe-news-feature__dot-inner,
    .fe-news-section__more,
    .fe-pagination__page,
    .fe-pagination__btn {
        transition: none;
    }
    .fe-news-card:hover,
    .fe-news-feature__side-card:hover {
        transform: none;
    }
    .fe-news-card:hover .fe-news-card__img {
        transform: none;
    }
}
