/* Parkleitsystem Zug */

@font-face {
    font-family: "Figtree";
    src: url("/static/fonts/figtree-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 900;
    font-display: swap;
}

:root {
    --brand: #0081c1;
    --brand-strong: #00679a;
    --accent: #00679a;
    --accent-hover: #17232d;
    --ink: #17232d;
    --muted: #586673;
    --line: #dfe5ea;
    --surface: #ffffff;
    --canvas: #f3f6f8;
    --free: #10b981;
    --low: #fbbf24;
    --full: #e11d48;
    --closed: #64748b;
    --on-free: #04261b;
    --on-low: #2b1b00;
    --on-full: #ffffff;
    --on-closed: #ffffff;
    --free-text: #047857;
    --low-text: #b45309;
    --full-text: #be123c;
    --closed-text: #586673;
    --field-border: #b9c3cc;
    --selected: #e6f2f8;
    --error-bg: #fdecea;
    --error-ink: #8f2114;
    --warn-bg: #fff1d6;
    --warn-ink: #6b3f00;
    --success-bg: #e6f4ec;
    --success-ink: #14613a;
    --overlay: rgba(255, 255, 255, .85);
    --map-bg: #e8ebe6;
    color-scheme: light;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(23, 35, 45, .08), 0 8px 28px rgba(23, 35, 45, .14);
    --header-height: 64px;
}

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

html, body { height: 100%; margin: 0; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

h1, h2, h3, h4 { color: var(--ink); font-family: inherit; font-weight: 700; letter-spacing: -.01em; }

/* Header and footer */

.site-header {
    position: relative;
    z-index: 30;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: var(--header-height);
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.site-logo { display: block; line-height: 0; }
.site-logo img { width: auto; height: 30px; }

.site-nav ul { display: flex; gap: 20px; margin: 0; padding: 0; list-style: none; }
.site-nav a { color: var(--ink); font-weight: 500; text-decoration: none; }
.site-nav a:hover, .site-nav .active > a { color: var(--brand-strong); }

.site-header-actions { display: flex; align-items: center; gap: 16px; }

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
}

.theme-toggle:hover { background: var(--canvas); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }

.site-footer {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: auto;
    padding: 20px 24px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 15px;
}

.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* Content pages */

body > .container { flex: 1 0 auto; width: 100%; max-width: 860px; padding: 48px 24px 72px; }

.page-header { margin: 0 0 28px; padding: 0; border: 0; }
.page-header h1 { margin: 0; font-size: clamp(30px, 5vw, 42px); line-height: 1.15; }

.area-wysiwyg { margin-top: 24px; }
.area-wysiwyg h2 { margin-top: 32px; font-size: 22px; }
.area-wysiwyg h3 { margin-top: 24px; font-size: 18px; }

.carousel.header { height: 400px; margin-bottom: 20px; }
.carousel.header .carousel-inner { position: absolute !important; top: 0; left: 0; }
.carousel.header .item { height: 400px; background-color: #777; }
.carousel.header .carousel-inner > .item > img { position: absolute; top: 0; left: 0; min-width: 100%; height: 400px; }

/* Contact form */

.contact-form { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin-top: 28px; }
.contact-field { display: grid; gap: 6px; margin: 0; font-weight: 600; }
.contact-field--wide { grid-column: 1 / -1; }
.contact-field .optional { color: var(--muted); font-weight: 400; }

.contact-field input,
.contact-field textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--field-border);
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    font-weight: 400;
}

.contact-field textarea { min-height: 160px; resize: vertical; }
.contact-field input:focus, .contact-field textarea:focus { border-color: var(--brand); outline: 3px solid rgba(0, 129, 193, .25); outline-offset: 0; }

.button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 22px;
    background: var(--accent);
    border: 0;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

.button-primary:hover, .button-primary:focus { background: var(--accent-hover); color: #fff; }

.contact-actions { grid-column: 1 / -1; }

.notice { padding: 14px 16px; border-radius: 10px; }
.notice--error { background: var(--error-bg); color: var(--error-ink); }
.notice--success { background: var(--success-bg); color: var(--success-ink); }

/* Map page */

.page-map { height: 100%; overflow: hidden; }
.page-map .site-footer { display: none; }

.pls-app { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--map-bg); }
.pls-map { position: absolute; inset: 0; }

/* Panel */

.pls-panel {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: 380px;
    overflow: hidden;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.pls-sheet-handle { display: none; }

.pls-view { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.pls-view[hidden] { display: none; }

.pls-summary { padding: 20px 20px 14px; }
.pls-summary h1 { margin: 0; color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: 0; }
.pls-total { margin: 2px 0 0; font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.pls-total small { color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: 0; }

.pls-stand { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.pls-stand::before { content: ""; width: 8px; height: 8px; background: var(--free); border-radius: 50%; }
.pls-stand.is-stale::before { background: var(--low); }

.pls-filter { display: flex; align-items: center; gap: 12px; padding: 0 20px 14px; border-bottom: 1px solid var(--line); }

.pls-search {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    background: var(--canvas);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
}

.pls-search:focus { background: var(--surface); border-color: var(--brand); outline: 3px solid rgba(0, 129, 193, .25); outline-offset: 0; }
.pls-search::placeholder { color: var(--muted); }

.pls-only-free { display: flex; flex: none; align-items: center; gap: 7px; margin: 0; cursor: pointer; font-size: 15px; font-weight: 500; }
.pls-only-free input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.pls-notice { margin: 12px 20px 0; padding: 10px 12px; background: var(--error-bg); border-radius: 10px; color: var(--error-ink); font-size: 14px; }
.pls-notice[hidden] { display: none; }
.pls-notice--warn { background: var(--warn-bg); color: var(--warn-ink); }
.pls-detail-stale { margin: 0 20px 16px; }
.pls-stand.is-outdated { color: var(--warn-ink); font-weight: 600; }

/* Outdated numbers stay readable but lose their status colours, so they are not mistaken for live data. */
.has-stale-data .pls-pin, .has-stale-data .pls-count { filter: grayscale(.85); }
.has-stale-data .pls-row-status { color: var(--muted); }

.pls-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 6px 8px; overflow-y: auto; list-style: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pls-list li[hidden] { display: none; }

.pls-row {
    display: grid;
    grid-template-columns: 58px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
}

.pls-row:hover, .pls-row:focus { background: var(--canvas); color: var(--ink); text-decoration: none; }
.pls-row.is-selected { background: var(--selected); }

.pls-count {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border-radius: 10px;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.is-free .pls-count, .pls-count.is-free { background: var(--free); color: var(--on-free); }
.is-low .pls-count, .pls-count.is-low { background: var(--low); color: var(--on-low); }
.is-full .pls-count, .pls-count.is-full { background: var(--full); color: var(--on-full); }
.is-closed .pls-count, .pls-count.is-closed,
.is-unknown .pls-count, .pls-count.is-unknown { background: var(--closed); color: var(--on-closed); }

.pls-row-text { min-width: 0; }
.pls-row-name { display: block; overflow: hidden; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.pls-row-address { display: block; overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.pls-row-status { font-size: 13px; font-weight: 600; white-space: nowrap; }

.is-free .pls-row-status { color: var(--free-text); }
.is-low .pls-row-status { color: var(--low-text); }
.is-full .pls-row-status { color: var(--full-text); }
.is-closed .pls-row-status, .is-unknown .pls-row-status { color: var(--closed-text); }

.pls-empty { padding: 28px 20px; color: var(--muted); text-align: center; }
.pls-empty[hidden] { display: none; }

.pls-panel-links { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 14px; }
.pls-panel-links a { color: var(--muted); }
.pls-panel-links a:hover { color: var(--ink); }

/* Detail */

.pls-detail { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.pls-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 14px 12px 0;
    padding: 8px 10px;
    background: none;
    border: 0;
    border-radius: 8px;
    color: var(--brand-strong);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.pls-back:hover { background: var(--canvas); }

.pls-detail-head { display: grid; grid-template-columns: 1fr 76px; align-items: start; gap: 16px; padding: 6px 20px 18px; }
.pls-detail-head h2 { margin: 0; font-size: 26px; line-height: 1.15; }
.pls-detail-head p { margin: 6px 0 0; color: var(--muted); }
.pls-detail-head .pls-count { flex-direction: column; height: 76px; font-size: 26px; line-height: 1.05; }
.pls-detail-head .pls-count small { font-size: 12px; font-weight: 600; }

.pls-detail-actions { padding: 0 20px 20px; }
.pls-detail-actions .button-primary { width: 100%; }

.pls-section { padding: 16px 20px; border-top: 1px solid var(--line); }
.pls-section h3 { margin: 0 0 8px; font-size: 15px; }
.pls-section p { margin: 0 0 4px; }
.pls-rich > :last-child { margin-bottom: 0; }
.pls-rich ul, .pls-rich ol { margin: 0 0 4px; padding-left: 20px; }

.pls-prices { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pls-prices th { padding: 4px 0; color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; }
.pls-prices td { padding: 6px 0; border-top: 1px solid var(--line); }
.pls-prices th:last-child, .pls-prices td:last-child { text-align: right; }

.pls-logo { display: block; max-width: 150px; max-height: 70px; }

/* Map controls */

.pls-controls { position: absolute; top: 16px; right: 16px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

.pls-layers, .pls-zoom { display: flex; overflow: hidden; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); }
.pls-zoom { flex-direction: column; }

.pls-layers button, .pls-zoom button, .pls-locate {
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    background: var(--surface);
    border: 0;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
}

.pls-zoom button { font-size: 22px; font-weight: 500; line-height: 1; }
.pls-zoom button + button { border-top: 1px solid var(--line); }
.pls-layers button:hover, .pls-zoom button:hover, .pls-locate:hover { background: var(--canvas); }
.pls-layers button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.pls-locate { display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 10px; box-shadow: var(--shadow); }
.pls-locate svg { width: 20px; height: 20px; }
.pls-locate.is-busy { color: var(--accent); cursor: progress; }
.pls-locate.is-busy svg { animation: pls-locate-pulse 1s ease-in-out infinite; }
@keyframes pls-locate-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pls-locate.is-busy svg { animation: none; } }

.pls-locate-message { max-width: 260px; margin: 0; padding: 10px 12px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); color: var(--ink); font-size: 14px; line-height: 1.4; }
.pls-locate-message[hidden] { display: none; }

.pls-map .maplibregl-ctrl-bottom-right { display: flex; flex-direction: column; align-items: flex-end; }
.pls-map .maplibregl-ctrl-attrib { background: var(--overlay); border-radius: 6px; color: var(--ink); font-size: 12px; }
.pls-map .maplibregl-ctrl-attrib a { color: var(--ink); }
.pls-map .maplibregl-ctrl-scale { background: var(--overlay); border-color: var(--ink); color: var(--ink); font-family: inherit; font-size: 11px; }

/* Markers */

.pls-pin {
    position: relative;
    display: block;
    min-width: 40px;
    height: 32px;
    padding: 0 9px;
    border: 2px solid #fff;
    border-radius: 9px;
    box-shadow: 0 1px 2px rgba(23, 35, 45, .3), 0 3px 10px rgba(23, 35, 45, .28);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transition: transform .12s ease;
    transform-origin: 50% 120%;
}

.pls-pin::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: 50%;
    width: 10px;
    height: 10px;
    background: inherit;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateX(-50%) rotate(45deg);
}

.pls-pin.is-free { background: var(--free); color: var(--on-free); }
.pls-pin.is-low { background: var(--low); color: var(--on-low); }
.pls-pin.is-full { background: var(--full); color: var(--on-full); }
.pls-pin.is-closed, .pls-pin.is-unknown { background: var(--closed); color: var(--on-closed); }

.pls-pin:hover, .pls-pin.is-selected { transform: scale(1.18); }
.pls-pin.is-selected { border-color: var(--ink); }
.pls-pin.is-selected::after { border-color: var(--ink); }

.pls-me { width: 18px; height: 18px; background: #1a73e8; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 6px rgba(26, 115, 232, .25); }

@media (max-width: 767px) {
    :root { --header-height: 56px; }

    .site-header { padding: 0 16px; }
    .site-logo img { height: 26px; }
    .site-footer { padding: 18px 16px; }
    body > .container { padding: 32px 16px 56px; }

    .contact-form { grid-template-columns: 1fr; }

    .pls-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        height: 68%;
        border-radius: var(--radius) var(--radius) 0 0;
        transform: translateY(calc(100% - 118px));
        transition: transform .24s ease;
    }

    .pls-panel.is-open { transform: none; }

    .pls-sheet-handle {
        display: block;
        flex: none;
        width: 100%;
        height: 22px;
        padding: 0;
        background: none;
        border: 0;
        cursor: pointer;
        touch-action: none;
    }

    .pls-sheet-handle::before { content: ""; display: block; width: 40px; height: 4px; margin: 9px auto 0; background: var(--field-border); border-radius: 2px; }

    .pls-summary { padding: 2px 16px 12px; cursor: pointer; touch-action: none; }
    .pls-total { font-size: 28px; }
    .pls-filter { padding: 0 16px 12px; }
    .pls-panel-links { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .pls-detail-head { padding: 6px 16px 16px; }
    .pls-detail-actions { padding: 0 16px 16px; }
    .pls-section { padding: 14px 16px; }

    .pls-controls { top: 12px; right: 12px; }
    .pls-map .maplibregl-ctrl-bottom-right { bottom: 118px; }
    .pls-map .maplibregl-ctrl-scale { display: none; }
}


/* Dark theme: follows the system unless the visitor chose a theme with the header button. */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand: #39a9e0;
        --brand-strong: #6cc3ee;
        --accent: #00679a;
        --accent-hover: #0081c1;
        --ink: #e8eef2;
        --muted: #a3b1bc;
        --line: #2f3c47;
        --surface: #1b252e;
        --canvas: #121a21;
        --free-text: #63d395;
        --low-text: #f2b552;
        --full-text: #ff9583;
        --closed-text: #a9b6c0;
        --field-border: #4a5966;
        --selected: #1d3a4b;
        --error-bg: #47201b;
        --error-ink: #ffc4ba;
    --warn-bg: #3f2d0e;
    --warn-ink: #ffd99c;
        --success-bg: #173a29;
        --success-ink: #a9e8c6;
        --overlay: rgba(27, 37, 46, .85);
        --map-bg: #1a2127;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .45);
        color-scheme: dark;
    }

    :root:not([data-theme="light"]) .site-logo img { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }

    /* swisstopo has no dark map style, so the rendered map is darkened in the browser. */
    :root:not([data-theme="light"]) .pls-map[data-layer="basemap"] .maplibregl-canvas { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.88) saturate(.8); }
    :root:not([data-theme="light"]) .pls-map[data-layer="lightbasemap"] .maplibregl-canvas { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
    :root:not([data-theme="light"]) .pls-map[data-layer="imagerybasemap"] .maplibregl-canvas { filter: brightness(.72) saturate(.9); }

    :root:not([data-theme="light"]) .well, :root:not([data-theme="light"]) .panel, :root:not([data-theme="light"]) .thumbnail, :root:not([data-theme="light"]) .modal-content, :root:not([data-theme="light"]) .list-group-item, :root:not([data-theme="light"]) .form-control {
        background-color: var(--surface);
        border-color: var(--line);
        color: var(--ink);
    }
}

:root[data-theme="dark"] {
    --brand: #39a9e0;
    --brand-strong: #6cc3ee;
    --accent: #00679a;
    --accent-hover: #0081c1;
    --ink: #e8eef2;
    --muted: #a3b1bc;
    --line: #2f3c47;
    --surface: #1b252e;
    --canvas: #121a21;
    --free-text: #34d399;
    --low-text: #fbbf24;
    --full-text: #fb7185;
    --closed-text: #a9b6c0;
    --field-border: #4a5966;
    --selected: #1d3a4b;
    --error-bg: #47201b;
    --error-ink: #ffc4ba;
    --warn-bg: #3f2d0e;
    --warn-ink: #ffd99c;
    --success-bg: #173a29;
    --success-ink: #a9e8c6;
    --overlay: rgba(27, 37, 46, .85);
    --map-bg: #1a2127;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

:root[data-theme="dark"] .site-logo img { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* swisstopo has no dark map style, so the rendered map is darkened in the browser. */
:root[data-theme="dark"] .pls-map[data-layer="basemap"] .maplibregl-canvas { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.88) saturate(.8); }
:root[data-theme="dark"] .pls-map[data-layer="lightbasemap"] .maplibregl-canvas { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
:root[data-theme="dark"] .pls-map[data-layer="imagerybasemap"] .maplibregl-canvas { filter: brightness(.72) saturate(.9); }

:root[data-theme="dark"] .well, :root[data-theme="dark"] .panel, :root[data-theme="dark"] .thumbnail, :root[data-theme="dark"] .modal-content, :root[data-theme="dark"] .list-group-item, :root[data-theme="dark"] .form-control {
    background-color: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
    .pls-panel, .pls-pin { transition: none; }
}
