/* Dividend stocks page (utbytteaksjer.php). Built on the shared --ak-* theme tokens. */

.ub {
    --ub-radius: 12px;
    --ub-gap: clamp(1rem, 2.4vw, 1.5rem);
    padding-top: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: 2rem;
    color: var(--ak-text);
}

:where(.ub) h1,
:where(.ub) h2 {
    margin: 0;
    font-family: 'Sora', 'Manrope', system-ui, sans-serif;
    letter-spacing: -0.02em;
    color: var(--ak-text);
}

:where(.ub) h1 {
    font-size: clamp(1.9rem, 5vw, 2.75rem);
    line-height: 1.1;
}

:where(.ub) h2 {
    font-size: clamp(1.2rem, 3vw, 1.45rem);
    line-height: 1.25;
}

:where(.ub) p {
    margin: 0;
}

.ub a {
    color: var(--ak-brand);
}

.ub-hero {
    max-width: 46rem;
    margin-bottom: var(--ub-gap);
}

.ub-lead {
    margin-top: 0.75rem !important;
    color: var(--ak-text-soft);
    font-size: clamp(1rem, 2.2vw, 1.12rem);
    line-height: 1.55;
}

.ub-asof {
    margin-top: 0.6rem !important;
    color: var(--ak-text-muted);
    font-size: 0.85rem;
}

.ub-card {
    background: var(--ak-surface-solid);
    border: 1px solid var(--ak-border);
    border-radius: var(--ub-radius);
    padding: clamp(1rem, 2.5vw, 1.4rem);
}

.ub-empty {
    max-width: 46rem;
    display: grid;
    gap: 0.6rem;
    line-height: 1.5;
}

.ub-empty a {
    font-weight: 600;
}

/* Summary figures */

.ub-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.ub-stat dt {
    color: var(--ak-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ub-stat dd {
    margin: 0.4rem 0 0;
    font-family: 'Sora', 'Manrope', system-ui, sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--ak-text);
}

.ub-stat dd.ub-stat-meta {
    margin-top: 0.2rem;
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ak-text-soft);
    overflow-wrap: anywhere;
}

.ub-stat-meta a {
    font-weight: 600;
    text-decoration: none;
}

.ub-stat-meta a:hover {
    text-decoration: underline;
}

/* Sections */

.ub-section {
    margin-top: clamp(1.75rem, 4.5vw, 2.75rem);
}

.ub-intro {
    max-width: 52rem;
    margin-top: 0.5rem !important;
    color: var(--ak-text-soft);
    font-size: 0.96rem;
    line-height: 1.55;
}

.ub-note {
    max-width: 52rem;
    margin-top: 0.75rem !important;
    color: var(--ak-text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.ub-note a {
    font-weight: 600;
}

/* Tables */

.ub-table-card {
    margin-top: 0.9rem;
    padding: 0.25rem clamp(0.5rem, 1.6vw, 1rem);
}

.ub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.ub-table th,
.ub-table td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--ak-border);
    text-align: left;
    vertical-align: middle;
    background: none;
    color: var(--ak-text);
}

.ub-table thead th {
    vertical-align: bottom;
    color: var(--ak-text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.3;
    text-transform: uppercase;
}

.ub-table tbody tr:last-child :is(th, td) {
    border-bottom: 0;
}

.ub-table .ub-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ub-table tbody .ub-num {
    white-space: nowrap;
}

.ub-table .ub-rank {
    width: 2.5rem;
    color: var(--ak-text-muted);
    font-size: 0.88rem;
}

.ub-table .ub-strong {
    font-weight: 700;
}

.ub-company {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ub-company a {
    font-weight: 700;
    text-decoration: none;
}

.ub-company a:hover {
    text-decoration: underline;
}

.ub-company span {
    display: block;
    color: var(--ak-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.ub-table td small {
    display: block;
    color: var(--ak-text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.ub-meter {
    display: block;
    width: 3.5rem;
    height: 0.3rem;
    margin: 0.3rem 0 0 auto;
    border-radius: 999px;
    background: var(--ak-surface-soft);
    border: 1px solid var(--ak-border);
    overflow: hidden;
}

.ub-meter > span {
    display: block;
    height: 100%;
    background: var(--ak-brand);
}

/* Guide, links and FAQ */

.ub-guide {
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.ub-guide strong {
    display: block;
    color: var(--ak-text);
}

.ub-guide p {
    margin-top: 0.35rem;
    color: var(--ak-text-soft);
    font-size: 0.95rem;
    line-height: 1.55;
}

.ub-links {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.75rem;
}

.ub-links a {
    font-weight: 600;
    text-decoration: none;
}

.ub-links a:hover {
    text-decoration: underline;
}

.ub-faq h2 {
    margin-bottom: 0.9rem;
}

.ub-faq details {
    margin-top: 0.6rem;
    max-width: 46rem;
}

.ub-faq summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--ak-text);
}

.ub-faq details p {
    margin-top: 0.6rem;
    color: var(--ak-text-soft);
    line-height: 1.55;
}

.ub-disclaimer {
    margin-top: clamp(1.5rem, 4vw, 2.5rem) !important;
    color: var(--ak-text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.ub a:focus-visible,
.ub summary:focus-visible {
    outline: 3px solid var(--ak-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Narrow screens: each table row becomes a small card with labelled values. */

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

    .ub-table-card {
        padding: 0 0.9rem;
    }

    .ub-table,
    .ub-table tbody {
        display: block;
    }

    .ub-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .ub-table tbody tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem 0.75rem;
        padding: 0.85rem 0;
        border-bottom: 1px solid var(--ak-border);
    }

    .ub-table tbody tr:last-child {
        border-bottom: 0;
    }

    .ub-table tbody :is(th, td),
    .ub-table tbody .ub-num {
        display: block;
        min-width: 0;
        padding: 0;
        border: 0;
        text-align: left;
        white-space: normal;
    }

    .ub-table .ub-company {
        grid-column: 1 / -1;
        font-size: 1rem;
    }

    .ub-company span {
        display: inline;
    }

    /* Ranked list: number in its own column, then yields and years on one line,
       latest dividend and score on the next. */
    .ub-table-ranked tbody tr {
        grid-template-columns: 1.7rem repeat(3, minmax(0, 1fr));
    }

    .ub-table-ranked tbody .ub-rank {
        grid-column: 1;
        grid-row: 1 / span 3;
        width: auto;
        padding-top: 0.15rem;
    }

    .ub-table-ranked .ub-company {
        grid-column: 2 / -1;
    }

    .ub-table-ranked tbody td:nth-child(6) {
        order: 1;
    }

    .ub-table-ranked tbody td:nth-child(5) {
        order: 2;
        grid-column: span 2;
    }

    .ub-table-ranked tbody td:nth-child(7) {
        order: 2;
    }

    .ub-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.1rem;
        color: var(--ak-text-muted);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .ub-meter {
        display: none;
    }
}
