:root {
    --background: #f5f6f7;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #52606d;
    --border: #cbd2d9;
    --primary: #145c9e;
    --primary-dark: #0d4679;
    --focus: #ffbf47;
    --notice: #fff7d6;
    --notice-border: #d9a514;
    --shadow: 0 8px 24px rgba(31, 41, 51, 0.08);
    --radius: 0.75rem;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary-dark);
}

a:hover {
    text-decoration-thickness: 0.15em;
}

button,
select,
input {
    font: inherit;
}

button,
select,
a,
input {
    outline-offset: 3px;
}

button:focus-visible,
select:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
.leaflet-container:focus-visible {
    outline: 3px solid var(--focus);
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 9999;
    transform: translateY(-150%);
    padding: 0.75rem 1rem;
    border-radius: 0.4rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 1.5rem clamp(1rem, 4vw, 3rem);
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.5rem;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.12;
}

.intro {
    max-width: 75ch;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
    gap: 1rem;
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 1rem clamp(0.75rem, 2vw, 1.5rem) 2rem;
}

.map-column,
.filters-column,
.results-column {
    min-width: 0;
}

.map-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.control-group {
    display: grid;
    gap: 0.25rem;
}

.control-group label {
    font-weight: 700;
}

select {
    min-height: 2.75rem;
    padding: 0.45rem 2.5rem 0.45rem 0.7rem;
    border: 1px solid #8a99a8;
    border-radius: 0.4rem;
    background: var(--surface);
    color: var(--text);
}

.button {
    min-height: 2.75rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    cursor: pointer;
    font-weight: 700;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.button--primary {
    background: var(--primary);
    color: #ffffff;
}

.button--primary:hover {
    background: var(--primary-dark);
}

.button--secondary {
    border-color: var(--primary);
    background: var(--surface);
    color: var(--primary-dark);
}

.button--link {
    min-height: auto;
    padding: 0.35rem 0;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    text-decoration: underline;
}

.map {
    height: min(72vh, 760px);
    min-height: 430px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #dfe6eb;
    box-shadow: var(--shadow);
}

.map-caption {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.filters-column,
.results-column {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.filters-column {
    align-self: start;
}

.results-column {
    grid-column: 1 / -1;
}

.filters {
    padding: 1rem;
}

.filters > summary {
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 800;
}

.filters__help {
    margin: 0.7rem 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.filter-group + .filter-group {
    margin-top: 0.8rem;
}

.filter-group fieldset {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.filter-group legend {
    margin-bottom: 0.4rem;
    font-weight: 750;
}

.check-option {
    display: grid;
    grid-template-columns: 1.25rem 1fr;
    gap: 0.5rem;
    align-items: start;
    cursor: pointer;
    font-size: 0.93rem;
}

.check-option input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.15rem;
    accent-color: var(--primary);
}

.filter-empty {
    color: var(--muted);
    font-size: 0.9rem;
}

.results-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.results-heading h2 {
    margin-bottom: 0.35rem;
}

.status {
    margin-bottom: 0;
    color: var(--muted);
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.status--loading::before {
    content: "";
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    margin-right: 0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.08rem;
    animation: spin 0.8s linear infinite;
}

.notice {
    margin: 1rem 1rem 0;
    padding: 0.75rem;
    border-left: 4px solid var(--notice-border);
    background: var(--notice);
}

.results-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.5rem;
    margin: 0;
    padding: 0.25rem 1rem 1rem;
    list-style: none;
}

.result-card {
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.result-card:first-child {
    border-top: 0;
}

.result-card:nth-child(2) {
    border-top: 0;
}

.result-card__map-button {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.result-card__map-button h3 {
    margin-bottom: 0.2rem;
    color: var(--primary-dark);
    font-size: 1.08rem;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.15em;
}

.result-card__distance {
    white-space: nowrap;
    color: var(--muted);
    font-weight: 750;
}

.result-card p {
    margin-bottom: 0.6rem;
}

.result-card__address {
    color: var(--muted);
}

.result-card__details {
    margin-top: 0.4rem;
}

.result-card__details summary {
    cursor: pointer;
    color: var(--primary-dark);
    font-weight: 700;
}

.result-card__details ul {
    margin: 0.4rem 0 0.7rem;
    padding-left: 1.25rem;
}

.result-card__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.9rem;
    margin-top: 0.75rem;
}

.result-card__contacts a {
    font-weight: 700;
}

.empty-results {
    padding: 1rem 0;
    color: var(--muted);
}

.search-center-icon span {
    display: block;
    width: 24px;
    height: 24px;
    border: 4px solid #ffffff;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dark), 0 2px 8px rgba(0, 0, 0, 0.35);
}

.popup-card h3 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.popup-card p {
    margin-bottom: 0.55rem;
}

.popup-card .distance {
    color: var(--muted);
    font-weight: 750;
}

.popup-alert {
    padding: 0.45rem;
    background: var(--notice);
}

.popup-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.5rem 0;
    padding: 0;
    list-style: none;
}

.popup-tags li {
    padding: 0.18rem 0.4rem;
    border-radius: 999px;
    background: #edf2f7;
    font-size: 0.78rem;
}

.popup-links a {
    font-weight: 700;
}

.site-footer {
    padding: 1rem clamp(1rem, 4vw, 3rem) 2rem;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.site-footer p {
    margin: 0;
}

.noscript {
    margin: 1rem;
    padding: 1rem;
    border: 2px solid #b42318;
    background: #fff0ee;
}

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

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

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .results-list {
        grid-template-columns: 1fr;
    }

    .result-card:nth-child(2) {
        border-top: 1px solid var(--border);
    }

    .map {
        height: 56vh;
        min-height: 360px;
    }
}

@media (max-width: 620px) {
    .site-header__inner {
        padding-block: 1.1rem;
    }

    .app-shell {
        padding-inline: 0.5rem;
    }

    .map-toolbar {
        align-items: stretch;
    }

    .control-group,
    .control-group select,
    .map-toolbar .button {
        width: 100%;
    }

    .results-heading {
        align-items: stretch;
    }

    .results-actions,
    .results-actions .button {
        width: 100%;
    }

    .map {
        height: 52vh;
        min-height: 320px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fiche détaillée des lieux */
.button--compact {
    min-height: 2.35rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.92rem;
}

.result-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.popup-details-button {
    min-height: 2.25rem;
    margin-top: 0.45rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--primary);
    border-radius: 0.4rem;
    background: var(--surface);
    color: var(--primary-dark);
    cursor: pointer;
    font-weight: 700;
}

.place-dialog {
    width: min(820px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.place-dialog::backdrop {
    background: rgba(15, 23, 42, 0.68);
}

.place-dialog__panel {
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.place-dialog__header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.place-dialog__header h2 {
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.place-dialog__distance {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.place-dialog__close {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1.8rem;
    line-height: 1;
}

.place-dialog__content {
    padding: 0 1.25rem 1.5rem;
}

.place-dialog__section {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border);
}

.place-dialog__section:last-child {
    border-bottom: 0;
}

.place-dialog__section h3 {
    margin-bottom: 0.8rem;
    color: var(--primary-dark);
    font-size: 1.15rem;
}

.place-dialog__lead {
    font-weight: 650;
}

.place-dialog__long-text {
    white-space: pre-line;
}

.place-dialog__note {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.place-detail-list,
.opening-hours-list {
    display: grid;
    grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1fr);
    gap: 0.55rem 1rem;
    margin: 0;
}

.place-detail-list dt,
.opening-hours-list dt {
    font-weight: 750;
}

.place-detail-list dd,
.opening-hours-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.place-detail-list__values {
    margin: 0;
    padding-left: 1.15rem;
}

.place-detail-list__values li + li {
    margin-top: 0.25rem;
}

@media (max-width: 620px) {
    .place-dialog {
        width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
    }

    .place-dialog__panel {
        max-height: calc(100vh - 1rem);
    }

    .place-dialog__header,
    .place-dialog__content {
        padding-inline: 1rem;
    }

    .place-detail-list,
    .opening-hours-list {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .place-detail-list dd,
    .opening-hours-list dd {
        margin-bottom: 0.65rem;
    }
}

.result-card__detail-text {
    margin: 0.45rem 0 0.7rem;
    white-space: pre-line;
}

.result-card__opening-hours {
    display: grid;
    grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
    gap: 0.3rem 0.7rem;
    margin: 0.45rem 0 0.7rem;
}

.result-card__opening-hours dt {
    font-weight: 700;
}

.result-card__opening-hours dd {
    margin: 0;
}

.place-dialog__source-value {
    margin-top: 0.8rem;
}

.place-dialog__source-value summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.place-dialog__source-value code {
    display: block;
    margin-top: 0.45rem;
    padding: 0.6rem;
    border-radius: 0.35rem;
    background: #f2f4f7;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

@media (max-width: 620px) {
    .result-card__opening-hours {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .result-card__opening-hours dd {
        margin-bottom: 0.45rem;
    }
}
