/* Jakarta MRT map — poster-inspired theme: cream paper, ink text, MRT red. */

:root {
  --paper: #f2ede1;
  --paper-soft: rgba(242, 237, 225, 0.92);
  --ink: #1c1a15;
  --ink-soft: #5c574b;
  --red: #ce0037;
  --line: rgba(28, 26, 21, 0.14);
  --shadow: 0 10px 30px rgba(28, 26, 21, 0.18);
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
}

.map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ---- masthead ---------------------------------------------------- */

.masthead {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 5;
  max-width: 340px;
  padding: 18px 20px 16px;
  background: var(--paper-soft);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.masthead .kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.masthead h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.masthead h1::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 8px;
  background: var(--red);
}

.masthead .sub {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* ---- station panel ------------------------------------------------ */

.panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5;
  width: 264px;
  max-height: calc(100% - 110px);
  display: flex;
  flex-direction: column;
  background: var(--paper-soft);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-head .count {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
}

.station-list {
  margin: 0;
  padding: 6px 8px;
  list-style: none;
  overflow-y: auto;
}

.station-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.station-list button:hover,
.station-list button.active {
  background: rgba(206, 0, 55, 0.08);
}

.station-list .num {
  flex: 0 0 22px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.station-list .nm { flex: 1; font-weight: 600; }

.station-list .code {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--red);
  border: 1px solid rgba(206, 0, 55, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
}

.panel-note {
  margin: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.panel-sub {
  padding: 10px 16px 6px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.station-list.construction button { opacity: 0.82; }

.station-list .code.ghost {
  color: var(--ink-soft);
  border-color: var(--line);
}

/* ---- legend -------------------------------------------------------- */

.legend {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 1.5px 0;
}

.swatch {
  flex: 0 0 auto;
  width: 26px;
  height: 0;
  border-top: 4px solid var(--c, var(--red));
}

.swatch.line.solid { border-top-style: solid; }
.swatch.line.dashed {
  border-top-style: dashed;
  opacity: 0.85;
}

.swatch.line.dashdot {
  height: 4px;
  border-top: 0;
  background: repeating-linear-gradient(90deg,
    var(--c, var(--red)) 0 9px, transparent 9px 13px,
    var(--c, var(--red)) 13px 16px, transparent 16px 21px);
  opacity: 0.9;
}

.swatch.dot {
  width: 11px;
  height: 11px;
  margin: 0 7px;
  border: 2.5px solid var(--c, var(--red));
  border-radius: 50%;
  height: 11px;
}

.swatch.dot.solid { background: var(--c, var(--red)); }
.swatch.dot.hollow {
  background: transparent;
  border-style: dashed;
  opacity: 0.75;
}

.legend-note {
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  opacity: 0.85;
}

/* ---- popup construction chip ---------------------------------------- */

.popup-card .chip.construction {
  color: var(--ink-soft);
  border-color: var(--line);
}

/* ---- base map switcher -------------------------------------------- */

.basemaps,
.lines {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--paper-soft);
}

.basemaps { top: 20px; }
.lines { top: 64px; }

.basemaps button,
.lines button {
  padding: 7px 14px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  cursor: pointer;
}

.basemaps button + button,
.lines button + button { border-left: 1px solid var(--line); }

.basemaps button.active,
.lines button.active {
  background: var(--ink);
  color: var(--paper);
}

/* ---- popup --------------------------------------------------------- */

.popup {
  position: fixed;
  z-index: 6;
  transform: translate(-50%, calc(-100% - 18px));
  pointer-events: none;
}

.popup.hidden { display: none; }

.popup-card {
  pointer-events: auto;
  min-width: 210px;
  max-width: 260px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.popup-card::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}

.popup-card h3 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.popup-card .official { margin: 0 0 8px; font-size: 12px; color: var(--ink-soft); }

.popup-card .meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.popup-card .chip {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--red);
  border: 1px solid rgba(206, 0, 55, 0.35);
  border-radius: 4px;
  padding: 1px 6px;
}

.popup-card .coords { font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.popup-card a.osm-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

/* ---- footer attribution -------------------------------------------- */

.attribution {
  position: fixed;
  left: 20px;
  bottom: 16px;
  z-index: 5;
  max-width: 420px;
  padding: 8px 12px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.attribution a { color: var(--ink); }

/* OpenLayers controls: keep them clear of the footer card */
.ol-attribution {
  bottom: 16px;
  right: 20px;
  left: auto;
  background: var(--paper-soft);
}

.ol-scale-line { bottom: 52px; left: 20px; background: var(--paper-soft); }

.ol-zoom {
  top: auto;
  bottom: 90px;
  left: 20px;
}

/* ---- small screens --------------------------------------------------- */

@media (max-width: 760px) {
  .masthead {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
    padding: 12px 14px;
  }
  .masthead h1 { font-size: 26px; }
  .basemaps { top: auto; bottom: 12px; left: 12px; transform: none; }
  .lines { top: auto; bottom: 48px; left: 12px; transform: none; }
  .panel {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 92px;
    width: auto;
    max-height: 38vh;
  }
  .attribution { display: none; }
  .ol-zoom { display: none; }
}
