/* The town picture with a data panel under each row of buildings. Tokens from ui/theme.css. */
:root { --panel: var(--primary); }
.town { margin-bottom: 40px; }
.town-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.town-head h2 { margin: 0; }
.town-head .legend { margin: 0; }
.town-art { position: relative; container-type: inline-size; border-radius: var(--r-lg); overflow: hidden; background: var(--blush); }
.town-pic { position: relative; }
.town-art img { display: block; width: 100%; height: auto; }
.tpanel { position: absolute; left: var(--l); width: var(--w); top: var(--t); height: var(--h); background: var(--panel); color: #fff;
  font-size: clamp(9px, 0.95cqw, 13px); line-height: 1.3; }
.tpanel.sub { color: #fff; margin: 0; font-size: clamp(9px, 0.95cqw, 13px); left: 2.6%; width: 17%; top: 61%; height: 19%; border-radius: var(--r-sm); padding: 0.9cqw 1cqw; display: flex; flex-direction: column; gap: 0.15cqw; }
.tpanel.sub.down { background: #7A2A35; }
.tcell { position: absolute; top: 0; bottom: 0; left: var(--x); width: 11cqw; transform: translateX(-50%); padding: 0.8cqw 0.4cqw;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.15cqw; cursor: default; }
.c-name { font-weight: 700; font-size: 1.05em; white-space: nowrap; }
.c-kw { font-weight: 700; font-variant-numeric: tabular-nums; }
.c-sub { opacity: 0.82; font-size: 0.9em; }
.c-sub.warn { opacity: 1; color: #FFD27A; font-weight: 600; }
.c-pill { align-self: center; font-size: 0.85em; font-weight: 700; padding: 0.1em 0.75em; border-radius: var(--r-pill); background: #fff; color: var(--panel); }
.tpanel.sub .c-pill, .tpanel.sub .c-name { align-self: flex-start; }
.c-pill.trim { background: #FFE3A1; color: var(--s-trim-ink); }
.c-pill.local { background: #FFD1AE; color: var(--s-backup-ink); }
.c-pill.off { background: #FFC9CC; color: var(--s-off-ink); }
.c-pill.switch { background: #E6E3EE; color: var(--ink); }
.bmark { position: absolute; pointer-events: none; border-radius: 6px; }
.bmark i { position: absolute; top: -0.4cqw; right: -0.4cqw; width: 1.3cqw; height: 1.3cqw; min-width: 9px; min-height: 9px; border-radius: 50%;
  border: 2px solid var(--blush); background: var(--s-grid); }
.bmark.trim i { background: var(--s-trim); }
.bmark.local i { background: var(--s-backup); }
.bmark.switch i { background: var(--muted); }
.bmark.off i { background: var(--s-off); }
/* Lights: a powered building glows warm; one without power goes dark grey (its own pixels only, from
   ui/town-dark.webp cropped to the mark's box via --bx --by --sx --sy, set in town.js). */
.town-pic { isolation: isolate; }
.town-pic img { position: relative; z-index: -2; }
.bmark::after { content: ""; position: absolute; inset: -22% -18% -6%; border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 200, 60, 0.75), rgba(255, 200, 60, 0.3) 55%, transparent 100%);
  mix-blend-mode: multiply; transition: opacity 0.6s ease; }
.bmark.trim::after { opacity: 0.45; }
.bmark.local::after { background: radial-gradient(closest-side, rgba(255, 140, 70, 0.75), rgba(255, 140, 70, 0.3) 55%, transparent 100%); }
.bmark.off::after, .bmark.switch::after { opacity: 0; }
.bmark::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s ease;
  background: url("/ui/town-dark.webp") no-repeat var(--bx) var(--by) / var(--sx) var(--sy); }
.bmark.off::before { opacity: 1; animation: lights-out 0.9s steps(1, end); }
@keyframes lights-out { 0% { opacity: 0 } 15% { opacity: 1 } 25% { opacity: 0.2 } 40% { opacity: 1 } 50% { opacity: 0.4 } 60% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .bmark.off::before { animation: none; } .bmark::after, .bmark::before { transition: none; } }
.bmark.local { box-shadow: 0 0 0 2px color-mix(in srgb, var(--s-backup) 70%, transparent); }
.town-note { margin: 10px 0 0; font-size: var(--fs-xs); color: var(--muted); }

@media (max-width: 700px) {
  .town-art { overflow: visible; background: none; }
  .town-art img { border-radius: var(--r-md); background: var(--blush); }
  .tpanel, .tpanel.sub { position: static; width: auto; height: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    background: none; color: var(--ink); font-size: var(--fs-xs); margin-top: 8px; padding: 0; }
  .tpanel.sub { display: flex; background: var(--panel); color: #fff; padding: 10px 12px; }
  .tpanel.sub.down { background: #7A2A35; }
  .tcell { position: static; transform: none; width: auto; background: var(--panel); color: #fff; padding: 10px 8px; border-radius: var(--r-sm); gap: 2px; }
}
.town-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 12px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.town-legend li { display: flex; align-items: center; gap: 7px; }
.town-legend .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }
