/*
 * style.css — global styles. Session 2: network map; Session 4: HUD (time
 * ruler, budget readouts), paint-mode interaction and ambient animation
 * effects. Session 5's dashboard/debrief styles live in styleDashboard.css
 * (split to honour the 300-line file cap); the game-setup modal lives in
 * styleSetup.css (replaced the Session 2 generate panel post-prototype).
 */

body {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  margin: 2rem;
  background: #f5f5f2;
  color: #222;
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.byline { color: #777; font-style: italic; font-size: 0.95rem; }
/* .link-btn (the About trigger) lives in styleInfo.css. */

.status {
  font-size: 0.95rem;
  color: #444;
}

/* --- Network map (Session 2) --- */

/* uiFx.fitMapHeight sets an explicit height so the map's bottom aligns
   with the dashboard column's bottom (small networks no longer sprawl);
   the SVG letterboxes inside via its preserveAspectRatio default. */
.map-container {
  max-width: 900px;
}

.map-container .network-map { height: 100%; }

.network-map {
  display: block;
  width: 100%;
  height: auto;
  background: #eceae2;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.parcel {
  fill: #e0ddd2;
}

/* Stroke colour is bound to condition state by render.js; the transition
   animates state changes (and hover widening) smoothly. */
.road {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.6s ease, stroke-width 0.15s ease;
}

.road-hovered {
  filter: saturate(1.25) brightness(1.1);
}

/* Invisible widened hit target above the visible stroke (§4 Session 2). */
.road-hit {
  fill: none;
  stroke: #000;
  stroke-opacity: 0;
  pointer-events: stroke;
  cursor: pointer;
}

/* --- HUD: time ruler and readouts (Session 4) --- */

.hud {
  max-width: 900px;
  margin: 1rem 0;
}

.time-ruler {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

.ruler-svg { display: block; width: 100%; height: auto; }
.ruler-band { fill: #eef0f4; }
.ruler-band-alt { fill: #e2e6ec; }
.ruler-month { stroke: #b6bcc6; stroke-width: 1; }
.ruler-year-label { fill: #667; font-size: 10px; text-anchor: middle; }
.ruler-needle { stroke: #c62828; stroke-width: 2.5; }

/* Stacked card: controls row on top, treatment row beneath. */
.hud-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.6rem 1rem;
}

.hud-block { position: relative; font-size: 0.95rem; }
.hud-label { color: #888; font-size: 0.75rem; display: block; }
.hud-value { font-weight: 600; }

.hud-controls { display: flex; gap: 0.6rem; }

.hud-controls button {
  padding: 0.4rem 1.1rem;
  border: none;
  border-radius: 4px;
  background: #2e5e8c;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
.hud-controls button:hover { background: #24496d; }

/* Insufficient-funds refusal: shake the budget readout (§4 — visible
   feedback, never an error). */
@keyframes hud-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.hud-block.shake { animation: hud-shake 0.4s ease; color: #c62828; }

/* Year-boundary forfeit/carry float (display only). */
@keyframes money-float-up {
  0% { opacity: 0; transform: translateY(6px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px); }
}
.money-float {
  position: absolute;
  left: 0;
  top: -0.2rem;
  white-space: nowrap;
  font-weight: 600;
  color: #2e7d32;
  animation: money-float-up 2.2s ease-out forwards;
  pointer-events: none;
}
.money-float-loss { color: #c62828; }

/* --- Treatment menu and paint mode (Session 4) --- */

/* Treatment row wraps; the hint span forces itself onto its own line. */
.treatment-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.menu-label {
  color: #888;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Selectable pill chips — visibly pressable, with a ✓ when armed. */
.treatment-menu button {
  padding: 0.45rem 1rem;
  border: 1px solid #9fb3c8;
  border-radius: 999px;
  background: #f4f7fa;
  color: #24496d;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.treatment-menu button:hover {
  background: #e6eef5;
  border-color: #2e5e8c;
}
.treatment-menu button.armed {
  background: #2e5e8c;
  border-color: #2e5e8c;
  color: #fff;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}
.treatment-menu button.armed::before { content: "✓ "; }

/* Futile chip: even its cheapest eligible segment exceeds the clickable
   budget — dimmed but still armable (informed, not blocked). */
.treatment-menu button.futile {
  opacity: 0.45;
  border-style: dashed;
}

.menu-warning {
  flex-basis: 100%;
  color: #a15c00;
  font-size: 0.85rem;
  font-weight: 600;
}

/* No-treatment nudge: shown when a road is clicked with nothing armed. */
.menu-nudge {
  flex-basis: 100%;
  color: #2e5e8c;
  font-size: 0.85rem;
  font-weight: 600;
}

@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 0 0 4px rgba(46, 94, 140, 0.35); }
}
.treatment-menu button.nudge-pulse { animation: chip-pulse 0.6s ease; }

.menu-hint {
  flex-basis: 100%;
  color: #999;
  font-size: 0.8rem;
}

/* Colour swatch in the RM-dot hint, filled from config at build time. */
.rm-dot-swatch {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
}

.hover-info {
  min-height: 1.2rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}

body.paint-armed .road-hit { cursor: crosshair; }

/* Cursor badge naming the armed treatment and the hover cost preview. */
.cursor-badge {
  position: fixed;
  z-index: 10;
  padding: 0.2rem 0.55rem;
  background: #2c3440;
  color: #fff;
  font-size: 0.8rem;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}
.cursor-badge.unaffordable { background: #c62828; }
.hidden { display: none; }

/* --- Map effects (Session 4) --- */

/* RM blue dot: flash and fade at a display-only random offset (§1.2). */
@keyframes rm-pop {
  0% { opacity: 0; transform: scale(0.3); }
  25% { opacity: 1; transform: scale(1.5); }
  100% { opacity: 0; transform: scale(0.9); }
}
.rm-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: rm-pop 1.6s ease-out forwards;
  pointer-events: none;
}

/* Roadworks hatching overlay while worksRemaining > 0. */
/* Roadworks overlay and tag styles live in styleWorks.css (split at the
   300-line cap when the treated-this-year ledger display was added). */

/* Click refused (roadworks/duplicate/unaffordable): blink the segment. */
@keyframes refuse-blink {
  0%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.25; }
}
.refused-flash { animation: refuse-blink 0.45s linear; }

