/* Shared components: citation cards, status and coverage badges, freshness.
   Every page already defines the palette as CSS custom properties, so this only
   uses those variables and never sets a literal colour that would have to be
   duplicated for dark mode. Keep it that way. */

/* ---------- Evidence kinds ----------
   One colour per kind of source, used by both the compact chip and the full
   card so a reader learns the mapping once. Deliberately not the same palette
   as the restriction types (red / orange / purple) — what a restriction is and
   how well it is evidenced are different questions and must not look alike. */
.kind-primary { --src-accent: var(--tertiary-green); }
.kind-measurement { --src-accent: #1b7fb8; }
.kind-research { --src-accent: var(--age-purple); }
.kind-reporting { --src-accent: var(--muted-gray); }
.kind-reference { --src-accent: var(--alert-orange); }
.kind-other { --src-accent: var(--muted-gray); }

/* Compact citation, for dense rows: the publisher's name where "[47]" used to
   be. The accessible name spells out publisher, kind and date (see
   Site.sourceLabel), so the short visible text costs a screen reader nothing. */
a.src-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--on-surface-variant);
    border: 1px solid var(--outline-variant);
    border-left: 3px solid var(--src-accent, var(--muted-gray));
    background: var(--surface-container-low);
    padding: 3px 7px;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.src-chip:hover { background: var(--surface-container-high); color: var(--primary); }
a.src-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Full citation card, for case files. */
a.src-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--outline-variant);
    border-left: 3px solid var(--src-accent, var(--muted-gray));
    background: var(--surface-container-low);
    padding: 9px 11px;
    margin-top: 10px;
}
a.src-card:hover { background: var(--surface-container); }
a.src-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.src-kind {
    flex: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--on-primary);
    background: var(--src-accent, var(--muted-gray));
    padding: 3px 6px;
    margin-top: 1px;
}
.src-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.src-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--primary);
}
.src-pub, .src-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.03em;
    color: var(--muted-gray);
}
.src-pub { font-weight: 700; text-transform: uppercase; color: var(--on-surface-variant); }
.src-go { margin-left: auto; flex: none; color: var(--muted-gray); font-size: 13px; }

/* ---------- Status and coverage badges ----------
   Status is the stage a restriction is at; coverage is how well the row is
   evidenced. Both read as small outlined tags rather than filled chips, so
   they never compete with the restriction-type colours next to them. */
.tag-status, .tag-evidence {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border: 1px solid var(--outline-variant);
    color: var(--on-surface-variant);
    background: var(--surface-container-low);
    padding: 2px 6px;
    white-space: nowrap;
}
.tag-status::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--muted-gray);
}
/* Scheduled is the one that must not be mistaken for "already happening", so
   it is the only hollow marker in the set. */
.tag-status.scheduled { border-color: var(--alert-orange); color: var(--alert-orange); }
.tag-status.scheduled::before { background: transparent; border: 1.5px solid var(--alert-orange); }
.tag-status.enforced::before { background: #1b7fb8; }
.tag-status.in_force::before { background: var(--tertiary-green); }
.tag-status.reported::before { background: var(--muted-gray); }

.tag-evidence.uncorroborated { border-color: var(--secondary); color: var(--secondary); }
.tag-evidence[hidden] { display: none; }

/* ---------- Freshness readout ----------
   Two dates, never one: when the data last changed, and when the citations
   were last re-opened. They answer different questions and a single "data as
   of" line was quietly conflating them. */
.freshness {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted-gray);
}
.freshness b { color: var(--primary); font-weight: 700; }
.freshness .rel { opacity: 0.75; }
.freshness [hidden] { display: none; }

/* ---------- Source legend ---------- */
.src-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.src-legend-item {
    border-left: 3px solid var(--src-accent, var(--muted-gray));
    background: var(--surface-container-low);
    padding: 8px 10px;
}
.src-legend-item .sl-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--primary);
}
.src-legend-item .sl-count { color: var(--muted-gray); }
.src-legend-item .sl-blurb {
    font-size: 12px;
    line-height: 1.45;
    color: var(--on-surface-variant);
    margin-top: 3px;
}

/* Screen-reader-only text, for labels whose visible form is an icon or a
   decorative string like "SEARCH_". */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    a.src-chip { max-width: 130px; }
    .src-legend { grid-template-columns: 1fr; }
}
