/* AV Identifier: a quiet, single-column tool. One accent, no gradients, no heavy shadows. */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/Inter-Regular.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/static/fonts/Inter-Medium.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/Inter-SemiBold.woff2") format("woff2");
}

:root {
    color-scheme: light;

    --bg: #FFFFFF;
    --bg-subtle: #F8FAFC;
    --text: #111827;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --accent: #2563EB;
    --warn: #B45309;       /* icon only: marks a missing or unverified contact */

    --radius-control: 10px;
    --radius-card: 12px;
    --control-height: 52px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, p, ul, figure { margin: 0; }

a { color: var(--accent); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
h1:focus { outline: none; }

.container {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -64px;
    padding: var(--space-2) var(--space-3);
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius-control);
    z-index: 10;
}
.skip-link:focus { top: var(--space-3); }

/* ------------------------------------------------------------------ header */

.site-header {
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}
.header-inner {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.wordmark {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    gap: var(--space-1);
}
.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-control);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); }

.dev-banner {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
}
.dev-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-top: var(--space-3);
    padding-bottom: var(--space-4);
}
.dev-text {
    display: flex;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--text);
}
.dev-text .icon { margin-top: 2px; color: var(--text-muted); }

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
select {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 var(--space-3);
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}

/* -------------------------------------------------------------------- main */

main {
    flex: 1;
    padding-top: var(--space-6);
    padding-bottom: var(--space-7);
}

.view {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

h1 {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.lead {
    font-size: 16px;
    color: var(--text);
}
.supporting {
    font-size: 14px;
    color: var(--text-muted);
}
.caption {
    font-size: 13px;
    color: var(--text-muted);
}
.eyebrow {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.result-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.result-header h1 { margin-bottom: var(--space-1); }

#result-body, #error-body, #error-fallback, .view-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    width: fit-content;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.text-link:hover { text-decoration: underline; }
.back-link { margin: calc(-1 * var(--space-3)) 0 calc(-1 * var(--space-2)); color: var(--text-muted); }

/* --------------------------------------------------------------- directory */

.search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: var(--control-height);
    padding: 0 var(--space-4);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}
.search:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 16px;   /* 16px stops iOS zooming into the field */
    color: var(--text);
}
.search input::placeholder { color: var(--text-muted); }

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-top: calc(-1 * var(--space-2));
}
.check input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--text);
}
.check label { font-size: 15px; font-weight: 500; cursor: pointer; }

#directory-count:empty { display: none; }

.provider-list {
    list-style: none;
    padding: 0;
    margin: calc(-1 * var(--space-2)) 0 0;
    border-top: 1px solid var(--border);
}
.provider-list:empty { display: none; }
.provider-list li { border-bottom: 1px solid var(--border); }
.provider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 64px;
    padding: var(--space-3) 0;
    color: var(--text);
    text-decoration: none;
}
.provider-row:hover .provider-name { text-decoration: underline; }
.provider-name { font-size: 16px; font-weight: 500; }

/* ----------------------------------------------------------------- buttons */

.actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    min-height: var(--control-height);
    padding: 0 var(--space-5);
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--text);
    color: var(--bg);
}
.btn-primary:hover:not(:disabled) { background: #1F2937; }

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-subtle); }

.btn-call {
    min-height: 56px;
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- icons */

.icon {
    width: 20px;
    height: 20px;
    flex: none;
}
.icon-muted { color: var(--text-muted); }
.icon-accent { color: var(--accent); }

.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .spin { animation: none; }
    .btn { transition: none; }
}

/* ----------------------------------------------------------- photo preview */

.preview {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-subtle);
    overflow: hidden;
}
.preview img {
    display: block;
    width: 100%;
    max-height: 52vh;
    object-fit: contain;
}
.preview figcaption {
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--border);
}

/* A photo a point can be selected on, or shown on. It is exactly as big as the picture, with no
   letterboxing, so a position in it is a position in the photo; --aspect (width / height) keeps it
   within the preview's height. */
.target-surface {
    position: relative;
    width: min(100%, calc(52vh * var(--aspect, 1)));
    margin: 0 auto;
}
.target-surface img { max-height: none; }
.target-surface.selectable { cursor: crosshair; }
.target-surface.selectable:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.target-marker {
    position: absolute;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%);
    border: 3px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--text), inset 0 0 0 2px var(--text);
    pointer-events: none;
}
.target-marker::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 6px;
    height: 6px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--text);
}
#target-status:empty, #target-flag:empty { display: none; }
/* Location context: buttons share their row, and one left alone fills it. */
.location-actions { display: flex; gap: var(--space-3); }
.location-actions .btn { flex: 1 1 0; }
#location-status:empty { display: none; }
#target-clear-btn { align-self: flex-start; }

/* Several views of one vehicle: each shows its photo in the preview above. */
.view-strip {
    display: flex;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-1) 0;
    list-style: none;
    overflow-x: auto;
}
.view-thumb {
    position: relative;
    display: block;
    width: 64px;
    height: 64px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-subtle);
    overflow: hidden;
    cursor: pointer;
}
.view-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.view-thumb[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.view-thumb:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.view-thumb:disabled { cursor: default; }
.view-thumb-number {
    position: absolute;
    left: 4px;
    bottom: 4px;
    min-width: 20px;
    padding: 0 4px;
    border-radius: 6px;
    background: var(--text);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}
label.photo-item { cursor: pointer; }

.status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 15px;
    color: var(--text);
}
.status .icon { color: var(--text-muted); }

/* ------------------------------------------------------------ cards, notes */

.card {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}
.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.notice {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    font-size: 14px;
    color: var(--text-muted);
}
.notice p + p { margin-top: var(--space-2); }
.notice strong { color: var(--text); font-weight: 600; }
.notice-icon { color: var(--text-muted); margin-top: 1px; }

.callout {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    font-size: 14px;
}
.callout-icon { color: var(--text-muted); margin-top: 1px; }
.callout-warn .callout-icon { color: var(--warn); }

.rows {
    list-style: none;
    padding: 0;
    border-top: 1px solid var(--border);
}
.rows li { border-bottom: 1px solid var(--border); }
.row-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 52px;
    padding: var(--space-2) 0;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    word-break: break-word;
}
.row-link:hover span:first-child { text-decoration: underline; }
.row-stack { display: flex; flex-direction: column; }

.verification {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--text-muted);
}
.verification .icon { width: 18px; height: 18px; margin-top: 1px; }

.verification-block { display: flex; flex-direction: column; gap: var(--space-2); }
.sources { font-size: 13px; color: var(--text-muted); padding-left: 26px; }
.sources summary { cursor: pointer; width: fit-content; }
.sources ul { margin-top: var(--space-2); font-size: 13px; }
.sources a { color: var(--text-muted); word-break: break-all; }

.fallback-line { padding-top: var(--space-1); }

.plain-list {
    padding-left: 20px;
    font-size: 15px;
}
.plain-list li + li { margin-top: var(--space-1); }

.meta { word-break: break-word; }

/* ------------------------------------------------------------- maintainers */

.form-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.input {
    width: 100%;
    min-width: 0;
    height: var(--control-height);
    padding: 0 var(--space-4);
    font: inherit;
    font-size: 16px;   /* 16px stops iOS zooming into the field */
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { font-size: 14px; color: var(--text); font-weight: 500; }

.maintainer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: calc(-1 * var(--space-3));
}
.maintainer-bar .caption { overflow-wrap: anywhere; }
.maintainer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: calc(-1 * var(--space-3));
    border-bottom: 1px solid var(--border);
}
.maintainer-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}
.maintainer-nav a:hover { color: var(--text); }
.maintainer-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--text); }
.btn-text {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: none;
    border: 0;
    cursor: pointer;
}
.btn-text .icon { width: 18px; height: 18px; }

#history-count:empty, #diagnostics-count:empty, #storage-status:empty, #flag-status:empty,
#association-status:empty { display: none; }

.association-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-3) 0;
}
.association-row .row-stack { flex: 1 1 12rem; min-width: 0; }

.facts {
    display: grid;
    grid-template-columns: minmax(96px, auto) 1fr;
    gap: var(--space-2) var(--space-4);
    margin: 0;
    font-size: 15px;
}
.facts dt { color: var(--text-muted); font-size: 14px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.view-stack-tight { display: flex; flex-direction: column; gap: var(--space-3); }

/* ----------------------------------------------------------------- reports */

#reports-count:empty { display: none; }

.filters { border: 1px solid var(--border); border-radius: var(--radius-card); }
.filters-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    font-size: 15px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
}
.filters-toggle::-webkit-details-marker { display: none; }
.filters-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-2px) rotate(45deg);
}
.filters[open] .filters-toggle::after { transform: translateY(2px) rotate(225deg); }
#report-filter-count:empty { display: none; }
.filters .input { height: 44px; padding: 0 var(--space-3); }   /* level with the selects beside them */
.filters-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-2) var(--space-4) var(--space-4);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-top: calc(-1 * var(--space-2));
}
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
.chips li { min-width: 0; max-width: 100%; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-width: 100%;
    min-height: 36px;
    padding: 0 var(--space-2) 0 var(--space-3);
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}
.chip:hover { border-color: var(--text-muted); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .icon { flex: none; width: 16px; height: 16px; color: var(--text-muted); }

#report-form { gap: var(--space-6); }
#report-form > .btn { margin-top: calc(-1 * var(--space-2)); }

.fieldset {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.legend {
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.tag { margin-left: var(--space-1); font-size: 13px; font-weight: 500; color: var(--text-muted); }
.hint { font-size: 14px; color: var(--text-muted); }
#report-form .field { gap: var(--space-2); }

.choices { display: flex; flex-direction: column; }
.choice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    min-height: 44px;
    padding: var(--space-2) 0;
    font-size: 15px;
    cursor: pointer;
}
.choice input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: var(--text);
}

.reveal {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-left: var(--space-4);
    border-left: 2px solid var(--border);
}
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.field-row .input { padding: 0 var(--space-3); }
/* Date inputs have a wide intrinsic size that would push the row past its container. */
.field-row > .field { min-width: 0; }

.textarea {
    height: auto;
    min-height: 152px;
    padding: var(--space-3) var(--space-4);
    line-height: 1.5;
    resize: vertical;
}
.input::placeholder { color: var(--text-muted); }

.field-error { font-size: 14px; font-weight: 500; color: var(--text); }
.field-error::before { content: "⚠ "; color: var(--warn); }
[aria-invalid="true"] { border: 2px solid var(--warn); }

.error-summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 2px solid var(--warn);
    border-radius: var(--radius-card);
}
.error-summary:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.error-summary-title { font-size: 16px; font-weight: 600; }
.error-summary a { color: var(--text); }

.report-frame {
    padding: var(--space-4);
    background: var(--bg-subtle);
    border: 1px dashed var(--text-muted);
    border-radius: var(--radius-card);
}
.report-frame .result-header h2 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
/* Labels above values: the reported-detail labels are too long for two columns on a phone. */
.facts-stacked { grid-template-columns: 1fr; gap: var(--space-1) 0; }
.facts-stacked dd + dt { margin-top: var(--space-2); }
.report-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    margin: var(--space-1) 0;
    font-size: 15px;
    overflow-wrap: anywhere;
}
.report-address { overflow-wrap: anywhere; }

/* Photos on a report, and the photos a reporter has chosen so far. */
.report-photos { display: flex; flex-direction: column; gap: var(--space-4); }
/* The width and height attributes only reserve the picture's shape while it loads. */
.report-photos img { height: auto; }
.photo-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}
.photo-list:empty, #photos-identified:empty { display: none; }
.photo-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}
.photo-item .row-stack { flex: 1 1 0; min-width: 0; }
.photo-item .field-error { flex-basis: 100%; }
.photo-thumb {
    flex: none;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-control);
    background: var(--bg-subtle);
}

/* ------------------------------------------------------------------ footer */

.site-footer {
    border-top: 1px solid var(--border);
    padding: var(--space-5) 0 calc(var(--space-5) + env(safe-area-inset-bottom));
    font-size: 13px;
    color: var(--text-muted);
}
.site-footer p + p { margin-top: var(--space-2); }
.footer-link { color: var(--text-muted); }

/* ------------------------------------------------------------ narrow screens */

/* The wordmark and three links do not fit on one line on a phone. */
@media (max-width: 519px) {
    .header-inner {
        height: auto;
        flex-wrap: wrap;
        row-gap: 0;
        padding-top: var(--space-2);
    }
    .wordmark { line-height: 40px; }
    .site-nav { width: 100%; margin-left: calc(-1 * var(--space-2)); }
}

/* ------------------------------------------------------------ wider screens */

@media (min-width: 640px) {
    main { padding-top: var(--space-7); }
    h1 { font-size: 30px; }
    .dev-inner {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
    .dev-text { flex: 1 1 auto; padding-bottom: var(--space-3); }
    .dev-inner .field { flex: 0 0 240px; min-width: 0; }
    .filters-body { display: grid; grid-template-columns: 1fr 1fr; }
    .filters-wide { grid-column: 1 / -1; }
}
