/* ============================================================
   Essai de page d'accueil — Casa Felipe.

   Mesures relevées sur `home/new/homepage_modele.png` (1920×1080), pas
   estimées à l'œil : colonne de gauche 200 px fixes, décor 1720×680 collé
   en haut à droite, cadre des applications 160 px de haut posé au bas de
   l'image, trois cadres de 500×300 en dessous, barre de pied de 50 px.

   Objectif de tenue : sur un écran 1920×1080, TOUT est visible sans faire
   défiler. C'est ce qui fixe le budget vertical :
       680 (décor) + 14 + 300 (cadres) + 14 + 50 (pied) + marges ≈ 1064.
   La colonne de gauche ne bouge jamais ; c'est le décor qui rétrécit.
   ============================================================ */
:root {
  --fond:    #000f1d;          /* le fond de la page */
  --cadre:   #071a28;          /* l'intérieur des cadres */
  --contour: #1d3849;
  --trait:   3px;
  --texte:   #ffffff;
  --doux:    #9fb3c6;          /* texte secondaire, lisible sans crier */
  --col:     200px;            /* largeur FIXE de la colonne de gauche */
  --gapx:    10px;
  --gapy:    14px;
  --carre-l: 500px;
  --carre-h: 300px;
  --appl-h:  118px;
  --pied-h:  50px;
  /* Le cadre des applications et le groupe des trois carrés partagent la
     même largeur et le même axe : c'est ce qui aligne toute la page. */
  --large:   calc(var(--carre-l) * 3 + var(--gapx) * 2);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ---------- charpente ---------- */
#page {
  display: grid;
  grid-template-columns: var(--col) 1fr;
  grid-template-areas:
    "colonne decor"
    "colonne trois"
    "pied    pied";
  column-gap: var(--gapx);
  row-gap: var(--gapy);
  padding: 8px;
  align-content: start;
}

/* ---------- colonne de gauche ----------
   Largeur fixe : elle ne suit pas la fenêtre. Un raccourci qui se déplace à
   chaque redimensionnement n'est plus un repère. */
#colonne {
  grid-area: colonne;
  background: var(--cadre);
  border: var(--trait) solid var(--contour);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 22px;
}

#drapeaux { display: flex; gap: 10px; justify-content: center; }
.lang { padding: 0; border: 0; background: none; cursor: pointer; line-height: 0;
  opacity: .5; transition: opacity .15s ease, transform .15s ease; }
.lang img { width: 40px; height: auto; display: block; }
.lang:hover { transform: translateY(-2px); opacity: .85; }
/* La langue active est pleinement éclairée : c'est le seul repère, il n'y a
   pas de cadre pour la signaler. */
.lang[aria-pressed="true"] { opacity: 1; }

/* Raccourcis SANS cadre : l'icône, le texte, rien d'autre. */
#liens { display: flex; flex-direction: column; gap: 2px; }
#liens a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px;
  color: var(--texte); text-decoration: none;
  font-size: 12.5px; font-weight: 600; line-height: 1.2;
  transition: color .14s ease;
}
#liens a:hover { color: #8fd0ff; }
#liens .i { font-size: 14px; line-height: 1; flex: none; width: 20px; text-align: center; }
.contact {
  display: flex; align-items: center; gap: 9px; padding: 8px 6px;
  color: var(--texte); border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.2; text-align: left;
}
.contact:hover { color: #8fd0ff; }
.contact .i { font-size: 14px; line-height: 1; flex: none; width: 20px; text-align: center; }

/* ---------- le décor ----------
   ⚠️ On ne le recadre JAMAIS : l'enseigne au néon est posée en pourcentages
   de l'image, un recadrage la ferait dériver de la porte qu'elle désigne.
   Il occupe toute la largeur restante à son rapport 1720×680 — c'est donc
   lui qui rétrécit quand la fenêtre rétrécit. */
#decor {
  grid-area: decor; position: relative;
  aspect-ratio: 1720 / 680;
  overflow: hidden;
}
#fond { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* L'enseigne : les quatre images sont empilées et préchargées, on ne change
   que celle qui est visible — jamais le `src`, qui ferait clignoter du vide
   le temps du chargement.
   Repère MESURÉ sur l'image : le halo rose de la porte est centré à
   55,0 % / 48,0 %. L'enseigne se pose juste à sa gauche. */
#neon {
  position: absolute;
  left: 41%; top: 42%; width: 10%;
  aspect-ratio: 800 / 533;
  pointer-events: none;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .55));
}
#neon .f { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
#neon .f.on { opacity: 1; }

/* ---------- le compte, par-dessus l'image ---------- */
#compte {
  position: absolute; right: 22px; top: 20px;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  min-width: 172px;
}
.cadre {
  font: inherit; font-size: 12.5px; font-weight: 700;
  padding: 8px 16px; cursor: pointer;
  background: var(--cadre); color: var(--texte);
  border: var(--trait) solid var(--texte); border-radius: 0;
  transition: background .14s ease, color .14s ease;
}
.cadre:hover { background: var(--texte); color: var(--cadre); }
/* Le second cadre porte les couleurs inversées : c'est ce qui le distingue
   du premier, sans ajouter de couleur d'accent. */
.cadre.inv { background: var(--texte); color: var(--cadre); }
.cadre.inv:hover { background: var(--cadre); color: var(--texte); }

#connecte { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
#qui {
  background: var(--cadre); border: var(--trait) solid var(--texte);
  padding: 8px 12px; font-size: 12.5px; font-weight: 700; text-align: center;
}

/* Ambiance : un contrôle discret, mais toujours accessible. */
.son {
  margin-top: auto; padding: 7px 6px; border: 0; background: transparent;
  color: var(--doux); font: inherit; font-size: 11.5px; cursor: pointer;
  text-align: left;
}
.son:hover { color: var(--texte); }

/* ---------- cadres ---------- */
.panneau {
  background: var(--cadre);
  border: var(--trait) solid var(--contour);
  padding: 14px 16px;
}
.panneau h2 {
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--doux); margin-bottom: 10px;
}

/* Les applications : posées AU BAS de l'image, centrées sur le même axe que
   les trois carrés. La médiathèque n'y figure pas — elle a son propre cadre
   juste en dessous. */
#applis {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(var(--large), calc(100% - 2 * var(--gapx)));
  height: var(--appl-h);
  display: flex; align-items: center;
}
#vignettes {
  display: flex; justify-content: center; align-items: flex-start;
  gap: 10px; width: 100%;
}
#vignettes a {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 74px; flex: 0 0 auto;
  text-decoration: none; color: var(--texte);
}
#vignettes img {
  width: 54px; height: 54px; object-fit: cover; border-radius: 50%;
  border: 2px solid var(--contour);
  transition: border-color .15s ease, transform .15s ease;
}
#vignettes a:hover img { border-color: var(--texte); transform: translateY(-3px); }
#vignettes span { font-size: 10px; font-weight: 600; text-align: center; line-height: 1.2; }

/* Le nuage est informatif : il ne reçoit aucun clic. */
#info-appli {
  position: absolute; left: 50%; bottom: 88px;
  width: min(34%, 480px); aspect-ratio: 1059 / 663;
  transform: translateX(-50%) scale(.94);
  background: url("home/nuage4.png") center / contain no-repeat;
  z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity .16s ease, transform .16s ease;
}
#info-appli.is-visible { opacity: 1; transform: translateX(-50%) scale(1); }
.info-appli-inner {
  position: absolute; left: 50%; top: 52%;
  width: 62%; max-height: 58%; overflow: hidden;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-align: center;
}
#info-appli h2 {
  font-size: clamp(12px, 1.05vw, 17px); font-weight: 800; color: #172c45;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
}
#info-appli p { font-size: clamp(9px, .72vw, 12px); line-height: 1.3; color: #23324a; }

/* ---------- les trois cadres ---------- */
/* Les trois cadres restent TOUJOURS côte à côte : 500 px chacun quand la
   place le permet, et ils rétrécissent ensemble sinon. Une largeur rigide
   ferait passer le troisième à la ligne dès que la fenêtre descend sous
   1746 px — c'est exactement ce qui arrivait. */
#trois {
  grid-area: trois;
  display: flex; justify-content: center; gap: var(--gapx);
  flex-wrap: nowrap;
}
#trois .panneau {
  flex: 1 1 0; min-width: 0; max-width: var(--carre-l);
  height: var(--carre-h);
  display: flex; flex-direction: column; overflow: hidden;
}

/* Nouveautés */
#nouv-liste { display: flex; flex-direction: column; gap: 11px; flex: 1; overflow: hidden; }
.nouv {
  display: grid; grid-template-columns: auto 1fr; gap: 9px; align-items: start;
  font-size: 11.5px; line-height: 1.45; color: var(--doux);
}
.nouv .em { font-size: 13px; line-height: 1.3; }
.nouv b { display: block; color: var(--texte); font-size: 9.5px; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase; margin-bottom: 2px; }

.plus {
  margin-top: 10px; align-self: flex-start;
  font: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--texte); text-decoration: none; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--contour);
  padding: 3px 0;
}
.plus:hover { border-bottom-color: var(--texte); }

/* Une application au hasard, en grand */
#p-alea a { text-decoration: none; color: var(--texte); display: flex; flex-direction: column;
  flex: 1; min-height: 0; }
#alea-img {
  width: 100%; flex: 1; min-height: 0; object-fit: contain;
  border: 1px solid var(--contour); display: block; margin-bottom: 9px;
}
#alea-nom { font-size: 14px; font-weight: 800; display: block; margin-bottom: 4px; }
#p-alea p {
  font-size: 11.5px; line-height: 1.4; color: var(--doux);
  /* Trois lignes au plus : la description ne doit pas pousser l'image hors
     du cadre, dont la hauteur est fixe. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Médiathèque : ses catégories, en icônes */
#media-liste { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; flex: 1; }
#media-liste a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: var(--texte);
  border: 1px solid var(--contour);
  transition: border-color .15s ease, background .15s ease;
}
#media-liste a:hover { border-color: var(--texte); background: var(--contour); }
#media-liste .i { font-size: 25px; line-height: 1; }
#media-liste span:last-child { font-size: 11.5px; font-weight: 600; }

/* ---------- pied ---------- */
#pied {
  grid-area: pied;
  height: var(--pied-h);
  background: var(--cadre);
  border: var(--trait) solid var(--contour);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 18px;
  font-size: 11.5px; color: var(--doux);
}
#ver { color: var(--texte); font-size: 10.5px; letter-spacing: .04em; }

/* ---------- formulaire de compte ---------- */
#modale, #contact-modale {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 6, 12, .84);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#form, #contact-form {
  width: min(360px, 100%);
  background: var(--cadre); border: var(--trait) solid var(--texte);
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
#form b, #contact-form b { font-size: 16px; }
#form label, #contact-form label { display: block; font-size: 12px; font-weight: 700; color: var(--doux); }
#form input, #contact-form select, #contact-form textarea {
  width: 100%; margin-top: 5px; padding: 9px 11px;
  font: inherit; font-size: 14px;
  background: var(--fond); color: var(--texte);
  border: 1px solid var(--contour); border-radius: 0;
}
#contact-form textarea { min-height: 120px; resize: vertical; }
#form input:focus, #contact-form select:focus, #contact-form textarea:focus { outline: none; border-color: var(--texte); }
#form-msg { min-height: 1em; font-size: 12.5px; font-weight: 700; color: #ff9b9b; }
#form-msg.ok { color: #9be8b0; }
#app-msg {
  position: fixed; z-index: 80; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(520px, calc(100vw - 28px));
  padding: 14px 18px; border: 1px solid #f2c56b; border-radius: 12px;
  background: rgba(10, 18, 34, .97); color: #ffe3a3; box-shadow: 0 12px 36px #000b;
  font-size: clamp(14px, 2.2vw, 17px); font-weight: 750; text-align: center;
}
#app-msg[hidden] { display: none; }
#contact-msg { min-height: 1em; font-size: 12.5px; font-weight: 700; color: #ff9b9b; }
#contact-msg.ok { color: #9be8b0; }
.contact-intro { font-size: 12.5px; line-height: 1.45; color: var(--doux); }
.frow { display: flex; gap: 10px; }
.frow .cadre { flex: 1; }

/* ---------- écrans plus étroits ----------
   Sous 1600 px, les trois carrés à 500 px ne tiennent plus côte à côte : ils
   rétrécissent d'abord, puis passent à la ligne. La colonne, elle, ne bouge
   toujours pas. */
@media (max-width: 1200px), (orientation: portrait) {
  /* Le décor devient trop bas pour porter quoi que ce soit : le cadre des
     applications redescend sous l'image. */
  #applis { position: static; transform: none; width: 100%; height: auto; }
  #vignettes { flex-wrap: wrap; }
  #info-appli { display: none; }
}
@media (max-width: 1200px), (orientation: portrait) {
  #page {
    grid-template-columns: 1fr;
    grid-template-areas:
      "decor"
      "colonne"
      "applis"
      "media"
      "nouv"
      "alea"
      "pied";
  }
  /* Les enfants du décor et des trois cadres deviennent directement des
     cases de la grille : on peut les ordonner sans toucher à la version
     bureau, où les applications restent posées sur l'image. */
  #decor, #trois { display: contents; }
  #fond {
    grid-area: decor; position: relative; inset: auto;
    width: 100%; height: auto; aspect-ratio: 1720 / 680; object-fit: contain;
  }
  /* `#decor` devient display:contents sur mobile. Le néon doit donc devenir
     lui aussi un élément de la grille, superposé à la même zone que le fond ;
     sinon son positionnement absolu n'a plus le décor pour repère. */
  #neon {
    grid-area: decor;
    position: relative;
    left: 41%; top: 42%; width: 10%;
    justify-self: start; align-self: start;
    z-index: 1;
  }
  #compte {
    grid-area: decor; position: relative; right: auto; top: auto;
    z-index: 1; justify-self: end; align-self: start; margin: 16px;
  }
  #colonne { flex-direction: column; align-items: stretch; gap: 16px; }
  #drapeaux { justify-content: flex-start; }
  #liens { flex-direction: column; }
  #b-son { margin-top: 0; }

  #applis { grid-area: applis; width: 100%; }
  #vignettes { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
  #vignettes a { width: auto; }
  #vignettes img { width: 64px; height: 64px; }

  #p-media { grid-area: media; }
  #p-nouv { grid-area: nouv; }
  #p-alea { grid-area: alea; }
  #trois .panneau { width: 100%; max-width: none; height: auto; min-height: 0; }
  #media-liste { min-height: 220px; }
  #alea-img { height: min(48vw, 270px); flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- « Aussi » et espace Familia ----------
   Buzzer et Targos restent hors des vignettes. Familia et Fotos ont leur
   propre bloc : il n'apparaît que pour les comptes qui y ont accès. */
#aussi h3, #reservado-familia h3, #reservado-admin h3 {
  font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--doux); margin: 0 0 6px 6px;
}
#aussi-liste { display: flex; flex-direction: column; gap: 2px; }
#aussi-liste a, .reserve-liste a {
  display: block; padding: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--texte); text-decoration: none;
  transition: color .14s ease;
}
#aussi-liste a:hover, .reserve-liste a:hover { color: #8fd0ff; }
.reserve-liste { display: flex; flex-direction: column; gap: 2px; }
.reserve-liste .i { display: inline-block; width: 20px; text-align: center; margin-right: 9px; }
