/* ============================================================
   News Image Grid  —  news-grid.css
   Matches the HTML generated by news-grid.js exactly.
   Class names: .hb-ngrid__feat  .hb-ngrid__tile
                .hb-ngrid__overlay  .hb-ngrid__title
                .hb-ngrid__cat  .hb-ngrid__date
   ============================================================ */

:root {
    --ngrid-accent : #00c9a7;
    --ngrid-gap    : 2px;
    --ngrid-height : 460px;
}

/* ── Section wrapper ─────────────────────────────────────── */
.hb-ngrid-section {
    width: 100%;
    background: transparent;
    position: relative;
}

/* Teal accent rule across the top */
.hb-ngrid-section::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--ngrid-accent) 0%, #005f73 60%, transparent 100%);
}

/* ── Inner container ─────────────────────────────────────── */
.hb-ngrid-section__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px 24px;
}

/* ── Skeleton (shown while fetch is in-flight) ───────────── */
.hb-ngrid-skeleton {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--ngrid-gap);
    height: var(--ngrid-height);
}

.hb-ngrid-skeleton__feat,
.hb-ngrid-skeleton__tile {
    background: linear-gradient(
        90deg,
        #e4e7e6 25%, #eff1f0 50%, #e4e7e6 75%
    );
    background-size: 1600px 100%;
    animation: hb-ngrid-shimmer 1.7s ease-in-out infinite;
}

html[data-theme="dark"] .hb-ngrid-skeleton__feat,
html[data-theme="dark"] .hb-ngrid-skeleton__tile {
    background: linear-gradient(
        90deg,
        #1e2a2c 25%, #243032 50%, #1e2a2c 75%
    );
    background-size: 1600px 100%;
}

.hb-ngrid-skeleton__tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ngrid-gap);
}

@keyframes hb-ngrid-shimmer {
    0%   { background-position: -800px 0; }
    100% { background-position:  800px 0; }
}

/* ── Live grid container ─────────────────────────────────── */
.hb-news-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--ngrid-gap);
    height: var(--ngrid-height);
}

.hb-ngrid-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ngrid-gap);
}

/* ── Wrappers must stretch to fill grid height ───────────── */
.hb-ngrid-featured {
    height: 100%;
}

/* ── Featured tile (large left) ──────────────────────────── */
.hb-ngrid__feat {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    outline: none;
    /* Teal left-edge accent bar */
}

.hb-ngrid__feat::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--ngrid-accent);
    z-index: 4;
}

.hb-ngrid__feat img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform 0.5s ease;
}

.hb-ngrid__feat:hover img,
.hb-ngrid__feat:focus img {
    transform: scale(1.04);
}

/* ── Smaller tile ────────────────────────────────────────── */
.hb-ngrid__tile {
    position: relative;
    display: block;
    overflow: hidden;
    cursor: pointer;
    outline: none;
}

.hb-ngrid__tile img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform 0.5s ease;
}

.hb-ngrid__tile:hover img,
.hb-ngrid__tile:focus img {
    transform: scale(1.06);
}

/* ── Gradient overlay (both tile types) ──────────────────── */
.hb-ngrid__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(4, 12, 18, 0.08) 0%,
        rgba(4, 12, 18, 0.72) 65%,
        rgba(4, 12, 18, 0.90) 100%
    );
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px 18px 18px;
    transition: background 0.3s ease;
}

.hb-ngrid__feat:hover .hb-ngrid__overlay,
.hb-ngrid__feat:focus .hb-ngrid__overlay {
    background: linear-gradient(
        180deg,
        rgba(4, 12, 18, 0.12) 0%,
        rgba(4, 12, 18, 0.80) 65%,
        rgba(4, 12, 18, 0.95) 100%
    );
}

/* "READ MORE →" label fades in on hover for featured */
.hb-ngrid__feat .hb-ngrid__overlay::after {
    content: 'READ MORE →';
    display: block;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--ngrid-accent);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hb-ngrid__feat:hover .hb-ngrid__overlay::after,
.hb-ngrid__feat:focus .hb-ngrid__overlay::after {
    opacity: 1;
    transform: translateY(0);
}

/* ── Category badge ──────────────────────────────────────── */
.hb-ngrid__cat {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 8px;
    background: var(--ngrid-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 2px;
}

/* ── Title ───────────────────────────────────────────────── */
.hb-ngrid__title {
    margin: 0;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.18;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.hb-ngrid__feat .hb-ngrid__title {
    font-size: 28px;
}

.hb-ngrid__tile .hb-ngrid__title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
}

/* ── Date ────────────────────────────────────────────────── */
.hb-ngrid__date {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 500;
}

/* ── Empty / error state ─────────────────────────────────── */
.hb-ngrid-empty {
    padding: 32px 20px;
    text-align: center;
    color: #7a8b8f;
    font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    :root { --ngrid-height: 400px; }

    .hb-ngrid__feat .hb-ngrid__title { font-size: 22px; }
    .hb-ngrid__tile .hb-ngrid__title { font-size: 14px; }
}

@media (max-width: 768px) {
    :root { --ngrid-height: auto; }

    .hb-news-grid,
    .hb-ngrid-skeleton {
        grid-template-columns: 1fr;
        height: auto;
    }

    .hb-ngrid__feat {
        min-height: 280px;
    }

    .hb-ngrid-tiles,
    .hb-ngrid-skeleton__tiles {
        grid-template-columns: repeat(2, 1fr);
    }

    .hb-ngrid__tile { min-height: 160px; }

    .hb-ngrid__feat .hb-ngrid__title { font-size: 20px; }
    .hb-ngrid__tile .hb-ngrid__title { font-size: 13px; }

    .hb-ngrid__overlay { padding: 14px 12px 12px; }

    .hb-ngrid__feat::before { display: none; }

    .hb-ngrid-skeleton__feat { min-height: 280px; }
    .hb-ngrid-skeleton__tile { min-height: 160px; }
}

@media (max-width: 480px) {
    .hb-ngrid-tiles,
    .hb-ngrid-skeleton__tiles { grid-template-columns: 1fr; }
}
