/* ================================================================
   External resources block (Ārējie resursi)
   .rl-filter  — tag chips that filter the cards
   .rl-grid    — cards: icon, tag, domain, title, text,
                 "open site" hint and an optional link to our page
   .rl-note    — disclaimer under the cards
   Section head reuses .pub-section / .pub-section__head
   from publications-block.css
   ================================================================ */

.rl-block * {
    box-sizing: border-box;
}

/* filter */

.rl-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 28px;
}

.rl-filter__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 20px;
    border: 1px solid var(--pub-line);
    border-radius: 999px;
    background-color: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--pub-ink);
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}

.rl-filter__btn:hover {
    border-color: #d9b9c1;
    color: var(--pub-red);
}

.rl-filter__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background-color: var(--pub-card);
    font-size: 12px;
    font-weight: 700;
    color: var(--pub-bordo-soft);
}

.rl-filter__btn.is-active {
    border-color: var(--pub-bordo);
    background-color: var(--pub-bordo);
    color: #fff;
}

.rl-filter__btn.is-active .rl-filter__count {
    background-color: rgba(255, 255, 255, .16);
    color: #fff;
}

/* grid */

.rl-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* card */

.rl-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 30px 32px 26px;
    border: 1px solid var(--pub-line);
    border-radius: 16px;
    background-color: #fff;
    box-shadow: var(--pub-shadow-s);
    overflow: hidden;
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.rl-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pub-bordo), var(--pub-red) 60%, #c9798f);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s ease;
}

.rl-card:hover {
    border-color: #e2c3ca;
    box-shadow: var(--pub-shadow-m);
    transform: translateY(-4px);
}

.rl-card:hover::before {
    transform: scaleX(1);
}

.rl-card[hidden] {
    display: none;
}

.rl-card__top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 22px;
}

.rl-card__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--pub-red), var(--pub-bordo));
    color: #fff;
    box-shadow: 0 10px 22px rgba(107, 12, 38, .22);
}

.rl-card__icon svg {
    width: 28px;
    height: 28px;
}

.rl-card__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    margin: 0;
}

.rl-card__tag {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--pub-bordo-soft);
}

.rl-card__domain {
    overflow: hidden;
    font-size: 14px;
    color: var(--pub-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rl-card__num {
    margin-left: auto;
    align-self: flex-start;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    color: #f0e3e6;
    transition: color .25s ease;
}

.rl-card:hover .rl-card__num {
    color: #e6cdd3;
}

.rl-card__title {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--pub-bordo);
}

.rl-card__link {
    font: inherit;
    color: inherit;
    text-decoration: none;
}

/* the whole card opens the site */
.rl-card__link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.rl-card__link:focus-visible {
    outline: none;
}

.rl-card__link:focus-visible::after {
    outline: 2px solid var(--pub-red);
    outline-offset: -2px;
}

.rl-card__text {
    margin: 12px 0 22px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--pub-muted);
}

.rl-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f1e6e9;
}

.rl-card__open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--pub-red);
}

.rl-card__open svg {
    width: 18px;
    height: 18px;
    transition: transform .25s ease;
}

.rl-card:hover .rl-card__open svg {
    transform: translate(2px, -2px);
}

/* link to our own page sits above the stretched card link */
.rl-card__related {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background-color: var(--pub-card);
    font-size: 14px;
    color: var(--pub-ink);
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}

.rl-card__related span {
    color: var(--pub-muted);
}

.rl-card__related b {
    font-weight: 500;
}

.rl-card__related svg {
    width: 16px;
    height: 16px;
    color: var(--pub-red);
    transition: transform .2s ease;
}

.rl-card__related:hover {
    background-color: #f3e2e6;
    color: var(--pub-bordo);
}

.rl-card__related:hover svg {
    transform: translateX(3px);
}

/* note */

.rl-note {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 28px 0 0;
    padding: 18px 22px;
    border: 1px dashed #dcc4ca;
    border-radius: 14px;
    background-color: rgba(250, 242, 243, .6);
}

.rl-note__icon {
    flex: 0 0 auto;
    color: var(--pub-red);
}

.rl-note__icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.rl-note__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--pub-muted);
}

/* ================= adaptive ================= */

@media (max-width: 1024px) {
    .rl-grid {
        gap: 18px;
    }

    .rl-card {
        padding: 26px 24px 22px;
    }

    .rl-card__title {
        font-size: 21px;
    }
}

@media (max-width: 768px) {
    .rl-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rl-filter {
        flex-wrap: nowrap;
        margin: 0 -20px 22px;
        padding: 0 20px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .rl-filter::-webkit-scrollbar {
        display: none;
    }

    .rl-filter__btn {
        flex: 0 0 auto;
    }
}

@media (max-width: 576px) {
    .rl-filter {
        margin: 0 -16px 20px;
        padding: 0 16px 4px;
    }

    .rl-filter__btn {
        padding: 8px 10px 8px 16px;
        font-size: 14px;
    }

    .rl-card {
        padding: 22px 18px 18px;
        border-radius: 14px;
    }

    .rl-card:hover {
        transform: none;
    }

    .rl-card__top {
        gap: 14px;
        margin-bottom: 18px;
    }

    .rl-card__icon {
        width: 50px;
        height: 50px;
        border-radius: 12px;
    }

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

    .rl-card__num {
        font-size: 28px;
    }

    .rl-card__title {
        font-size: 20px;
    }

    .rl-card__text {
        font-size: 15px;
    }

    .rl-card__foot {
        flex-direction: column;
        align-items: flex-start;
    }

    .rl-note {
        padding: 16px;
    }
}