/*
 * L'espace famille — la direction B, « aux couleurs de la structure »
 * (PLAN §113, D8 ; référence : maquettes/espace-famille-b.html).
 *
 * Une feuille à part, exprès : l'espace a son propre style, distinct de
 * celui du bureau (DESIGN.md). La couleur vient de la marque de l'agence
 * (`--marque`, `--marque-contrast`, posées par `marque.variables_css`) ;
 * sans marque, un bleu canard neutre.
 *
 * Le thème suit le proche (`data-theme` sur <html>) ou, sur « auto », le
 * système. La taille du texte suit son réglage (`data-taille`).
 */

@font-face { font-family: "Geist"; font-weight: 400; font-display: swap; src: url("../fonts/Geist-Regular.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 500; font-display: swap; src: url("../fonts/Geist-Medium.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 600; font-display: swap; src: url("../fonts/Geist-SemiBold.woff2") format("woff2"); }

:root {
  --ressort: cubic-bezier(0.32, 0.72, 0, 1);
  --accent: var(--marque, #0f6e74);
  --accent-encre: var(--marque-contrast, #ffffff);
  --fond: #f2f1ee;
  --coque: rgba(20, 20, 18, 0.04);
  --filet: rgba(20, 20, 18, 0.07);
  --surface: #ffffff;
  --encre: #17171a;
  --encre-2: #5d5c63;
  --encre-3: #77767d;
  --reflet: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --ombre: 0 1px 2px rgba(23, 23, 26, 0.04), 0 18px 40px -18px rgba(23, 23, 26, 0.16);
  --ombre-haute: 0 2px 4px rgba(23, 23, 26, 0.04), 0 40px 80px -32px rgba(23, 23, 26, 0.28);
  --ok: #1a7f45;
  --ok-fond: #e5f4ea;
  --attention: #a14a07;
  --attention-fond: #fdf1df;
  --danger: #b42318;
  --danger-fond: #fdecea;
  --neutre-fond: #ebeae6;
  --taille: 1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0d0d0f;
    --coque: rgba(255, 255, 255, 0.05);
    --filet: rgba(255, 255, 255, 0.09);
    --surface: #17171a;
    --encre: #f4f3f0;
    --encre-2: #b3b2b8;
    --encre-3: #93929a;
    --reflet: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.6);
    --ombre-haute: 0 2px 4px rgba(0, 0, 0, 0.3), 0 40px 80px -32px rgba(0, 0, 0, 0.8);
    --ok: #4ccf84;
    --ok-fond: rgba(76, 207, 132, 0.13);
    --attention: #f2a54a;
    --attention-fond: rgba(242, 165, 74, 0.13);
    --danger: #ff8a7f;
    --danger-fond: rgba(255, 138, 127, 0.13);
    --neutre-fond: rgba(255, 255, 255, 0.07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0d0d0f;
  --coque: rgba(255, 255, 255, 0.05);
  --filet: rgba(255, 255, 255, 0.09);
  --surface: #17171a;
  --encre: #f4f3f0;
  --encre-2: #b3b2b8;
  --encre-3: #93929a;
  --reflet: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --ombre-haute: 0 2px 4px rgba(0, 0, 0, 0.3), 0 40px 80px -32px rgba(0, 0, 0, 0.8);
  --ok: #4ccf84;
  --ok-fond: rgba(76, 207, 132, 0.13);
  --attention: #f2a54a;
  --attention-fond: rgba(242, 165, 74, 0.13);
  --danger: #ff8a7f;
  --danger-fond: rgba(255, 138, 127, 0.13);
  --neutre-fond: rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}
:root[data-taille="grand"] { --taille: 1.12; }
:root[data-taille="tres_grand"] { --taille: 1.25; }

* { box-sizing: border-box; }
html { background: var(--fond); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  font-family: "Geist", system-ui, sans-serif; font-size: calc(16px * var(--taille));
  line-height: 1.45; color: var(--encre); background: var(--fond);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.nb { white-space: nowrap; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- La page ---------- */
.espace { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; padding-bottom: 116px; }
.espace--sans-barre { padding-bottom: 40px; }

/* L'en-tête plein, aux couleurs de l'agence */
.tete {
  padding: calc(14px + env(safe-area-inset-top)) 20px 64px; color: var(--accent-encre);
  background:
    radial-gradient(80% 70% at 85% 10%, color-mix(in oklab, white 26%, var(--accent)), transparent 60%),
    radial-gradient(70% 70% at 0% 100%, color-mix(in oklab, black 22%, var(--accent)), transparent 70%),
    var(--accent);
}
.tete--grande { padding-bottom: 76px; }
.tete__haut { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.marque { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.9375em; text-decoration: none; min-width: 0; }
.marque__logo {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.2); font-size: 13px; font-weight: 600; overflow: hidden;
}
.marque__logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.marque__nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.retour { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 0.9375em; text-decoration: none; padding: 10px 0; }
.titre-tete { font-size: 2.1em; letter-spacing: -0.035em; line-height: 1.02; margin: 18px 0 0; font-weight: 600; }
.sous-tete { margin: 8px 0 0; font-size: 0.9375em; opacity: 0.88; }

.qui { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.qui > a {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; text-decoration: none;
  font-size: 0.875em; font-weight: 600; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  min-height: 40px;
}
.qui > a b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: rgba(255, 255, 255, 0.22); }
.qui > a[aria-current="page"] { background: rgba(255, 255, 255, 0.94); color: #17171a; }
.qui > a[aria-current="page"] b { background: var(--accent); color: var(--accent-encre); }

.grand-avatar {
  width: 84px; height: 84px; border-radius: 50%; margin: 22px 0 14px; display: grid; place-items: center;
  font-size: 30px; font-weight: 600; background: rgba(255, 255, 255, 0.22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}
.nom-personne { font-size: 2.1em; letter-spacing: -0.035em; margin: 0; font-weight: 600; line-height: 1.02; }
.verre {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); font-weight: 600; font-size: 0.875em;
}
.verre i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* La feuille posée sous l'en-tête */
.feuille {
  position: relative; margin-top: -44px; padding: 22px 16px 8px; border-radius: 32px 32px 0 0; background: var(--fond);
  animation: monter 700ms var(--ressort) both;
}
@keyframes monter { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.feuille--seule { margin-top: 0; border-radius: 0; }

.sous-titre {
  font-size: 1.0625em; font-weight: 600; letter-spacing: -0.02em; margin: 24px 4px 12px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.sous-titre:first-child { margin-top: 4px; }
.sous-titre a { font-size: 0.8125em; color: var(--accent); text-decoration: none; font-weight: 600; }
[data-theme="dark"] .sous-titre a { color: var(--encre); text-decoration: underline; }
.gris { color: var(--encre-3); font-size: 0.875em; line-height: 1.5; margin: 8px 4px 0; }

/* Les jours de la semaine */
.jours { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 4px 16px 8px; }
.jours::-webkit-scrollbar { display: none; }
.jour {
  flex: 0 0 auto; width: 64px; padding: 12px 0; border-radius: 22px; text-align: center; text-decoration: none;
  background: var(--surface); box-shadow: 0 0 0 1px var(--filet), var(--ombre);
}
.jour b { display: block; font-size: 0.75em; color: var(--encre-3); font-weight: 500; }
.jour strong { display: block; font-size: 1.25em; margin: 4px 0 6px; letter-spacing: -0.02em; }
.jour em { font-style: normal; font-size: 0.6875em; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--ok-fond); color: var(--ok); }
.jour em.a { background: var(--attention-fond); color: var(--attention); }
.jour em.n { background: var(--neutre-fond); color: var(--encre-2); }
.jour[aria-current="true"] { background: var(--encre); color: var(--fond); }
.jour[aria-current="true"] b { color: inherit; opacity: 0.75; }

/* Les listes à double cadre */
.liste { display: flex; flex-direction: column; gap: 2px; padding: 5px; border-radius: 28px; background: var(--coque); box-shadow: 0 0 0 1px var(--filet); }
.ligne {
  display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border-radius: 8px;
  text-decoration: none; min-height: 60px;
}
.ligne:first-child { border-radius: 23px 23px 8px 8px; }
.ligne:last-child { border-radius: 8px 8px 23px 23px; }
.ligne:only-child { border-radius: 23px; }
.ligne__ico {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in oklab, var(--accent) 13%, var(--surface)); color: var(--accent);
}
[data-theme="dark"] .ligne__ico { color: var(--encre); }
.ligne__txt { flex: 1; min-width: 0; }
.ligne__txt strong { display: block; font-weight: 600; font-size: 0.9375em; }
.ligne__txt span { font-size: 0.8125em; color: var(--encre-3); }
.fleche {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--coque); color: var(--encre-2); transition: transform 500ms var(--ressort);
}
a.ligne:hover .fleche { transform: translate(2px, -1px) scale(1.06); }

.puce {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.75em; font-weight: 600; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: var(--attention-fond); color: var(--attention);
}
.puce--ok { background: var(--ok-fond); color: var(--ok); }
.puce--neutre { background: var(--neutre-fond); color: var(--encre-2); }

.coque { padding: 5px; border-radius: 28px; background: var(--coque); box-shadow: 0 0 0 1px var(--filet); }
.coeur { border-radius: 23px; background: var(--surface); box-shadow: var(--reflet), var(--ombre); padding: 18px; }

/* Les messages */
.annonce { margin: 0 0 16px; padding: 14px 16px; border-radius: 18px; background: var(--surface); color: var(--encre); box-shadow: inset 4px 0 0 var(--accent), 0 0 0 1px var(--filet); }
.message { margin: 0 0 12px; padding: 12px 16px; border-radius: 18px; font-size: 0.9375em; background: var(--ok-fond); color: var(--encre); }
.message--warning { background: var(--attention-fond); }
.message--error { background: var(--danger-fond); }

/* Les boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px;
  font: inherit; font-weight: 600; font-size: 0.9375em; border: 0; cursor: pointer; text-decoration: none;
  padding: 6px 6px 6px 20px; border-radius: 999px; background: var(--encre); color: var(--fond);
  transition: transform 300ms var(--ressort);
}
.bouton:active { transform: scale(0.98); }
.bouton:focus-visible, .ligne:focus-visible, .jour:focus-visible, .onglets a:focus-visible, .module:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bouton__rond { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.15); transition: transform 500ms var(--ressort); }
.bouton:hover .bouton__rond { transform: translate(2px, -1px) scale(1.05); }
.bouton--plein { width: 100%; }
.bouton--accent { background: var(--accent); color: var(--accent-encre); }
.bouton--doux { background: var(--surface); color: var(--encre); box-shadow: 0 0 0 1px var(--filet), var(--ombre); }
.bouton--doux .bouton__rond { background: var(--coque); }
.bouton--danger { background: var(--danger); color: #fff; }
.bouton--simple { padding: 6px 20px; justify-content: center; }
.lien { color: var(--accent); font-weight: 600; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
[data-theme="dark"] .lien { color: var(--encre); text-decoration: underline; }

.collant {
  position: sticky; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 2; margin-top: 18px;
}

/* La carte de contact */
.contact {
  margin: 18px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 22px; background: var(--coque); box-shadow: 0 0 0 1px var(--filet); font-size: 0.875em;
}
.contact strong { display: block; font-weight: 600; }
.contact span { color: var(--encre-3); }

/* La barre en bas : une île de verre */
.onglets {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5;
  width: calc(100% - 24px); max-width: 496px;
  display: grid; grid-template-columns: repeat(var(--places, 5), 1fr); gap: 2px; padding: 6px;
  border-radius: 30px; background: color-mix(in oklab, var(--surface) 84%, transparent);
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 0 0 1px var(--filet), var(--ombre-haute);
}
.onglets a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; border-radius: 24px;
  color: var(--encre-3); text-decoration: none; min-height: 52px; justify-content: center;
  transition: background 500ms var(--ressort), color 500ms var(--ressort);
}
.onglets b { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; }
.onglets a[aria-current="page"] { color: var(--accent); background: color-mix(in oklab, var(--accent) 13%, transparent); }
[data-theme="dark"] .onglets a[aria-current="page"] { color: var(--encre); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .onglets a[aria-current="page"],
  :root:not([data-theme="light"]) .ligne__ico,
  :root:not([data-theme="light"]) .module__ico { color: var(--encre); }
  :root:not([data-theme="light"]) .lien,
  :root:not([data-theme="light"]) .sous-titre a { color: var(--encre); text-decoration: underline; }
}

/* « Plus » : les tuiles */
.modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.module {
  padding: 12px 10px 11px; border-radius: 22px; background: var(--surface); text-decoration: none;
  box-shadow: 0 0 0 1px var(--filet), var(--ombre); display: flex; flex-direction: column; gap: 2px; min-height: 108px;
}
.module__ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px;
  background: color-mix(in oklab, var(--accent) 13%, var(--surface)); color: var(--accent);
}
[data-theme="dark"] .module__ico { color: var(--encre); }
.module strong { font-size: 0.8125em; font-weight: 600; line-height: 1.2; }
.module span:not(.module__ico) { font-size: 0.6875em; color: var(--encre-3); line-height: 1.3; }

/* Repas : les options du jour */
.jour-carte { scroll-margin-top: 16px; margin: 18px 0; }
.jour-carte__titre { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 4px 10px; font-weight: 600; font-size: 1.0625em; letter-spacing: -0.02em; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 22px; background: var(--surface); box-shadow: 0 0 0 1px var(--filet), var(--ombre); cursor: pointer; }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option__rond { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; margin-top: 1px; box-shadow: inset 0 0 0 2px var(--encre-3); transition: box-shadow 300ms var(--ressort); }
.option:has(input:checked) { box-shadow: 0 0 0 2px var(--accent), var(--ombre); }
.option:has(input:checked) .option__rond { box-shadow: inset 0 0 0 7px var(--accent); }
.option:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.option:has(input:disabled) { opacity: 0.55; cursor: not-allowed; box-shadow: 0 0 0 1px var(--filet); }
.option strong { display: block; font-weight: 600; }
.option span.detail { display: block; font-size: 0.875em; color: var(--encre-2); margin-top: 3px; }
.option span.allergene { display: block; font-size: 0.8125em; color: var(--danger); margin-top: 4px; }
.option--absent { background: transparent; box-shadow: inset 0 0 0 1.5px var(--filet); }
.groupe-plats { border: 0; margin: 0 0 10px; padding: 0; }
.groupe-plats legend { font-size: 0.8125em; font-weight: 600; color: var(--encre-3); margin: 0 4px 6px; }

/* Absences : les cases */
.cases { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.case { position: relative; }
.case input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.case label, .case span.case__vide {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0; border-radius: 16px; min-height: 56px;
  font-weight: 600; background: var(--surface); box-shadow: 0 0 0 1px var(--filet); cursor: pointer; justify-content: center;
}
.case b { font-size: 0.625em; font-weight: 500; color: var(--encre-3); }
.case input:checked + label { background: var(--accent); color: var(--accent-encre); box-shadow: none; }
.case input:checked + label b { color: inherit; opacity: 0.8; }
.case input:disabled + label { cursor: not-allowed; opacity: 0.45; }
.case input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.case span.case__vide { opacity: 0.3; box-shadow: none; background: transparent; cursor: default; }

/* Réglages */
.reglage { margin-bottom: 22px; }
.reglage > label, .reglage > .etiquette { display: block; font-size: 0.8125em; font-weight: 600; color: var(--encre-3); margin: 0 0 8px 4px; }
.segments { display: flex; padding: 4px; border-radius: 999px; background: var(--coque); box-shadow: 0 0 0 1px var(--filet); }
.segments label { flex: 1; text-align: center; padding: 10px 6px; border-radius: 999px; font-size: 0.875em; font-weight: 600; color: var(--encre-3); cursor: pointer; min-height: 44px; display: grid; place-items: center; }
.segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments label:has(input:checked) { background: var(--surface); color: var(--encre); box-shadow: var(--ombre); }
.segments label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Les champs */
.champ {
  display: flex; align-items: center; gap: 10px; padding: 6px 18px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--filet), var(--ombre);
}
.champ input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--encre); padding: 12px 0; outline: none; }
/* L'anneau sur la pilule entière, jamais un carré dans la pilule. */
.champ:focus-within { box-shadow: 0 0 0 3px var(--accent), var(--ombre); }
.champ--code input { font-size: 1.9em; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; padding: 10px 0; }

/* Les pages sans compte (connexion, code, fermé) */
.porte { max-width: 440px; margin: 0 auto; min-height: 100dvh; padding: calc(28px + env(safe-area-inset-top)) 22px 40px; display: flex; flex-direction: column; }
.porte__milieu { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.sourcil { display: inline-block; width: max-content; font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; background: var(--coque); color: var(--encre-2); box-shadow: 0 0 0 1px var(--filet); }
.tres-grand { font-size: 2.5em; letter-spacing: -0.04em; line-height: 1.02; font-weight: 600; margin: 18px 0 12px; }
.porte p { color: var(--encre-2); margin: 0 0 22px; }
.porte form { display: flex; flex-direction: column; gap: 12px; }
.porte__pied { font-size: 0.8125em; color: var(--encre-3); text-align: center; margin-top: 28px; }

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