@font-face {
  font-family: "DM Serif Display";
  src: url("/fonts/DMSerifDisplay-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --fond: #faf6f0;
  --surface: #ffffff;
  --sable: #f3ece2;
  --bord: #e3d8c8;
  --texte: #1f2a2e;
  --doux: #5d6a6e;
  --teal: #1f4e5a;
  --terra: #b85c38;
  --terra-fonce: #9a4527;
  --sur-terra: #ffffff;
  --rayon: 12px;
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #141a1c;
    --surface: #1b2326;
    --sable: #232d30;
    --bord: #33403f;
    --texte: #ebe6de;
    --doux: #a9b3b3;
    --teal: #8cc4cf;
    --terra: #e08a63;
    --terra-fonce: #f0a47f;
    --sur-terra: #1b1310;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
img { max-width: 100%; height: auto; }
a { color: var(--terra-fonce); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--teal); line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin: .3rem 0 1rem; }
h2 { font-size: clamp(1.45rem, 3.4vw, 1.9rem); margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.25rem; margin: 1.6rem 0 .5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: .35rem; }
code { font-size: .92em; background: var(--sable); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }

.lien-evitement { position: absolute; left: -9999px; }
.lien-evitement:focus { left: 16px; top: 8px; background: var(--surface); padding: .5rem; z-index: 10; }

/* En-tête */
.entete { background: var(--surface); border-bottom: 1px solid var(--bord); }
.entete-in { max-width: 1080px; margin: 0 auto; padding: .7rem 16px; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; align-items: center; justify-content: space-between; }
.marque { font-family: var(--serif); font-size: 1.25rem; color: var(--teal); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.marque img { width: 28px; height: 28px; }
.nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .93rem; }
.nav a { color: var(--texte); text-decoration: none; padding: .25rem 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--terra-fonce); text-decoration: underline; text-underline-offset: 4px; }

/* Contenu */
main { max-width: 820px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.fil { font-size: .85rem; color: var(--doux); margin-bottom: .3rem; }
.fil a { color: var(--doux); }
.chapo { font-size: 1.12rem; color: var(--doux); }
.maj { font-size: .85rem; color: var(--doux); }

.encadre { background: var(--sable); border-radius: var(--rayon); padding: 1rem 1.2rem; margin: 1.4rem 0; }
.encadre > :last-child { margin-bottom: 0; }
.note { border-left: 4px solid var(--teal); background: var(--surface); padding: .8rem 1rem; border-radius: 0 var(--rayon) var(--rayon) 0; margin: 1.2rem 0; font-size: .95rem; }
.note > :last-child { margin-bottom: 0; }

/* Cartes et grilles */
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1rem 1.1rem; }
.carte h3 { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }
a.carte { display: block; color: inherit; text-decoration: none; }
a.carte:hover { border-color: var(--terra); }
a.carte span { color: var(--terra-fonce); font-weight: 600; }

.apercus { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin: 1rem 0 1.5rem; }
.apercus figure { margin: 0; }
.apercus img { display: block; border: 1px solid var(--bord); border-radius: 6px; background: #fff; }
.apercus figcaption { font-size: .82rem; color: var(--doux); margin-top: .3rem; text-align: center; }

/* Boutons */
.bouton { display: inline-block; background: var(--terra); color: var(--sur-terra); text-decoration: none; font-weight: 600; padding: .7rem 1.2rem; border-radius: 999px; border: 0; font-size: 1rem; cursor: pointer; font-family: inherit; }
.bouton:hover { background: var(--terra-fonce); }
.bouton.secondaire { background: transparent; color: var(--teal); border: 2px solid var(--teal); }
.bouton.secondaire:hover { background: var(--sable); }
.boutons { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }

/* Téléchargements gratuits */
.gratuit { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.gratuit .carte { display: flex; flex-direction: column; gap: .4rem; }
.gratuit .carte p { font-size: .95rem; }
.gratuit .bouton { align-self: flex-start; margin-top: auto; }
.format { font-size: .78rem; font-weight: 700; letter-spacing: .06em; color: var(--terra-fonce); text-transform: uppercase; }

/* Encart vers le modèle complet */
.cta { display: grid; grid-template-columns: 170px 1fr; gap: 1.3rem; align-items: start; background: var(--sable); border: 2px solid var(--terra); border-radius: 16px; padding: 1.3rem; margin: 2.5rem 0 1rem; }
.cta img { border-radius: 6px; border: 1px solid var(--bord); background: #fff; }
.cta h2 { margin: .1rem 0 .6rem; font-size: 1.5rem; }
.cta ul { padding-left: 1.1rem; font-size: .95rem; }
.cta .prix { font-weight: 700; color: var(--texte); }
.cta .petit { font-size: .82rem; color: var(--doux); margin: .8rem 0 0; }
.surtitre { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--terra-fonce); margin: 0; }

/* Check-list */
.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.checklist section { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .9rem 1.1rem; }
.checklist h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.checklist ul { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding-left: 1.7rem; font-size: .95rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .3em; width: .95rem; height: .95rem; border: 2px solid var(--teal); border-radius: 3px; }
.checklist .num { color: var(--terra-fonce); font-family: var(--serif); margin-right: .3rem; }

/* Tableaux */
.tableau { overflow-x: auto; margin: 1rem 0 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--surface); }
th, td { border: 1px solid var(--bord); padding: .55rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--sable); color: var(--teal); font-weight: 600; }
td[lang="en"] { font-style: italic; }

/* Générateur QR */
.outil { background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; padding: 1.2rem; margin: 1.2rem 0 2rem; display: grid; grid-template-columns: 1fr 260px; gap: 1.4rem; }
.outil label { display: block; font-weight: 600; font-size: .93rem; margin: .7rem 0 .25rem; }
.outil label:first-child { margin-top: 0; }
.outil input[type="text"], .outil input[type="password"], .outil select { width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--bord); border-radius: 8px; background: var(--fond); color: var(--texte); }
.outil .case { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.outil .aide { font-size: .82rem; color: var(--doux); margin: .2rem 0 0; }
.rendu { text-align: center; }
.rendu .qr { background: #fff; border-radius: 8px; padding: 6px; border: 1px solid var(--bord); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.rendu .qr svg { width: 100%; height: auto; display: block; }
.rendu .vide { color: #666; font-size: .9rem; padding: 1rem; }
.rendu .boutons { justify-content: center; }
.rendu .bouton { padding: .55rem .9rem; font-size: .9rem; }
.erreur { color: #b42318; font-size: .9rem; }
.carte-wifi { display: none; }

/* Pied de page */
.pied { border-top: 1px solid var(--bord); background: var(--surface); font-size: .88rem; color: var(--doux); }
.pied-in { max-width: 1080px; margin: 0 auto; padding: 1.4rem 16px; }
.pied a { color: var(--doux); }
.pied nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-bottom: .6rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .cta { grid-template-columns: 1fr; }
  .cta img { max-width: 160px; }
  .outil { grid-template-columns: 1fr; }
  .rendu { max-width: 280px; margin: 0 auto; width: 100%; }
  .nav { font-size: .88rem; }
  .empile table, .empile tbody, .empile tr, .empile td { display: block; width: 100%; }
  .empile thead { display: none; }
  .empile tr { border: 1px solid var(--bord); border-radius: 8px; margin-bottom: .8rem; overflow: hidden; }
  .empile td { border: 0; border-top: 1px solid var(--bord); }
  .empile td:first-child { border-top: 0; background: var(--sable); color: var(--teal); font-weight: 600; }
  .empile td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); }
}

/* Impression de la carte Wi-Fi (page /qr-code-wifi) */
@media print {
  @page { size: A5; margin: 12mm; }
  body { background: #fff; color: #000; }
  body.impression-wifi > *:not(.carte-wifi) { display: none !important; }
  body.impression-wifi .carte-wifi { display: block; text-align: center; font-family: system-ui, sans-serif; color: #000; }
  .carte-wifi h2 { font-family: var(--serif); color: #1f4e5a; font-size: 30pt; margin: 0 0 2mm; }
  .carte-wifi .nom { font-size: 14pt; margin: 0 0 6mm; }
  .carte-wifi .qr { width: 80mm; margin: 0 auto 6mm; }
  .carte-wifi .qr svg { width: 100%; height: auto; }
  .carte-wifi table { width: auto; margin: 0 auto 6mm; font-size: 13pt; }
  .carte-wifi th, .carte-wifi td { border: 1px solid #999; padding: 2mm 4mm; background: #fff; color: #000; font-style: normal; }
  .carte-wifi p { font-size: 11pt; margin: 0 0 2mm; }
}
