/*
 * Home page: the module cards and the news panel.
 *
 * Loaded after app.css, so these rules win over the older section styles
 * there. Colours are from the palette the site borrows from G&P.
 */

.s-homepage {
    background: #F4F6FB;
    padding: 72px 0 36px;
}

/* ------------------------------------------------------------------ cards */

.module-cards {
    /* The cards measure their offsets from here, to take their slice of the
       shared gradient. */
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* Every row as tall as the tallest card, so all six are the same size. */
    grid-auto-rows: 1fr;
    gap: 20px;
}

.module-card {
    display: flex;
    flex-direction: column;
    padding: 24px 24px 22px;
    border-radius: 16px;
    /*
     * One gradient runs across the whole grid, corner to corner, and each card
     * shows its own slice of it: the script beneath the cards sets
     * background-size to the grid's size and background-position to the card's
     * offset. Until it runs, or if it never does, each card simply shows the
     * whole gradient. The solid colour is for browsers without gradients.
     *
     * Deepest navy (#171F3D) at the top-left through navy-700 and indigo to
     * blue-500, with a soft azure light over the bottom-right corner. The light
     * is held at 25% opacity: that keeps white text at 4.5:1 even at the
     * brightest point, the minimum for small text to stay readable.
     */
    background-color: #33478F;
    background-image:
        radial-gradient(circle at 100% 100%, rgba(91, 141, 239, 0.25) 0%, rgba(91, 141, 239, 0) 50%),
        linear-gradient(to bottom right, #171F3D 0%, #2A3663 35%, #33478F 60%, #4A69C4 100%);
    background-repeat: no-repeat;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(23, 31, 61, 0.08), 0 10px 26px -14px rgba(23, 31, 61, 0.45);
    transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

/* A faint light wash on hover, since the card's colour is its slice of the
   shared gradient and cannot simply be swapped for another. */
.module-card:hover,
.module-card:focus-visible {
    color: #fff;
    text-decoration: none;
    transform: scale(1.02);
    box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.06),
        0 2px 4px rgba(23, 31, 61, 0.1), 0 18px 36px -16px rgba(23, 31, 61, 0.55);
}

.module-card:focus-visible {
    outline: 3px solid #93B4F4;
    outline-offset: 3px;
}

.module-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.module-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.12);
    color: #DCE6F8;
}

.module-card__icon svg {
    width: 24px;
    height: 24px;
}

.module-card__number {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 40px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.22);
}

/*
 * Titles are 20px and may take two lines, as in the reference design. Every
 * card keeps room for the second line, so the descriptions start level and
 * all the cards stay the same size; a title longer than two lines is cut.
 */
.module-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
    margin: 0;
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

/*
 * The description keeps two lines, whether it needs them or not, so the bottom
 * row sits at the same height in every card; a longer one is cut.
 */
.module-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3em;
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

.module-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 20px;
}

.module-card__count {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.module-card__go {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.module-card__go svg {
    width: 18px;
    height: 18px;
}

.module-card:hover .module-card__go,
.module-card:focus-visible .module-card__go {
    background: #fff;
    color: #33478F;
    transform: translateX(2px);
}

@media only screen and (max-width: 1023px) {
    .module-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media only screen and (max-width: 639px) {
    .s-homepage {
        padding-top: 48px;
    }

    .module-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ------------------------------------------------------------------- news */

.news-strip {
    background: #F4F6FB;
    padding: 0 0 96px;
}

/* The heading column is only as wide as "Noutăți" and its link need; every
   remaining pixel goes to the news items. */
.news-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    padding: 26px 30px;
    border: 1px solid #E3E8F2;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(23, 31, 61, 0.04);
}

.news-panel__title {
    margin: 0 0 6px;
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    color: #1F2951;
}

.news-panel__all {
    font-size: 14px;
    font-weight: 700;
    color: #33478F;
    text-decoration: none;
}

.news-panel__all:hover {
    color: #33478F;
    text-decoration: underline;
}

/*
 * With arrows, the panel reads heading | ← | items | →. Each part has a fixed
 * column, so the list keeps its place even though the arrows are optional.
 */
.news-panel--slider {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    column-gap: 20px;
}

.news-panel--slider .news-panel__head {
    grid-column: 1;
    margin-right: 8px;
}

.news-panel__btn--prev {
    grid-column: 2;
}

.news-panel--slider .news-panel__track {
    grid-column: 3;
}

.news-panel__btn--next {
    grid-column: 4;
}

.news-panel__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #DCE6F8;
    border-radius: 50%;
    background: #fff;
    color: #33478F;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.news-panel__btn svg {
    width: 16px;
    height: 16px;
}

/* One arrow shape for both buttons; the "back" one is turned around. */
.news-panel__btn--prev svg {
    transform: rotate(180deg);
}

.news-panel__btn:hover:not(:disabled) {
    border-color: #33478F;
    background: #33478F;
    color: #fff;
}

.news-panel__btn:focus-visible {
    outline: 2px solid #5B8DEF;
    outline-offset: 2px;
}

.news-panel__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/*
 * Three items in view, scrolled sideways. Each item snaps to the left edge, so
 * a step of the arrows - or a swipe - always lands on a whole item.
 */
.news-panel__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 2 * 28px) / 3);
    gap: 28px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.news-panel__track::-webkit-scrollbar {
    display: none;
}

.news-item {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    scroll-snap-align: start;
    color: inherit;
    text-decoration: none;
}

.news-item:focus-visible {
    outline: 2px solid #5B8DEF;
    outline-offset: -2px;
    border-radius: 8px;
}

/* As tall as the label plus two lines of title beside it (58px). */
.news-item__icon {
    display: flex;
    flex: 0 0 58px;
    align-items: center;
    justify-content: center;
    height: 58px;
    border-radius: 14px;
    background: #EDF2FC;
    color: #33478F;
}

.news-item__icon svg {
    width: 28px;
    height: 28px;
}

.news-item__body {
    min-width: 0;
}

/* One line always: a long label is cut with "…" rather than wrapping. */
.news-item__kind {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6B76A0;
}

.news-item__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: #1F2951;
    transition: color 0.2s ease;
}

.news-item:hover .news-item__title {
    color: #33478F;
    text-decoration: underline;
}

/* Small laptops: three items would leave each title too narrow to read. */
@media only screen and (max-width: 1279px) {
    .news-panel__track {
        grid-auto-columns: calc((100% - 28px) / 2);
    }
}

@media only screen and (max-width: 1023px) {
    .news-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .news-panel__head {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px 24px;
    }

    .news-panel__title {
        margin: 0;
    }

    /* Heading across the top; arrows either side of the list below it. */
    .news-panel--slider {
        grid-template-columns: auto minmax(0, 1fr) auto;
        column-gap: 14px;
    }

    .news-panel--slider .news-panel__head {
        grid-column: 1 / -1;
        margin-right: 0;
    }

    .news-panel__btn--prev {
        grid-column: 1;
    }

    .news-panel--slider .news-panel__track {
        grid-column: 2;
    }

    .news-panel__btn--next {
        grid-column: 3;
    }

    .news-panel__track {
        grid-auto-columns: calc((100% - 28px) / 2);
    }
}

@media only screen and (max-width: 639px) {
    .news-strip {
        padding-bottom: 64px;
    }

    .news-panel {
        gap: 20px;
        padding: 22px 20px;
    }

    .news-panel__track {
        grid-auto-columns: 100%;
    }

    /* A phone has far less width per item; the tile gives some back. */
    .news-item__icon {
        flex-basis: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .news-item__icon svg {
        width: 24px;
        height: 24px;
    }

    /* Slimmer arrows on a phone, to leave the one visible item more room. */
    .news-panel--slider {
        column-gap: 8px;
    }

    .news-panel__btn {
        width: 30px;
        height: 30px;
    }

    .news-panel__btn svg {
        width: 14px;
        height: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .module-card,
    .module-card__go,
    .news-panel__btn,
    .news-item__title {
        transition: none;
    }

    .news-panel__track {
        scroll-behavior: auto;
    }

    .module-card:hover,
    .module-card:focus-visible {
        transform: none;
    }
}
