/* ─────────────────────────────────────────────────────────────
   main.css — Netprobe / Connection Intelligence
   Dark theme, gray accents.
   Fully self-contained. Depends on fonts.css for font tokens
   and nav.css for --nav-h.
───────────────────────────────────────────────────────────── */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Grays */
  --g0: #0a0a0a;
  --g1: #111111;
  --g2: #181818;
  --g3: #222222;
  --g4: #2e2e2e;
  --g5: #3d3d3d;
  --g6: #5a5a5a;
  --g7: #888888;
  --g8: #b4b4b4;
  --g9: #e0e0e0;
  --ga: #f2f2f2;

  /* Accent — muted sage green */
  --accent:     #4e7a44;
  --accent-2:   #3a5e32;
  --accent-3:   #6b9e5e;
  --accent-4:   #9ec490;

  /* Semantic status */
  --ok:       #3a7a48;
  --ok-dim:   rgba(58,122,72,.15);
  --warn:     #7a6200;
  --warn-dim: rgba(122,98,0,.12);
  --err:      #7a2222;
  --err-dim:  rgba(122,34,34,.12);

  /* Layout */
  --nav-h: 64px;
  --r:  8px;
  --r2: 4px;
  --r3: 2px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--g1);
  color: var(--g8);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── SPLIT HERO ─────────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - var(--nav-h));    /* exactly viewport minus nav */
  overflow: hidden;                       /* no outer scroll */
}

/* LEFT PANEL — sticky text column */
.split-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 56px 60px 48px;
  border-right: 1px solid var(--g3);
  background: var(--g1);
  overflow: hidden;
}

/* RIGHT PANEL — map + card, NO internal scroll */
.split-right {
  display: flex;
  flex-direction: column;
  background: var(--g2);
  overflow: hidden;   /* ← prevents any scrolling inside */
}

/* ── Hero text ──────────────────────────────────────────── */
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-3);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent-3);
  opacity: .5;
}

.hero-label {
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 400;
  color: var(--g7);
  line-height: 1.3;
  margin-bottom: 10px;
}

.hero-ip {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(38px, 4.5vw, 60px);
  color: var(--accent-3);
  line-height: 1.05;
  letter-spacing: -.01em;
  margin-bottom: 8px;
  word-break: break-all;
  min-height: 1.1em;
}

.hero-location {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--g6);
  letter-spacing: .02em;
  margin-bottom: 24px;
  min-height: 1em;
}

/* ── Status row (pill + refresh btn) ────────────────────── */
.hero-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Refresh button */
.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--g4);
  background: var(--g2);
  color: var(--g6);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .18s, border-color .18s, background .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.refresh-btn:hover:not(:disabled) {
  color: var(--g9);
  border-color: var(--g5);
  background: var(--g3);
}
.refresh-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.refresh-btn svg.refresh-icon {
  width: 14px;
  height: 14px;
  display: block;
  /* SVG elements default transform-origin to 0 0 — override to center */
  transform-origin: center center;
  transform-box: fill-box;
}
.refresh-btn.spinning .refresh-icon {
  animation: spin 0.65s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Hero action links ──────────────────────────────────── */
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: -20px;
}

.hero-action-link {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--g6);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-line: underline;
  text-decoration-color: var(--g4);
  text-decoration-thickness: 1.2px;
  letter-spacing: .01em;
  transition: color .18s ease, text-decoration-color .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hero-action-link:hover {
  color: var(--g9);
  text-decoration-color: var(--g7);
}

.action-arrow {
  font-size: 11px;
  line-height: 1;
  display: inline-block;
  transition: transform .18s ease;
}

.hero-action-link:hover .action-arrow {
  transform: translate(1px, -1px);
}

.hero-action-sep {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--g4);
  user-select: none;
  line-height: 1;
  align-self: center;
}

.hero-sub {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 300;
  color: var(--g6);
  line-height: 1.75;
  max-width: 380px;
  margin-bottom: 36px;
}

/* ── Status pill ────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--g7);
  background: var(--g2);
  border: 1px solid var(--g4);
  border-radius: 99px;
  padding: 7px 16px 7px 12px;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g5);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.status-dot.ok   { background: var(--ok);   box-shadow: 0 0 0 3px var(--ok-dim); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.status-dot.err  { background: var(--err);  box-shadow: 0 0 0 3px var(--err-dim); }

/* ── Hero quick-facts strip ─────────────────────────────── */
.hero-facts {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--g3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}

.hero-fact-label {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--g6);
  margin-bottom: 4px;
}

.hero-fact-val {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--g9);
}
.hero-fact-val.green { color: var(--ok); }
.hero-fact-val.moss  { color: var(--accent-3); }

/* ── Map ────────────────────────────────────────────────── */
.map-wrap {
  position: relative;
  flex: 0 0 55%;
  border-bottom: 1px solid var(--g3);
  overflow: hidden;
}

#map { position: absolute; inset: 0; }

/* Dim the tiles to suit dark theme */
#map .leaflet-tile-pane {
  filter: brightness(0.72) saturate(0.8);
}

/* Attribution — readable but unobtrusive */
.leaflet-control-attribution {
  background: rgba(10,10,10,.75) !important;
  color: var(--g6) !important;
  font-family: var(--mono) !important;
  font-size: 9px !important;
  padding: 2px 6px !important;
  backdrop-filter: blur(4px);
}
.leaflet-control-attribution a {
  color: var(--g7) !important;
}

/* Zoom controls */
.leaflet-control-zoom a {
  background: rgba(18,18,18,.92) !important;
  color: var(--g7) !important;
  border-color: var(--g4) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--g3) !important;
  color: var(--g9) !important;
}

.map-overlay {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 500;
  background: rgba(10,10,10,.88);
  border-radius: var(--r2);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--g7);
  line-height: 1.85;
  pointer-events: none;
  backdrop-filter: blur(6px);
  border: 1px solid var(--g3);
}
.map-overlay strong {
  font-size: 12px;
  color: var(--ga);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.map-overlay .edge-tag {
  color: var(--accent-4);
  font-weight: 700;
}

/* ── Right card ─────────────────────────────────────────── */
.right-card {
  flex: 1;
  min-height: 0;          /* allow flex child to not overflow */
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  background: var(--g1);
  overflow: hidden;       /* hard clip — no scroll */
}

.right-card-title {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--g6);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.kv-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--g3);
  gap: 16px;
  flex-shrink: 0;
}
.kv-row:last-child { border-bottom: none; }

.kv-key {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--g6);
  flex-shrink: 0;
}

.kv-val {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--g9);
  text-align: right;
  word-break: break-all;
}
.kv-val.green { color: var(--ok); }
.kv-val.moss  { color: var(--accent-3); }
.kv-val.dim   { color: var(--g6); font-weight: 400; }

/* Cloudflare provider link inside kv-val */
.kv-provider-link {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--g9);
  text-decoration: none;
  position: relative;
  transition: color .18s ease;
}
.kv-provider-link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-3);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .2s ease;
}
.kv-provider-link:hover {
  color: var(--accent-4);
}
.kv-provider-link:hover::after {
  transform: scaleX(1);
}

/* ── Skeleton ────────────────────────────────────────────── */
.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, var(--g3) 25%, var(--g4) 50%, var(--g3) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r3);
  color: transparent !important;
  user-select: none;
  min-width: 60px;
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── Leaflet overrides ──────────────────────────────────── */
.leaflet-control-zoom a {
  background: var(--g2) !important;
  color: var(--g9)      !important;
  border-color: var(--g4) !important;
}
.leaflet-control-zoom a:hover { background: var(--g3) !important; }
.leaflet-control-attribution {
  font-family: var(--mono) !important;
  font-size: 9px !important;
  background: rgba(10,10,10,.75) !important;
  color: var(--g6) !important;
}
.leaflet-tooltip.map-tip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.leaflet-tooltip-top.map-tip::before { display: none !important; }

.map-popup {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ga);
  background: var(--g0);
  border-radius: 5px;
  padding: 5px 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.6);
  display: block;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up   { animation: fadeUp .4s ease both; }
.fade-up-1 { animation: fadeUp .4s .1s ease both; }
.fade-up-2 { animation: fadeUp .4s .2s ease both; }
.fade-up-3 { animation: fadeUp .4s .3s ease both; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--g2); }
::-webkit-scrollbar-thumb { background: var(--g5); border-radius: 3px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .split-left {
    height: auto;
    padding: 48px 28px 40px;
    border-right: none;
    border-bottom: 1px solid var(--g3);
  }
  .split-right {
    min-height: 520px;
    overflow: hidden;
  }
  .map-wrap { flex: 0 0 280px; }
}

@media (max-width: 480px) {
  .hero-facts { grid-template-columns: 1fr; }
}