/*
 * Subsidies overview infographic (/dotace/reporty) and the shared layout of the detail subsidy reports (Views/Dotace).
 * Pages are built from Bootstrap 5 utilities plus hlidac.css (.hs-tags, .tag, .btn); only the data visuals and a few
 * layout grids live here, scoped under .hs-dotace with the hsd- prefix. The visuals are rendered on the server by
 * Web/Framework/DotaceInfografikaRender.cs. Tokens mirror the Hlidac statu design system (see rozpocet2027.css).
 */
.hs-dotace {
    --hsd-ink: #28313B;
    --hsd-ink-2: #3D4651;
    --hsd-muted: #6F6F6F;
    --hsd-line: #E0E6ED;
    --hsd-surface: #F0F3F7;
    --hsd-track: #E0E6ED;
    --hsd-s1: #0074E4;
    --hsd-s2: #FFA82F;
    --hsd-s2-strong: #E08A0B;
    --hsd-s3: #38CAAA;
    --hsd-s4: #003688;
    --hsd-s5: #8EC3F5;
    --hsd-s6: #8A94A3;
    --hsd-q1: #DCEBFB;
    --hsd-q2: #A9CFF5;
    --hsd-q3: #5FA8EE;
    --hsd-q4: #0074E4;
    --hsd-q5: #003688;
    --hsd-radius: 12px;
    --hsd-dur: .35s;
    --bs-body-color: #28313B;
    --bs-body-color-rgb: 40, 49, 59;
    --bs-secondary-color: #6F6F6F;
    --bs-border-color: #E0E6ED;
    --bs-tertiary-bg: #F0F3F7;
    --bs-tertiary-bg-rgb: 240, 243, 247;
    --bs-border-radius-lg: 12px;
    font-family: 'Cabin', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: .3px;
    color: var(--hsd-ink);
}

.hs-dotace h1, .hs-dotace h2, .hs-dotace h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: .6px;
    text-wrap: balance;
    color: inherit;
}

.hs-dotace p {
    margin: 0;
    max-width: 72ch;
}

.hs-dotace .lead {
    color: var(--hsd-ink-2);
}

.hsd-eyebrow {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--hsd-s1);
}

.hsd-h1 {
    font-size: clamp(30px, 4.2vw, 52px);
    line-height: 1.08;
    max-width: 24ch;
}

.hsd-h1--report {
    font-size: clamp(26px, 3vw, 38px);
    max-width: 32ch;
}

.hsd-h2 {
    font-size: clamp(22px, 2.4vw, 30px);
    line-height: 1.15;
}

.hsd-num, .hsd-stat {
    font-variant-numeric: tabular-nums;
}

.hsd-stat {
    font-weight: 700;
    font-size: clamp(24px, 2.6vw, 34px);
    line-height: 1.1;
    letter-spacing: .6px;
}

.hsd-muted {
    color: var(--hsd-muted);
}

.hsd-take {
    font-size: clamp(17px, 1.6vw, 20px);
    color: var(--hsd-ink-2);
}

/* ---------- sections ---------- */
.hsd-sec {
    padding-block: clamp(20px, 3vw, 40px);
}

.hsd-sec + .hsd-sec {
    border-top: 1px solid var(--hsd-line);
}

.hsd-panel {
    background: var(--hsd-surface);
    border-radius: var(--hsd-radius);
    padding: clamp(16px, 2.4vw, 28px);
    min-width: 0;
}

.hsd-split {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 992px) {
    .hsd-split {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        align-items: start;
    }
}

/* ---------- KPI tiles: tiles touch with a 4px gap and share one rounded outline ---------- */
.hsd-tiles {
    display: grid;
    gap: 4px;
    border-radius: var(--hsd-radius);
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hsd-tiles--3 {
    grid-template-columns: minmax(0, 1fr);
}

.hsd-tile {
    display: grid;
    gap: 4px;
    align-content: start;
    background: var(--hsd-surface);
    padding: clamp(14px, 2vw, 24px);
    min-width: 0;
}

.hsd-tile__label {
    font-size: 14px;
    font-weight: 700;
    color: var(--hsd-muted);
}

.hsd-tile__note {
    font-size: 14px;
    color: var(--hsd-ink-2);
}

@media (min-width: 576px) {
    .hsd-tiles--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .hsd-tiles {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hsd-tiles--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ---------- ranked horizontal bars ---------- */
.hsd-bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

@media (min-width: 768px) {
    .hsd-bars--cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 40px;
    }
}

.hsd-bar {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.hsd-bar__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.hsd-bar__label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.hsd-bar__head .hsd-num {
    flex: none;
    font-weight: 700;
}

.hsd-bar__track {
    height: 10px;
    border-radius: 5px;
    background: var(--hsd-track);
    overflow: hidden;
}

.hsd-bar__track i {
    display: block;
    height: 100%;
    border-radius: 5px;
    background: var(--hsd-s1);
    transition: width var(--hsd-dur) ease, opacity .12s ease, background-color .12s ease;
}

.hsd-bar--muted .hsd-bar__track i {
    background: var(--hsd-s6);
}

.hsd-bars:has(.hsd-bar:is(:hover, :focus-within)) .hsd-bar:not(:hover, :focus-within) .hsd-bar__track i {
    opacity: .4;
}

.hsd-bar:is(:hover, :focus-within) .hsd-bar__track i {
    background: var(--hsd-s4);
}

.hsd-bar--muted:is(:hover, :focus-within) .hsd-bar__track i {
    background: var(--hsd-ink-2);
}

.hsd-bar:is(:hover, :focus-within) .hsd-bar__head .hsd-num {
    color: var(--hsd-s4);
}

.hsd-bar__note {
    font-size: 14px;
    color: var(--hsd-muted);
}

/* ---------- chart tooltips: shown on hover or keyboard/tap focus of a chart item ---------- */
.hsd-tip {
    position: absolute;
    z-index: 5;
    left: 0;
    display: grid;
    gap: 2px;
    width: max-content;
    max-width: 240px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--hsd-ink);
    color: #fff;
    box-shadow: 0 4px 14px rgba(40, 49, 59, .25);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: .2px;
    text-align: left;
    white-space: normal;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease, visibility .12s;
}

.hsd-tip--end {
    left: auto;
    right: 0;
}

.hsd-tip b {
    font-weight: 700;
}

.hsd-cols__col:is(:hover, :focus) .hsd-tip,
.hsd-stack__seg:is(:hover, :focus) .hsd-tip,
.hsd-map__t:is(:hover, :focus) .hsd-tip {
    opacity: 1;
    visibility: visible;
}

/* ---------- year columns: every column carries its value; value labels turn vertical when columns get narrow ---------- */
.hsd-cols {
    --hsd-val-space: 22px;
    container: hsd-cols / inline-size;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
    height: 240px;
}

.hsd-cols--small {
    height: 120px;
}

.hsd-cols__col {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100%;
    min-width: 0;
    text-align: center;
    cursor: default;
    outline: 0;
}

.hsd-cols__plot {
    position: relative;
    min-height: 0;
}

.hsd-cols__area {
    position: absolute;
    inset: var(--hsd-val-space) 0 0;
}

.hsd-cols__area i {
    position: absolute;
    inset: auto 0 0;
    height: var(--hsd-h);
    border-radius: 4px 4px 0 0;
    background: var(--hsd-s5);
    transition: opacity .12s ease, background-color .12s ease;
}

.hsd-cols__col--last i {
    background: var(--hsd-s1);
}

.hsd-cols--alt .hsd-cols__col i {
    background: var(--hsd-q2);
}

.hsd-cols--alt .hsd-cols__col--last i {
    background: var(--hsd-s2);
}

.hsd-cols__val {
    position: absolute;
    left: 50%;
    bottom: calc(var(--hsd-h) + 3px);
    transform: translateX(-50%);
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--hsd-ink-2);
    font-variant-numeric: tabular-nums;
}

.hsd-cols__col--last .hsd-cols__val {
    font-weight: 700;
    color: var(--hsd-ink);
}

.hsd-cols__lbl {
    font-size: 12px;
    color: var(--hsd-muted);
    padding-top: 4px;
}

.hsd-cols__plot .hsd-tip {
    top: 0;
}

.hsd-cols:has(.hsd-cols__col:is(:hover, :focus)) .hsd-cols__col:not(:hover, :focus) i {
    opacity: .4;
}

.hsd-cols__col:is(:hover, :focus) i {
    background: var(--hsd-s4);
}

.hsd-cols--alt .hsd-cols__col:is(:hover, :focus) i {
    background: var(--hsd-s2-strong);
}

.hsd-cols__col:is(:hover, :focus) :is(.hsd-cols__val, .hsd-cols__lbl) {
    font-weight: 700;
    color: var(--hsd-ink);
}

@container hsd-cols (max-width: 1000px) {
    .hsd-cols--dense .hsd-cols__area {
        top: 64px;
    }

    .hsd-cols--dense .hsd-cols__val {
        writing-mode: vertical-rl;
        transform: translateX(-50%) rotate(180deg);
        font-size: 11px;
    }
}

@container hsd-cols (max-width: 640px) {
    .hsd-cols--medium .hsd-cols__area {
        top: 64px;
    }

    .hsd-cols--medium .hsd-cols__val {
        writing-mode: vertical-rl;
        transform: translateX(-50%) rotate(180deg);
        font-size: 11px;
    }

    .hsd-cols--dense .hsd-cols__col:nth-child(even) .hsd-cols__lbl {
        visibility: hidden;
    }
}

@container hsd-cols (max-width: 300px) {
    .hsd-cols--sparse .hsd-cols__area {
        top: 64px;
    }

    .hsd-cols--sparse .hsd-cols__val {
        writing-mode: vertical-rl;
        transform: translateX(-50%) rotate(180deg);
        font-size: 11px;
    }
}

/* ---------- stacked share bar: segments print their share, legend hover highlights the matching segment ---------- */
.hsd-stack {
    container: hsd-stack / inline-size;
    display: flex;
    height: 28px;
    gap: 2px;
    background: var(--hsd-surface);
}

@container hsd-stack (max-width: 600px) {
    .hsd-stack__val--narrow {
        display: none;
    }
}

.hsd-stack__seg {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2px;
    color: var(--hsd-ink);
    cursor: default;
    outline: 0;
    transition: opacity .12s ease;
}

.hsd-stack__seg:first-child {
    border-radius: 6px 0 0 6px;
}

.hsd-stack__seg:last-child {
    border-radius: 0 6px 6px 0;
}

.hsd-stack__seg:only-child {
    border-radius: 6px;
}

.hsd-stack__seg.hsd-c1,
.hsd-stack__seg.hsd-c4 {
    color: #fff;
}

.hsd-stack__val {
    overflow: hidden;
    padding-inline: 4px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: clip;
}

.hsd-stack__seg .hsd-tip {
    top: calc(100% + 6px);
}

.hsd-stack:has(.hsd-stack__seg:is(:hover, :focus)) .hsd-stack__seg:not(:hover, :focus) {
    opacity: .35;
}

.hsd-stack__seg:is(:hover, :focus) {
    box-shadow: inset 0 0 0 2px rgba(40, 49, 59, .55);
}

.hsd-share:has(.hsd-legend li:hover) .hsd-stack__seg {
    opacity: .35;
}

.hsd-share:has(.hsd-legend li:nth-child(1):hover) .hsd-stack__seg:nth-child(1),
.hsd-share:has(.hsd-legend li:nth-child(2):hover) .hsd-stack__seg:nth-child(2),
.hsd-share:has(.hsd-legend li:nth-child(3):hover) .hsd-stack__seg:nth-child(3),
.hsd-share:has(.hsd-legend li:nth-child(4):hover) .hsd-stack__seg:nth-child(4),
.hsd-share:has(.hsd-legend li:nth-child(5):hover) .hsd-stack__seg:nth-child(5),
.hsd-share:has(.hsd-legend li:nth-child(6):hover) .hsd-stack__seg:nth-child(6),
.hsd-share:has(.hsd-legend li:nth-child(7):hover) .hsd-stack__seg:nth-child(7),
.hsd-share:has(.hsd-legend li:nth-child(8):hover) .hsd-stack__seg:nth-child(8) {
    opacity: 1;
}

.hsd-share:has(.hsd-stack__seg:nth-child(1):is(:hover, :focus)) .hsd-legend li:nth-child(1),
.hsd-share:has(.hsd-stack__seg:nth-child(2):is(:hover, :focus)) .hsd-legend li:nth-child(2),
.hsd-share:has(.hsd-stack__seg:nth-child(3):is(:hover, :focus)) .hsd-legend li:nth-child(3),
.hsd-share:has(.hsd-stack__seg:nth-child(4):is(:hover, :focus)) .hsd-legend li:nth-child(4),
.hsd-share:has(.hsd-stack__seg:nth-child(5):is(:hover, :focus)) .hsd-legend li:nth-child(5),
.hsd-share:has(.hsd-stack__seg:nth-child(6):is(:hover, :focus)) .hsd-legend li:nth-child(6),
.hsd-share:has(.hsd-stack__seg:nth-child(7):is(:hover, :focus)) .hsd-legend li:nth-child(7),
.hsd-share:has(.hsd-stack__seg:nth-child(8):is(:hover, :focus)) .hsd-legend li:nth-child(8) {
    font-weight: 700;
}

.hsd-share .hsd-legend li {
    cursor: default;
}

.hsd-legend {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.hsd-legend li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.hsd-sw {
    display: inline-block;
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.hsd-c1 { background: var(--hsd-s1); }
.hsd-c2 { background: var(--hsd-s2); }
.hsd-c3 { background: var(--hsd-s3); }
.hsd-c4 { background: var(--hsd-s4); }
.hsd-c5 { background: var(--hsd-s5); }
.hsd-c6 { background: var(--hsd-s6); }

/* ---------- region tile map ---------- */
.hsd-map {
    max-width: 640px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    gap: 4px;
}

.hsd-map__t {
    display: grid;
    gap: 2px;
    align-content: center;
    justify-items: center;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    padding: 4px;
    min-width: 0;
    text-align: center;
    color: var(--hsd-ink);
    position: relative;
    cursor: default;
    outline: 0;
    transition: opacity .12s ease, transform .12s ease;
}

.hsd-map__t .hsd-tip {
    top: auto;
    bottom: calc(100% + 6px);
}

.hsd-map:has(.hsd-map__t:is(:hover, :focus)) .hsd-map__t:not(:hover, :focus) {
    opacity: .45;
}

.hsd-map__t:is(:hover, :focus) {
    z-index: 4;
    transform: scale(1.06);
    box-shadow: 0 0 0 2px var(--hsd-ink);
}

@media (prefers-reduced-motion: reduce) {
    .hsd-map__t:is(:hover, :focus) {
        transform: none;
    }
}

.hsd-map__t b {
    font-size: clamp(11px, 1.4vw, 15px);
}

.hsd-map__t span {
    font-size: clamp(9px, 1.1vw, 13px);
    line-height: 1.1;
}

.hsd-q1 { background: var(--hsd-q1); }
.hsd-q2 { background: var(--hsd-q2); }
.hsd-q3 { background: var(--hsd-q3); color: #fff; }
.hsd-q4 { background: var(--hsd-q4); color: #fff; }
.hsd-q5 { background: var(--hsd-q5); color: #fff; }

.hsd-scale {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--hsd-muted);
}

.hsd-scale i {
    display: block;
    width: 24px;
    height: 10px;
    border-radius: 2px;
}

/* ---------- ranked top lists ---------- */
.hsd-list {
    list-style: none;
    counter-reset: hsd-rank;
    margin: 0;
    padding: 0;
    display: grid;
}

.hsd-list li {
    counter-increment: hsd-rank;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: baseline;
    padding-block: 8px;
    border-bottom: 1px solid var(--hsd-line);
}

.hsd-list li:last-child {
    border-bottom: 0;
}

.hsd-list li::before {
    content: counter(hsd-rank) ".";
    color: var(--hsd-muted);
    font-variant-numeric: tabular-nums;
}

.hsd-list a {
    overflow-wrap: anywhere;
}

.hsd-list .hsd-num {
    font-weight: 700;
    white-space: nowrap;
}

/* ---------- report hub cards ---------- */
.hsd-cards {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .hsd-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .hsd-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.hsd-card {
    display: grid;
    gap: 10px;
    align-content: start;
    border: 1px solid var(--hsd-line);
    border-radius: var(--hsd-radius);
    padding: 20px;
    background: #fff;
    min-width: 0;
}

.hsd-card__icon {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--hsd-surface);
    color: var(--hsd-s1);
}

.hsd-card__head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hsd-card__fact {
    font-size: 14px;
    color: var(--hsd-ink-2);
    border-left: 3px solid var(--hsd-s2);
    padding-left: 8px;
}

.hsd-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hsd-years {
    font-size: 14px;
    color: var(--hsd-muted);
}

.hsd-years a {
    margin-left: 6px;
}

/* ---------- report filter bar ---------- */
.hsd-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--hsd-radius);
    background: var(--hsd-surface);
}

.hsd-filter__row {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.hsd-filter__label {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--hsd-muted);
    min-width: 7ch;
}

.hsd-filter__select {
    width: auto;
    max-width: 100%;
    min-width: 0;
    flex: 0 1 auto;
    font-size: 14px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.hsd-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.hsd-seg > a, .hsd-seg__opt > span, .hsd-seg .dropdown-toggle {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid var(--hsd-line);
    background: #fff;
    color: var(--hsd-ink);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.5;
}

.hsd-seg > a:hover, .hsd-seg__opt > input:enabled:not(:checked) + span:hover, .hsd-seg .dropdown-toggle:hover {
    border-color: var(--hsd-s1);
    color: var(--hsd-s1);
}

.hsd-seg > a.active, .hsd-seg__opt > input:checked + span, .hsd-seg .dropdown-toggle.active {
    background: var(--hsd-s1);
    border-color: var(--hsd-s1);
    color: #fff;
}

.hsd-seg .dropdown-menu {
    max-height: 320px;
    overflow-y: auto;
}

.hsd-seg__opt {
    position: relative;
    margin: 0;
}

.hsd-seg__opt > input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.hsd-seg__opt > span {
    cursor: pointer;
    user-select: none;
}

.hsd-seg__opt > input:focus-visible + span {
    outline: 2px solid var(--hsd-s1);
    outline-offset: 2px;
}

.hsd-seg__opt > input:disabled + span {
    cursor: default;
    opacity: .45;
}

.hsd-filter__actions {
    padding-top: 2px;
}

.hsd-filter__hint {
    font-size: 13px;
    color: var(--hsd-muted);
}

.hsd-yeartable > tbody > tr:first-child > * {
    border-bottom-width: 0;
}

.hsd-yeartable__top > td {
    font-size: 14px;
    color: var(--hsd-ink-2);
    padding-top: 0;
}

.hsd-yearcell__count {
    display: block;
    font-size: 12px;
    color: var(--hsd-muted);
}

/* ---------- report body ---------- */
.hsd-report {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

/* Wide report tables scroll inside their section instead of widening the whole page on phones. */
.hsd-report > section {
    min-width: 0;
    overflow-x: auto;
    grid-template-columns: minmax(0, 1fr);
}

.hsd-report .table {
    font-size: 15px;
}

.hsd-note {
    font-size: 14px;
    color: var(--hsd-ink-2);
    border-left: 3px solid var(--hsd-s2);
    padding-left: 10px;
}

.hsd-related {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .hsd-related {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.hsd-related a {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--hsd-line);
    border-radius: var(--hsd-radius);
    text-decoration: none;
    color: var(--hsd-ink);
    transition: border-color var(--hsd-dur) ease;
}

.hsd-related a:hover {
    border-color: var(--hsd-s1);
}

.hsd-related small {
    color: var(--hsd-muted);
}

@media (prefers-reduced-motion: reduce) {
    .hsd-bar__track i, .hsd-related a {
        transition: none;
    }
}
