/* RUMO · tradução da identidade canônica PULSO para orientação espacial.
   O mapa é campo; a interface é instrumento; o carmim é acontecimento. */

:focus-visible {
  outline: 1px solid rgba(251, 249, 245, 0.75);
  outline-offset: 4px;
}

html,
body {
  overflow: hidden;
  background: var(--preto);
  color: var(--branco-quente);
}

#map {
  background: #0b0b0b;
}

#map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), transparent 20%, transparent 68%, rgba(0, 0, 0, 0.28));
}

.maplibregl-canvas {
  filter: saturate(0.72) contrast(1.04) brightness(0.88);
}

#instrument-header {
  position: fixed;
  z-index: 7;
  top: max(22px, env(safe-area-inset-top));
  left: 22px;
  right: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  color: rgba(251, 249, 245, 0.82);
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.9);
}

.instrument-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.instrument-name strong {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.2em;
  font-weight: 600;
}

.instrument-name span,
.instrument-mode {
  font-size: 9px;
  letter-spacing: 0.16em;
  font-weight: 300;
  color: rgba(251, 249, 245, 0.38);
  text-transform: lowercase;
}

.instrument-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(251, 249, 245, 0.62);
}

/* O vidro existe como matéria, não como cartão. O backdrop fica numa camada
   separada para preservar os inputs no Safari/iOS. */
#panel {
  position: fixed;
  z-index: 8;
  color: var(--branco-quente);
  isolation: isolate;
}

#panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 80% 0%, rgba(251, 249, 245, 0.035), transparent 34%),
    rgba(12, 12, 12, 0.89);
  -webkit-backdrop-filter: blur(32px) saturate(112%);
  backdrop-filter: blur(32px) saturate(112%);
  border: 1px solid rgba(251, 249, 245, 0.08);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.sheet-grip {
  display: none;
  width: 28px;
  height: 1px;
  background: rgba(251, 249, 245, 0.28);
  margin: 0 auto 18px;
}

.panel-kicker {
  margin: 0 0 17px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

#panel .panel-kicker h1 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  line-height: 1;
  color: var(--branco-quente);
}

.panel-kicker span {
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.13em;
  color: rgba(251, 249, 245, 0.34);
  text-transform: lowercase;
}

.search-shell {
  position: relative;
  border-bottom: 1px solid rgba(251, 249, 245, 0.17);
  transition: border-color 520ms var(--pulso-ease);
}

.search-shell:focus-within {
  border-color: rgba(251, 249, 245, 0.72);
}

.search-prefix {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: rgba(251, 249, 245, 0.28);
  pointer-events: none;
}

#panel input[type="text"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 42px;
  padding: 8px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--branco-quente);
  font: 400 15px/1.35 var(--font-body);
}

#panel input[type="text"]::placeholder {
  color: rgba(251, 249, 245, 0.27);
}

#panel input[type="text"]:focus {
  outline: none;
  border: 0;
  background: transparent;
}

#results {
  max-height: 178px;
  overflow-y: auto;
  margin: 4px 0 8px;
  scrollbar-width: none;
}

#results::-webkit-scrollbar {
  display: none;
}

.result-item {
  padding: 11px 3px;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.45;
  color: rgba(251, 249, 245, 0.64);
  cursor: pointer;
  border: 0;
  border-bottom: 1px solid rgba(251, 249, 245, 0.06);
  border-radius: 0;
  transition: color 280ms ease, padding 280ms ease;
}

.result-item:hover,
.result-item:active {
  color: var(--branco-quente);
  padding-left: 8px;
  background: transparent;
}

#waypoints {
  margin: 8px 0 6px;
  display: grid;
  gap: 0;
  position: relative;
}

#waypoints::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 23px;
  bottom: 23px;
  width: 1px;
  background: rgba(251, 249, 245, 0.12);
}

.waypoint {
  display: grid;
  grid-template-columns: 10px 48px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid rgba(251, 249, 245, 0.07);
  transition: border-color 420ms var(--pulso-ease);
}

.waypoint[data-active="true"] {
  border-bottom-color: rgba(251, 249, 245, 0.34);
}

.waypoint-mark {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(251, 249, 245, 0.5);
  border-radius: 50%;
  background: #0f0f0f;
  position: relative;
  z-index: 1;
  transition: all 500ms var(--pulso-ease);
}

.waypoint[data-ready="true"] .waypoint-mark--origin {
  background: var(--carmim);
  border-color: var(--carmim);
  box-shadow: 0 0 14px rgba(184, 40, 62, 0.5);
}

.waypoint[data-ready="true"] .waypoint-mark--dest {
  background: var(--branco-quente);
  border-color: var(--branco-quente);
  box-shadow: 0 0 12px rgba(251, 249, 245, 0.18);
}

.waypoint-label {
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(251, 249, 245, 0.28);
  transition: color 420ms var(--pulso-ease);
}

.waypoint[data-active="true"] .waypoint-label {
  color: rgba(251, 249, 245, 0.7);
}

.waypoint input[type="text"] {
  min-height: 46px;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  color: rgba(251, 249, 245, 0.84);
  text-overflow: ellipsis;
}

.waypoint input[type="text"]::placeholder {
  color: rgba(251, 249, 245, 0.27);
}

#swap-btn {
  justify-self: end;
  margin: 7px 0 7px 66px !important;
  min-height: 26px;
  padding: 0 1px !important;
  color: rgba(251, 249, 245, 0.34) !important;
}

#swap-btn:hover,
#swap-btn:active {
  color: var(--branco-quente) !important;
}

#results-context {
  min-height: 12px;
  margin-top: 8px;
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(251, 249, 245, 0.27);
  text-transform: lowercase;
}

.actions {
  display: flex;
  align-items: center;
  gap: 22px;
  border-top: 1px solid rgba(251, 249, 245, 0.08);
  padding-top: 14px;
}

#panel button {
  -webkit-appearance: none;
  appearance: none;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(251, 249, 245, 0.45);
  font: 300 10px/1 var(--font-body);
  letter-spacing: 0.13em;
  text-transform: lowercase;
  cursor: pointer;
  transition: color 300ms ease, text-shadow 300ms ease;
}

#panel button:hover,
#panel button:active {
  color: var(--branco-quente);
  background: transparent;
}

#panel .result-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 11px 3px;
  border: 0;
  border-bottom: 1px solid rgba(251, 249, 245, 0.06);
  border-radius: 0;
  background: transparent;
  color: rgba(251, 249, 245, 0.64);
  font: 300 12px/1.45 var(--font-body);
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
}

#panel .result-item:hover,
#panel .result-item:active {
  padding-left: 8px;
  color: var(--branco-quente);
}

#route-btn {
  color: rgba(251, 249, 245, 0.82) !important;
}

#route-btn[data-ready="true"] {
  text-shadow: 0 0 14px rgba(251, 249, 245, 0.22);
}

#clear-btn {
  margin-left: auto !important;
}

#status {
  min-height: 15px;
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1.5;
  color: rgba(251, 249, 245, 0.34);
  opacity: 1;
  white-space: pre-wrap;
  text-transform: lowercase;
}

#route-info {
  display: none;
  margin: 17px 0 2px;
  padding: 14px 0 2px;
  border: 0;
  border-top: 1px solid rgba(184, 40, 62, 0.45);
  border-radius: 0;
  background: transparent;
}

.route-metrics {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.route-metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.route-metric span {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  letter-spacing: 0.13em;
  color: rgba(251, 249, 245, 0.3);
  text-transform: uppercase;
}

.route-source {
  margin-left: auto;
  align-self: flex-end;
  padding-bottom: 2px;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(251, 249, 245, 0.22);
  line-height: 1.35;
  text-align: right;
}

.route-source small {
  display: block;
  margin-top: 3px;
  font-size: 7px;
  letter-spacing: 0.04em;
  color: rgba(251, 249, 245, 0.38);
}

.attrib {
  margin-top: 14px;
  font-family: var(--font-body);
  font-size: 7.5px;
  letter-spacing: 0.055em;
  line-height: 1.5;
  color: rgba(251, 249, 245, 0.18);
}

.attrib a {
  color: inherit;
}

.rumo-marker {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.rumo-marker::before {
  content: "";
  display: block;
  border-radius: 50%;
}

.rumo-marker--origin::before {
  width: 7px;
  height: 7px;
  background: var(--carmim);
  box-shadow: 0 0 0 5px rgba(184, 40, 62, 0.12), 0 0 22px rgba(184, 40, 62, 0.5);
}

.rumo-marker--dest::before {
  width: 8px;
  height: 8px;
  background: #0f0f0f;
  border: 2px solid var(--branco-quente);
  box-shadow: 0 0 0 4px rgba(251, 249, 245, 0.08);
}

.maplibregl-ctrl-top-right {
  top: max(54px, env(safe-area-inset-top));
  right: 12px;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  background: rgba(15, 15, 15, 0.72) !important;
  border: 1px solid rgba(251, 249, 245, 0.08);
  box-shadow: none !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.maplibregl-ctrl-group button {
  filter: invert(1);
  opacity: 0.62;
}

@media (min-width: 641px) {
  #panel {
    top: auto;
    left: 22px;
    bottom: 22px;
    width: 354px;
    border-radius: 2px;
  }

  #panel::before {
    border-radius: 2px;
  }

  #panel-inner {
    padding: 22px 24px 20px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
  }
}

@media (max-width: 640px) {
  #instrument-header {
    left: 18px;
    right: 18px;
  }

  .instrument-mode {
    display: none;
  }

  #panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  #panel::before {
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
  }

  #panel-inner {
    padding: 12px 20px 17px;
    max-height: min(68dvh, 590px);
    overflow-y: auto;
  }

  .sheet-grip {
    display: block;
  }

  .panel-kicker {
    margin-bottom: 13px;
  }

  #waypoints { margin-top: 4px; }

  .attrib {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
