/*
  Citizen-facing design system. --brand and --brand-accent are set per city from the "Theme"
  configuration (see App.razor); every other color is derived from them so each city's site stays
  consistent. Light, high-contrast and restrained: brand color marks actions, selection and focus only.
*/
:root {
    --brand: #164769;
    --brand-accent: #F2C24B;

    --surface: color-mix(in oklch, var(--brand) 3%, oklch(99% 0 none));
    --surface-raised: color-mix(in oklch, var(--brand) 1%, oklch(99.6% 0 none));
    --surface-sunken: color-mix(in oklch, var(--brand) 6%, oklch(96% 0 none));
    --brand-tint: color-mix(in oklch, var(--brand) 9%, oklch(98% 0 none));
    --brand-ink: color-mix(in oklch, var(--brand) 80%, oklch(15% 0 none));

    --ink: color-mix(in oklch, var(--brand) 18%, oklch(22% 0 none));
    --ink-muted: color-mix(in oklch, var(--brand) 14%, oklch(42% 0 none));
    --on-brand: oklch(99% 0.003 250);

    --line: color-mix(in oklch, var(--brand) 14%, oklch(88% 0 none));
    --line-strong: color-mix(in oklch, var(--brand) 22%, oklch(50% 0 none));

    --danger: oklch(47% 0.17 27);
    --danger-tint: oklch(97% 0.015 27);
    --success: oklch(45% 0.12 150);

    /* --city-font is the city's configured typeface (Theme:FontFamily); system fonts are only a fallback. */
    --font: var(--city-font, Roboto), "Helvetica Neue", Helvetica, Arial, sans-serif;
    --text-sm: 0.9375rem;
    --text-base: 1.0625rem;
    --text-md: 1.25rem;
    --text-lg: 1.5rem;
    --text-xl: 1.875rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    --radius: 6px;
    --radius-lg: 10px;
    --control-height: 2.875rem;
    --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
}

html, body {
    font-family: var(--font);
    font-size: 100%;
    color: var(--ink);
    background: var(--surface);
}

body {
    font-size: var(--text-base);
    line-height: 1.55;
}

a, .btn-link {
    color: var(--brand);
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--brand-ink);
}

/* ---------- Focus: one visible ring everywhere (WCAG 2.4.7) ---------- */
:focus-visible,
.btn:focus-visible,
.form-control:focus,
.form-check-input:focus {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--surface-raised);
}

/* Elements focused by script (headings, landmarks) are not interactive, so no ring. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
    outline: none;
    box-shadow: none;
}

/* ---------- Page shell ---------- */
.cr-page {
    width: 100%;
    max-width: 46rem;
    margin: 0 auto;
    padding: var(--space-5) var(--space-4) var(--space-7);
}

.cr-page--narrow {
    max-width: 28rem;
}

.cr-city-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--line);
}

.cr-city-header img {
    height: 3rem;
    width: auto;
}

.cr-city-header__title {
    font-size: var(--text-md);
    font-weight: 600;
    line-height: 1.25;
    margin: 0;
}

.cr-city-header--stacked {
    flex-direction: column;
    text-align: center;
    border-bottom: none;
    margin-bottom: var(--space-4);
}

.cr-city-header--stacked img {
    height: 7.5rem;
}

.cr-title {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 var(--space-5);
    letter-spacing: -0.01em;
}

.cr-lede {
    color: var(--ink-muted);
    margin: 0 0 var(--space-5);
    max-width: 65ch;
}

.cr-city-message {
    max-width: 65ch;
}

.cr-city-message > :last-child {
    margin-bottom: 0;
}

.cr-city-message {
    line-height: 1.4;
}

/* City messages keep the fonts the city chose in Centricity Apps; only pasted highlight backgrounds are cleared. */
.cr-city-message * {
    background-color: transparent !important;
}

.cr-city-message a {
    color: var(--brand) !important;
    text-decoration: underline !important;
}

.cr-city-message h1, .cr-city-message h2, .cr-city-message h3,
.cr-city-message h4, .cr-city-message h5, .cr-city-message h6 {
    margin: 0 0 var(--space-2);
}

/* ---------- Steps ---------- */
.cr-step {
    padding: var(--space-5) 0 var(--space-6);
    border-top: 1px solid var(--line);
}

.cr-step:first-of-type {
    border-top: none;
    padding-top: 0;
}

.cr-step__title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-lg);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 var(--space-2);
}

.cr-step__num {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    font-size: var(--text-sm);
    font-weight: 700;
}

.cr-step__intro {
    color: var(--ink-muted);
    margin: 0 0 var(--space-4);
    max-width: 65ch;
}

.cr-step__intro p:last-child {
    margin-bottom: 0;
}

/* ---------- Fields ---------- */
.cr-field {
    margin-bottom: var(--space-4);
}

.cr-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.cr-label__hint {
    font-weight: 400;
    color: var(--ink-muted);
}

.cr-input,
.cr-select,
.cr-textarea {
    display: block;
    width: 100%;
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-3);
    font: inherit;
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    transition: border-color 150ms var(--ease-out);
}

.cr-textarea {
    min-height: 8rem;
    resize: vertical;
}

.cr-input:hover,
.cr-select:hover,
.cr-textarea:hover {
    border-color: var(--ink);
}

.cr-input:focus,
.cr-select:focus,
.cr-textarea:focus {
    outline: 3px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}

.cr-input[aria-invalid="true"] {
    border-color: var(--danger);
    border-width: 2px;
}

.cr-input::placeholder,
.cr-textarea::placeholder {
    color: var(--ink-muted);
    opacity: 1;
}

.cr-field-row {
    display: grid;
    gap: 0 var(--space-4);
}

@media (min-width: 40rem) {
    .cr-field-row {
        grid-template-columns: 1fr 1fr;
    }
}

.cr-search {
    display: flex;
}

.cr-search .cr-input {
    border-radius: var(--radius) 0 0 var(--radius);
}

.cr-search__button {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 3.25rem;
    min-height: var(--control-height);
    border: 1px solid var(--brand);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--brand-accent);
    color: var(--brand);
    cursor: pointer;
}

.cr-search__button svg {
    width: 1.25rem;
    height: 1.25rem;
}

.cr-search__button:hover {
    background: color-mix(in oklch, var(--brand-accent) 85%, var(--brand));
}

/* ---------- Messages ---------- */
.cr-error {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    margin: var(--space-2) 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    color: var(--danger);
    background: var(--danger-tint);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    font-weight: 600;
}

.cr-error:empty,
.cr-status:empty {
    display: none;
}

.cr-error::before {
    content: "!";
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    background: var(--danger);
    color: var(--on-brand);
    font-size: 0.875rem;
    line-height: 1;
}

.cr-status {
    margin: var(--space-2) 0 var(--space-4);
    color: var(--ink-muted);
}

.cr-confirm {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin: var(--space-3) 0 0;
    color: var(--success);
    font-weight: 600;
}

/* ---------- Buttons ---------- */
.cr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-5);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border-radius: var(--radius);
    border: 2px solid var(--brand);
    cursor: pointer;
    transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.cr-btn--primary {
    background: var(--brand);
    color: var(--on-brand);
}

.cr-btn--primary:hover {
    background: var(--brand-ink);
    border-color: var(--brand-ink);
    color: var(--on-brand);
}

.cr-btn--secondary {
    background: var(--surface-raised);
    color: var(--brand);
}

.cr-btn--secondary:hover {
    background: var(--brand-tint);
    color: var(--brand-ink);
}

.cr-btn--quiet {
    border-color: transparent;
    background: transparent;
    color: var(--brand);
    padding-inline: var(--space-2);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.cr-btn--quiet:hover {
    color: var(--brand-ink);
}

.cr-btn--block {
    width: 100%;
}

.cr-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.cr-btn svg {
    width: 1.125rem;
    height: 1.125rem;
    flex: none;
}

/* ---------- Choice list (categories, address matches) ---------- */
.cr-options {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.cr-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 3rem;
    padding: var(--space-3) var(--space-4);
    font: inherit;
    text-align: left;
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.cr-option::after {
    content: "";
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    opacity: 0.6;
}

.cr-option:hover {
    background: var(--brand-tint);
    border-color: var(--brand);
}

.cr-group {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    margin-bottom: var(--space-2);
}

.cr-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 3rem;
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.cr-group > summary::-webkit-details-marker {
    display: none;
}

.cr-group > summary::after {
    content: "";
    flex: none;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 200ms var(--ease-out);
}

.cr-group[open] > summary::after {
    transform: rotate(-135deg);
}

.cr-group > .cr-options {
    padding: 0 var(--space-3) var(--space-3);
}

.cr-selected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--brand-tint);
    border: 2px solid var(--brand);
    border-radius: var(--radius);
}

.cr-selected__label {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 600;
}

/* ---------- Map ---------- */
.cr-map {
    height: min(60vh, 26rem);
    width: 100%;
    margin-top: var(--space-4);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ---------- Photo uploader (Syncfusion) ---------- */
.cr-step .e-upload.e-control-wrapper {
    width: 100%;
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
}

.cr-step .e-upload .e-file-select-wrap {
    padding: var(--space-4);
}

.cr-step .e-upload .e-file-select-wrap .e-btn {
    min-height: var(--control-height);
    padding: var(--space-2) var(--space-5);
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: 600;
    text-transform: none;
    color: var(--brand);
    background: var(--surface-raised);
    border: 2px solid var(--brand);
    border-radius: var(--radius);
}

.cr-step .e-upload .e-file-drop {
    color: var(--ink-muted);
    font-family: var(--font);
    font-size: var(--text-base);
}

.cr-step .e-upload .e-upload-files .e-upload-file-list {
    background: var(--surface);
}

/* ---------- Submit area ---------- */
.cr-submit {
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
}

@media (max-width: 39.99rem) {
    .cr-submit .cr-btn {
        width: 100%;
    }
}

/* ---------- Loading skeleton ---------- */
.cr-skeleton {
    height: 3rem;
    margin-bottom: var(--space-2);
    border-radius: var(--radius);
    background: var(--surface-sunken);
}

@media (prefers-reduced-motion: no-preference) {
    .cr-skeleton {
        animation: cr-pulse 1.4s var(--ease-out) infinite alternate;
    }
}

@keyframes cr-pulse {
    to { opacity: 0.55; }
}

/* ---------- Inline reveal (anonymous confirmation) ---------- */
.cr-notice {
    margin-top: var(--space-3);
    padding: var(--space-4);
    background: var(--brand-tint);
    border: 1px solid var(--brand);
    border-radius: var(--radius);
}

.cr-notice > :first-child {
    margin-top: 0;
}

.cr-notice__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.cr-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    color: var(--ink-muted);
    font-size: var(--text-sm);
}

.cr-divider::before,
.cr-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--line);
}

.cr-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-4);
}

.cr-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 2.75rem;
}

.cr-checkbox input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--brand);
}

/* ---------- Confirmation page ---------- */
.cr-done {
    text-align: center;
    padding: var(--space-6) 0;
}

.cr-done__icon {
    display: inline-grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: var(--space-4);
    border-radius: 50%;
    background: var(--success);
    color: var(--on-brand);
}

.cr-done__icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.cr-done .cr-city-message,
.cr-done .cr-lede {
    margin-inline: auto;
}

/* ---------- My reports ---------- */
.cr-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-2) var(--space-4);
    margin: 0 0 var(--space-5);
}

.cr-details dt {
    font-weight: 600;
}

.cr-details dd {
    margin: 0;
}

.cr-comment {
    padding: var(--space-3) 0;
    border-top: 1px solid var(--line);
}

.cr-comment__meta {
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

.cr-photo {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
}

/* ---------- Bootstrap pages (account management) pick up the same vocabulary ---------- */
.btn-primary {
    color: var(--on-brand);
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-ink);
    border-color: var(--brand-ink);
}

.form-control {
    border-color: var(--line-strong);
    border-radius: var(--radius);
}

.text-danger,
.validation-message {
    color: var(--danger) !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Inside a step the heading carries the hierarchy, so a city message is intro text: keep its
   bold/italic emphasis but not the oversized, centered heading styling older messages were written with. */
.cr-step__intro.cr-city-message,
.cr-step__intro.cr-city-message * {
    font-size: var(--text-base) !important;
    text-align: left !important;
    color: var(--ink-muted) !important;
}

.cr-step__intro.cr-city-message strong,
.cr-step__intro.cr-city-message b {
    font-weight: 600;
}

.cr-step__title .cr-label__hint {
    font-size: var(--text-base);
    font-weight: 400;
}

/* Inline icons default to text size wherever they appear. */
.cr-icon {
    width: 1.125em;
    height: 1.125em;
    flex: none;
}

/* ---------- My reports list ---------- */
.cr-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.cr-page-head .cr-title {
    margin: 0;
}

.cr-count {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--surface-sunken);
    border-radius: 999px;
    padding: 0.1em 0.65em;
}

.cr-empty {
    color: var(--ink-muted);
    margin: 0;
}

.cr-reports {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.cr-report {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font: inherit;
    text-align: left;
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.cr-report:hover {
    background: var(--brand-tint);
    border-color: var(--brand);
}

.cr-report__main {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
}

.cr-report__title {
    font-weight: 600;
}

.cr-report__meta {
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

.cr-report__desc {
    color: var(--ink-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cr-badge {
    flex: none;
    display: inline-block;
    padding: 0.15em 0.6em;
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--brand);
    background: var(--brand-tint);
    border: 1px solid var(--brand);
    border-radius: 999px;
}

.cr-badge--closed {
    color: var(--ink-muted);
    background: var(--surface-sunken);
    border-color: var(--line-strong);
}

.cr-skeleton--tall {
    height: 5rem;
}

/* ---------- Busy button spinner ---------- */
.cr-spinner {
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
    .cr-spinner {
        animation: cr-spin 700ms linear infinite;
    }
}

@keyframes cr-spin {
    to { transform: rotate(360deg); }
}

.cr-btn[aria-disabled="true"] {
    cursor: progress;
}

/* ---------- Account settings ---------- */
.cr-account {
    display: grid;
    gap: var(--space-5);
}

@media (min-width: 48rem) {
    .cr-account {
        grid-template-columns: 12rem 1fr;
        align-items: start;
    }
}

.cr-account-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 48rem) {
    .cr-account-nav ul {
        flex-direction: column;
    }
}

.cr-account-nav a {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
}

.cr-account-nav a:hover {
    background: var(--brand-tint);
}

.cr-account-nav a.active {
    background: var(--brand-tint);
    color: var(--brand);
    font-weight: 700;
    box-shadow: inset 0 0 0 2px var(--brand);
}

.cr-account__body .cr-step__title {
    margin-top: 0;
}

.cr-hint {
    margin: 0 0 var(--space-1);
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

.cr-success {
    margin: var(--space-2) 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    color: var(--success);
    background: color-mix(in oklch, var(--success) 8%, oklch(99% 0 none));
    border: 1px solid var(--success);
    border-radius: var(--radius);
    font-weight: 600;
}

.cr-danger-zone {
    margin-top: var(--space-6);
    padding: var(--space-4);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: var(--danger-tint);
}

.cr-danger-zone p {
    margin: 0 0 var(--space-3);
}

.cr-btn--danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--on-brand);
}

.cr-btn--danger:hover {
    background: color-mix(in oklch, var(--danger) 80%, oklch(15% 0 none));
    color: var(--on-brand);
}

/* ---------- Skip link (WCAG 2.4.1) ---------- */
.cr-skip-link {
    position: absolute;
    left: var(--space-3);
    top: -4rem;
    z-index: 1000;
    padding: var(--space-2) var(--space-4);
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    border-radius: var(--radius);
    text-decoration: none;
}

.cr-skip-link:focus {
    top: var(--space-3);
    color: var(--on-brand);
}

main:focus {
    outline: none;
}

#blazor-error-ui .dismiss {
    background: none;
    border: none;
    font-size: 1.25rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    cursor: pointer;
}

/* Bootstrap's pink <code> is 4.15:1 on our surface; use body ink (WCAG 1.4.3). */
code {
    color: var(--ink);
}
