/*
 * Teaser row ("Це також може вас зацікавити") - scoped to .hipp-teasers.
 * Variants: --cards (image on top, text below), --overlay (image fills the card, text on a gradient).
 */
.hipp-teasers {
    /* Same navy the site uses for headings and links (fileadmin/tpl/css/fonts_override.css). */
    --hipp-teasers-accent: #0d2e6b;
    --hipp-teasers-ink: #0d2e6b;
    --hipp-teasers-muted: #5b6b82;
    --hipp-teasers-border: #e3e9f1;
    --hipp-teasers-radius: 14px;
    --hipp-teasers-gap: 20px;

    clear: both;
    margin: 40px 0 24px;
    font-family: inherit;
    line-height: 1.4;
}

.hipp-teasers *,
.hipp-teasers *::before,
.hipp-teasers *::after {
    box-sizing: border-box;
}

.hipp-teasers__heading {
    margin: 0 0 18px;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.25;
    color: var(--hipp-teasers-accent);
}

.hipp-teasers__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--hipp-teasers-gap);
}

/* A lone or paired teaser must not stretch over the whole row. */
.hipp-teasers--n1 .hipp-teasers__grid {
    grid-template-columns: minmax(200px, 360px);
}

.hipp-teasers--n2 .hipp-teasers__grid {
    grid-template-columns: repeat(2, minmax(200px, 360px));
}

/* Four teasers: two balanced rows on narrow columns instead of three plus one. */
.hipp-teasers--n4 .hipp-teasers__grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.hipp-teasers__card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--hipp-teasers-border);
    border-radius: var(--hipp-teasers-radius);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.hipp-teasers__card:hover,
.hipp-teasers__card:focus-visible {
    text-decoration: none;
    color: inherit;
}

a.hipp-teasers__card:hover {
    transform: translateY(-4px);
    border-color: #cfdcec;
    box-shadow: 0 12px 28px rgba(20, 48, 92, 0.12);
}

.hipp-teasers__card--static {
    cursor: default;
}

.hipp-teasers__media {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #eef3f9;
}

.hipp-teasers__image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.hipp-teasers__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 16px;
}

.hipp-teasers__title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--hipp-teasers-ink);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

a.hipp-teasers__card:hover .hipp-teasers__title,
a.hipp-teasers__card:focus-visible .hipp-teasers__title {
    text-decoration-color: currentColor;
}

.hipp-teasers__text {
    display: block;
    font-size: 12.5px;
    color: var(--hipp-teasers-muted);
}

.hipp-teasers__cta {
    display: block;
    margin-top: auto;
    padding-top: 4px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hipp-teasers-accent);
}

.hipp-teasers__arrow {
    display: inline-block;
    transition: transform 0.2s ease;
}

a.hipp-teasers__card:hover .hipp-teasers__arrow,
a.hipp-teasers__card:focus-visible .hipp-teasers__arrow {
    transform: translateX(4px);
}

/* ---------- Variant: overlay ---------- */

.hipp-teasers--overlay .hipp-teasers__card {
    justify-content: flex-end;
    min-height: 0;
    aspect-ratio: 16 / 10;
    border: 0;
    background: var(--hipp-teasers-ink);
    color: #fff;
}

.hipp-teasers--overlay .hipp-teasers__media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    background: linear-gradient(135deg, #1d4f91, #14305c);
}

.hipp-teasers--overlay .hipp-teasers__card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgba(10, 24, 48, 0.92) 0%, rgba(10, 24, 48, 0.5) 70%, rgba(10, 24, 48, 0.15) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hipp-teasers--overlay a.hipp-teasers__card:hover::before,
.hipp-teasers--overlay a.hipp-teasers__card:focus-visible::before,
.hipp-teasers--overlay .hipp-teasers__card--static:hover::before {
    opacity: 1;
}

.hipp-teasers--overlay .hipp-teasers__body {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    gap: 0;
    padding: 56px 16px 16px;
    background: linear-gradient(to top, rgba(10, 24, 48, 0.88) 0%, rgba(10, 24, 48, 0.55) 55%, rgba(10, 24, 48, 0) 100%);
}

.hipp-teasers--overlay .hipp-teasers__title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.hipp-teasers--overlay .hipp-teasers__reveal {
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.35s ease;
}

.hipp-teasers--overlay .hipp-teasers__text {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.92);
}

.hipp-teasers--overlay .hipp-teasers__cta {
    margin-top: 0;
    padding-top: 8px;
    color: #fff;
}

.hipp-teasers--overlay a.hipp-teasers__card:hover .hipp-teasers__reveal,
.hipp-teasers--overlay a.hipp-teasers__card:focus-visible .hipp-teasers__reveal,
.hipp-teasers--overlay .hipp-teasers__card--static:hover .hipp-teasers__reveal {
    max-height: 140px;
    opacity: 1;
    transform: none;
}

.hipp-teasers--overlay a.hipp-teasers__card:hover .hipp-teasers__image,
.hipp-teasers--overlay a.hipp-teasers__card:focus-visible .hipp-teasers__image,
.hipp-teasers--overlay .hipp-teasers__card--static:hover .hipp-teasers__image {
    transform: scale(1.04);
}

/* Touch devices cannot hover: always show title and description. */
@media (hover: none) {
    .hipp-teasers--overlay .hipp-teasers__card::before {
        opacity: 1;
    }

    .hipp-teasers--overlay .hipp-teasers__reveal {
        max-height: none;
        opacity: 1;
        transform: none;
    }

    .hipp-teasers--overlay .hipp-teasers__card {
        aspect-ratio: auto;
        min-height: 220px;
    }
}

/* ---------- Site overrides ----------
 * fileadmin/tpl/css/fonts_override.css gives "body, body *" and every link one text colour and underlines links
 * on hover/focus, all with !important; legacy site styles also drop link outlines. These rules re-assert the
 * row's own palette, keep the card link itself un-underlined (only the title underlines, see above) and restore
 * the focus ring. "body .hipp-teasers" lifts specificity above the site selectors. Keep this block minimal.
 */
body .hipp-teasers .hipp-teasers__heading {
    color: var(--hipp-teasers-accent) !important;
}

body .hipp-teasers a.hipp-teasers__card {
    text-decoration: none !important;
}

body .hipp-teasers a.hipp-teasers__card:focus-visible {
    outline: 3px solid var(--hipp-teasers-accent) !important;
    outline-offset: 3px;
}

body .hipp-teasers .hipp-teasers__card,
body .hipp-teasers .hipp-teasers__title {
    color: var(--hipp-teasers-ink) !important;
}

body .hipp-teasers .hipp-teasers__text {
    color: var(--hipp-teasers-muted) !important;
}

body .hipp-teasers .hipp-teasers__cta {
    color: var(--hipp-teasers-accent) !important;
}

body .hipp-teasers .hipp-teasers__arrow {
    color: inherit !important;
}

/* Overlay variant: light text on the image (after the rules above, same specificity). */
body .hipp-teasers--overlay .hipp-teasers__card,
body .hipp-teasers--overlay .hipp-teasers__title,
body .hipp-teasers--overlay .hipp-teasers__cta {
    color: #fff !important;
}

body .hipp-teasers--overlay .hipp-teasers__text {
    color: rgba(255, 255, 255, 0.92) !important;
}

/* ---------- Responsive ---------- */

@media (max-width: 575.98px) {
    .hipp-teasers__grid,
    .hipp-teasers--n1 .hipp-teasers__grid,
    .hipp-teasers--n2 .hipp-teasers__grid {
        grid-template-columns: 1fr;
    }

    .hipp-teasers--overlay .hipp-teasers__card {
        aspect-ratio: 4 / 3;
        min-height: 220px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hipp-teasers__card,
    .hipp-teasers__image,
    .hipp-teasers__title,
    .hipp-teasers__arrow,
    .hipp-teasers--overlay .hipp-teasers__card::before,
    .hipp-teasers--overlay .hipp-teasers__reveal {
        transition: none;
    }

    a.hipp-teasers__card:hover,
    .hipp-teasers--overlay a.hipp-teasers__card:hover .hipp-teasers__image,
    .hipp-teasers--overlay a.hipp-teasers__card:focus-visible .hipp-teasers__image,
    a.hipp-teasers__card:hover .hipp-teasers__arrow {
        transform: none;
    }

    .hipp-teasers--overlay .hipp-teasers__reveal {
        transform: none;
    }
}
