/* Portail OCA — même interface que Conspectus (ciel, nuages, cartes de verre, barre d'état,
   fenêtre d'activité), aux couleurs et polices de la charte OCA. Aucun style en ligne. */
:root {
  --ciel-haut: #5fb1ff;
  --ciel-bas: #dff1ff;
  --nuage: rgba(255, 255, 255, 0.95);
  --ombre-nuage: rgba(80, 140, 210, 0.18);
  --encre: #0A2240;
  --encre-pale: rgba(10, 34, 64, 0.64);
  --verre: rgba(255, 255, 255, 0.55);
  --bord-verre: rgba(255, 255, 255, 0.8);
  --verre-survol: rgba(255, 255, 255, 0.8);
  --tuile: #ffffff;
  --accent: #086BD3;
  --rouge: #C0392B;
  --marine-logo: #072D5E;
  --en-ligne: #23c55e;
  --alerte: #f59e0b;
  --hors-ligne: #ef4444;
  --inconnu: #a3b1c2;
  --etoiles: 0;
  --soleil: 1;
  --lune: 0;
  --fond-fenetre: rgba(255, 255, 255, 0.94);
  --titres: "Roboto Slab", Georgia, serif;
  --corps: "Roboto", "Segoe UI", system-ui, Arial, sans-serif;
}
body.soir {
  --ciel-haut: #3b4c8f;
  --ciel-bas: #ffb385;
  --nuage: rgba(255, 232, 220, 0.92);
  --ombre-nuage: rgba(120, 60, 90, 0.25);
  --encre: #1b1533;
  --encre-pale: rgba(27, 21, 51, 0.66);
  --soleil: 0.9;
}
body.nuit {
  --ciel-haut: #060d24;
  --ciel-bas: #1b2c5c;
  --nuage: rgba(140, 160, 205, 0.28);
  --ombre-nuage: rgba(0, 0, 0, 0.35);
  --encre: #eef3ff;
  --encre-pale: rgba(238, 243, 255, 0.64);
  --verre: rgba(255, 255, 255, 0.08);
  --bord-verre: rgba(255, 255, 255, 0.18);
  --verre-survol: rgba(255, 255, 255, 0.16);
  --tuile: rgba(255, 255, 255, 0.94);
  --accent: #8ab8ff;
  --etoiles: 1;
  --soleil: 0;
  --lune: 1;
  --fond-fenetre: rgba(16, 26, 54, 0.95);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--encre);
  font-family: var(--corps);
  background: linear-gradient(180deg, var(--ciel-haut) 0%, var(--ciel-bas) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  transition: background 1.2s ease, color 0.6s ease;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
svg.icone { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Ciel ---------- */
#ciel { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#etoiles { position: absolute; inset: 0; opacity: var(--etoiles); transition: opacity 1.2s ease; }
.etoile {
  position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  animation: scintille var(--d, 3s) ease-in-out infinite alternate; animation-delay: var(--dl, 0s);
}
@keyframes scintille { from { opacity: 0.15; transform: scale(0.8); } to { opacity: 1; transform: scale(1.3); } }
#soleil, #lune { position: absolute; top: 9vh; right: 12vw; width: 88px; height: 88px; border-radius: 50%; transition: opacity 1.2s ease; }
#soleil {
  opacity: var(--soleil);
  background: radial-gradient(circle, #fff7c2 0%, #ffe066 45%, rgba(255, 210, 80, 0) 72%);
  box-shadow: 0 0 60px 20px rgba(255, 230, 120, 0.45);
  animation: respire 6s ease-in-out infinite;
}
#lune {
  opacity: var(--lune);
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #dfe6f5 55%, #b9c4dc 100%);
  box-shadow: 0 0 50px 12px rgba(200, 215, 255, 0.35), inset -16px -10px 0 0 rgba(150, 165, 200, 0.35);
}
@keyframes respire { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.nuage {
  position: absolute; top: var(--haut); left: -40vw;
  width: calc(180px * var(--t)); height: calc(60px * var(--t));
  background: var(--nuage); border-radius: 100px; opacity: var(--o, 1);
  filter: drop-shadow(0 12px 18px var(--ombre-nuage));
  animation: derive var(--duree) linear infinite; animation-delay: var(--dl);
  will-change: transform; transition: background 1.2s ease;
}
.nuage::before, .nuage::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.nuage::before { width: calc(90px * var(--t)); height: calc(90px * var(--t)); left: calc(28px * var(--t)); top: calc(-42px * var(--t)); }
.nuage::after { width: calc(64px * var(--t)); height: calc(64px * var(--t)); right: calc(30px * var(--t)); top: calc(-24px * var(--t)); }
@keyframes derive { from { transform: translateX(0); } to { transform: translateX(180vw); } }
#avion { position: absolute; top: 22vh; left: -10vw; width: 44px; height: 44px; opacity: 0; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.18)); }
#avion.vole { animation: vole 14s cubic-bezier(.45, .05, .55, .95) 1; }
@keyframes vole {
  0% { transform: translate(0, 0) rotate(8deg); opacity: 0; }
  5% { opacity: 1; }
  50% { transform: translate(60vw, -8vh) rotate(-4deg); }
  95% { opacity: 1; }
  100% { transform: translate(125vw, 4vh) rotate(6deg); opacity: 0; }
}

/* ---------- Contenu ---------- */
#portail { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 22px 24px 80px; }
nav.barre { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.marque { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: inherit; text-decoration: none; }
.marque .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--marine-logo); display: grid; place-items: center; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.35); }
.marque .logo img { width: 18px; height: auto; display: block; }
.marque small { font-weight: 400; color: var(--encre-pale); }
.droite { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.droite form { margin: 0; }
.puce {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 0.82rem;
  background: var(--verre); border: 1px solid var(--bord-verre);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--encre); text-decoration: none; cursor: pointer; transition: background .2s;
}
.puce:hover { background: var(--verre-survol); }
.puce .avatar {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #086BD3, #072D5E); color: #fff; font-weight: 700; font-size: 0.7rem;
}
.puce.icone-seule { padding: 7px 9px; }

header.heros { text-align: center; padding: 64px 0 34px; }
header.heros h1 {
  margin: 0; font-family: var(--titres); font-size: clamp(2.8rem, 8vw, 4.8rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
header.heros h1 span { background: linear-gradient(90deg, var(--encre), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
header.heros h1::after { content: ""; display: block; width: 56px; height: 4px; margin: 14px auto 0; border-radius: 2px; background: var(--rouge); }
header.heros p { margin: 14px auto 0; color: var(--encre-pale); font-size: 1.05rem; max-width: 640px; }
header.heros p.signature { margin-top: 4px; font-size: 0.9rem; font-style: italic; }

.etatbar {
  margin: 26px auto 0; display: inline-flex; flex-wrap: wrap; justify-content: center;
  border-radius: 14px; overflow: hidden;
  background: var(--verre); border: 1px solid var(--bord-verre);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.78rem;
}
.etatbar > div { padding: 9px 16px; display: flex; align-items: center; gap: 8px; border-right: 1px solid var(--bord-verre); }
.etatbar > div:last-child { border-right: 0; }
.etatbar .k { color: var(--encre-pale); }
.point { width: 8px; height: 8px; border-radius: 50%; background: var(--inconnu); display: inline-block; position: relative; flex: none; }
.point.ok { background: var(--en-ligne); }
.point.ok::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--en-ligne);
  animation: onde 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}
.point.alerte { background: var(--alerte); }
.point.panne { background: var(--hors-ligne); }
@keyframes onde { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(1.6); opacity: 0; } }

section { margin-top: 44px; }
section > h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--encre-pale); margin: 0 0 16px; font-weight: 700;
}
section > h2::after { content: ""; flex: 1; height: 1px; background: var(--bord-verre); }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

.carte {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px; border-radius: 22px; text-decoration: none; color: var(--encre);
  background: var(--verre); border: 1px solid var(--bord-verre);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -22px rgba(20, 60, 120, 0.45);
  animation: flotte 7s ease-in-out infinite alternate; animation-delay: calc(var(--i, 0) * -1.3s);
  transition: background .25s, transform .25s, box-shadow .25s;
}
a.carte:hover { background: var(--verre-survol); transform: translateY(-6px) scale(1.015); box-shadow: 0 30px 50px -22px rgba(20, 60, 120, 0.55); animation-play-state: paused; }
@keyframes flotte { from { translate: 0 0; } to { translate: 0 -7px; } }
.carte .tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tuile {
  width: 58px; height: 58px; border-radius: 16px; background: var(--tuile); color: #086BD3;
  display: grid; place-items: center; overflow: hidden; flex: none;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.25);
}
.tuile.marine { background: var(--marine-logo); }
.tuile img { width: 26px; height: auto; display: block; }
.tuile svg.icone { width: 30px; height: 30px; }
.carte .statut { display: flex; align-items: center; gap: 7px; font-size: 0.72rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; }
.carte .nom { font-weight: 700; font-size: 1.08rem; margin-top: 4px; }
.carte .desc { font-size: 0.86rem; color: var(--encre-pale); line-height: 1.45; }
.carte .hote { font-size: 0.72rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.carte .mesures, .carte .apercu { font-size: 0.72rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; display: flex; flex-wrap: wrap; gap: 4px 10px; min-height: 0.9em; }
.carte .mesures b, .carte .apercu b { color: var(--encre); font-weight: 700; }
.carte .mesures b.rouge { color: var(--hors-ligne); }
.rangee { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ouvrir { font-size: 0.8rem; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.ouvrir svg.icone { width: 14px; height: 14px; transition: transform .2s; }
a.carte:hover .ouvrir svg.icone { transform: translate(2px, -2px); }
.bouton-activite {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 700; color: var(--encre-pale); background: transparent;
  border: 1px solid var(--bord-verre); transition: background .2s, color .2s, border-color .2s;
}
.bouton-activite:hover { background: var(--verre-survol); color: var(--accent); border-color: var(--accent); }
.bouton-activite svg.icone { width: 13px; height: 13px; }

.carte.projet { cursor: default; }
.badge-projet {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(245, 183, 5, 0.18); color: #b45309; border: 1px solid rgba(245, 183, 5, 0.45);
}
body.nuit .badge-projet { color: #fcd34d; }
.badge-projet::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #f2b705; animation: clignote 1.6s ease-in-out infinite; }
@keyframes clignote { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.actions-projet { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.bouton-projet {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px;
  font-size: 0.78rem; font-weight: 700; text-decoration: none; color: #fff; background: #086BD3;
  transition: filter .2s, transform .2s;
}
a.bouton-projet:hover { filter: brightness(1.1); transform: translateY(-1px); }
.bouton-projet svg.icone { width: 14px; height: 14px; }
.bouton-projet.bientot { background: transparent; color: var(--encre-pale); border: 1px dashed var(--bord-verre); cursor: not-allowed; font-weight: 600; }

footer { margin-top: 64px; text-align: center; font-size: 0.76rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- Porte (visiteur) ---------- */
#porte { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.porte-carte {
  width: min(420px, 100%); text-align: center; padding: 30px 26px; border-radius: 24px;
  background: var(--verre); border: 1px solid var(--bord-verre);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 60px -28px rgba(20, 60, 120, 0.6);
}
.porte-carte .tuile { margin: 0 auto 14px; width: 72px; height: 72px; border-radius: 20px; }
.porte-carte .tuile img { width: 32px; }
.porte-carte h1 { font-family: var(--titres); margin: 0; font-size: 1.6rem; }
.porte-carte p { color: var(--encre-pale); margin: 10px 0 18px; line-height: 1.45; }
.porte-carte form { display: grid; gap: 8px; margin-top: 16px; }
.porte-carte input { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--bord-verre); background: rgba(255, 255, 255, 0.85); font: inherit; color: #0A2240; }
.porte-carte .essai { font-size: 0.75rem; font-weight: 700; color: #b45309; margin: 0; }
.porte-carte .public { display: inline-block; margin-top: 18px; font-size: 0.85rem; color: var(--accent); }
.bouton-google, .bouton-verre {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 11px 16px; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
}
.bouton-google { background: #072D5E; color: #fff; border: 1px solid #072D5E; }
.bouton-google:hover { filter: brightness(1.2); }
.bouton-verre { background: var(--verre); color: var(--encre); border: 1px solid var(--bord-verre); }

/* ---------- Fenêtre Activité ---------- */
#voile {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(10, 22, 46, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: apparait .18s ease;
}
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }
#fenetre {
  width: min(460px, 100%); max-height: min(78vh, 640px); display: flex; flex-direction: column;
  border-radius: 22px; overflow: hidden; background: var(--fond-fenetre); border: 1px solid var(--bord-verre);
  box-shadow: 0 40px 80px -30px rgba(0, 20, 60, 0.6); animation: surgit .22s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes surgit { from { transform: translateY(14px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.fenetre-tete { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--bord-verre); }
.fenetre-tete .tuile { width: 42px; height: 42px; border-radius: 12px; }
.fenetre-tete .tuile img { width: 20px; }
.fenetre-tete .tuile svg.icone { width: 22px; height: 22px; }
.fenetre-tete .t { flex: 1; min-width: 0; }
.fenetre-tete .n { font-weight: 700; font-size: 1rem; }
.fenetre-tete .s { font-size: 0.72rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; }
#fermer { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--bord-verre); background: transparent; color: var(--encre-pale); font-size: 0.9rem; cursor: pointer; line-height: 1; }
#fermer:hover { background: var(--verre-survol); color: var(--encre); }
.fenetre-corps { padding: 8px 18px 14px; overflow-y: auto; }
.bloc { margin-top: 12px; }
.bloc > h3 { margin: 0 0 8px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--encre-pale); display: flex; align-items: center; gap: 8px; }
.bloc > h3::after { content: ""; flex: 1; height: 1px; background: var(--bord-verre); }
.ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 0.84rem; }
.ligne + .ligne { border-top: 1px dashed var(--bord-verre); }
.ligne .qui { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ligne .qui small { font-weight: 400; color: var(--encre-pale); }
.ligne .quand { flex: none; font-size: 0.74rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; }
.ligne a { color: inherit; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.chiffre { padding: 8px 10px; border-radius: 12px; background: var(--verre); border: 1px solid var(--bord-verre); }
.chiffre b { display: block; font-size: 1.4rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.chiffre b.rouge { color: var(--hors-ligne); }
.chiffre span { font-size: 0.72rem; color: var(--encre-pale); }
.vide { padding: 10px 0; color: var(--encre-pale); font-size: 0.84rem; font-style: italic; }
.note { margin-top: 10px; font-size: 0.72rem; color: var(--encre-pale); }
.niveau-alerte { color: #b45309; }
body.nuit .niveau-alerte { color: #fcd34d; }
.fenetre-pied { padding: 10px 18px; border-top: 1px solid var(--bord-verre); font-size: 0.68rem; color: var(--encre-pale); font-family: ui-monospace, Menlo, Consolas, monospace; display: flex; justify-content: space-between; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .nuage, .carte, .point.ok::after, #soleil, #avion, .badge-projet::before { animation: none !important; }
}
@media (max-width: 520px) {
  #portail { padding: 16px 16px 60px; }
  header.heros { padding-top: 40px; }
  .etatbar > div { padding: 8px 12px; }
  .marque small, .puce .nom { display: none; }
}
