/*
 * ServiceTok public site.
 *
 * One stylesheet, no framework, no build step. Tokens taken from the React
 * template in servicetok-web-template — slate-950 base, teal accents — so the
 * site and that prototype are recognisably the same product.
 *
 * Dark-first because the design is, but a reader who has asked their OS for a
 * light interface gets one. Ignoring that preference on a civic site aimed at
 * older adults is not a style choice, it is an accessibility failure.
 */

:root {
    --bg:            #020617; /* slate-950 */
    --surface:       #0F172A; /* slate-900 */
    --surface-raised:#111C33;
    --border:        #1E293B; /* slate-800 */
    --border-soft:   #0F172A;

    --text:          #E2E8F0; /* slate-200 */
    --text-muted:    #94A3B8; /* slate-400 */
    --text-faint:    #64748B; /* slate-500 */

    --accent:        #2DD4BF; /* teal-400 */
    --accent-strong: #14B8A6; /* teal-500 */
    --accent-bg:     #042F2E; /* teal-950 */

    --resolved:      #34D399; /* emerald-400 */
    --dispatched:    #FBBF24; /* amber-400 */
    --urgent:        #F97316; /* orange-500 */
    --emergency:     #EF4444; /* red-500 */

    --radius: 14px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #F4F6F6;
        --surface: #FFFFFF;
        --surface-raised: #FFFFFF;
        --border: #D5DBDB;
        --border-soft: #E6EBEB;
        --text: #14211F;
        --text-muted: #56635F;
        --text-faint: #78857F;
        --accent: #0F5257;
        --accent-strong: #0F5257;
        --accent-bg: #D7E8E9;
    }
}

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

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

/* ---------- Header ------------------------------------------------------ */

.site-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.wordmark {
    color: var(--text);
    font-weight: 800;
    font-size: 1.2rem;
    text-decoration: none;
    letter-spacing: -0.02em;
}
.wordmark span { color: var(--accent); }

.site-nav { display: flex; gap: 0.35rem; margin-left: auto; flex-wrap: wrap; }

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    /* 44px tap target even in a dense nav bar. */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.site-nav a:hover { color: var(--text); background: var(--border); }
.site-nav a.active { color: var(--bg); background: var(--accent); }

/* ---------- Layout ------------------------------------------------------ */

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
main.narrow { max-width: 44rem; }

.site-footer {
    max-width: 60rem;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-faint);
}

/* ---------- Typography -------------------------------------------------- */

h1 { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 1rem;
     letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.25rem; }

.lead { font-size: 1.1rem; color: var(--text-muted); margin-top: 0; max-width: 40rem; }
.muted { color: var(--text-muted); font-size: 0.92rem; }
.faint { color: var(--text-faint); font-size: 0.85rem; }
.updated { color: var(--text-faint); font-size: 0.9rem; margin-top: -0.5rem; }

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

/* ---------- Hero -------------------------------------------------------- */

.hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: clamp(1.5rem, 5vw, 3rem);
    margin-bottom: 2rem;
}

.eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-bg);
    border: 1px solid var(--border);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

/* ---------- Buttons ----------------------------------------------------- */

.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 0; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #04201F;
    padding: 0.85rem 1.6rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    min-height: 48px;
    border: 1px solid transparent;
}
.button:hover { background: var(--accent-strong); }

.button.secondary {
    background: var(--surface-raised);
    color: var(--text);
    border-color: var(--border);
}
.button.secondary:hover { border-color: var(--accent); }

/* ---------- Cards ------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 1.25rem 0;
}

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps .card { margin: 0; }
.steps h3 { margin-top: 0; }

/* ---------- Feed strip -------------------------------------------------- */

.feed-strip {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.feed-strip .count { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.feed-strip .label { font-size: 0.8rem; text-transform: uppercase;
                     letter-spacing: 0.1em; color: var(--text-faint); }

.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.selected { background: var(--accent); color: #04201F; border-color: var(--accent); }

/* ---------- Search / filters -------------------------------------------- */

.filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    margin-bottom: 1.5rem;
}

.filters input[type="search"], .filters select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 1rem;
    min-height: 48px;
}
.filters input[type="search"] { flex: 1 1 16rem; }
.filters select { flex: 0 1 12rem; }
.filters button { flex: 0 0 auto; }

/* ---------- Incident cards ---------------------------------------------- */

.incident {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
@media (min-width: 44rem) {
    .incident { grid-template-columns: 15rem 1fr; }
}

.incident-media { position: relative; background: var(--border-soft); min-height: 11rem; }
.incident-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.incident-media .no-photo {
    display: flex; align-items: center; justify-content: center;
    height: 100%; min-height: 11rem;
    color: var(--text-faint); font-size: 0.85rem; text-align: center; padding: 1rem;
}

.tag {
    position: absolute; top: 0.75rem; left: 0.75rem;
    background: rgba(2, 6, 23, 0.85);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.8rem; font-weight: 700;
    padding: 0.3rem 0.7rem; border-radius: 8px;
}

.ref {
    position: absolute; bottom: 0.75rem; left: 0.75rem;
    background: rgba(2, 6, 23, 0.85);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem; border-radius: 8px;
}

.incident-body { padding: 1.1rem 1.25rem; }

.incident-head {
    display: flex; align-items: flex-start; gap: 0.75rem;
    flex-wrap: wrap; margin-bottom: 0.6rem;
}
.incident-where { color: var(--text-muted); font-size: 0.92rem; flex: 1 1 12rem; }

.municipality {
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent); background: var(--accent-bg);
    border: 1px solid var(--border);
    padding: 0.25rem 0.6rem; border-radius: 6px;
}

.incident-description { margin: 0 0 1rem; font-size: 1.02rem; }

.incident-meta {
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.85rem; border-top: 1px solid var(--border);
    font-size: 0.85rem; color: var(--text-faint);
}

/* Status is a word plus a colour, never a colour alone. */
.status {
    margin-left: auto;
    font-size: 0.8rem; font-weight: 700;
    padding: 0.25rem 0.7rem; border-radius: 999px;
    border: 1px solid currentColor;
}
.status.submitted   { color: var(--text-muted); }
.status.acknowledged{ color: var(--accent); }
.status.in_progress { color: var(--dispatched); }
.status.resolved    { color: var(--resolved); }
.status.closed      { color: var(--text-faint); }
.status.duplicate   { color: var(--text-faint); }

.endorsements { display: inline-flex; align-items: center; gap: 0.4rem;
                color: var(--text-muted); font-weight: 600; }

.days-open { color: var(--urgent); font-weight: 700; }
.days-open.resolved { color: var(--resolved); }

/* ---------- Pagination -------------------------------------------------- */

.pagination { display: flex; gap: 0.75rem; align-items: center;
              justify-content: center; margin-top: 2rem; }

/* ---------- Report detail ----------------------------------------------- */

.days { font-size: 2.4rem; font-weight: 800; line-height: 1.1; margin: 0.5rem 0 0; }
.days.open { color: var(--urgent); }
.days.resolved { color: var(--resolved); }

.report-photo { width: 100%; border-radius: 12px; margin: 1rem 0; display: block; }
.reference { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
             letter-spacing: 0.05em; }

dl.facts { margin: 1rem 0 0; }
dl.facts dt { font-size: 0.85rem; color: var(--text-faint); margin-top: 0.75rem; }
dl.facts dd { margin: 0; font-weight: 600; }

/* ---------- Accessibility ---------------------------------------------- */

a:focus-visible, .button:focus-visible, .chip:focus-visible,
input:focus-visible, select:focus-visible, button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
