/* Polices auto-hébergées : le site interdit les ressources extérieures (CSP).
   Caveat, EB Garamond et IBM Plex Mono, sous licence SIL Open Font 1.1. */
@font-face { font-family: "Caveat"; src: url("caveat.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("garamond-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("plexmono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }

/* Les lavis, placés ici : un attribut style= serait refusé par la CSP du site. */
#lavis1 { left: 330px; top: 170px; width: 960px; opacity: .34; }
#lavis2 { left: 1360px; top: 830px; width: 860px; opacity: .28; }
#lavis3 { left: 690px; top: 980px; width: 920px; opacity: .26; }
/* Une carte de Bruxelles dessinée à la main : lavis de Razi, hachures, notes à l'encre, ratures. */
:root {
  color-scheme: light;
  --papier: #EFE7D8;
  --encre: #1E2431;
  --encre-pale: #5C6373;
  --rouge: #93331F;
  --main: "Caveat", "Segoe Script", cursive;
  --livre: "EB Garamond", Georgia, serif;
  --machine: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--papier); color: var(--encre); font-family: var(--livre); overflow: hidden; }
#carte { position: absolute; inset: 0; cursor: grab; touch-action: none; overflow: hidden; }
#carte.saisi { cursor: grabbing; }
#calque { position: absolute; left: 0; top: 0; width: 2400px; height: 1700px; transform-origin: 0 0; }
#fond, #traits { position: absolute; inset: 0; width: 2400px; height: 1700px; }
.lavis { position: absolute; mix-blend-mode: multiply; pointer-events: none; }

.note { position: absolute; width: 250px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: var(--encre); }
.note .tete { font-family: var(--machine); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--encre-pale); }
.note .titre { font-family: var(--main); font-size: 25px; line-height: 1.08; margin: 2px 0 0; display: inline-block; position: relative; }
.note.rature .titre::after { content: ""; position: absolute; left: -3%; right: -3%; top: 52%; height: 2px;
  background: var(--rouge); transform: rotate(-1.6deg); opacity: .85; }
.note.rature .titre { color: var(--encre-pale); }
.note .genre { font-family: var(--machine); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; display: block; margin-top: 4px; color: var(--encre-pale); }
.note:hover .titre, .note:focus-visible .titre { color: var(--rouge); }
.note:focus-visible, .piece:focus-visible { outline: 2px solid var(--rouge); outline-offset: 4px; }
.note.eteinte, .piece.eteinte { opacity: .2; }

.piece { position: absolute; width: 230px; background: none; border: 0; padding: 0; cursor: pointer; }
.piece img, .piece video { width: 100%; display: block; box-shadow: 0 7px 20px rgba(30,36,49,.3); }
.piece .tete { display: block; font-family: var(--machine); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--encre-pale); margin-top: 5px; }
.piece figcaption { font-family: var(--main); font-size: 20px; line-height: 1.06; color: var(--encre); }
.piece:hover figcaption { color: var(--rouge); }

.lieu { position: absolute; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.lieu b { display: block; font-family: var(--main); font-size: 21px; font-weight: 600; letter-spacing: .02em; }
.lieu span { font-family: var(--machine); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--encre-pale); }

#titre { position: absolute; top: 0; left: 0; right: 0; padding: 20px 22px 30px; pointer-events: none;
  background: linear-gradient(to bottom, var(--papier) 30%, rgba(239,231,216,.8) 62%, transparent); }
h1 { font-family: var(--main); font-weight: 600; font-size: clamp(30px, 6vw, 46px); margin: 0; line-height: 1; }
#titre .court { display: none; }
@media (max-width: 760px) { #titre .court { display: inline; } }
#titre p { margin: 6px 0 0; max-width: 62ch; font-size: 14.5px; line-height: 1.5; color: var(--encre-pale); }
#legende { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 7px; justify-content: center;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--papier) 34%, transparent); }
.cle { font-family: var(--machine); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; background: none;
  border: 1px solid rgba(30,36,49,.3); border-radius: 2px; padding: 6px 11px; color: var(--encre-pale); cursor: pointer; }
.cle:hover { color: var(--encre); border-color: var(--encre); }
.cle[aria-pressed="true"] { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.cle:focus-visible { outline: 2px solid var(--rouge); outline-offset: 2px; }

#fiche { position: absolute; inset: auto 0 0 0; max-height: 78%; overflow-y: auto; background: var(--papier);
  border-top: 1.5px solid var(--encre); padding: 24px 22px calc(28px + env(safe-area-inset-bottom, 0px)); }
#fiche[hidden] { display: none !important; }
#fiche .dedans { max-width: 660px; margin: 0 auto; }
#fiche .tete { font-family: var(--machine); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--encre-pale); }
#fiche h2 { font-family: var(--main); font-weight: 600; font-size: clamp(27px, 5vw, 38px); margin: 6px 0 14px; line-height: 1.05; }
#fiche h2.rature { text-decoration: line-through; text-decoration-color: var(--rouge); text-decoration-thickness: 2px; color: var(--encre-pale); }
#fiche p { margin: 0 0 11px; font-size: 16px; line-height: 1.66; max-width: 64ch; }
#fiche .suite { font-family: var(--machine); font-size: 12px; line-height: 1.6; color: var(--encre-pale); }
#f-media { margin-bottom: 14px; }
#f-media img, #f-media video { width: 100%; max-width: 560px; display: block; border: 1px solid rgba(30,36,49,.22); }
#fermer { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 999px;
  border: 1px solid rgba(30,36,49,.35); background: none; color: var(--encre-pale); font-size: 15px; cursor: pointer; }
#fermer:hover { color: var(--encre); border-color: var(--encre); }
#boussole { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-family: var(--machine);
  font-size: 9.5px; letter-spacing: .28em; text-transform: uppercase; color: rgba(92,99,115,.55); writing-mode: vertical-rl; pointer-events: none; }
@media (max-width: 760px) {
  #titre { padding: 14px 16px 26px; }
  #titre p { font-size: 13px; line-height: 1.45; }
  #titre .long { display: none; }
  #boussole { display: none; }
  #legende { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  #legende::-webkit-scrollbar { display: none; }
  .cle { flex: 0 0 auto; }
  #fiche { max-height: 86%; padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  #fiche p { font-size: 15.5px; }
}

/* Les couches de Razi. Elles tapissent la carte par strates et respirent :
   une pièce monte, s'efface, revient. Aucune ne s'installe pour de bon, et on
   ne les a toutes vues que si on est resté. Pas de z-index ici : les couches
   doivent se fondre au papier (multiply), ce qu'un contexte d'empilement
   empêcherait. L'ordre du DOM suffit — elles sont posées avant les traits. */
#strates { position: absolute; left: 0; top: 0; width: 2400px; height: 1700px; pointer-events: none; }
.strate { position: absolute; mix-blend-mode: multiply; opacity: 0; }
/* Les figures sont des lavis pâles sur papier : sans contraste elles disparaissent. */
.strate[src*="figure"], .strate[src*="main"] { filter: contrast(1.16) saturate(.95); }
.strate.posee { opacity: var(--max); transition: opacity 4s ease; }
.strate.respire { animation: respire var(--periode, 90s) ease-in-out var(--retard, 0s) infinite both; }
@keyframes respire {
  0%, 100% { opacity: 0; }
  16% { opacity: var(--max); }
  42% { opacity: calc(var(--max) * .45); }
  66% { opacity: var(--max); }
  88% { opacity: calc(var(--max) * .15); }
}

/* Les bords fondent. Sans ce masque, chaque scan est un rectangle collé ;
   avec, la matière se dépose sur le papier comme une tache d'encre. */
.strate, .lavis {
  -webkit-mask-image: radial-gradient(ellipse 62% 62% at 50% 50%, #000 42%, rgba(0,0,0,.55) 72%, transparent 92%);
  mask-image: radial-gradient(ellipse 62% 62% at 50% 50%, #000 42%, rgba(0,0,0,.55) 72%, transparent 92%);
}

/* Retour vers le site : la carte s'ouvre souvent seule, par un lien partagé. */
.retour-site {
  position: fixed; top: 14px; left: 14px; z-index: 60;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(20, 10, 13, 0.82); color: #F3EFE9;
  font: 13px/1 system-ui, sans-serif; letter-spacing: 0.08em;
  text-decoration: none; backdrop-filter: blur(4px);
}
.retour-site:hover { background: #C8412F; }

/* Le renvoi d'une note vers la page qui la développe. La carte dit ce qu'on
   a cherché, la page dit ce qu'on propose : elles ne se répètent pas. */
#f-corps .renvoi { margin-top: 18px; }
#f-corps .renvoi a {
  color: #93331F; text-decoration: none;
  border-bottom: 1px solid rgba(147, 51, 31, .4); padding-bottom: 2px;
}
#f-corps .renvoi a:hover { border-bottom-color: #93331F; }
