/*
 * /tema/{slug}: one theme's stories. A compact header (title, a line, the figures inline), the stories as cards (a lead
 * across the grid on the first page, then two columns; rows with a thumbnail on a phone), and a side column with the
 * portals and other themes. Shopping themes add discounts, prices and shops on the cards, a row of shops that filters the
 * list (theme-page.js) and a row of partner deals among the stories. Square, flat, Archivo headlines, red accent bars,
 * like /teme (themes.css). Loaded by Themes/Details only.
 */

.tema-shell {
    display: grid;
    gap: 1rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
}

.tema-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.tema-breadcrumb a {
    color: var(--news-ink);
    text-decoration: none;
}

.tema-breadcrumb a:hover,
.tema-breadcrumb a:focus-visible {
    color: var(--news-accent);
    text-decoration: underline;
}

.tema-breadcrumb strong {
    min-width: 0;
    color: var(--muted);
    font-weight: 700;
}

/* ---------- Header: compact, the figures in one line ---------- */

.tema-head {
    display: grid;
    justify-items: start;
    gap: 0.45rem;
    padding: 1.05rem 1.4rem 1.1rem;
    background: var(--panel);
    border: 1px solid var(--news-rule);
    border-left: 6px solid var(--news-accent);
}

.tema-kicker {
    margin: 0;
    padding: 0.15rem 0.5rem;
    color: #ffffff;
    background: var(--news-accent);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tema-head h1 {
    margin: 0;
    color: var(--news-ink);
    font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.6rem);
    font-weight: 900;
    line-height: 1.05;
}

.tema-lead {
    max-width: 46rem;
    margin: 0;
    color: var(--news-soft-ink);
    font-size: 1rem;
    line-height: 1.5;
}

.tema-figures {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.55rem;
    margin: 0.1rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.tema-figures > span + span::before {
    content: "·";
    margin-right: 0.55rem;
    color: #98a2b3;
}

.tema-figures strong {
    color: var(--news-ink);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.tema-figures time {
    color: var(--news-ink);
}

/* ---------- The page and its side column ---------- */

.tema-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 1.5rem;
    align-items: start;
}

.tema-main,
.tema-side {
    display: grid;
    align-content: start;
    gap: 1rem;
    min-width: 0;
}

/* The list's heading with the order (Najnovije / Najčitanije) beside it. */
.tema-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding-bottom: 0.45rem;
    border-bottom: 3px solid var(--news-ink);
}

.tema-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto 0 0;
    color: var(--news-ink);
    font-size: 1.02rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tema-title i {
    color: var(--news-accent);
}

.tema-sort {
    display: inline-flex;
    background: var(--panel);
    border: 1px solid var(--news-rule);
}

.tema-sort a {
    padding: 0.38rem 0.85rem;
    color: var(--news-soft-ink);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: inset 0 -3px 0 transparent;
}

.tema-sort a + a {
    border-left: 1px solid var(--news-rule);
}

.tema-sort a:hover,
.tema-sort a:focus-visible {
    color: var(--news-ink);
    background: #f8fafc;
}

.tema-sort a.is-active {
    color: var(--news-ink);
    box-shadow: inset 0 -3px 0 var(--news-accent);
}

.tema-page-of {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ---------- Shops (shopping themes): a row that filters the page's stories ---------- */

.tema-shops {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
    /* Clear of the header that stays on top on a phone, when a card's chip scrolls the row into view. */
    scroll-margin-top: 5.5rem;
}

.tema-shops[hidden] {
    display: none;
}

.tema-shops-label {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tema-shops-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 0;
}

.tema-shop {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.15rem;
    padding: 0.25rem 0.7rem;
    color: var(--news-ink);
    background: var(--panel);
    border: 1px solid var(--news-rule);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
}

.tema-shop small {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tema-shop:hover,
.tema-shop:focus-visible {
    border-color: var(--news-ink);
}

.tema-shop.is-active {
    border-color: var(--news-ink);
    box-shadow: inset 0 -3px 0 var(--news-accent);
}

.tema-shop[hidden] {
    display: none;
}

.tema-shop-more {
    color: var(--muted);
}

.tema-shops-status {
    flex-basis: 100%;
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.tema-shops-status:empty {
    display: none;
}

/* ---------- The stories: cards in two columns, a lead across the first page ---------- */

.tema-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.tema-card {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--news-rule);
    transition: border-color 0.15s ease;
}

.tema-card[hidden] {
    display: none !important;
}

.tema-card:hover {
    border-color: #98a2b3;
}

.tema-card-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #eef1f4;
}

.tema-card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tema-card-media.is-empty {
    background: #f4f5f6 url("../img/brand/adios-article-placeholder.svg") center / cover no-repeat;
}

/* The story's biggest discount on its picture, like a price tag. */
.tema-card-discount {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    padding: 0.32rem 0.55rem;
    color: #ffffff;
    background: var(--news-accent);
    font-family: var(--news-font-head);
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tema-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.8rem 0.95rem 0.95rem;
}

.tema-card-kicker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.tema-card-source {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    color: var(--news-accent);
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tema-card-source img,
.tema-card-source-initial {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
}

.tema-card-source img {
    object-fit: contain;
}

.tema-card-source-initial {
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    background: var(--news-ink);
    font-size: 0.68rem;
}

.tema-card-source > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tema-card-kicker time {
    flex: 0 0 auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tema-card-title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.tema-card-title a {
    color: var(--news-ink);
    text-decoration: none;
}

.tema-card-title a:hover,
.tema-card-title a:focus-visible {
    color: var(--news-accent);
    text-decoration: underline;
}

.tema-card-summary {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--news-soft-ink);
    font-size: 0.9rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/* Discounts, prices and shops a story names. */
.tema-card-deals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.2rem;
}

.tema-deal-discount,
.tema-deal-price,
.tema-deal-shop {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.65rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.8rem;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
}

.tema-deal-discount {
    color: var(--news-accent);
    border: 1px solid var(--news-accent);
}

.tema-deal-price {
    color: var(--news-ink);
    background: #f1f3f5;
    border: 1px solid #f1f3f5;
    font-variant-numeric: tabular-nums;
}

.tema-deal-shop {
    color: var(--news-ink);
    background: var(--panel);
    border: 1px solid var(--news-rule);
    font-family: inherit;
    font-weight: 800;
}

.tema-deal-shop i {
    color: var(--muted);
    font-size: 0.7rem;
}

button.tema-deal-shop {
    cursor: pointer;
}

button.tema-deal-shop:hover,
button.tema-deal-shop:focus-visible,
.tema-deal-shop.is-active {
    border-color: var(--news-ink);
}

.tema-deal-shop.is-active {
    box-shadow: inset 0 -2px 0 var(--news-accent);
}

/* Partner deals among the stories (shopping themes): a row across the grid, boxed like the homepage's. */
.tema-grid > .affiliate-strip {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.85rem 1rem 1rem;
    background: #ffffff;
    border: 1px solid var(--news-rule);
    border-top: 3px solid var(--news-accent);
}

@media (min-width: 768px) {
    /* The lead (first page) and an odd last card go across both columns, the picture beside the words. A shop filter
       puts every card back in the columns. */
    .tema-grid:not(.is-filtered) > .tema-card:is(.is-lead, .is-wide) {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
        grid-template-rows: none;
    }

    .tema-grid:not(.is-filtered) > .tema-card:is(.is-lead, .is-wide) .tema-card-media {
        aspect-ratio: auto;
        min-height: 13rem;
    }

    .tema-grid:not(.is-filtered) > .tema-card:is(.is-lead, .is-wide) .tema-card-body {
        justify-content: center;
        padding: 1.1rem 1.25rem 1.2rem;
    }

    .tema-grid:not(.is-filtered) > .tema-card.is-lead .tema-card-media {
        min-height: 17rem;
    }

    .tema-grid:not(.is-filtered) > .tema-card.is-lead .tema-card-title {
        font-size: clamp(1.35rem, 0.95rem + 1vw, 1.75rem);
        line-height: 1.15;
        -webkit-line-clamp: 4;
        line-clamp: 4;
    }

    .tema-grid:not(.is-filtered) > .tema-card.is-lead .tema-card-summary {
        font-size: 0.95rem;
        -webkit-line-clamp: 4;
        line-clamp: 4;
    }

    .tema-grid:not(.is-filtered) > .tema-card.is-lead .tema-card-discount {
        font-size: 1.35rem;
    }
}

/* A short theme: what to expect. */
.tema-thin {
    margin: 0;
    padding: 0.75rem 1rem;
    color: var(--news-soft-ink);
    background: var(--panel);
    border: 1px solid var(--news-rule);
    border-left: 3px solid var(--news-ink);
    font-size: 0.9rem;
    font-weight: 600;
}

.tema-thin a,
.tema-more-link {
    color: var(--news-ink);
    font-weight: 900;
    text-decoration: underline;
    text-decoration-color: var(--news-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* No stories (yet, or from the chosen portal). */
.tema-empty {
    display: grid;
    justify-items: start;
    gap: 0.6rem;
    padding: 1.4rem 1.5rem;
    background: var(--panel);
    border: 1px solid var(--news-rule);
    border-left: 3px solid var(--news-ink);
}

.tema-empty h3 {
    margin: 0;
    color: var(--news-ink);
    font-size: 1.3rem;
    font-weight: 900;
}

.tema-empty p {
    margin: 0;
    color: var(--news-soft-ink);
}

.tema-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.tema-button {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.35rem 1rem;
    color: var(--news-ink);
    background: var(--panel);
    border: 2px solid var(--news-ink);
    font-weight: 900;
    text-decoration: none;
}

.tema-button:hover,
.tema-button:focus-visible {
    color: var(--news-accent);
    border-color: var(--news-accent);
}

/* Pages: numbers around the current one. */
.tema-pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    padding-top: 0.5rem;
}

.tema-pages a,
.tema-pages span {
    display: inline-grid;
    place-items: center;
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0 0.7rem;
    color: var(--news-ink);
    background: var(--panel);
    border: 1px solid var(--news-rule);
    font-weight: 800;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.tema-pages a:hover,
.tema-pages a:focus-visible {
    border-color: var(--news-ink);
}

.tema-pages .is-current {
    border-color: var(--news-ink);
    box-shadow: inset 0 -3px 0 var(--news-accent);
    font-weight: 900;
}

.tema-pages .tema-page-gap {
    min-width: 1rem;
    padding: 0;
    background: transparent;
    border: 0;
}

/* ---------- Side column: the portals, related and active themes ---------- */

.tema-panel {
    padding: 0.85rem 1rem 1rem;
    background: var(--panel);
    border: 1px solid var(--news-rule);
    border-top: 3px solid var(--news-ink);
}

.tema-panel-title {
    margin: 0 0 0.6rem;
    color: var(--news-ink);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tema-sources {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tema-sources a {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.3rem;
    color: var(--news-ink);
    border-bottom: 1px solid var(--news-rule);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.tema-sources li:last-child a {
    border-bottom: 0;
}

.tema-sources a:hover .tema-sources-name,
.tema-sources a:focus-visible .tema-sources-name {
    color: var(--news-accent);
    text-decoration: underline;
}

.tema-sources a.is-active {
    padding-left: 0.6rem;
    box-shadow: inset 3px 0 0 var(--news-accent);
}

.tema-sources-mark {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--muted);
    font-weight: 900;
}

.tema-sources-mark img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.tema-sources-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tema-sources-count {
    min-width: 2rem;
    padding: 0.1rem 0.4rem;
    color: var(--news-ink);
    background: #eef1f4;
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.tema-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tema-chips a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    color: var(--news-ink);
    background: var(--panel);
    border: 1px solid var(--news-rule);
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
}

.tema-chips a:hover,
.tema-chips a:focus-visible {
    color: var(--news-accent);
    border-color: var(--news-ink);
}

.tema-chips small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tema-more-link {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

/* ---------- Narrower screens ---------- */

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

@media (max-width: 767.98px) {
    .tema-shell {
        gap: 0.85rem;
        padding-top: 0.75rem;
    }

    .tema-head {
        gap: 0.4rem;
        padding: 0.85rem 1rem 0.9rem;
        border-left-width: 4px;
    }

    .tema-lead {
        font-size: 0.95rem;
    }

    .tema-toolbar {
        gap: 0.5rem 0.75rem;
    }

    .tema-title {
        font-size: 0.95rem;
    }

    /* The page numbers are under the list. */
    .tema-page-of {
        display: none;
    }

    /* The shops slide sideways under their label, edge to edge. */
    .tema-shops {
        display: grid;
        gap: 0.4rem;
    }

    .tema-shops-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-inline: -12px;
        padding: 0 12px 2px;
        scrollbar-width: none;
    }

    .tema-shops-list::-webkit-scrollbar {
        display: none;
    }

    .tema-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.65rem;
    }

    /* Rows: a thumbnail beside the words; the lead keeps its big picture. */
    .tema-card:not(.is-lead) {
        grid-template-columns: 7rem minmax(0, 1fr);
        grid-template-rows: none;
    }

    .tema-card:not(.is-lead) .tema-card-media {
        aspect-ratio: auto;
        min-height: 6.5rem;
    }

    .tema-card:not(.is-lead) .tema-card-body {
        gap: 0.3rem;
        padding: 0.6rem 0.7rem 0.7rem;
    }

    .tema-card:not(.is-lead) .tema-card-title {
        font-size: 1rem;
        line-height: 1.22;
    }

    .tema-card:not(.is-lead) .tema-card-summary {
        display: none;
    }

    .tema-card:not(.is-lead) .tema-card-discount {
        padding: 0.22rem 0.38rem;
        font-size: 0.82rem;
    }

    .tema-card-kicker {
        font-size: 0.7rem;
    }

    .tema-card.is-lead .tema-card-title {
        font-size: 1.3rem;
        line-height: 1.18;
    }

    .tema-grid > .affiliate-strip {
        padding: 0.75rem 0.75rem 0.85rem;
    }

    .tema-pages a,
    .tema-pages span {
        min-width: 2.2rem;
        height: 2.2rem;
        padding: 0 0.55rem;
    }
}
