/* ============================================
   1SafeRE 2.0 — design system
   Light-first, navy-anchored. Brand: brand/README.md
   Class names are a contract with index.html + app.js — do not rename.
   ============================================ */

/* Visually hidden but screen-reader accessible — for form <label>s where the
   placeholder already gives sighted users the field's purpose and a visible
   label would add clutter the brand rules (PROJECT_RULES.md) ask us to avoid. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --navy: #08182E;
    --charcoal: #0E1726;
    --blue: #198CFF;
    --blue-deep: #0E7FAF;
    --sky: #35C3FF;
    --gold: #D4A63D;
    --gold-bright: #F6C453;
    --safe: #2E9E68;
    --sos: #D63A3A;
    --ground: #F7F9FB;
    --surface: #FFFFFF;
    --panel: #F2F6FA;
    --ink: #132437;
    --muted: #5E7185;
    --muted-strong: #3D4F63;
    --line: #E4EAF0;
    --line2: #DCE5EC;
    --navy-bg: #08182E;
    --navy-bg-hover: #10294A;
    --blue-text: #198CFF;
    --green-text: #2E9E68;
    --red-text: #D63A3A;
    --amber-text: #C77F17;
    --safe-tint: #E7F4ED;
    --safe-tint-border: #BFE0CD;
    --sos-border: #EEC7C7;
    --sos-tint: #FBEFEF;
    --nav-bg: rgba(255, 255, 255, .96);
    --radius: 14px;
    --radius-lg: 16px;
    --shadow: 0 2px 12px rgba(8, 24, 46, .06);
}

/* Dark theme: follows the device setting; data-theme attribute wins for QA/future toggle */
@media (prefers-color-scheme: dark) {
    :root {
        --ground: #0D141C;
        --surface: #161F26;
        --panel: #1D2938;
        --ink: #E6EDF3;
        --muted: #94A6B8;
        --muted-strong: #BCC9D6;
        --line: #273443;
        --line2: #31404F;
        --navy-bg: #198CFF;
        --navy-bg-hover: #3E9AFF;
        --blue-text: #57B1FF;
        --green-text: #4BC98B;
        --red-text: #F17B7B;
        --amber-text: #F0B052;
        --safe-tint: #15301F;
        --safe-tint-border: #2A5A3C;
        --sos-border: #5C2E2E;
        --sos-tint: #2E1A1C;
        --nav-bg: rgba(22, 31, 38, .96);
        --shadow: 0 2px 12px rgba(0, 0, 0, .35);
    }
}
:root[data-theme="dark"] {
    --ground: #0D141C;
    --surface: #161F26;
    --panel: #1D2938;
    --ink: #E6EDF3;
    --muted: #94A6B8;
    --muted-strong: #BCC9D6;
    --line: #273443;
    --line2: #31404F;
    --navy-bg: #198CFF;
    --navy-bg-hover: #3E9AFF;
    --blue-text: #57B1FF;
    --green-text: #4BC98B;
    --red-text: #F17B7B;
    --amber-text: #F0B052;
    --safe-tint: #15301F;
    --safe-tint-border: #2A5A3C;
    --sos-border: #5C2E2E;
    --sos-tint: #2E1A1C;
    --nav-bg: rgba(22, 31, 38, .96);
    --shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
:root[data-theme="light"] {
    --ground: #F7F9FB;
    --surface: #FFFFFF;
    --panel: #F2F6FA;
    --ink: #132437;
    --muted: #5E7185;
    --muted-strong: #3D4F63;
    --line: #E4EAF0;
    --line2: #DCE5EC;
    --navy-bg: #08182E;
    --navy-bg-hover: #10294A;
    --blue-text: #198CFF;
    --green-text: #2E9E68;
    --red-text: #D63A3A;
    --amber-text: #C77F17;
    --safe-tint: #E7F4ED;
    --safe-tint-border: #BFE0CD;
    --sos-border: #EEC7C7;
    --sos-tint: #FBEFEF;
    --nav-bg: rgba(255, 255, 255, .96);
    --shadow: 0 2px 12px rgba(8, 24, 46, .06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--ground);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.screen {
    display: none;
    min-height: 100vh;
    padding-bottom: 96px;
}

.screen.active {
    display: block;
    animation: screenIn .18s ease-out;
}

@keyframes screenIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 20px;
}

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

.btn {
    font-family: inherit;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: background-color .15s ease, opacity .15s ease, transform .1s ease;
    min-height: 48px;
}

.btn:active { transform: scale(.985); }

.btn-primary {
    background: var(--navy-bg);
    color: #fff;
    padding: 15px 44px;
    border-radius: var(--radius);
    font-size: 17px;
}

.btn-primary:hover { background: var(--navy-bg-hover); }

.btn-sos {
    background: transparent;
    color: var(--red-text);
    border: 1.5px solid var(--sos-border);
    padding: 15px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    width: 100%;
}

.btn-sos:hover { background: var(--sos-tint); }

/* ---------- Forms ---------- */

.input {
    width: 100%;
    padding: 15px 18px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 16px;
    margin-bottom: 14px;
    font-family: inherit;
}

.input::placeholder { color: #8FA1B3; }

.input:focus {
    outline: 0;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(25, 140, 255, .15);
}

button:focus-visible, a:focus-visible, input:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* ---------- Cards & panels ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

#manual-address-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.status-pill {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.status-pill.active {
    background: var(--safe-tint);
    border-color: var(--safe-tint-border);
}

.back-btn {
    background: none;
    border: none;
    color: var(--blue-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    margin-bottom: 22px;
    font-size: 16px;
    font-weight: 600;
    min-height: 44px;
}

.contact-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

/* ---------- Pricing ---------- */

.price-card {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 22px;
    position: relative;
    box-shadow: var(--shadow);
}

.price-card.featured {
    background: linear-gradient(160deg, #08182E, #0E2745);
    border-color: #08182E;
    color: #fff;
}

/* ---------- Bottom navigation ---------- */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    z-index: 1000;
    padding-bottom: clamp(3px, calc(3px + env(safe-area-inset-bottom)), 35px);
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    color: #7C8FA3;
    text-decoration: none;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    transition: color .15s;
    cursor: pointer;
    background: none;
    border: none;
    flex: 1;
    min-height: 56px;
}

.nav-btn.active { color: var(--blue-text); }

/* ---------- Map & notifications ---------- */

#map {
    width: 100%;
    height: 220px;
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    border: 1px solid var(--line);
}

.notif {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy-bg);
    color: #fff;
    padding: 14px 22px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 6px 20px rgba(8, 24, 46, .25);
    max-width: 90%;
    text-align: center;
    opacity: 0;
    transition: opacity .3s ease;
}

.notif.show { opacity: 1; }

.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib {
    display: none !important;
}

/* ---------- Home quick-activity chips ---------- */

.home-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    margin-bottom: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.home-chips::-webkit-scrollbar { display: none; }
.home-chips:empty { display: none; }

.home-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--line2);
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.home-chip:hover { border-color: var(--blue); }
.home-chip.active {
    background: var(--navy-bg);
    border-color: var(--navy-bg);
    color: #fff;
}
.home-chip .hc-icon { font-size: 15px; line-height: 1; }

/* ---------- Timer preset chips ---------- */

.timer-preset {
    flex: 1;
    min-width: 56px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--line2);
    border-radius: 6px;
    color: var(--muted);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.timer-preset:hover { background: var(--line2); color: var(--ink); }

/* ---------- Activity personalization cards (onboarding + settings) ---------- */

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}

.activity-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 16px;
    padding: 18px 8px;
    min-height: 98px;
    cursor: pointer;
    font-family: inherit;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
    animation: activityCardIn .34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.activity-card:hover {
    transform: translateY(-3px);
    border-color: var(--blue);
    box-shadow: 0 6px 18px rgba(8, 24, 46, .10);
}

.activity-card:active { transform: scale(.97); }

.activity-card.selected {
    border-color: var(--blue);
    background: var(--blue-soft, rgba(25,140,255,.08));
    box-shadow: 0 0 0 3px rgba(25, 140, 255, .18);
}

.activity-card .ac-icon { font-size: 30px; line-height: 1; }
.activity-card .ac-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    text-align: center;
    line-height: 1.25;
}

@keyframes activityCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .activity-card { animation: none; }
    .activity-card:hover { transform: none; }
}

/* ---------- SOS screen: the one red surface, always white text ---------- */

#sos { color: #fff; }

/* ---------- Onboarding: the one dark brand moment ---------- */

#splash {
    background: linear-gradient(180deg, #08182E 0%, #0E2745 100%);
    color: #fff;
}

/* ---------- Retired decorations (markup may still reference) ---------- */

.police-light { display: none; }
.circuit-bg { display: none; }
.logo-powerup { animation: none; }

@keyframes pulseLines { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 0; } }

/* ---------- Motion preferences ---------- */

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