/* ——— Fontes auto-hébergées ————————————————————————————————————————————— */
@font-face {
    font-family: 'Bricolage Grotesque';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/bricolage-latin-ZzKOOYL.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                   U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                   U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Bricolage Grotesque';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/bricolage-latin-ext-E7qegro.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                   U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                   U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/inter-latin-joy4ri1.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                   U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                   U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/inter-latin-ext-9fzmmZy.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                   U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                   U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ——— Jetons ———————————————————————————————————————————————————————————— */
:root {
    --fond: #0B1020;
    --surface: #161B33;
    --surface-haute: #1E2544;
    --bordure: #2A3157;

    --turquoise: #2DD4BF;      /* actions, position, « ouvert » — un signal, jamais un aplat */
    --turquoise-sombre: #14B8A6;
    --violet: #8B5CF6;         /* marqueurs, catégories */
    --ambre: #F59E0B;          /* « ferme bientôt » */
    --rose: #F43F5E;           /* « fermé », erreurs */

    --texte: #E8EAF2;
    --texte-doux: #9AA3B8;

    --titre: 'Bricolage Grotesque', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --corps: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --rayon: 14px;
    --rayon-petit: 10px;
    --gouttiere: 20px;
    --touche: 44px;            /* cible tactile minimale */
}

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

html {
    background: var(--fond);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--fond);
    color: var(--texte);
    font-family: var(--corps);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

h1, h2, h3 {
    font-family: var(--titre);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

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

/* ——— Marque ——————————————————————————————————————————————————————————— */
.titre-marque {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    line-height: 1.1;
}

.sous-titre {
    margin: 6px 0 28px;
    color: var(--texte-doux);
    font-size: 0.95rem;
}

/* ——— Écran de connexion ——————————————————————————————————————————————— */
.ecran-centre {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--gouttiere);
    /* halo discret : le violet et le turquoise en lueur, pas en aplat */
    background:
        radial-gradient(60ch 40ch at 15% -10%, rgba(139, 92, 246, 0.18), transparent 70%),
        radial-gradient(50ch 35ch at 110% 110%, rgba(45, 212, 191, 0.14), transparent 70%);
}

.carte-accueil {
    width: 100%;
    max-width: 380px;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
}

/* ——— Formulaire ——————————————————————————————————————————————————————— */
.formulaire { display: grid; gap: 6px; }

.formulaire label {
    margin-top: 14px;
    color: var(--texte-doux);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.formulaire input {
    min-height: var(--touche);
    padding: 0 14px;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon-petit);
    color: var(--texte);
    font: inherit;
    font-size: 1rem; /* ≥ 16px : évite le zoom automatique sur iOS */
}

.formulaire input:focus-visible {
    outline: 2px solid var(--turquoise);
    outline-offset: 1px;
    border-color: transparent;
}

.bouton-principal {
    min-height: var(--touche);
    margin-top: 24px;
    background: var(--turquoise);
    border: 0;
    border-radius: var(--rayon-petit);
    color: #04131A;
    font-family: var(--titre);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.bouton-principal:hover { background: var(--turquoise-sombre); }

.alerte {
    margin: 0 0 16px;
    padding: 10px 14px;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.35);
    border-radius: var(--rayon-petit);
    color: #FFC2CD;
    font-size: 0.9rem;
}

/* ——— Chrome de l'application —————————————————————————————————————————— */
.entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px var(--gouttiere);
    border-bottom: 1px solid var(--bordure);
}

.entete .titre-marque { font-size: 1.4rem; }

.lien-discret {
    color: var(--texte-doux);
    font-size: 0.85rem;
    text-decoration: none;
}

.lien-discret:hover { color: var(--texte); }

.contenu { padding: var(--gouttiere); }

.vide {
    color: var(--texte-doux);
    text-align: center;
    padding: 48px 0;
}

/* ——— Liste des carnets ————————————————————————————————————————————————— */
.liste-carnets {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.carte-carnet {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: var(--touche);
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    color: var(--texte);
    text-decoration: none;
}

.carte-carnet:hover { border-color: var(--turquoise); }

.carte-carnet__nom {
    font-family: var(--titre);
    font-size: 1.1rem;
    font-weight: 700;
}

.carte-carnet__meta { color: var(--texte-doux); font-size: 0.85rem; }

.formulaire--inline { gap: 6px; }

.champ-avec-bouton { display: flex; gap: 8px; }
.champ-avec-bouton input { flex: 1; min-width: 0; }
.champ-avec-bouton .bouton-principal { margin-top: 0; padding: 0 20px; }

/* ——— Écran carte ——————————————————————————————————————————————————————— */
.ecran-carte {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.entete--carte { align-items: flex-start; }
.entete--carte .lien-discret { display: block; margin-bottom: 2px; }

.compteur {
    flex: none;
    padding: 5px 11px;
    background: var(--surface-haute);
    border-radius: 999px;
    color: var(--texte-doux);
    font-size: 0.8rem;
}

.carte {
    height: 52dvh;
    min-height: 260px;
    background: var(--surface);
}

.aide-carte {
    margin: 0;
    padding: 10px var(--gouttiere);
    background: var(--surface);
    border-bottom: 1px solid var(--bordure);
    color: var(--texte-doux);
    font-size: 0.8rem;
    text-align: center;
}

/* Marqueur : le violet porte les lieux, le turquoise reste à la position et aux actions. */
.marqueur {
    width: 34px;
    height: 34px;
    padding: 0;
    background: var(--violet);
    border: 2px solid var(--fond);
    border-radius: 50% 50% 50% 4px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.45);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transform: rotate(-45deg);
}

.marqueur > * { display: inline-block; transform: rotate(45deg); }

/* ——— Liste des lieux —————————————————————————————————————————————————— */
.liste-lieux {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0 0 24px;
}

.ligne-lieu {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-height: var(--touche);
    padding: 13px var(--gouttiere);
    border-bottom: 1px solid var(--bordure);
    cursor: pointer;
}

.ligne-lieu:hover { background: var(--surface); }

.ligne-lieu__pastille {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    background: var(--surface-haute);
    border-radius: 10px;
}

.ligne-lieu__corps { display: grid; gap: 2px; min-width: 0; }
.ligne-lieu__adresse,
.ligne-lieu__note { color: var(--texte-doux); font-size: 0.85rem; }
.ligne-lieu__horaires { color: var(--turquoise); font-size: 0.85rem; }

/* ——— Panneau d'édition ———————————————————————————————————————————————— */
.feuille {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 10;
    max-height: 86dvh;
    overflow-y: auto;
    padding: 20px var(--gouttiere) calc(24px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--bordure);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 32px rgb(0 0 0 / 0.5);
}

.feuille h2 {
    margin: 0 36px 4px 0;
    font-size: 1.2rem;
}

.feuille__fermer {
    position: absolute;
    top: 12px;
    right: 12px;
    width: var(--touche);
    height: var(--touche);
    background: none;
    border: 0;
    color: var(--texte-doux);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.feuille textarea {
    padding: 10px 14px;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon-petit);
    color: var(--texte);
    font: inherit;
    font-size: 1rem;
    resize: vertical;
}

.feuille textarea:focus-visible {
    outline: 2px solid var(--turquoise);
    outline-offset: 1px;
    border-color: transparent;
}

.bouton-danger {
    width: 100%;
    min-height: var(--touche);
    margin-top: 10px;
    background: none;
    border: 1px solid rgb(244 63 94 / 0.4);
    border-radius: var(--rayon-petit);
    color: var(--rose);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.bouton-danger:hover { background: rgb(244 63 94 / 0.12); }

.fiche-lecture p { margin: 4px 0; color: var(--texte-doux); }

/* Les contrôles MapLibre au thème nocturne */
.maplibregl-ctrl-group {
    background: var(--surface-haute);
    border: 1px solid var(--bordure);
}

.maplibregl-ctrl-group button + button { border-top-color: var(--bordure); }
.maplibregl-ctrl-group button span { filter: invert(1); }
.maplibregl-ctrl-attrib { background: rgb(11 16 32 / 0.75); }
.maplibregl-ctrl-attrib a { color: var(--texte-doux); }

@media (min-width: 900px) {
    .carte { height: 60dvh; }
    .feuille {
        inset: auto auto 24px 24px;
        width: 380px;
        border-radius: var(--rayon);
        border: 1px solid var(--bordure);
    }
}

/* ——— Autour de moi ———————————————————————————————————————————————————— */
.bouton-position {
    flex: none;
    min-height: 38px;
    padding: 0 16px;
    background: var(--turquoise);
    border: 0;
    border-radius: 999px;
    color: #04131A;
    font-family: var(--titre);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.bouton-position:disabled { opacity: 0.55; cursor: progress; }

.rayons {
    display: flex;
    gap: 8px;
    padding: 14px var(--gouttiere) 0;
}

.rayon {
    flex: 1;
    min-height: 38px;
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: 999px;
    color: var(--texte-doux);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.rayon--actif {
    background: var(--surface-haute);
    border-color: var(--turquoise);
    color: var(--turquoise);
    font-weight: 600;
}

.etat-position {
    margin: 12px 0 0;
    padding: 0 var(--gouttiere) 14px;
    color: var(--texte-doux);
    font-size: 0.85rem;
}

.ligne-lieu__distance {
    flex: none;
    align-self: center;
    padding: 4px 10px;
    background: var(--surface-haute);
    border-radius: 999px;
    color: var(--turquoise);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bandeau-proximite {
    display: block;
    margin-bottom: 20px;
    padding: 16px 18px;
    /* le seul dégradé de l'interface : c'est l'action principale */
    background: linear-gradient(135deg, rgb(45 212 191 / 0.16), rgb(139 92 246 / 0.16));
    border: 1px solid var(--turquoise);
    border-radius: var(--rayon);
    color: var(--texte);
    text-decoration: none;
}

.bandeau-proximite__titre {
    display: block;
    font-family: var(--titre);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--turquoise);
}

.bandeau-proximite__aide { color: var(--texte-doux); font-size: 0.85rem; }
