/* Simplified access-to applet — mobile-first responsive shell.
   Single column on phones; controls + map stack, info card is a bottom sheet.
   At a wide breakpoint the controls become a left rail and the info card a
   right-side panel. */

:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e2e2e2;
  --accent: #2b6cb0;
  --sheet-shadow: 0 -2px 16px rgba(0,0,0,0.12);
  --panel-shadow: 0 2px 16px rgba(0,0,0,0.12);
  --pad: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* ---------- Headline ---------- */
#headline {
  padding: var(--pad) var(--pad) 8px;
  border-bottom: 1px solid var(--line);
}
#headline-main {
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.25;
}
#headline-main .num { color: var(--accent); }
#headline-main .delta-up { color: #1a7a4c; }
#headline-main .delta-down { color: #b3402a; }
#headline-sub {
  margin-top: 3px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Controls ---------- */
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px var(--pad);
  border-bottom: 1px solid var(--line);
}
.ctl { display: flex; flex-direction: column; gap: 3px; flex: 1 1 160px; min-width: 140px; }
.ctl-label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.ctl select {
  font-size: 0.95rem; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink); width: 100%;
}
.ctl-profile { flex: 1 1 100%; }
#profile-axes { display: flex; flex-wrap: wrap; gap: 8px; }
#profile-axes select { font-size: 0.9rem; padding: 6px 7px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- Map ---------- */
#map-wrap { position: relative; flex: 1 1 auto; min-height: 280px; }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 10px; }

#legend {
  position: absolute; left: 10px; bottom: 24px; z-index: 5;
  background: rgba(255,255,255,0.94); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; box-shadow: var(--panel-shadow);
  font-size: 0.72rem; max-width: 230px;
}
#legend h4 { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; }
.legend-caption { color: var(--muted); margin-top: 6px; line-height: 1.3; }

#modeled-note {
  position: absolute; right: 8px; bottom: 24px; z-index: 5;
  background: rgba(255,255,255,0.9); border-radius: 6px; padding: 3px 7px;
  font-size: 0.68rem; color: var(--muted);
}
#modeled-note a { color: var(--accent); }

/* ---------- Info / tap card ---------- */
#info-card {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: var(--sheet-shadow);
  max-height: 60%; overflow-y: auto;
  padding: 14px var(--pad) 18px;
  transform: translateY(0); transition: transform 0.18s ease;
}
#info-card.hidden { transform: translateY(110%); pointer-events: none; }
#info-close {
  position: absolute; top: 8px; right: 10px; border: none; background: none;
  font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer;
}
.info-zone-title { font-size: 0.95rem; font-weight: 650; margin-bottom: 2px; }
.info-zone-sub { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; }
.mode-row {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 4px 8px;
  align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.mode-row.head { color: var(--muted); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.03em; border-top: none; }
.mode-row.qualifies { font-weight: 650; }
.mode-name { display: flex; align-items: center; gap: 6px; }
.mode-swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.mode-row .gated { color: #b3402a; }
.mode-check { color: #1a7a4c; }

/* ---------- Wide breakpoint: rail + side panel ---------- */
@media (min-width: 760px) {
  #app {
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "head head"
      "ctl  map";
    height: 100%;
  }
  #headline { grid-area: head; }
  #controls {
    grid-area: ctl; flex-direction: column; flex-wrap: nowrap;
    border-right: 1px solid var(--line); border-bottom: none; align-content: start;
  }
  .ctl, .ctl-profile { flex: 0 0 auto; }
  #map-wrap { grid-area: map; }
  #info-card {
    left: auto; right: 16px; bottom: 16px; top: auto; width: 340px;
    max-height: calc(100% - 32px); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--panel-shadow);
  }
  #info-card.hidden { transform: translateX(120%); }
}

.hidden-soft { display: none; }
