/* Repas — le planning aimanté de Thibault & Mila */

:root {
  --fond: #f6f3fc;
  --carte: #ffffff;
  --creux: #f1edf9;
  --encre: #1b1230;
  --encre-2: #6b6385;
  --encre-3: #a39cb8;
  --filet: #e9e4f5;
  --tomate: #ff4b2b;
  --tomate-fonce: #e63816;
  --mangue: #ff9f1c;
  --basilic: #0e9f5e;
  --thibault: #2563ff;
  --mila: #ff2d87;
  --ombre: 0 1px 2px rgb(27 18 48 / 0.05), 0 10px 28px -14px rgb(27 18 48 / 0.22);
  --ombre-forte: 0 -10px 40px -10px rgb(27 18 48 / 0.3);
  --rayon: 24px;
  --display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --texte: "Figtree", system-ui, -apple-system, sans-serif;
  --ressort: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --doux: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #110b1d;
    --carte: #1d1530;
    --creux: #271e3b;
    --encre: #f5f1ff;
    --encre-2: #aaa1c4;
    --encre-3: #6f6789;
    --filet: #2e2545;
    --tomate: #ff6147;
    --tomate-fonce: #ff4b2b;
    --basilic: #34d399;
    --thibault: #5b8cff;
    --mila: #ff5aa5;
    --ombre: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 30px -16px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--texte);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--thibault) 60%, transparent); outline-offset: 2px; }
svg { display: block; }

/* ---------- Marque ---------- */
.marque {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.03em;
}
.marque-point { color: var(--tomate); }
.marque-grande { font-size: clamp(64px, 22vw, 96px); line-height: 0.9; letter-spacing: -0.05em; }

/* ---------- Écrans plein cadre (accès, choix) ---------- */
.ecran-plein {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
  background: var(--tomate);
  color: #fff;
}
.ecran-plein .marque-point { color: var(--encre); }
.accueil { width: min(100%, 380px); }
.accueil-texte { font-size: 19px; margin: 12px 0 40px; opacity: 0.92; }
.accueil-form { display: grid; gap: 10px; }
.accueil-label { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.accueil-champ {
  height: 56px;
  border-radius: 18px;
  border: 2px solid rgb(255 255 255 / 0.35);
  background: rgb(255 255 255 / 0.16);
  color: #fff;
  padding: 0 18px;
  font-size: 20px;
  letter-spacing: 0.1em;
}
.accueil-champ:focus { outline: none; border-color: #fff; background: rgb(255 255 255 / 0.24); }
.accueil-erreur { min-height: 20px; margin: 0; font-weight: 600; }

.bouton {
  height: 56px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 17px;
  transition: transform 160ms var(--doux), filter 160ms;
}
.bouton:active { transform: scale(0.97); }
.bouton-blanc { background: #fff; color: var(--tomate-fonce); box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.35); }
.bouton-tomate { background: var(--tomate); color: #fff; width: 100%; }
.bouton-ligne { background: var(--creux); color: var(--encre); width: 100%; }

.ecran-qui { background: var(--fond); color: var(--encre); }
.ecran-qui .marque-point { color: var(--tomate); }
.qui-titre { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 28px 0 20px; }
.qui-choix { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qui-bouton {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 28px 12px 22px;
  border-radius: var(--rayon);
  background: var(--carte);
  box-shadow: var(--ombre);
  font-weight: 700;
  font-size: 18px;
  transition: transform 180ms var(--ressort);
}
.qui-bouton:active { transform: scale(0.95); }

/* ---------- Aimants (signature) ---------- */
.aimant {
  --couleur: var(--thibault);
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.45), transparent 42%),
    var(--couleur);
  box-shadow:
    inset 0 -3px 0 rgb(0 0 0 / 0.18),
    0 3px 8px -2px color-mix(in srgb, var(--couleur) 70%, transparent);
  transition: transform 220ms var(--ressort), background 200ms, box-shadow 200ms;
  flex: none;
}
.aimant-thibault { --couleur: var(--thibault); }
.aimant-mila { --couleur: var(--mila); }
.aimant-xl { width: 76px; height: 76px; font-size: 34px; }
.aimant .icone-mallette { display: none; width: 18px; height: 18px; }
.aimant[aria-pressed="false"] {
  background: transparent;
  color: var(--couleur);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--couleur) 55%, transparent);
  border: 0;
}
.aimant[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed var(--couleur);
  opacity: 0.55;
}
.aimant[aria-pressed="false"] .aimant-lettre { display: none; }
.aimant[aria-pressed="false"] .icone-mallette { display: block; }
button.aimant:active { transform: scale(0.88); }
.aimant.pose { animation: pose 380ms var(--ressort); }
@keyframes pose {
  0% { transform: scale(0.7) rotate(-12deg); }
  60% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- En-tête du planning ---------- */
.entete {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
  background: color-mix(in srgb, var(--fond) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--filet) 70%, transparent);
}
.entete-haut { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.entete-actions { display: flex; align-items: center; gap: 10px; }
.bouton-profil { border-radius: 50%; }
.bouton-profil .aimant { width: 36px; height: 36px; font-size: 15px; }
.entete-semaine { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.titre-semaine {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 7vw, 30px);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.nav-semaine { display: flex; align-items: center; gap: 6px; }
.bouton-rond {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--carte);
  box-shadow: var(--ombre);
  transition: transform 160ms var(--doux);
}
.bouton-rond:active { transform: scale(0.9); }
.bouton-rond svg { width: 20px; height: 20px; }
.bouton-rond-petit { width: 34px; height: 34px; box-shadow: none; background: var(--creux); }
.pastille-auj {
  height: 32px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--tomate);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.bande-jours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; }
.puce-jour {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 0 8px;
  border-radius: 14px;
  background: var(--carte);
  box-shadow: 0 1px 2px rgb(27 18 48 / 0.05);
  transition: transform 160ms var(--doux);
}
.puce-jour:active { transform: scale(0.94); }
.puce-lettre { font-size: 11px; font-weight: 700; color: var(--encre-2); text-transform: uppercase; letter-spacing: 0.06em; }
.puce-num { font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1; }
.puce-points { display: flex; gap: 3px; }
.puce-point { width: 6px; height: 6px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--encre-3); }
.puce-point.rempli { background: var(--tomate); box-shadow: none; }
.puce-point.libre { box-shadow: none; background: var(--filet); }
.puce-jour.aujourdhui { background: var(--tomate); color: #fff; }
.puce-jour.aujourdhui .puce-lettre { color: rgb(255 255 255 / 0.85); }
.puce-jour.aujourdhui .puce-point { box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.8); }
.puce-jour.aujourdhui .puce-point.rempli { background: #fff; }
.puce-jour.aujourdhui .puce-point.libre { background: rgb(255 255 255 / 0.3); box-shadow: none; }

/* ---------- Jours ---------- */
.contenu { padding: 14px 16px calc(env(safe-area-inset-bottom) + 32px); max-width: 640px; margin: 0 auto; }
.astuce { margin: 0 4px 12px; font-size: 13px; color: var(--encre-2); }
.liste-jours { display: grid; gap: 14px; }
.liste-jours.glisse-g { animation: glisse-g 280ms var(--doux); }
.liste-jours.glisse-d { animation: glisse-d 280ms var(--doux); }
@keyframes glisse-g { from { opacity: 0; transform: translateX(-24px); } }
@keyframes glisse-d { from { opacity: 0; transform: translateX(24px); } }

.jour {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 16px 16px 6px;
  scroll-margin-top: 190px;
}
.jour.passe { opacity: 0.62; }
.jour.aujourdhui { box-shadow: var(--ombre), inset 0 0 0 2px var(--tomate); }
.jour-tete { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.jour-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 40px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.jour.aujourdhui .jour-num { color: var(--tomate); }
.jour-nom { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; text-transform: capitalize; }
.jour-badge {
  margin-left: auto;
  align-self: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--tomate);
  background: color-mix(in srgb, var(--tomate) 12%, transparent);
  padding: 4px 10px;
  border-radius: 99px;
}

.creneau { padding: 12px 0 14px; }
.creneau + .creneau { border-top: 1px solid var(--filet); }
.creneau-ligne { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.moment { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.moment svg { width: 18px; height: 18px; color: var(--mangue); }
.moment-soir svg { color: #7c5cff; }
.aimants { display: flex; gap: 8px; margin-left: auto; }

.champ { position: relative; display: flex; align-items: center; }
.plat {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--creux);
  padding: 0 58px 0 16px;
  font-size: 17px;
  font-weight: 600;
  transition: box-shadow 160ms, background 160ms;
}
.plat::placeholder { color: var(--encre-3); font-weight: 500; }
.plat:focus { outline: none; background: var(--carte); box-shadow: inset 0 0 0 2px var(--tomate); }
.plat.erreur { box-shadow: inset 0 0 0 2px var(--tomate); }
.plat.enregistre { animation: enregistre 700ms var(--doux); }
@keyframes enregistre {
  30% { box-shadow: inset 0 0 0 2px var(--basilic); }
}
.bouton-idee {
  position: absolute;
  right: 6px;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--tomate), var(--mangue));
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--tomate) 80%, transparent);
  transition: transform 180ms var(--ressort);
}
.bouton-idee:active { transform: scale(0.88) rotate(-8deg); }
.bouton-idee svg { width: 20px; height: 20px; }
.auteur { margin: 6px 4px 0; font-size: 12px; font-weight: 600; color: var(--encre-2); }
.auteur-mila { color: var(--mila); }
.auteur-thibault { color: var(--thibault); }
.personne-maison {
  display: none;
  height: 52px;
  align-items: center;
  padding: 0 16px;
  border-radius: 16px;
  border: 1.5px dashed var(--filet);
  color: var(--encre-2);
  font-size: 15px;
}
.creneau.absents .champ, .creneau.absents .auteur { display: none; }
.creneau.absents .personne-maison { display: flex; }

.resume { text-align: center; color: var(--encre-2); font-size: 14px; margin: 22px 0 0; }

/* ---------- Feuille ---------- */
.voile {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgb(17 11 29 / 0.42);
  opacity: 0;
  transition: opacity 240ms var(--doux);
}
.voile.visible { opacity: 1; }
.feuille {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-width: 640px;
  margin: 0 auto;
  max-height: 88dvh;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--carte);
  border-radius: 30px 30px 0 0;
  box-shadow: var(--ombre-forte);
  padding: 8px 18px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(100%);
  transition: transform 300ms var(--doux);
}
.feuille.visible { transform: none; }
.feuille-poignee { width: 40px; height: 5px; border-radius: 99px; background: var(--filet); margin: 0 auto 10px; }
.feuille-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.feuille-titre { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: -0.03em; }
.feuille-sous { margin: -8px 0 16px; color: var(--encre-2); font-size: 14px; }
.feuille-corps { display: grid; gap: 12px; }

.idee {
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 16px;
  border-radius: 20px;
  background: var(--creux);
  transition: transform 180ms var(--ressort), background 160ms;
}
.idee:active { transform: scale(0.97); }
.idee-haut { display: flex; align-items: flex-start; gap: 10px; }
.idee-nom { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; line-height: 1.15; flex: 1; }
.idee-desc { color: var(--encre-2); font-size: 15px; }
.idee-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--encre-2); }
.idee-meta svg { width: 15px; height: 15px; }
.etiquette { flex: none; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; }
.etiquette-classique { color: var(--basilic); background: color-mix(in srgb, var(--basilic) 14%, transparent); }
.etiquette-nouveau { color: #7c5cff; background: color-mix(in srgb, #7c5cff 14%, transparent); }
.squelette {
  height: 96px;
  border-radius: 20px;
  background: linear-gradient(100deg, var(--creux) 30%, color-mix(in srgb, var(--creux) 50%, var(--carte)) 50%, var(--creux) 70%) 0 0 / 300% 100%;
  animation: brille 1.3s linear infinite;
}
@keyframes brille { to { background-position: -150% 0; } }
.message-erreur { margin: 0; padding: 16px; border-radius: 16px; background: color-mix(in srgb, var(--tomate) 10%, transparent); color: var(--tomate-fonce); font-weight: 600; }

/* Profil */
.bloc { display: grid; gap: 10px; padding: 16px; border-radius: 20px; background: var(--creux); }
.bloc-titre { margin: 0; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.bloc-titre .aimant { width: 28px; height: 28px; font-size: 13px; }
.bloc-texte { margin: 0; color: var(--encre-2); font-size: 14px; }
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--carte); }
.segment button { height: 40px; border-radius: 11px; font-weight: 700; color: var(--encre-2); }
.segment button[aria-pressed="true"] { background: var(--encre); color: var(--carte); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 6px 0 12px;
  border-radius: 99px;
  background: var(--carte);
  font-weight: 600;
  font-size: 14px;
}
.chip button { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--encre-2); }
.chip svg { width: 14px; height: 14px; }
.ajout { display: flex; gap: 8px; }
.ajout input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--carte);
  padding: 0 14px;
  font-size: 16px;
}
.ajout input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--tomate); }
.ajout button { height: 44px; padding: 0 16px; border-radius: 12px; background: var(--encre); color: var(--carte); font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  z-index: 30;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 140%);
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--encre);
  color: var(--fond);
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--ombre);
  transition: transform 280ms var(--ressort);
  pointer-events: none;
}
.toast.visible { transform: translate(-50%, 0); }

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