/*
 * Vilabot.cat v0.5 — server-rendered pages (event permalinks, agendas,
 * cobertura, publica, privadesa, errors).
 *
 * Loaded after app.css and built only from its tokens and components (ticket
 * cards, day heads, facts, action tiles, share grid, side cards), so a page
 * reached from WhatsApp or Google looks like the app it leads to. Nothing
 * here is set from inline styles (CSP style-src 'self'): proportional bars
 * use the quantised .pct-N classes at the end of the file.
 */

/* ------------------------------------------------------------ base */
main:focus,
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

/* Server-rendered lists are complete on first paint: no entrance animation. */
.page-site .card-item { animation: none; }

.page-hero .hl,
.error-page .hl {
    white-space: normal;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

code {
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.05em 0.25em;
    border-radius: 5px;
    background: var(--bg-2);
    overflow-wrap: anywhere;
}

/* Source name on cards: ellipsis needs a real box (app.css puts it on the flex parent). */
.card-src-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ breadcrumbs */
.crumbs { margin-bottom: 1rem; font-size: 0.86rem; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0; list-style: none; padding: 0; }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.crumbs li + li::before {
    content: "›";
    padding: 0 0.5rem;
    color: var(--line-2);
    font-weight: 700;
}
.crumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--text-2);
    font-weight: 600;
    text-decoration: none;
}
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current="page"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

/* ------------------------------------------------------------ banners */
.banner {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line-2);
    border-left-width: 6px;
    border-radius: var(--radius);
    background: var(--surface-2);
}
.banner-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
}
.banner-body { min-width: 0; }
.banner-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 750; line-height: 1.25; }
.banner-body p + p { margin-top: 0.3rem; color: var(--text-2); }
.banner-links { display: grid; gap: 0.15rem; margin-top: 0.5rem; padding-left: 1.1rem; }
.banner-links { font-size: 0.95rem; }
.banner-links a { font-weight: 650; }
.banner-when { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.banner-past { border-left-color: var(--muted); }
.banner-stale { border-left-color: var(--red); background: var(--warn-bg); }
.banner-stale .banner-ic { color: var(--accent); }

/* ------------------------------------------------------------ page hero */
.page-hero {
    position: relative;
    isolation: isolate;
    padding: clamp(1.25rem, 4vw, 2.5rem) 0 clamp(1.5rem, 4vw, 2.25rem);
}
.page-hero-inner { position: relative; }
.page-hero .eyebrow { margin-bottom: 0.9rem; }
.page-hero .eyebrow .ic { color: var(--ok); }
.page-title {
    font-size: clamp(2.1rem, 7vw, 3.7rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -0.03em;
    max-width: 22ch;
    overflow-wrap: break-word;
    font-variation-settings: "SOFT" 50, "WONK" 1;
}
.page-sub {
    margin-top: 0.85rem;
    max-width: 42rem;
    font-size: clamp(1.02rem, 2.3vw, 1.15rem);
    color: var(--text-2);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.35rem; }
.page-hero-sm .page-title { font-size: clamp(2rem, 6vw, 3.1rem); }

.page-body { padding-bottom: 3rem; }
.page-section { margin-top: clamp(2.25rem, 6vw, 3.5rem); }
.page-h2 { font-size: clamp(1.55rem, 4.4vw, 2.15rem); font-weight: 780; letter-spacing: -0.02em; }
.page-lead { margin-top: 0.5rem; max-width: 46rem; color: var(--text-2); }
.page-section .section-kicker { display: block; margin-bottom: 0.35rem; }

/* ------------------------------------------------------------ event page */
.event-wrap { padding-top: 1rem; padding-bottom: 3rem; max-width: 1120px; }
.event { position: relative; }

.event-head { display: grid; }
.event-hero {
    margin: 0 calc(var(--gutter) * -1);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-2);
}
.event-hero img { width: 100%; height: 100%; object-fit: cover; }
.event-hero + .ticket-frame { margin-top: -2.25rem; position: relative; z-index: 1; }

.ticket-frame {
    /* drop-shadow follows the notched mask of the ticket (box-shadow would not). */
    filter: drop-shadow(5px 5px 0 var(--yellow));
}
.event-ticket {
    --stub-w: 92px;
    display: grid;
    grid-template-columns: var(--stub-w) minmax(0, 1fr);
    min-height: 150px;
    background: var(--surface);
    border: 1.5px solid var(--text);
    border-radius: var(--radius-lg);
    overflow: hidden;
    -webkit-mask:
        radial-gradient(circle 11px at var(--stub-w) 0, #0000 97%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle 11px at var(--stub-w) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat;
    mask:
        radial-gradient(circle 11px at var(--stub-w) 0, #0000 97%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle 11px at var(--stub-w) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat;
}
.event-stub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    padding: 1rem 0.25rem;
    background: var(--stub);
    color: #fff;
    text-align: center;
    border-right: 2px dashed rgba(255, 255, 255, 0.6);
}
.event-stub .stub-day { font-size: 2.9rem; }
.event-stub .stub-mon { font-size: 0.85rem; }
.event-stub .stub-wd { font-size: 0.78rem; }
.is-past .event-stub { background: #5d594f; }

.event-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
    padding: 1.1rem 1.1rem 1.15rem 1.2rem;
    border-top: 4px solid var(--cat, var(--red));
}
.event-heading .cat-tag { align-self: flex-start; }
.event-title {
    font-size: clamp(1.55rem, 5.2vw, 2.6rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
    font-variation-settings: "SOFT" 30;
}
.event-place {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-2);
}
.event-place .ic { color: var(--accent); }
.event-place a { color: inherit; text-decoration-color: var(--line-2); }
.event-place a:hover { color: var(--accent); }

.event-body { display: grid; gap: 1.75rem; margin-top: 1.75rem; }
.event-side { display: grid; gap: 0.85rem; align-content: start; min-width: 0; }
.event-side .detail-facts { margin-top: 0; }
.event-side .detail-actions { margin-top: 0.25rem; }
.event-main { min-width: 0; }
.detail-facts dd { margin: 0; }
.fact-ic .sr-only { position: absolute; }

.event-original { white-space: normal; }
.event-open { min-height: 56px; }
.event-open small { margin-top: 0.05rem; }

.event-section { margin-top: 2rem; scroll-margin-top: 1rem; }
.event-section:first-child { margin-top: 0; }
.event-h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.35rem;
    font-weight: 760;
}
.event-h2::before {
    content: "";
    flex: none;
    width: 10px;
    height: 1.2em;
    border-radius: 3px;
    background: var(--senyera-v);
    box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.25);
}
.event-desc .detail-desc { margin-top: 0.75rem; font-size: 1.04rem; }
.event-section .share-grid { margin-top: 0.9rem; max-width: 520px; }
.event-section .copy-row { max-width: 520px; }
.event-section .cal-list { max-width: 520px; margin-top: 0.75rem; }

.report-panel {
    margin-top: 1.25rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--surface);
    scroll-margin-top: 1rem;
}
.report-panel > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 650;
    color: var(--text-2);
    border-radius: var(--radius);
}
.report-panel > summary::-webkit-details-marker { display: none; }
.report-panel > summary::after {
    content: "";
    margin-left: auto;
    width: 0.55rem; height: 0.55rem;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.2s var(--ease-out);
}
.report-panel[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.report-panel > summary:hover { color: var(--accent); }
.report-panel .report-form { padding: 0 1rem 1.1rem; }
.report-panel .report-reasons { margin-top: 0.25rem; }
.form-note { margin-top: 0.6rem; font-size: 0.9rem; color: var(--muted); }

.related { margin-top: 3rem; padding-top: 0.5rem; border-top: 3px solid var(--text); scroll-margin-top: 1rem; }
.related .section-head { margin-top: 1rem; }
.related .cards, .nearby .cards { padding-bottom: 0.75rem; }
.related-more { margin-top: 0.5rem; }
.related-empty { margin-top: 0.75rem; color: var(--text-2); }

@media (min-width: 640px) {
    .event-hero {
        width: 100%;
        height: clamp(240px, 38vw, 420px);
        margin: 0;
        aspect-ratio: auto;
        border-radius: var(--radius-lg);
        border: 1px solid var(--line);
    }
    .event-hero + .ticket-frame { margin: -3rem 1.25rem 0; }
    .event-ticket { --stub-w: 116px; min-height: 172px; }
    .event-stub .stub-day { font-size: 3.6rem; }
    .event-heading { padding: 1.35rem 1.5rem 1.4rem 1.6rem; }
}
@media (min-width: 960px) {
    .event-body {
        grid-template-columns: minmax(0, 1fr) 360px;
        gap: 2.5rem;
        margin-top: 2.25rem;
    }
    .event-side { grid-column: 2; grid-row: 1; position: sticky; top: 1.25rem; }
    .event-main { grid-column: 1; grid-row: 1; }
    .related .cards, .nearby .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
    .event-ticket { --stub-w: 74px; }
    .event-stub .stub-day { font-size: 2.3rem; }
    .event-heading { padding: 0.9rem 0.85rem 0.95rem 0.95rem; }
}
@media (prefers-color-scheme: dark) {
    .ticket-frame { filter: drop-shadow(5px 5px 0 rgba(218, 18, 26, 0.85)); }
    .event-ticket { border-color: var(--line-2); }
    .is-past .event-stub { background: #4a463c; }
}

/* ------------------------------------------------------------ agenda pages */
.agenda-hero { padding-bottom: 1.25rem; }
.agenda-layout { padding-top: 0.25rem; }
.agenda-layout .results-title { font-size: clamp(1.6rem, 4.4vw, 2.2rem); }
.agenda-layout .timeline { margin-top: 0.5rem; }
.agenda-layout .ongoing { margin-top: 0.5rem; }
.ongoing-title { display: block; font-size: 1.15rem; }
.ongoing > summary > span:nth-child(2) { min-width: 0; }
.nearby { margin-top: 1.5rem; }
.more { margin-top: 1rem; }

.munis-card .side-title { font-size: 1.15rem; }
.muni-list {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.75rem;
    max-height: 30rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
}
.muni-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.35rem 0.6rem 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
}
.muni-link:hover { background: var(--bg-2); color: var(--text); }
.muni-name { min-width: 0; overflow-wrap: anywhere; }
.muni-count {
    flex: none;
    min-width: 2rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--on-yellow);
    font-size: 0.8rem;
    font-weight: 750;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.muni-link.is-empty { color: var(--muted); font-weight: 500; }
.muni-link.is-empty .muni-count { background: var(--bg-2); color: var(--muted); }

/* ------------------------------------------------------------ cobertura */
.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.stat {
    position: relative;
    overflow: hidden;
    padding: 1rem 1.1rem 1.1rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.stat-num {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 6vw, 2.7rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: lining-nums tabular-nums;
}
.stat-num small { font-size: 0.5em; font-weight: 650; color: var(--muted); letter-spacing: 0; }
.stat-label { margin-top: 0.45rem; font-size: 0.88rem; font-weight: 600; color: var(--text-2); }
.stat-note { margin-top: 0.1rem; font-size: 0.8rem; color: var(--muted); }
.stat:first-child { background: var(--red); border-color: var(--red); color: #fff; }
.stat:first-child .stat-label { color: #fff; }
.stat:first-child::after {
    content: "";
    position: absolute;
    right: -36px; bottom: -44px;
    width: 110px; height: 110px;
    border-radius: 50%;
    background: var(--senyera-h);
    opacity: 0.25;
    transform: rotate(-20deg);
}
@media (min-width: 760px) {
    .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
    .stat { padding: 1.25rem 1.35rem; }
}

.how-list { display: grid; gap: 0.75rem; margin-top: 1.1rem; }
.how-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.how-ic, .api-ic {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 14px;
    background: var(--yellow);
    color: var(--on-yellow);
    box-shadow: 2px 2px 0 var(--ink);
}
.how-item h3 { font-size: 1.08rem; font-weight: 750; }
.how-item p { margin-top: 0.3rem; font-size: 0.94rem; color: var(--text-2); }
@media (min-width: 760px) { .how-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .how-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.table-wrap {
    margin-top: 1rem;
    overflow-x: auto;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.cov-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.cov-table th, .cov-table td { padding: 0.55rem 0.85rem; text-align: left; vertical-align: middle; }
.cov-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line-2);
}
.cov-table tbody tr + tr > * { border-top: 1px solid var(--line); }
.cov-table tbody th { font-weight: 650; }
.cov-table tbody th a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--text);
    text-decoration: none;
}
.cov-table tbody th a:hover { color: var(--accent); text-decoration: underline; }
.cov-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.cov-table tr.is-empty th a, .cov-table tr.is-empty td { color: var(--muted); font-weight: 500; }
.cov-cell { display: flex; align-items: center; gap: 0.6rem; }
.cov-meter {
    flex: 1 1 auto;
    min-width: 48px;
    max-width: 180px;
    height: 10px;
    border-radius: 999px;
    background: var(--bg-2);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--line);
}
.cov-bar { display: block; height: 100%; border-radius: 999px; background: var(--red); }
.cov-frac { flex: none; font-size: 0.85rem; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) {
    .cov-table { font-size: 0.9rem; }
    .cov-table th, .cov-table td { padding: 0.3rem 0.6rem; }
    .cov-table tbody th a { min-height: 36px; }
    .cov-meter { display: none; }
}

.src-list { display: grid; gap: 0.6rem; margin-top: 1rem; }
.src-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--surface);
}
.src-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.src-item.is-ok .src-dot { background: #1F9D47; box-shadow: 0 0 0 4px rgba(31, 157, 71, 0.18); }
.src-item.is-error .src-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(218, 18, 26, 0.18); }
.src-name { font-weight: 700; overflow-wrap: anywhere; }
.src-kind { font-size: 0.85rem; color: var(--muted); }
.src-state {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    font-size: 0.82rem;
    text-align: right;
}
.src-status {
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-2);
    font-weight: 700;
    color: var(--text-2);
}
.is-ok .src-status { background: var(--ok-bg); color: var(--ok); }
.is-error .src-status { background: var(--danger-bg); color: var(--accent); }
.src-when { color: var(--muted); white-space: nowrap; }
@media (min-width: 700px) {
    .src-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cta-band {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 1rem;
    align-items: center;
    margin-top: clamp(2.5rem, 6vw, 3.5rem);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--red);
    color: #fff;
}
.cta-band::after {
    content: "";
    position: absolute;
    right: -60px; bottom: -80px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: var(--senyera-h);
    opacity: 0.22;
    transform: rotate(-20deg);
    pointer-events: none;
}
.cta-band p { color: #fff; }
.cta-title { margin-top: 0.25rem; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 780; }
.cta-band .btn { position: relative; z-index: 1; justify-self: start; }
@media (min-width: 760px) {
    .cta-band { grid-template-columns: minmax(0, 1fr) auto; padding: 2rem 2.25rem; }
}

/* ------------------------------------------------------------ publica */
.ways { display: grid; gap: 1rem; margin-top: 1.1rem; }
.way {
    position: relative;
    min-width: 0;
    padding: 1.25rem 1.25rem 1.35rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.way-num {
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--yellow);
    color: var(--on-yellow);
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 800;
    box-shadow: 3px 3px 0 var(--ink);
}
.way-title { margin-top: 0.85rem; font-size: 1.3rem; font-weight: 760; }
.way p { margin-top: 0.5rem; color: var(--text-2); }
.way .way-note { font-size: 0.92rem; color: var(--muted); }
@media (min-width: 1000px) {
    .ways { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .way:last-child { grid-column: 1 / -1; }
}

.code {
    margin-top: 0.85rem;
    padding: 1rem 1.1rem;
    max-width: 100%;
    overflow-x: auto;
    border-radius: var(--radius);
    background: #1a1a1a;
    color: #F4F0E3;
    font-size: 0.8rem;
    line-height: 1.6;
    tab-size: 2;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.code code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; white-space: pre; }
.code:focus-visible { border-radius: var(--radius); }
.code-details { margin-top: 0.75rem; }
.code-details > summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    font-weight: 650;
    color: var(--accent);
}
@media (prefers-color-scheme: dark) {
    .code { background: #0d0c09; border-color: var(--line-2); }
}

.form-section { display: grid; gap: 1.5rem; scroll-margin-top: 1rem; }
.form-intro p { margin-top: 0.6rem; color: var(--text-2); max-width: 36rem; }
.checks { display: grid; gap: 0.4rem; margin-top: 1rem; list-style: none; padding: 0; }
.checks li { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.checks .ic { color: var(--ok); }
.site-form {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    border: 1.5px solid var(--text);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 5px 5px 0 var(--yellow), 5px 5px 0 1.5px var(--text);
}
.field { display: grid; gap: 0.35rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label:not(.radio-row), .field > legend { font-weight: 650; padding: 0; }
.field-choices .radio-row { font-weight: 550; }
.field-choices { gap: 0.4rem; }
.field-choices legend { margin-bottom: 0.35rem; }
.req { color: var(--accent); }
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:hover, .field textarea:hover { border-color: var(--text); }
.field input:focus-visible, .field textarea:focus-visible {
    outline: 0;
    border-color: var(--text);
    box-shadow: 0 0 0 4px var(--focus-halo);
    border-radius: var(--radius-sm);
}
.field [aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--danger-bg); }
.field-hint { font-size: 0.85rem; color: var(--muted); }
.site-form .btn[type="submit"] { justify-self: start; }
.site-form .form-msg { margin-top: 0; }
.site-form .form-msg:empty { display: none; }
/* Honeypot: off-screen for people, still in the form for bots. */
.hp-field {
    position: absolute !important;
    left: -10000px;
    width: 1px; height: 1px;
    overflow: hidden;
}
@media (min-width: 960px) {
    .form-section { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
    .form-intro { position: sticky; top: 1.5rem; }
    .site-form { padding: 1.75rem; }
}

.api-section { scroll-margin-top: 1rem; }
.api-grid { display: grid; gap: 1rem; margin-top: 1.25rem; }
.api-card {
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.api-card h3 { margin-top: 0.85rem; font-size: 1.25rem; font-weight: 760; }
.api-card p { margin-top: 0.45rem; color: var(--text-2); font-size: 0.96rem; }
.code-lines { display: grid; gap: 0.4rem; margin-top: 0.85rem; list-style: none; padding: 0; }
.code-lines code {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}
.code-verb { margin-right: 0.35rem; font-weight: 800; color: var(--ok); }
.council-band {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}
.council-band h3 { font-size: 1.2rem; font-weight: 760; }
.council-band p { margin-top: 0.35rem; color: var(--text-2); }
.api-terms { margin-top: 1rem; font-size: 0.88rem; color: var(--muted); }
@media (min-width: 900px) { .api-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------------------------------------ privadesa */
.prose-layout { display: grid; gap: 1.5rem; padding-top: 0.5rem; }
.toc {
    padding: 1rem 1.1rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    font-size: 0.93rem;
}
.toc-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin-top: 0.4rem; padding-left: 1.2rem; }
.toc a { display: inline-block; padding: 0.3rem 0; color: var(--text); font-weight: 600; text-decoration-color: var(--line-2); }
.toc a:hover { color: var(--accent); }
.prose { max-width: 44rem; min-width: 0; }
.prose section { scroll-margin-top: 1rem; }
.prose section + section { margin-top: 2.25rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.prose h2 { font-size: clamp(1.4rem, 4vw, 1.8rem); font-weight: 760; }
.prose p, .prose ul { margin-top: 0.8rem; color: var(--text-2); line-height: 1.68; }
.prose ul:not([class]) { padding-left: 1.3rem; }
.prose ul:not([class]) li + li { margin-top: 0.4rem; }
.prose strong { color: var(--text); }
.summary-list { display: grid; gap: 0.6rem; margin-top: 1rem !important; list-style: none; padding: 0; }
.summary-list li {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius);
    background: var(--ok-bg);
    color: var(--text);
}
.summary-list .ic { margin-top: 0.3em; color: var(--ok); }
.prose-updated { font-size: 0.88rem; color: var(--muted) !important; }
@media (min-width: 960px) {
    .prose-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; }
    .toc { position: sticky; top: 1.5rem; align-self: start; }
}

/* ------------------------------------------------------------ error page */
.error-page {
    position: relative;
    isolation: isolate;
    padding: clamp(2.5rem, 8vw, 5rem) 0 clamp(3rem, 8vw, 5rem);
}
.error-inner { display: grid; justify-items: start; }
.error-code {
    font-family: var(--font-display);
    font-size: clamp(5rem, 22vw, 9.5rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.05em;
}
.error-code span {
    background: repeating-linear-gradient(180deg, var(--yellow) 0 0.11em, var(--red) 0.11em 0.22em);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 2px var(--ink);
}
.error-emoji { margin-top: 0.75rem; font-size: 2.2rem; line-height: 1; }
.error-page .page-title { margin-top: 0.6rem; font-size: clamp(1.9rem, 6vw, 3rem); }
.error-search { width: 100%; }
.error-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; list-style: none; padding: 0; }
@media (prefers-color-scheme: dark) {
    .error-code span { -webkit-text-stroke-color: rgba(255, 250, 235, 0.55); }
}

/* ------------------------------------------------------------ toast */
.site-toast { display: block; }

/* ------------------------------------------------------------ proportional bars (CSP: no inline widths) */
.pct-0 { width: 0; }
.pct-5 { width: 5%; }
.pct-10 { width: 10%; }
.pct-15 { width: 15%; }
.pct-20 { width: 20%; }
.pct-25 { width: 25%; }
.pct-30 { width: 30%; }
.pct-35 { width: 35%; }
.pct-40 { width: 40%; }
.pct-45 { width: 45%; }
.pct-50 { width: 50%; }
.pct-55 { width: 55%; }
.pct-60 { width: 60%; }
.pct-65 { width: 65%; }
.pct-70 { width: 70%; }
.pct-75 { width: 75%; }
.pct-80 { width: 80%; }
.pct-85 { width: 85%; }
.pct-90 { width: 90%; }
.pct-95 { width: 95%; }
.pct-100 { width: 100%; }

/* ------------------------------------------------------------ print */
@media print {
    .detail-actions, .event-open, #comparteix, #calendari, .report-panel, .related, .hero-actions, .site-form, .toc { display: none !important; }
    .ticket-frame { filter: none; }
    .event-ticket { -webkit-mask: none; mask: none; }
}
