/* ==========================================================================
   tools.paulmunoz.fr - feuille de style (même base que paulmunoz.fr)
   1. Polices  2. Couleurs  3. Base  4. En-tête  5. Composants
   6. Pages    7. Pied de page  8. Mobile  9. Animations réduites
   ========================================================================== */

/* 1. Polices (hébergées sur le site, licences dans assets/fonts/) */
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("../assets/fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("../assets/fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("../assets/fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("../assets/fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("../assets/fonts/nunito-latin-800-normal.woff2") format("woff2"); }

/* 2. Couleurs */
:root {
  --bg: #F7FBFF; --surf: #FFFFFF; --ink: #1C3552; --soft: #486180; --line: #D9EAF8;
  --blue: #1F66AD; --onblue: #FFFFFF;
  /* Nuances d'un même bleu, pour les fonds */
  --sky: #D2EAFD; --cream: #E8F4FE; --mint: #DEF0FD; --peach: #C3E2FB; --lilac: #E0ECFB;
  --dash: #B7D3EC; --shadow: #1C3552;
  --title: "Fredoka", ui-rounded, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1A27; --surf: #18273A; --ink: #F0F7FF; --soft: #B8CBE0; --line: #2F455F;
    --blue: #93CCFF; --onblue: #0F1A27;
    --sky: #213C59; --cream: #192F47; --mint: #1D3650; --peach: #284869; --lilac: #223954;
    --dash: #3C5878; --shadow: #000000;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .round img { filter: brightness(0) invert(1); }
}
:root[data-theme="dark"] {
  --bg: #0F1A27; --surf: #18273A; --ink: #F0F7FF; --soft: #B8CBE0; --line: #2F455F;
  --blue: #93CCFF; --onblue: #0F1A27;
  --sky: #213C59; --cream: #192F47; --mint: #1D3650; --peach: #284869; --lilac: #223954;
  --dash: #3C5878; --shadow: #000000;
  color-scheme: dark;
}
:root[data-theme="dark"] .round img { filter: brightness(0) invert(1); }

/* 3. Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 18px/1.65 var(--body); overflow-wrap: break-word; }
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--title); font-weight: 600; line-height: 1.18; }
h1 { font-weight: 700; font-size: clamp(40px, 6vw, 70px); line-height: 1.08; }
h2 { font-size: clamp(30px, 4vw, 40px); }
h3 { font-size: 26px; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
section[id], article[id] { scroll-margin-top: 16px; }

/* Pleine largeur : seule la marge latérale s'adapte à l'écran. */
.wrap { width: 100%; padding-inline: clamp(24px, 3.5vw, 88px); }
.stack { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.soft { color: var(--soft); }
.skip { position: absolute; left: 16px; top: -80px; z-index: 20; padding: 12px 20px; border-radius: 24px; background: var(--ink); color: var(--bg); font-weight: 800; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html:not(.js) .needs-js { display: none !important; }

/* 4. En-tête */
body { min-height: 100vh; display: flex; flex-direction: column; }

/* 4. En-tête (celui de paulmunoz.fr) */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding-block: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 48px; text-decoration: none; font: 600 25px var(--title); }
.brand img { width: 32px; height: 58px; object-fit: contain; }
.menu { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; background: var(--surf); border: 2px solid var(--ink); border-radius: 30px; }
.menu a { display: flex; align-items: center; min-height: 40px; padding: 0 15px; border-radius: 20px; font-size: 16px; font-weight: 800; text-decoration: none; }
.menu a:hover { background: var(--sky); }
.menu a[aria-current] { background: var(--blue); color: var(--onblue); }
.tools-bar { display: flex; gap: 8px; }
.round { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0; background: var(--surf); border: 2px solid var(--ink); border-radius: 50%; font-size: 22px; }
.round img { width: 20px; height: 20px; }
.burger { display: none; }
@media (min-width: 1001px) {
  /* Menu centré sur l'écran, quelle que soit la largeur du logo et des boutons */
  .site .top { display: grid; grid-template-columns: 1fr auto 1fr; }
  .site .tools-bar { justify-self: end; }
}

/* 5. Composants */
main { flex: 1 0 auto; }
.page { display: flex; flex-direction: column; gap: 20px; padding-block: 20px 40px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 6px 22px; background: var(--surf); border: 2px solid var(--ink); border-radius: 26px; font-weight: 800; text-align: center; text-decoration: none; }
.btn:hover { box-shadow: 0 3px 0 var(--shadow); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--blue { background: var(--blue); color: var(--onblue); border-color: var(--blue); }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.retour { align-self: flex-start; min-height: 44px; font-size: 15px; }
.boite { min-width: 0; padding: clamp(18px, 2.5vw, 30px); background: var(--surf); border: 2px solid var(--line); border-radius: 22px; }
.note { padding: 14px 18px; background: var(--sky); border-radius: 16px; }

/* 6. Pages : messages centrés (téléchargements, atelier, recherche vide) et page « introuvable » */
.lost { max-width: 760px; align-items: center; text-align: center; margin-inline: auto; padding-block: 24px 48px; }
.lost img { height: 320px; width: auto; }
.lost .btns { justify-content: center; }
.centre { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding-block: 12px; }
.centre img { width: auto; height: 270px; }
.centre .bulle { margin-top: 4px; }
.centre h2.bulle { font-size: 21px; }

/* Mentions légales (celles de paulmunoz.fr) */
/* Mentions légales */
.legal { display: flex; flex-direction: column; gap: 16px; padding-block: 16px 48px; }
.legal > p, .legal > nav, .legal > section { width: 100%; max-width: 900px; margin-inline: auto; }
.legal > h1 { width: 100%; max-width: 900px; margin-inline: auto; font-size: clamp(34px, 5vw, 56px); }
.legal section { display: flex; flex-direction: column; gap: 12px; padding: clamp(20px, 3vw, 36px); background: var(--surf); border: 2px solid var(--ink); border-radius: 28px; }
.legal section h2 { font-size: clamp(26px, 3vw, 34px); }
.legal section h3 { margin-top: 10px; font-size: 21px; }
.legal ul { margin: 0; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal address { font-style: normal; }
.legal code { padding: 1px 7px; background: var(--cream); border-radius: 6px; }
.legal a { overflow-wrap: anywhere; }
.legal__toc { display: flex; flex-wrap: wrap; gap: 8px; }
.legal ul.legal__toc { padding: 0; list-style: none; }
.legal__toc a { display: flex; align-items: center; min-height: 44px; padding: 0 18px; background: var(--sky); border-radius: 22px; font-weight: 800; text-decoration: none; }
.credit { font-size: 14px; color: var(--soft); }
/* Téléchargements : une fiche par logiciel (modèle dans le README) */
.logiciels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.logiciel { height: 100%; gap: 8px; }

/* 7. Pied de page (celui de paulmunoz.fr) */
.foot { font-size: 16px; margin-top: 16px; }
.foot__miis { display: flex; justify-content: flex-end; align-items: flex-end; gap: 12px; height: 96px; padding-right: 16px; }
.foot__miis img { width: auto; height: 66px; }
.foot__miis img:nth-child(2) { height: 92px; }
.foot__miis img:nth-child(3) { height: 82px; }
.foot__grid { display: flex; flex-wrap: wrap; gap: 32px; padding-block: 32px; border-top: 3px solid var(--ink); }
.foot__grid > * { flex: 1 1 160px; }
.foot__grid > :first-child { flex: 2 1 260px; }
.foot__grid strong.logo { display: block; font: 600 28px var(--title); }
.foot nav, .foot .col { display: flex; flex-direction: column; align-items: flex-start; }
.foot nav a, .foot .col a { padding-block: 8px; }
.foot__end { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 28px; font-size: 15px; }
.pause { min-height: 44px; padding: 0 18px; background: var(--surf); border: 2px solid var(--ink); border-radius: 22px; font-weight: 800; }
.burger { display: none; }
footer .foot__legal { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0 24px; padding-block: 4px 8px; border-top: 1px solid var(--line); }
.foot__legal a { display: inline-block; padding-block: 12px; font-weight: 800; }

/* Le Mii assis se tient sur le bord d'une boîte : le bord du haut passe sous ses cuisses (à 80 % de la hauteur de l'image). */
.siege { --h: 270px; display: flex; flex-direction: column; align-items: center; max-width: 620px; margin-inline: auto; }
.siege > img { position: relative; z-index: 1; width: auto; height: var(--h); margin-bottom: calc(var(--h) * -0.2); }
.siege__boite { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; padding-top: calc(var(--h) * 0.2 + 22px); text-align: center; border-color: var(--ink); }

/* Bulle de parole : par défaut, le Mii est à gauche ; « --haut » quand il est au-dessus. */
.bulle { position: relative; padding: 12px 18px; background: var(--surf); border: 2px solid var(--ink); border-radius: 20px; }
.bulle::before { content: ""; position: absolute; left: -9px; top: calc(50% - 8px); width: 16px; height: 16px; background: var(--surf); border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
.bulle--haut::before { left: calc(50% - 8px); top: -9px; transform: rotate(135deg); }
.presente { display: flex; align-items: center; gap: 22px; }
.presente img { flex: none; width: auto; height: 170px; }
.presente .bulle { max-width: 620px; font-size: 19px; font-weight: 700; }

/* 8. Écran de chargement */

/* Écran de chargement : n'apparaît que si la page met plus de 0,3 s, et disparaît au plus tard après 5 s. */
.loader { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--bg); font: 600 24px var(--title); opacity: 0; visibility: hidden; animation: loader-in .2s .3s forwards, loader-out .3s 5s forwards; }
.js .loader { display: flex; }
.loader.leaving { animation: loader-out .25s forwards; }
.loader img { width: auto; height: 132px; }
.loader i { width: 180px; height: 14px; overflow: hidden; border: 2px solid var(--ink); border-radius: 10px; background: var(--surf); }
.loader i::after { content: ""; display: block; width: 40%; height: 100%; background: var(--blue); animation: loader-bar 1s ease-in-out infinite alternate; }
@keyframes loader-in { to { opacity: 1; visibility: visible; } }
@keyframes loader-out { from { opacity: 1; visibility: visible; } to { opacity: 0; visibility: hidden; } }
@keyframes loader-bar { from { transform: translateX(0); } to { transform: translateX(150%); } }

/* Les Mii posent leurs pieds sur un sol : une petite ombre ovale sous eux, comme sur les autres sites. */
.presente img, .centre img, .bravo img { display: block; padding-bottom: 9px; box-sizing: content-box; background: radial-gradient(ellipse closest-side at 50% 50%, rgba(28, 53, 82, .30), rgba(28, 53, 82, 0)) no-repeat 50% 100% / 78% 18px; }
.presente { align-items: flex-end; }
.presente .bulle { align-self: center; }

/* 9. Petits écrans */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 18px; }
  .brand { font-size: 20px; }
  .brand img { height: 48px; width: 27px; }
  .presente { gap: 16px; }
  .presente img { height: 128px; }
  .presente .bulle { font-size: 16px; padding: 10px 14px; }
  .centre img { height: 220px; }
  .lost img { height: 240px; }
  .siege { --h: 220px; }
}

/* Menu burger : téléphones (portrait et paysage) et petites tablettes. */
@media (max-width: 1000px) {
  :root { --bar: 70px; }
  .menu { display: none; }
  /* L'en-tête reste en haut : le menu est toujours à portée. La page hors ligne n'est pas concernée. */
  .site { position: sticky; top: 0; z-index: 30; background: var(--bg); box-shadow: 0 2px 0 var(--line); }
  .site .top { height: var(--bar); padding-block: 0; flex-wrap: nowrap; gap: 8px; }
  .site .brand { margin-right: auto; }
  .site .brand img { height: 46px; width: 26px; }
  section[id], article[id], .sheet { scroll-margin-top: calc(var(--bar) + 12px); }
  html:has(.burger[open]) { overflow: hidden; }
  .burger { display: block; }
  .burger summary { list-style: none; cursor: pointer; }
  .burger summary::-webkit-details-marker { display: none; }
  .burger[open] summary { background: var(--blue); color: var(--onblue); }
  .burger__icon { position: relative; width: 22px; height: 16px; }
  .burger__icon i { position: absolute; left: 0; width: 22px; height: 3px; border-radius: 2px; background: currentColor; transition: transform .18s, top .18s, opacity .18s; }
  .burger__icon i:nth-child(1) { top: 0; }
  .burger__icon i:nth-child(2) { top: 6.5px; }
  .burger__icon i:nth-child(3) { top: 13px; }
  .burger[open] .burger__icon i:nth-child(1) { top: 6.5px; transform: rotate(45deg); }
  .burger[open] .burger__icon i:nth-child(2) { opacity: 0; }
  .burger[open] .burger__icon i:nth-child(3) { top: 6.5px; transform: rotate(-45deg); }
  .burger__panel { position: absolute; top: 100%; left: 0; right: 0; height: calc(100vh - var(--bar)); height: calc(100dvh - var(--bar)); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 24px; padding: 18px 18px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 2px solid var(--ink); }
  .burger__panel > * { width: 100%; max-width: 560px; margin-inline: auto; }
  .burger__panel ul { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
  .burger__panel li a { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 6px 22px; background: var(--surf); border: 2px solid var(--ink); border-radius: 22px; font: 600 22px var(--title); text-decoration: none; }
  .burger__panel li a[aria-current] { background: var(--blue); color: var(--onblue); box-shadow: 4px 4px 0 var(--shadow); }
  .burger__out strong { display: block; margin-bottom: 8px; }
  .burger__out > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .burger__out a { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 4px 8px; background: var(--sky); border-radius: 18px; font-size: 15px; font-weight: 800; text-align: center; text-decoration: none; }
  .burger__out a:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 1000px) and (max-height: 760px) {
  /* Écrans peu hauts : on resserre pour tout afficher sans défiler. */
  .burger__panel { gap: 16px; padding-top: 14px; }
  .burger__panel ul { gap: 8px; }
  .burger__panel li a { min-height: 50px; font-size: 20px; }
  .burger__out > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .burger__out a:last-child:nth-child(odd) { grid-column: auto / span 2; }
}
@media (max-width: 1000px) and (max-height: 520px) {
  /* Téléphone à l'horizontale : les pages se répartissent sur deux colonnes. */
  .burger__panel { gap: 14px; padding-top: 12px; }
  .burger__panel ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .burger__panel li a { min-height: 50px; font-size: 19px; }
  .burger__out > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .burger__out a:last-child:nth-child(odd) { grid-column: auto; }
}

/* Animations réduites */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .loader i::after { width: 100%; animation: none; }
}
