/* Home page news slider. Cards come from news-list.css (.nw-card). */

.hn-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.hn-head__title {
    position: relative;
    margin: 0;
    padding-inline-start: 0.9rem;
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 800;
}

.hn-head__title::before {
    content: "";
    position: absolute;
    top: 0.25em;
    bottom: 0.25em;
    inset-inline-start: 0;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, #00ad9c, #1a2a55);
}

.hn-head__actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.hn-all {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-inline-end: 0.35rem;
    color: #0c58a4;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.hn-all svg {
    width: 1rem;
    height: 1rem;
}

.hn-all:hover {
    color: #00ad9c;
}

.hn-nav {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.8rem;
    background: #fff;
    color: #1a2a55;
    cursor: pointer;
    box-shadow: 0 8px 18px -14px rgba(26, 42, 85, 0.6);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.hn-nav svg {
    width: 1.1rem;
    height: 1.1rem;
}

.hn-nav:hover:not(:disabled),
.hn-nav:focus-visible {
    border-color: transparent;
    background: linear-gradient(135deg, #00ad9c, #0c58a4);
    color: #fff;
}

.hn-nav:focus-visible {
    outline: 2px solid #00ad9c;
    outline-offset: 2px;
}

.hn-nav:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ---- track: native scroll + snap, so touch swipe just works ---- */
.hn-slider {
    --hn-gap: 1.1rem;
    --hn-per-view: 4;
    position: relative;
}

.hn-track {
    display: grid;
    grid-auto-columns: calc((100% - (var(--hn-per-view) - 1) * var(--hn-gap)) / var(--hn-per-view));
    grid-auto-flow: column;
    gap: var(--hn-gap);
    margin: -0.5rem -0.5rem 0;
    padding: 0.5rem 0.5rem 1.1rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-padding-inline: 0.5rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.hn-track::-webkit-scrollbar {
    display: none;
}

.hn-track:focus-visible {
    outline: 2px solid #00ad9c;
    outline-offset: 2px;
    border-radius: 1rem;
}

.hn-slide {
    display: flex;
    min-width: 0;
    scroll-snap-align: start;
}

.hn-slide .nw-card {
    width: 100%;
}

/* ---- dots ---- */
.hn-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.hn-dots button {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.hn-dots button[aria-current="true"] {
    width: 1.6rem;
    background: linear-gradient(90deg, #00ad9c, #0c58a4);
}

.hn-dots button:focus-visible {
    outline: 2px solid #00ad9c;
    outline-offset: 2px;
}

@media (max-width: 1199px) {
    .hn-slider {
        --hn-per-view: 3;
    }
}

@media (max-width: 1023px) {
    .hn-slider {
        --hn-per-view: 2;
    }
}

@media (max-width: 639px) {
    /* one card plus a peek of the next, so it reads as swipeable */
    .hn-slider {
        --hn-per-view: 1.15;
        --hn-gap: 0.85rem;
    }

    .hn-all span,
    .hn-nav {
        display: none;
    }

    .hn-head__title {
        font-size: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hn-track {
        scroll-behavior: auto;
    }

    .hn-dots button,
    .hn-nav {
        transition: none;
    }
}
