/* ============================================================
   Pages legales autonomes (confidentialite, conditions).
   Design iOS calme, clair + sombre, polices auto-hebergees.
   Consomme fonts.css ; tokens locaux volontairement figes ici
   (pages servies hors app, pas de variables.css ni de JS).
   ============================================================ */

/* Clair PAR DEFAUT (lisibilite avant tout : une page legale doit se lire
   sans effort). Le sombre est un choix explicite via le bouton de bascule,
   memorise dans localStorage. */
:root {
    --green: #0e9f6e;
    --green-dim: rgba(14, 159, 110, .10);
    --bg: #f4f6f3;
    --surface: #ffffff;
    --surface2: #eef1ec;
    --border: #dde3da;
    --text: #1a2118;
    --muted: #5a7257;
    --radius: 16px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --green: #22c48b;
    --green-dim: rgba(34, 196, 139, .14);
    --bg: #0e120f;
    --surface: #161b17;
    --surface2: #1d231e;
    --border: #262e27;
    --text: #e8ede7;
    --muted: #9db09a;
    color-scheme: dark;
}

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

body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

/* Barre superieure : retour app + marque. */
.legal-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    /* Desktop : la barre s'aligne sur la colonne de lecture (768px) au lieu
       de s'etirer d'un bord a l'autre de l'ecran. */
    padding: 12px max(16px, calc((100vw - 768px) / 2));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.legal-brand {
    font-family: "Syne", system-ui, sans-serif;
    font-weight: 800;
    font-size: 17px;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -.01em;
}

.legal-brand b {
    color: var(--green);
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.legal-back:hover {
    background: var(--green-dim);
    border-color: var(--green);
}

/* Bascule clair/sombre : choix explicite, memorise. */
.legal-theme {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.legal-theme:hover {
    color: var(--text);
    border-color: var(--green);
}

.legal-theme .ic-sun {
    display: none;
}

:root[data-theme="dark"] .legal-theme .ic-sun {
    display: block;
}

:root[data-theme="dark"] .legal-theme .ic-moon {
    display: none;
}

/* Corps : colonne de lecture, groupes iOS. */
.legal-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 24px) 80px;
}

/* Titres en Inter comme le reste de l'app (Syne reste la marque UpTe dans
   la barre) : plus aere, moins ecrase que le display gras. */
.legal-head h1 {
    font-weight: 700;
    font-size: clamp(24px, 5vw, 32px);
    letter-spacing: -.015em;
    line-height: 1.25;
    margin-bottom: 8px;
}

.legal-head .legal-date {
    font-size: 12.5px;
    color: var(--muted);
}

.legal-head .legal-intro {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--green-dim);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    font-size: 14px;
}

/* Sommaire : rangees tappables. */
.legal-toc {
    margin: 24px 0 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.legal-toc a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.legal-toc a:last-child {
    border-bottom: none;
}

.legal-toc a:hover {
    background: var(--surface2);
}

.legal-toc .n {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    width: 20px;
    flex: none;
}

/* Sections : cartes iOS. */
.legal-sec {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px clamp(16px, 3vw, 24px);
    margin-top: 20px;
    scroll-margin-top: 76px;
}

.legal-sec h2 {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.01em;
    margin-bottom: 12px;
}

.legal-sec h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 16px 0 6px;
}

.legal-sec p {
    margin-bottom: 12px;
}

.legal-sec ul {
    margin: 0 0 12px 18px;
}

.legal-sec li {
    margin-bottom: 8px;
}

.legal-sec p:last-child,
.legal-sec ul:last-child {
    margin-bottom: 0;
}

.legal-sec strong {
    font-weight: 600;
}

/* Tableau simple (destinataires / services tiers). */
.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 8px 0 10px;
}

.legal-table th,
.legal-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.legal-table th {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

.legal-table tr:last-child td {
    border-bottom: none;
}

/* Pied : liens croises + contact. */
.legal-foot {
    margin-top: 28px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.legal-foot a {
    color: var(--green);
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 480px) {
    .legal-table {
        display: block;
        overflow-x: auto;
    }
}
