@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  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: "Archivo";
  src: url("/fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --platre: #ECEEEA;
  --papier: #FAFBF8;
  --encre: #18202E;
  --encre-2: #4A5363;
  --trait: #CDD2CB;
  --trait-fort: #9AA19A;
  --eteint: #DEE2DC;
  --f1: #2C4C9C; --f1-sur: #FFFFFF; --f1-doux: #DCE3F4;
  --f2: #C98A12; --f2-sur: #18202E; --f2-doux: #F5E7C8;
  --f3: #2F6F4E; --f3-sur: #FFFFFF; --f3-doux: #D6EADF;
  --alerte: #9C2F2C;
  --rayon-s: 6px;
  --rayon-m: 10px;
  --focus: #2C4C9C;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --platre: #121722; --papier: #1A2030; --encre: #E8EAE4; --encre-2: #A9B0BC;
    --trait: #2C3446; --trait-fort: #4B5468; --eteint: #222A3B;
    --f1: #8AA4EA; --f1-sur: #121722; --f1-doux: #26324F;
    --f2: #E4B04A; --f2-sur: #121722; --f2-doux: #3C3220;
    --f3: #74C197; --f3-sur: #121722; --f3-doux: #1F3A2D;
    --alerte: #EF8A84; --focus: #8AA4EA;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --platre: #121722; --papier: #1A2030; --encre: #E8EAE4; --encre-2: #A9B0BC;
  --trait: #2C3446; --trait-fort: #4B5468; --eteint: #222A3B;
  --f1: #8AA4EA; --f1-sur: #121722; --f1-doux: #26324F;
  --f2: #E4B04A; --f2-sur: #121722; --f2-doux: #3C3220;
  --f3: #74C197; --f3-sur: #121722; --f3-doux: #1F3A2D;
  --alerte: #EF8A84; --focus: #8AA4EA;
  color-scheme: dark;
}

[data-etage="1"] { --c: var(--f1); --c-sur: var(--f1-sur); --c-doux: var(--f1-doux); }
[data-etage="2"] { --c: var(--f2); --c-sur: var(--f2-sur); --c-doux: var(--f2-doux); }
[data-etage="3"] { --c: var(--f3); --c-sur: var(--f3-sur); --c-doux: var(--f3-doux); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--platre);
  color: var(--encre);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
h2 { font-size: 1.375rem; font-weight: 750; font-stretch: 112%; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saut { position: absolute; left: 1rem; top: -4rem; background: var(--encre); color: var(--platre); padding: .5rem .9rem; border-radius: var(--rayon-s); z-index: 10; }
.saut:focus { top: 1rem; }

/* ---------- en-tête : la plaque de rue */
.entete {
  display: flex; align-items: center; gap: .875rem;
  max-width: 72rem; margin: 0 auto;
  padding: 1.25rem 1rem .75rem;
}
.plaque {
  display: inline-grid; place-items: center;
  flex: none; min-width: 3.6rem; height: 2.6rem; padding: 0 .55rem;
  background: var(--encre); color: var(--platre);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px var(--encre), inset 0 0 0 4px var(--platre);
  font-weight: 800; font-stretch: 125%; font-size: 1.25rem; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.entete-texte { display: flex; flex-direction: column; line-height: 1.2; }
.entete-rue { font-size: .875rem; color: var(--encre-2); }
.entete-sujet { font-weight: 700; font-stretch: 112%; }

/* ---------- mise en page */
.mise-en-page {
  max-width: 72rem; margin: 0 auto; padding: 0 1rem 3rem;
  display: grid; gap: 1.25rem;
}
.colonne { display: grid; gap: 1.25rem; min-width: 0; }
@media (min-width: 60rem) {
  .mise-en-page { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: 2rem; align-items: start; padding-top: .5rem; }
  .bloc-immeuble { position: sticky; top: 1.25rem; }
  .colonne { max-width: 40rem; }
}

/* ---------- la coupe de l'immeuble */
.bloc-immeuble { min-width: 0; }
.coupe {
  background: var(--papier);
  border: 2px solid var(--encre);
  border-radius: var(--rayon-m) var(--rayon-m) 0 0;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.niveau {
  position: relative;
  display: flex; align-items: center;
  min-height: 3.25rem; padding: 0 1rem;
  border-bottom: 2px solid var(--encre);
  color: var(--encre-2);
  isolation: isolate;
}
.niveau:last-child { border-bottom: 0; }
.niveau-nom { font-weight: 650; font-stretch: 112%; font-size: .9375rem; position: relative; z-index: 2; }
.niveau-vous { margin-left: .5rem; font-size: .8125rem; font-weight: 600; padding: .05rem .45rem; border: 1.5px solid currentColor; border-radius: 999px; }
.escalier {
  position: absolute; right: 0; top: 0; bottom: 0; width: 42%;
  color: var(--trait-fort); z-index: 1;
}
.escalier.retourne { transform: scaleX(-1); right: auto; left: 58%; }
.niveau-rez { min-height: 3.75rem; background: repeating-linear-gradient(45deg, transparent 0 9px, var(--eteint) 9px 10px); }
.niveau-rez .porte { position: absolute; right: 1.25rem; bottom: 0; width: 1.6rem; height: 2.5rem; border: 2px solid var(--encre); border-bottom: 0; border-radius: 3px 3px 0 0; background: var(--papier); z-index: 2; }

.niveau.actif {
  min-height: 9.5rem; align-items: flex-end;
  padding-bottom: 1rem;
  color: var(--c-sur);
}
.niveau.actif::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--c);
  transform-origin: left center;
}
.niveau.actif .escalier { color: color-mix(in srgb, var(--c-sur) 35%, transparent); }
.actif-titre { position: relative; z-index: 2; display: flex; align-items: flex-end; gap: .75rem; }
.chiffre {
  font-size: 6.5rem; line-height: .78; font-weight: 850; font-stretch: 125%;
  letter-spacing: -0.04em;
}
.chiffre sup { font-size: .32em; vertical-align: top; position: relative; top: .1em; letter-spacing: 0; margin-left: .04em; }
.actif-texte { display: flex; flex-direction: column; padding-bottom: .2rem; }
.actif-texte strong { font-size: 1.25rem; font-weight: 750; font-stretch: 112%; line-height: 1.1; }
.actif-texte span { font-size: .9375rem; opacity: .92; }

/* la minuterie : l'étage s'allume une fois au chargement */
@media (prefers-reduced-motion: no-preference) {
  .coupe.allumer .niveau.actif::before { animation: minuterie .7s cubic-bezier(.2,.7,.2,1) .15s both; }
  .coupe.allumer .niveau.actif .actif-titre { animation: apparait .45s ease-out .55s both; }
}
@keyframes minuterie { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }

.sous-coupe {
  background: var(--encre); color: var(--platre);
  border-radius: 0 0 var(--rayon-m) var(--rayon-m);
  padding: .9rem 1rem 1rem;
  display: grid; gap: .2rem;
}
.dates { font-weight: 650; font-stretch: 106%; }
.statut { color: color-mix(in srgb, var(--platre) 78%, transparent); font-size: .9375rem; }
.statut .ok { display: inline-flex; align-items: center; gap: .35rem; color: var(--platre); font-weight: 600; }
.statut .ok svg { flex: none; }

/* ---------- blocs */
.bloc {
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon-m);
  padding: 1.25rem 1rem;
  display: grid; gap: 1rem;
  scroll-margin-top: 1rem;
}
.bloc:focus { outline: none; }
@media (min-width: 30rem) { .bloc { padding: 1.5rem 1.5rem; } }
.bloc-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.avancement { color: var(--encre-2); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.consigne { color: var(--encre-2); font-size: .9375rem; max-width: 60ch; }
.consigne:empty { display: none; }

.note-qr {
  display: flex; gap: .875rem; align-items: flex-start;
  background: var(--platre); border-radius: var(--rayon-s); padding: .875rem 1rem;
  color: var(--encre); font-size: .9375rem;
}
.note-qr svg { flex: none; margin-top: .1rem; }

/* tâches */
.liste-taches { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--trait); counter-reset: t; }
.tache { border-bottom: 1px solid var(--trait); counter-increment: t; }
.tache label {
  display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; gap: .875rem; align-items: start;
  padding: .875rem .25rem; cursor: pointer;
}
.tache.lecture label { cursor: default; }
.tache input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.case {
  width: 1.75rem; height: 1.75rem; border-radius: 6px;
  border: 2px solid var(--trait-fort); background: var(--papier);
  display: grid; place-items: center;
  font-size: .8125rem; font-weight: 700; color: var(--encre-2); font-variant-numeric: tabular-nums;
  transition: background-color .15s, border-color .15s;
}
.case::before { content: counter(t); }
.case svg { display: none; }
.tache input:checked + .case { background: var(--c, var(--encre)); border-color: var(--c, var(--encre)); color: var(--c-sur, var(--papier)); }
.tache input:checked + .case::before { content: none; }
.tache input:checked + .case svg { display: block; }
.tache input:focus-visible + .case { outline: 3px solid var(--focus); outline-offset: 2px; }
.tache input:disabled + .case { opacity: .75; }
.tache-texte { padding-top: .1rem; }
.tache input:checked ~ .tache-texte { color: var(--encre-2); text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in srgb, var(--encre-2) 60%, transparent); }
.tache-duree { padding-top: .15rem; font-size: .875rem; color: var(--encre-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tache-qui { display: block; font-size: .8125rem; color: var(--encre-2); text-decoration: none; margin-top: .1rem; }
@media (hover: hover) { .tache:not(.lecture) label:hover .case { border-color: var(--c, var(--encre)); } }
@media (prefers-reduced-motion: no-preference) {
  .tache input:checked + .case svg path { stroke-dasharray: 20; animation: coche .25s ease-out both; }
}
@keyframes coche { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }

/* formulaire de validation */
.valider { display: grid; gap: .875rem; padding-top: .25rem; }
.champ { display: grid; gap: .35rem; }
.champ label { font-weight: 600; font-size: .9375rem; }
.champ .aide { font-weight: 400; color: var(--encre-2); }
.champ input, .champ textarea {
  width: 100%; border: 1.5px solid var(--trait-fort); border-radius: var(--rayon-s);
  background: var(--papier); padding: .7rem .8rem; font-size: 1rem;
}
.champ textarea { min-height: 4.5rem; resize: vertical; }
.champ input:focus, .champ textarea:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }
details.mot summary { cursor: pointer; color: var(--encre-2); font-size: .9375rem; width: fit-content; }
details.mot[open] summary { margin-bottom: .6rem; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.25rem;
  border-radius: var(--rayon-s); border: 2px solid var(--encre);
  background: var(--encre); color: var(--platre);
  font-weight: 700; font-stretch: 108%; text-decoration: none; cursor: pointer;
}
.bouton-principal { background: var(--c, var(--encre)); border-color: var(--c, var(--encre)); color: var(--c-sur, var(--platre)); width: 100%; font-size: 1.0625rem; }
.bouton-trait { background: transparent; color: var(--encre); }
.bouton[disabled] { opacity: .55; cursor: progress; }
@media (hover: hover) { .bouton:hover { filter: brightness(1.08); } .bouton-trait:hover { background: var(--platre); filter: none; } }
.lien-discret { background: none; border: 0; padding: .25rem 0; color: var(--encre-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .9375rem; justify-self: start; }
.erreur { color: var(--alerte); font-size: .9375rem; font-weight: 600; }

.fait {
  display: grid; gap: .5rem; padding: 1rem;
  border-radius: var(--rayon-s); background: var(--c-doux, var(--platre));
  border-left: 5px solid var(--c, var(--encre));
}
.fait strong { font-size: 1.125rem; font-stretch: 108%; }
.fait blockquote { margin: 0; color: var(--encre-2); font-style: italic; }

/* rattrapage semaine dernière */
.rattrapage {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  border: 1.5px dashed var(--trait-fort); border-radius: var(--rayon-m); padding: .875rem 1rem;
  font-size: .9375rem;
}
.rattrapage .bouton { min-height: 2.5rem; padding: .45rem .9rem; }

/* choix de l'étage */
.choix-etage { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.choix-etage button {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  min-height: 4.25rem; padding: .5rem;
  border: 2px solid var(--trait); border-radius: var(--rayon-s); background: var(--papier); cursor: pointer;
}
.choix-etage button .n { font-size: 1.75rem; font-weight: 850; font-stretch: 125%; line-height: 1; color: var(--c); }
.choix-etage button .n sup { font-size: .45em; }
.choix-etage button .l { font-size: .8125rem; color: var(--encre-2); }
.choix-etage button[aria-pressed="true"] { border-color: var(--c); background: var(--c); }
.choix-etage button[aria-pressed="true"] .n, .choix-etage button[aria-pressed="true"] .l { color: var(--c-sur); }
.mon-etage { display: grid; gap: .875rem; }
.prochain { font-size: 1.1875rem; font-weight: 650; font-stretch: 106%; line-height: 1.3; }
.ensuite { color: var(--encre-2); font-size: .9375rem; }
.agenda { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.agenda .petit { font-size: .875rem; color: var(--encre-2); }

/* listes de semaines */
.semaines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--trait); }
.semaine {
  display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto; gap: .75rem; align-items: center;
  padding: .7rem 0; border-bottom: 1px solid var(--trait);
}
.pastille {
  width: 2.25rem; height: 2.25rem; border-radius: 5px; display: grid; place-items: center;
  background: var(--c); color: var(--c-sur); font-weight: 850; font-stretch: 125%; font-size: 1.05rem;
}
.pastille sup { font-size: .55em; }
.semaine-dates { font-variant-numeric: tabular-nums; }
.semaine-etage { display: block; font-size: .875rem; color: var(--encre-2); }
.semaine-etat { font-size: .875rem; color: var(--encre-2); text-align: right; }
.semaine.vous .semaine-dates { font-weight: 700; }
.semaine.vous .semaine-etat { color: var(--encre); font-weight: 600; }
.semaine.en-cours { background: linear-gradient(90deg, var(--c-doux), transparent 85%); margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; }
.etat-ok { color: var(--encre); font-weight: 600; }

.pied { display: grid; gap: .75rem; padding: .5rem 0 0; }
.pied p { color: var(--encre-2); font-size: .9375rem; }
.pdfs { display: flex; flex-wrap: wrap; gap: .5rem; }
.noscript { max-width: 40rem; margin: 2rem auto; padding: 0 1rem; }

/* sélecteur de langue */
.langues { margin-left: auto; display: inline-flex; border: 1.5px solid var(--encre); border-radius: var(--rayon-s); overflow: hidden; flex: none; }
.langues button {
  min-width: 2.75rem; min-height: 2.5rem; padding: 0 .6rem; border: 0; background: transparent; cursor: pointer;
  font-weight: 700; font-stretch: 112%; font-size: .875rem; color: var(--encre);
}
.langues button + button { border-left: 1.5px solid var(--encre); }
.langues button[aria-pressed="true"] { background: var(--encre); color: var(--platre); }
.langues abbr { text-decoration: none; }
