/* Page illustrée — s'appuie sur les variables de style.css */
.lud { --skin: #f0c8a4; --ink-fig: #14182f; --crowd: #3f5be0; }
@media (prefers-color-scheme: dark) { .lud { --ink-fig: #05070f; --crowd: #6f86ff; } }

.nav2 { display: inline-flex; gap: 0; }
.nav2 a { position: relative; text-decoration: none; font-weight: 500; font-size: .86rem; color: var(--muted); padding: 7px 16px; border-radius: 8px; transition: color 160ms ease, transform 160ms var(--ease-out), background-color 160ms ease; white-space: nowrap; }
.nav2 a:active { transform: scale(0.97); }
.nav2 a[aria-current="page"] { color: var(--ink); background: var(--card); box-shadow: var(--shadow); }
.nav2 a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Villes ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.chip { flex: none; scroll-snap-align: start; font: inherit; font-weight: 500; font-size: .84rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.chip:active { transform: scale(0.97); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.chip i.full { background: var(--blue); }
.chip i.part { background: transparent; border: 2px solid var(--blue); }
.chip[aria-selected="true"] { color: var(--bg); border-color: var(--ink); background: var(--ink); }
.chip[aria-selected="true"] i { background: var(--bg); border-color: var(--bg); }
.chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .chip:not([aria-selected="true"]):hover { color: var(--ink); border-color: var(--muted); } }

/* ---------- Scène ---------- */
.scene-card { padding: 14px; }
.scene { --h: 380px; position: relative; height: var(--h); border-radius: 12px; overflow: hidden; isolation: isolate; background: color-mix(in srgb, var(--blue) 8%, var(--card)); }
.sky { position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 18%, var(--card)) 0%, var(--card) 80%); z-index: -4; }
@media (prefers-color-scheme: dark) { .sky { background: linear-gradient(180deg, #0f1633 0%, #161e45 85%); } }

.bunting { position: absolute; inset: 0 0 auto 0; height: 40px; z-index: 5; display: flex; justify-content: space-around; padding: 0 6px; border-top: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.bunting b { width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 22px solid var(--c); transform-origin: 50% 0; animation: sway 2600ms ease-in-out infinite; animation-delay: calc(var(--n) * -240ms); }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* décor volontairement très simple : des blocs unis, sans détail */
.skyline { position: absolute; left: 0; bottom: 70px; height: 160px; width: 200%; display: flex; z-index: -3; animation: drift 140s linear infinite; }
.skyline .sl { flex: 0 0 50%; display: flex; align-items: flex-end; gap: 10px; padding: 0 8px; }
.skyline .bd { flex: 1; background: color-mix(in srgb, var(--blue) 10%, var(--card)); border-radius: 4px 4px 0 0; }
@keyframes drift { to { transform: translateX(-50%); } }

.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: color-mix(in srgb, var(--muted) 14%, var(--card)); border-top: 1px solid color-mix(in srgb, var(--muted) 30%, var(--card)); z-index: -1; }

/* vitrine */
.shop { position: absolute; right: 4%; bottom: 70px; width: 130px; height: 118px; z-index: -1; }
.shop .awning { height: 20px; border-radius: 4px 4px 0 0; background: repeating-linear-gradient(90deg, var(--red) 0 18px, #fff 18px 36px); }
.shop .glass { position: relative; height: 98px; background: color-mix(in srgb, var(--blue) 12%, var(--card)); border: 3px solid color-mix(in srgb, var(--muted) 55%, var(--card)); border-top: 0; overflow: hidden; }
.crack { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: color-mix(in srgb, var(--ink) 65%, var(--card)); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.crack polyline { stroke-dasharray: 120; stroke-dashoffset: 120; }
.has-hoods .crack { opacity: 1; }
.has-hoods .crack polyline { animation: crack 5s ease-out infinite; }
.has-hoods .crack polyline:nth-child(2) { animation-delay: 60ms; }
.has-hoods .crack polyline:nth-child(3) { animation-delay: 120ms; }
.has-hoods .crack polyline:nth-child(4) { animation-delay: 180ms; }
@keyframes crack { 0% { stroke-dashoffset: 120; opacity: 1; } 8% { stroke-dashoffset: 0; } 70% { stroke-dashoffset: 0; opacity: 1; } 88% { stroke-dashoffset: 0; opacity: 0; } 100% { stroke-dashoffset: 120; opacity: 0; } }

/* ---------- Étiquettes (lisibles d'un coup d'œil) ---------- */
.lbls { position: absolute; left: 3%; right: 4%; top: 56px; height: 52px; z-index: 6; pointer-events: none; }
.lbl { position: absolute; top: 0; background: var(--card); box-shadow: var(--shadow); border-radius: 10px; padding: 7px 11px; line-height: 1.25; max-width: 100%; }
.lbl strong { display: block; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lbl span { display: block; font-size: .72rem; color: var(--muted); font-weight: 500; }
.lbl i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.lbl-crowd { left: 0; } .lbl-crowd i { background: var(--crowd); }
.lbl-lyc { left: 59%; } .lbl-lyc i { background: #fff; border: 2px solid var(--blue); }
.lbl-hood { right: 0; } .lbl-hood i { background: var(--ink-fig); }
.lbl.off { visibility: hidden; }

/* ---------- Figurines ---------- */
.crowd, .group .fl { position: absolute; }
.crowd { left: 3%; width: 50%; bottom: 14px; height: 200px; }
.group { position: absolute; bottom: 14px; }
.group .fl { inset: 0; }
.lyc { left: 58%; width: 14%; min-width: 110px; height: 120px; z-index: 3; }
.hoods { right: 4%; width: 24%; min-width: 150px; height: 130px; z-index: 3; }
.group[hidden], .empty[hidden] { display: none; }

.p { position: absolute; width: 28px; height: 60px; scale: var(--s, 1); transform-origin: 50% 100%; animation: enter 340ms var(--ease-out) both; animation-delay: calc(var(--d, 0) * 1ms); }
.p .in { position: absolute; inset: 0; animation: bob 800ms ease-in-out infinite; animation-delay: calc(var(--b, 0) * -1ms); }
.p .h { position: absolute; left: 50%; top: 0; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--skin); }
.p .bd { position: absolute; left: 50%; bottom: 0; width: 22px; height: 40px; margin-left: -11px; border-radius: 11px 11px 4px 4px; background: var(--c, var(--crowd)); }
.p::before { content: ""; position: absolute; left: 50%; bottom: -3px; width: 24px; height: 6px; margin-left: -12px; border-radius: 50%; background: rgba(0, 0, 0, .14); }
@keyframes enter { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.instant .p { animation: none; }

.p.hood { --c: var(--ink-fig); width: 30px; }
.p.hood .h { background: var(--ink-fig); width: 18px; height: 18px; margin-left: -9px; }
.p.hood .h::before { content: ""; position: absolute; inset: -6px -4px 1px -4px; background: var(--ink-fig); clip-path: polygon(50% 0, 100% 48%, 100% 100%, 0 100%, 0 48%); }
.p.hood .h::after { content: ""; position: absolute; left: 50%; top: 7px; width: 10px; height: 5px; margin-left: -5px; border-radius: 3px; background: #9aa3d6; opacity: .5; }
.p.hood .arm { position: absolute; right: 0; top: 22px; width: 6px; height: 20px; border-radius: 3px; background: var(--ink-fig); transform-origin: 50% 2px; animation: swing 1000ms var(--ease-in-out) infinite; animation-delay: calc(var(--b, 0) * -1ms); }
@keyframes swing { 0%, 100% { transform: rotate(-15deg); } 45% { transform: rotate(150deg); } }

.p.ly { --c: #fff; }
.p.ly .bd { box-shadow: inset 0 0 0 2px var(--blue); }
.p.ly .bd::after { content: ""; position: absolute; left: -7px; top: 8px; width: 8px; height: 20px; border-radius: 3px; background: var(--red); z-index: -1; }
.p.ly .sg { position: absolute; left: 50%; top: -26px; width: 2px; height: 36px; background: #8a6a3c; margin-left: 6px; transform-origin: 50% 100%; animation: sign 1500ms ease-in-out infinite; animation-delay: calc(var(--b, 0) * -1ms); }
.p.ly .sg::before { content: ""; position: absolute; left: -11px; top: -5px; width: 24px; height: 16px; border-radius: 3px; background: #fff; border: 2px solid var(--blue); }
@keyframes sign { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

.empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; text-align: center; color: var(--ink); background: color-mix(in srgb, var(--card) 78%, transparent); z-index: 7; }
.empty strong { font-size: 1.05rem; font-weight: 600; }
.empty span { color: var(--muted); font-size: .86rem; }

/* ---------- Lecture sous la scène ---------- */
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.rd { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 0 12px; align-items: start; }
.rd .ico { position: relative; width: 30px; height: 64px; margin-top: 2px; }
.rd .ico .p { animation: none; position: absolute; left: 0; bottom: 2px; scale: .8; }
.rd .ico .p .in { animation: none; }
.rd .ico .p::before { display: none; }
.rd h4 { margin: 0; font-size: .76rem; font-weight: 500; color: var(--muted); }
.rd .nb { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.rd .nb.none { font-size: .9rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.rd .nb + .badge { margin-left: 6px; }
.rd p { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.scale { margin-top: 12px; font-size: .84rem; color: var(--muted); }
.scale b { color: var(--ink); font-weight: 600; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius); padding: 18px; animation: rise 320ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
.instant .stat { animation: none; }
.stat h3 { font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.stat .big { font-size: clamp(1.6rem, 4.5vw, 2rem); font-weight: 600; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .big.none { font-size: 1rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .s { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.stat .warn { font-size: .8rem; color: var(--disputed); margin-top: 6px; }
.stat ul { margin: 8px 0 0; padding-left: 18px; font-size: .88rem; }
.stat .big + .badge { margin-left: 8px; }
.ringbox { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.ringbox > div:last-child { flex: 1 1 130px; min-width: 0; }
.ring-svg { width: 96px; height: 96px; flex: none; transform: rotate(-90deg); }
.ring-svg circle { fill: none; stroke-width: 11; }
.ring-svg .bg { stroke: var(--track); }
.ring-svg .fg { stroke: var(--ink-fig); stroke-linecap: round; stroke-dasharray: var(--len) 999; transition: stroke-dasharray 640ms var(--ease-out); }
.ring-svg.ly .fg { stroke: var(--blue); }
.ring-svg.na .bg { stroke: var(--line); stroke-dasharray: 4 6; }
.ringbox .val { white-space: nowrap; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ringbox .val.none { font-size: 1rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.ringbox .cap { font-size: .78rem; color: var(--muted); margin-top: 4px; }

@media (max-width: 760px) {
  .scene { --h: 400px; }
  .lbls { top: 52px; }
  .lbl-lyc, .lbl-hood { display: none; }
  .crowd { left: 3%; width: 94%; bottom: 100px; height: 150px; }
  .lyc { left: 3%; bottom: 12px; width: 40%; height: 80px; }
  .hoods { right: 3%; bottom: 12px; width: 50%; height: 80px; }
  .shop { right: 3%; bottom: 100px; width: 96px; height: 92px; }
  .shop .glass { height: 72px; }
  .skyline { bottom: 100px; height: 120px; }
  .ground { height: 100px; }
  .p { scale: calc(var(--s, 1) * .9); }
}

@media (prefers-reduced-motion: reduce) {
  .p, .stat { animation: fade-only 200ms ease both; animation-delay: 0ms; }
  .p .in, .p.hood .arm, .p.ly .sg, .bunting b, .skyline, .has-hoods .crack polyline { animation: none; }
  .has-hoods .crack polyline { stroke-dashoffset: 0; }
  .ring-svg .fg { transition: none; }
}
