/* Shared styles for pages built on map/core.js. */

html, body { margin: 0; height: 100%; }
/* Smallest supported window: below it the page scrolls instead of squeezing */
body { position: relative; box-sizing: border-box; min-width: 1024px; min-height: 768px; }
body { font: var(--fs-14)/1.4 Inter, system-ui, sans-serif; color: var(--text); }
#map { position: absolute; inset: 0; }

/* Legend swatches (see legend() in panel.js) */
.legend { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 6px 0 2px; font-size: var(--fs-12); color: var(--text-2); }
.legend[hidden] { display: none; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: var(--radius-s); }

/* Zone impact popup */
.zone-popup .maplibregl-popup-content { padding: 10px 12px; font: var(--fs-12)/1.4 Inter, system-ui, sans-serif; color: var(--text); min-width: 250px; }
.zone-popup h3 { margin: 0; font-size: var(--fs-14); display: flex; align-items: center; gap: 6px; }
.zone-popup h3 i { width: 12px; height: 12px; border-radius: var(--radius-s); display: inline-block; }
.zone-popup table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.zone-popup th, .zone-popup td { padding: 2px 0; text-align: right; font-weight: normal; }
.zone-popup th:first-child, .zone-popup td:first-child { text-align: left; color: var(--text-2); }
.zone-popup thead th { font-size: var(--fs-12); color: var(--text-3); }
.zone-popup tbody + tbody tr:first-child td, .zone-popup tbody + tbody tr:first-child th { padding-top: 8px; }
.zone-popup .sub { color: var(--text-3); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.04em; }
.zone-popup .note { margin-top: 6px; font-size: var(--fs-12); color: var(--text-3); }

/* Tooltip under the cursor: the flood value or a facility (core.js) */
.value-tip { pointer-events: none; }
.value-tip .maplibregl-popup-content { padding: 3px 6px; font: var(--fs-12)/1.3 Inter, system-ui, sans-serif; color: var(--text); font-variant-numeric: tabular-nums; }
.value-tip .maplibregl-popup-tip { display: none; }
/* A facility's tooltip points at its icon */
.value-tip.facility-tip .maplibregl-popup-tip { display: block; border-width: 7px; translate: 0 -1px; /* under the text box's edge, so no seam shows between them */ }
/* Outlined and shadowed as one shape: a box shadow would run across the arrow */
.value-tip.facility-tip { filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.7)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1)); }
.value-tip.facility-tip .maplibregl-popup-content { box-shadow: none; }
.value-tip strong { font-size: var(--fs-14); }

/* Attribution: translucent, rounded, blurred, inset from the corner (Figma) */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib {
  margin: 0 10px 10px 0; padding: 2px 5px; border-radius: var(--radius-m);
  background: rgba(255, 255, 255, 0.65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib, .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib a { color: rgba(0, 0, 0, 0.65); }

/* Cascade links of the selected facility (drawLinks in core.js): SVG over
   the map canvas, so the 3D buildings don't cover them. */
.cascade-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.cascade-links path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cascade-links .casing { stroke: #ffffff; stroke-width: 3.5; }
.cascade-links .line { stroke: #000000; stroke-width: 1.5; }
.cascade-links .head { fill: #000000; stroke: #ffffff; stroke-width: 1.2; paint-order: stroke; }
.value-tip .tip-status { margin-top: 2px; color: var(--text-2); font-size: var(--fs-12); }

/* "Show cascades" pill next to the power plant (steps 3 and 4) */
.cascade-pill {
  /* A shadow and hairline outline, drawn around the clipped arrow shape by the wrapper (a clip-path would cut them off) */
  filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.7)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.18));
  animation: pill-bounce 1.6s ease-in-out infinite;
}
.cascade-pill button {
  /* The left edge is an arrow tip pointing at the facility */
  display: block; padding: 6px 12px 6px 22px; border: 0; border-radius: 0 999px 999px 0; background: #ffffff; color: #000000; cursor: pointer;
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  font: var(--fs-14)/1.2 Inter, system-ui, sans-serif; white-space: nowrap;
  font-weight: 500;
}
.cascade-pill button:hover { background: var(--surface-hover); }
@keyframes pill-bounce { 0%, 100% { translate: 0 0; } 50% { translate: 4px 0; } }
@media (prefers-reduced-motion: reduce) { .cascade-pill { animation: none; } }

.maplibregl-map .maplibregl-ctrl-group, .zone-popup .maplibregl-popup-content, .value-tip .maplibregl-popup-content { box-shadow: var(--shadow-sm); }

/* Minimized story card: the whole card opens it, only the icon takes the hover */
.card.min { padding: 0; }
.card.min button.restore.btn { gap: 12px; margin: 0; height: 52px; padding: 0 14px 0 20px; border-radius: 0; }
.card.min button.restore.btn:hover { background: transparent; }
.card button.restore .icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-m); }
.card button.restore:hover .icon { background: rgba(255, 255, 255, 0.14); }

.maplibregl-popup-content { border-radius: var(--radius-m); }

/* Zoom buttons 16px in from the corner, as the logo and panels, as big as the audience toggle is high */
.maplibregl-map .maplibregl-ctrl-group button { width: 32px; height: 32px; }
.maplibregl-map .maplibregl-ctrl-top-right { top: 0; }
.maplibregl-map .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 16px 16px 0 0; }
