/* Rôle foncier Québec : Design System CCMQ (voir design/DESIGN.md) */
:root {
  --socle-nuit: #070f2e;
  --socle-marine: #0d1c66;
  --socle-outremer: #1d41fc;
  --socle-outremer-clair: #6f87ff;
  --socle-glacier: #dce3ff;
  --socle-brume: #f3f5fb;
  --socle-blanc: #ffffff;
  --texte-encre: #12171d;
  --texte-encre-douce: #4a5368;
  --texte-givre: #aab6df;
  --accent-ambre: #ffb020;
  --hauteur-entete: 80px;
  --police: Archivo, "Arial Narrow", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--police);
  color: var(--texte-encre);
  background: var(--socle-brume);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--socle-outremer); }
a:hover { color: var(--socle-marine); }
button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--accent-ambre); outline-offset: 2px; }

.visuellement-cache {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
.evitement { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--socle-blanc); padding: 12px 16px; border-radius: 12px; }
.evitement:focus { top: 16px; }

.etiquette { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--texte-encre-douce); }
.etiquette-givre { color: var(--texte-givre); }
/* Nom de l'organisme au-dessus du nom de l'outil : casse normale, sur deux lignes au plus */
.etiquette-organisme { text-transform: none; letter-spacing: 0.01em; font-size: 12.5px; font-weight: 600; line-height: 1.25; max-width: 220px; }

/* En-tête */
.entete {
  background: var(--socle-nuit); color: var(--socle-blanc);
  padding: 16px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
  position: relative; z-index: 20;
}
.marque { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.nom-outil { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
/* Bouton de navigation entre la recherche et le tableau de bord : secondaire, à droite de l'en-tête */
.bouton-navigation {
  flex: none; display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px;
  border: 2px solid var(--socle-outremer-clair); border-radius: 12px; background: var(--socle-marine);
  color: var(--socle-blanc); font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.bouton-navigation:hover { background: var(--socle-outremer); border-color: var(--socle-outremer); color: var(--socle-blanc); }
.icone-navigation { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav-court, .nav-mobile { display: none; }
@media (max-width: 1365px) {
  .bouton-navigation .nav-long { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }
  .bouton-navigation .nav-court { display: inline; }
}
/* Tablette : le bouton passe sous le nom de l'outil pour garder la recherche sur une ligne */
@media (min-width: 768px) and (max-width: 1365px) {
  .entete {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "marque recherche" "navigation recherche";
    column-gap: 24px; row-gap: 8px; align-items: center;
  }
  .marque { grid-area: marque; align-self: end; }
  .recherche { grid-area: recherche; }
  .entete .champ { flex-basis: 240px; }
  .bouton-navigation { grid-area: navigation; align-self: start; justify-self: start; height: 36px; padding: 0 12px; gap: 8px; border-radius: 10px; font-size: 14px; }
  .icone-navigation { width: 18px; height: 18px; }
}
.recherche { flex: 999 1 560px; min-width: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.modes { display: flex; background: var(--socle-marine); border-radius: 12px; padding: 4px; gap: 4px; }
.mode {
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 9px; font-size: 15px; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--socle-glacier);
}
.mode[aria-pressed="true"] { background: var(--socle-blanc); color: var(--socle-nuit); }
.champ { flex: 1 1 320px; min-width: 0; position: relative; }
#q {
  width: 100%; height: 48px; padding: 0 16px; border: 2px solid var(--socle-outremer-clair); border-radius: 12px;
  background: var(--socle-blanc); color: var(--texte-encre); font-family: inherit; font-size: 17px;
}
#q::placeholder { color: #5d667c; }
.bouton-rechercher {
  height: 48px; padding: 0 24px; border: 0; border-radius: 12px; background: var(--socle-outremer);
  color: var(--socle-blanc); font-size: 16px; font-weight: 700; cursor: pointer;
}
.bouton-rechercher:hover { background: var(--socle-marine); }

.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--socle-blanc); border-radius: 12px; box-shadow: 0 8px 24px rgba(7, 15, 46, 0.25); z-index: 30;
  max-height: 60vh; overflow-y: auto;
}
.suggestions li {
  min-height: 44px; padding: 10px 12px; border-radius: 9px; color: var(--texte-encre); cursor: pointer;
  display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 15px;
}
.suggestions li .nombre { color: var(--texte-encre-douce); font-size: 13px; white-space: nowrap; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--socle-glacier); }

/* Contenu : carte à gauche, fiche à droite */
.contenu { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.zone-carte { flex: 1 1 auto; min-width: 0; position: relative; background: #f2efe9; min-height: 420px; }
.carte { position: absolute; inset: 0; }
.zoom { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 5; }
.zoom button {
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--socle-blanc); color: var(--texte-encre);
  font-size: 22px; font-weight: 700; box-shadow: 0 1px 4px rgba(7, 15, 46, 0.25); cursor: pointer;
}
.bandeau {
  position: absolute; top: 16px; left: 76px; right: 16px; width: max-content; max-width: calc(100% - 92px); z-index: 5;
  background: var(--socle-nuit); color: var(--socle-blanc); padding: 10px 14px; font-size: 14px; font-weight: 600;
  display: flex; gap: 10px; align-items: center;
}
.bandeau[hidden] { display: none; }
.pastille-ambre { width: 10px; height: 10px; border-radius: 999px; background: var(--accent-ambre); flex: none; }
.sans-position {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  background: var(--socle-blanc); padding: 16px 20px; border-radius: 12px; font-size: 16px; font-weight: 600;
  box-shadow: 0 2px 12px rgba(7, 15, 46, 0.2); max-width: 80%; text-align: center;
}
.sans-position[hidden] { display: none; }
.attributions {
  position: absolute; right: 0; bottom: 0; z-index: 5; background: rgba(255, 255, 255, 0.9);
  padding: 4px 10px; font-size: 12px; color: var(--texte-encre-douce);
}

/* Panneau de fiche */
.panneau {
  flex: 0 0 420px; width: 420px; background: var(--socle-blanc); border-left: 1px solid var(--socle-glacier);
  overflow-y: auto; position: relative; outline: none;
}
.poignee { display: none; }
.contenu-panneau { padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 24px; }
.accueil { margin: 0; font-size: 18px; line-height: 1.4; }
.source { margin: 0; font-size: 12px; line-height: 1.4; color: var(--texte-encre-douce); }

.tete { display: flex; flex-direction: column; gap: 8px; }
.tete h1 { margin: 0; font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.sous-titre { font-size: 15px; color: var(--texte-encre-douce); }
.sous-titre-mobile { display: none; }
.avertissement { background: var(--socle-glacier); padding: 12px 14px; font-size: 14px; line-height: 1.4; border-radius: 12px; }

.encadre-valeur { background: var(--socle-nuit); color: var(--socle-blanc); padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.ligne-valeur { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.valeur-immeuble { font-size: 44px; font-weight: 900; letter-spacing: -0.03em; font-variation-settings: 'wdth' 112; }
.pastille-ecart { font-size: 15px; font-weight: 700; color: var(--socle-nuit); background: var(--accent-ambre); padding: 3px 10px; border-radius: 999px; }
.date-marche { font-size: 13px; color: var(--texte-givre); }

.grille { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.grille dt { font-size: 13px; color: var(--texte-encre-douce); }
.grille dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
.grille-mobile { display: none; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--socle-outremer); }
.liens-tableau { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.liens-tableau a { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1px solid var(--socle-glacier); border-radius: 8px; color: var(--socle-outremer); font-size: 14px; font-weight: 600; text-decoration: none; }
.liens-tableau a:hover, .liens-tableau a:focus-visible { background: var(--socle-brume); border-color: var(--socle-outremer-clair); }
.lignes { margin: 0; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; font-size: 15px; }
.lignes dt { color: var(--texte-encre-douce); }
.lignes dd { margin: 0; font-weight: 600; }
.non-indique { font-weight: 400; color: var(--texte-encre-douce); }

.bouton-officiel {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 8px 20px;
  background: var(--socle-outremer); color: var(--socle-blanc); text-decoration: none; font-size: 16px; font-weight: 700;
  border-radius: 12px; text-align: center;
}
.bouton-officiel:hover { background: var(--socle-marine); color: var(--socle-blanc); }
.bouton-officiel svg { flex: none; }
.texte-court { display: none; }
.note { margin: 0; font-size: 13px; line-height: 1.4; color: var(--texte-encre-douce); }

.proximite { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--socle-glacier); padding-top: 16px; }
.proximite h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--texte-encre-douce); }
.ligne-unite {
  display: flex; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px;
  text-align: left; font-size: 14px; color: var(--texte-encre); cursor: pointer; align-items: center; background: var(--socle-brume); width: 100%;
}
.ligne-unite:hover { background: var(--socle-glacier); }
.ligne-unite[aria-current="true"] { background: var(--socle-glacier); }
.ligne-unite .adresse { font-weight: 700; }
.ligne-unite .secondaire { display: block; font-weight: 400; color: var(--texte-encre-douce); font-size: 13px; margin-top: 2px; }
.ligne-unite .montant { color: var(--texte-encre-douce); white-space: nowrap; }
.liste-resultats { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.message { margin: 0; font-size: 17px; line-height: 1.45; }
.squelette { background: var(--socle-brume); border-radius: 6px; }
.squelette-titre { height: 34px; width: 80%; }
.squelette-ligne { height: 16px; width: 60%; }
.squelette-encadre { height: 120px; }
.squelette-bloc { height: 90px; }

.sans-script { padding: 16px 32px; }

/* Marqueurs : couleurs reprises dans app.js pour les couches de la carte */
.maplibregl-canvas:focus-visible { outline: 3px solid var(--accent-ambre); }

/* Téléphone */
@media (max-width: 767px) {
  .entete { padding: 14px 16px 16px; gap: 10px; flex-direction: column; align-items: stretch; }
  .marque { min-width: 0; min-height: 36px; justify-content: center; padding-right: 168px; }
  .marque .etiquette { display: none; }
  .bouton-navigation { position: absolute; top: 14px; right: 16px; height: 36px; padding: 0 12px; gap: 6px; border-radius: 10px; font-size: 13px; }
  .bouton-navigation .nav-court { display: none; }
  .bouton-navigation .nav-mobile { display: inline; }
  .icone-navigation { width: 16px; height: 16px; }
  .nom-outil { font-size: 17px; }
  .recherche { flex: none; flex-direction: column; align-items: stretch; gap: 8px; }
  .champ { order: 1; flex: none; }
  .modes { order: 2; }
  .mode { flex: 1 1 0; }
  .bouton-rechercher { order: 3; display: none; }
  #q { height: 44px; font-size: 16px; padding: 0 14px; }

  .contenu { display: block; position: relative; flex: 1 1 auto; }
  .zone-carte { position: absolute; inset: 0; min-height: 0; }
  .bandeau { font-size: 13px; padding: 8px 12px; }
  .attributions { bottom: min(430px, calc(100% - 60px)); font-size: 10px; padding: 2px 8px; }

  .panneau {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: 430px; max-height: calc(100% - 60px);
    border-left: 0; border-radius: 12px 12px 0 0; box-shadow: 0 -4px 16px rgba(7, 15, 46, 0.18); z-index: 15;
    transition: height 0.2s ease;
  }
  .panneau.deploye { height: calc(100% - 24px); }
  .poignee {
    display: flex; justify-content: center; align-items: center; width: 100%; height: 28px; border: 0; background: transparent;
    cursor: grab; touch-action: none; position: sticky; top: 0; z-index: 2; background: var(--socle-blanc); border-radius: 12px 12px 0 0;
  }
  .poignee span { width: 40px; height: 4px; border-radius: 999px; background: var(--texte-givre); }
  .contenu-panneau { padding: 4px 20px 20px; gap: 14px; }
  .tete { gap: 4px; }
  .tete .etiquette { font-size: 11px; }
  .tete h1 { font-size: 22px; line-height: 1.1; }
  .sous-titre { font-size: 14px; }
  .sous-titre-bureau { display: none; }
  .sous-titre-mobile { display: block; }
  .encadre-valeur { padding: 14px 16px; gap: 4px; }
  .encadre-valeur .etiquette { font-size: 11px; }
  .valeur-immeuble { font-size: 32px; font-variation-settings: normal; }
  .pastille-ecart { font-size: 13px; padding: 2px 8px; }
  .grille { gap: 10px 16px; }
  .grille dt { font-size: 14px; }
  .grille dd { font-size: 14px; }
  .grille-bureau { display: none; }
  .grille-mobile { display: grid; }
  .texte-long { display: none; }
  .texte-court { display: inline; }
  .bouton-officiel { font-size: 15px; }
  .panneau:not(.deploye) .etendu { display: none; }
  .lignes { grid-template-columns: 130px minmax(0, 1fr); font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .panneau { transition: none; }
}
