/* Sigilint Well Monitor — mid-fi wireframe */

* { box-sizing: border-box; }

html, body, #root {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: #efe9da;
  color: #1a1a1a;
  overflow: hidden;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr 32px;
}

/* ============ TOP BAR ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: #f4efe4;
  border-bottom: 1px solid #1a1a1a;
  position: relative;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 1px solid #1a1a1a;
  background: #fff;
}
.brand-name {
  font-family: 'Architects Daughter', cursive;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.5px;
}
.brand-sub {
  font-size: 9px;
  color: #7a6f5c;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 2px;
}
.topnav {
  display: flex;
  gap: 18px;
  font-size: 11px;
  letter-spacing: 0.6px;
  margin-left: 12px;
}
.topnav a {
  color: #5b5b5b;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  position: relative;
}
.topnav a.active {
  color: #1a1a1a;
  border-bottom-color: #1a1a1a;
}
.topnav a:hover { color: #1a1a1a; }
.badge {
  display: inline-block;
  background: #c8442a;
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  margin-left: 4px;
  border-radius: 2px;
}
.region {
  margin-left: auto;
  font-size: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #5b5b5b;
}
.region-label { color: #1a1a1a; }
.region-val { color: #1a1a1a; }
.region-sep { color: #b8a888; }

/* ============ MAP AREA ============ */
.map-area {
  position: relative;
  overflow: hidden;
  background: #f4efe4;
}
.topo, .wells-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.wells-layer { z-index: 2; }

/* Markers */
.well text { user-select: none; }

/* Plume drift */
.plume ellipse, .plume circle {
  transition: cx 1s linear, cy 1s linear, rx 0.8s ease, ry 0.8s ease;
}

/* ============ LEGEND ============ */
.legend {
  position: absolute;
  top: 16px; left: 16px;
  background: #f4efe4;
  border: 1px solid #1a1a1a;
  padding: 8px 10px 10px;
  min-width: 180px;
  z-index: 5;
  box-shadow: 3px 3px 0 #1a1a1a;
}
.legend-title {
  font-size: 9px;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
  color: #5b5b5b;
}
.legend-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 4px 6px;
  margin: 0 -6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  font-size: 11px;
  color: #1a1a1a;
}
.legend-row:hover { background: #ebe3cf; }
.legend-row.active { background: #1a1a1a; color: #f4efe4; }
.legend-row.active .legend-count { color: #f4efe4; }
.legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.4px solid;
}
.legend-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.legend-count {
  font-size: 10px;
  color: #7a6f5c;
}
.legend-clear {
  background: none;
  border: 1px dashed #1a1a1a;
  width: 100%;
  margin-top: 6px;
  padding: 3px;
  font-size: 9px;
  cursor: pointer;
  letter-spacing: 0.5px;
}

/* ============ WIND ============ */
.wind-card {
  position: absolute;
  top: 16px; right: 16px;
  background: #f4efe4;
  border: 1px solid #1a1a1a;
  padding: 6px 10px 8px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 3px 3px 0 #1a1a1a;
}
.wind-title {
  font-size: 9px;
  letter-spacing: 1.2px;
  color: #5b5b5b;
  margin-bottom: 2px;
}
.wind-val {
  font-size: 10px;
  color: #1a1a1a;
}

/* ============ TOOLTIP ============ */
.tooltip {
  position: fixed;
  z-index: 50;
  background: #fffbf2;
  border: 1px solid #1a1a1a;
  padding: 8px 10px;
  font-size: 11px;
  box-shadow: 3px 3px 0 #1a1a1a;
  pointer-events: none;
  min-width: 200px;
}
.tt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tt-id { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #7a6f5c; }
.tt-name { font-weight: 600; font-size: 13px; }
.tt-meta { font-size: 10px; color: #7a6f5c; margin-left: auto; }
.tt-readout {
  display: flex;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #3a3a3a;
  padding-top: 4px;
  border-top: 1px dashed #b8a888;
  margin-top: 4px;
}
.tt-hint {
  font-size: 9px;
  color: #7a6f5c;
  font-style: italic;
  margin-top: 5px;
  letter-spacing: 0.3px;
}

.status-pill {
  display: inline-block;
  padding: 1px 6px;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.8px;
  border: 1px solid;
  border-radius: 2px;
}
.status-pill.big {
  font-size: 11px;
  padding: 3px 10px;
  letter-spacing: 1px;
}

/* ============ INFO PANEL ============ */
.info-panel {
  position: absolute;
  top: 56px; right: 0;
  height: calc(100vh - 56px - 32px);
  width: 360px;
  background: #fffbf2;
  border-left: 1px solid #1a1a1a;
  box-shadow: -6px 0 0 -4px #1a1a1a, -8px 0 24px rgba(0,0,0,0.08);
  z-index: 20;
  overflow-y: auto;
  animation: slideIn 0.22s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.close-btn {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px;
  background: none;
  border: 1px solid #1a1a1a;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid; place-items: center;
}
.close-btn:hover { background: #1a1a1a; color: #f4efe4; }

.ip-header {
  padding: 16px 18px 12px;
  border-bottom: 1px dashed #b8a888;
}
.ip-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #7a6f5c;
  letter-spacing: 1px;
}
.ip-header h2 {
  font-family: 'Architects Daughter', cursive;
  font-size: 24px;
  margin: 2px 0 8px;
  font-weight: 400;
  letter-spacing: -0.3px;
}
.ip-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ip-desc {
  font-size: 11px;
  color: #5b5b5b;
  font-style: italic;
}

.ip-section {
  padding: 12px 18px;
  border-bottom: 1px dashed #b8a888;
}
.ip-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: #5b5b5b;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mesh-status {
  display: flex; align-items: center; gap: 4px;
  color: #3a8a4f;
}
.mesh-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3a8a4f;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.ip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.ip-grid label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: #7a6f5c;
  display: block;
}
.ip-grid > div > .mono {
  font-size: 12px;
  margin-top: 1px;
}

/* Pollutants */
.pollutant {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dotted #d8cfb8;
}
.pollutant:last-child { border-bottom: none; }
.pollutant.over .poll-val { font-weight: 700; }
.poll-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.poll-name {
  display: flex; gap: 6px; align-items: baseline;
}
.poll-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
}
.poll-label {
  font-size: 10px;
  color: #7a6f5c;
}
.poll-val {
  font-size: 14px;
  font-weight: 500;
}
.poll-val .unit {
  font-size: 9px;
  color: #7a6f5c;
  margin-left: 3px;
  font-weight: 400;
}
.poll-bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.poll-bar {
  position: relative;
  height: 6px;
  background: #ece4d0;
  border: 1px solid #d8cfb8;
}
.poll-bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}
.poll-bar-limit {
  position: absolute;
  top: -2px; bottom: -2px;
  left: 100%;
  width: 1px;
  background: #c8442a;
  margin-left: -1px;
}

.sparkline { display: block; }

.ip-footer {
  padding: 10px 18px;
  font-size: 9px;
  color: #7a6f5c;
  letter-spacing: 0.5px;
}

/* ============ STATUS BAR ============ */
.status-bar {
  background: #1a1a1a;
  color: #d8cfb8;
  font-size: 10px;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-top: 1px solid #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
}
.status-bar b { color: #f4efe4; font-weight: 500; }
.status-bar .ok { color: #9fd3a8; }
.status-bar .warn { color: #f0a692; }

/* Tweaks panel — make it fit our aesthetic, but defer to component defaults */
.tweaks-panel {
  font-family: 'Inter', system-ui, sans-serif !important;
}

/* Place-name labels — ensure font loads */
.place-labels { font-family: 'Architects Daughter', cursive; }

/* Custom scrollbar in panel */
.info-panel::-webkit-scrollbar { width: 6px; }
.info-panel::-webkit-scrollbar-track { background: #f4efe4; }
.info-panel::-webkit-scrollbar-thumb { background: #b8a888; }
