/* LiquidWebSpace Weathermap — light theme (public + shared) */
:root {
  --bg:        #e9eff9;
  --bg-2:      #f4f7fc;
  --surface:   #ffffff;
  --surface-2: #f6f9fd;
  --border:    #e6ecf6;
  --border-2:  #eef2f9;
  --text:      #1f2a44;
  --heading:   #14223f;
  --muted:     #6b7a93;
  --brand:     #2f6bff;
  --brand-2:   #19c6c9;
  --shadow:    0 10px 30px rgba(31,42,68,0.08);
  --shadow-sm: 0 2px 8px rgba(31,42,68,0.06);

  --operational: #16a34a;  --operational-dot: #22c55e;
  --degraded:    #d97706;  --degraded-dot:    #f59e0b;
  --down:        #dc2626;  --down-dot:        #ef4444;
  --maintenance: #2563eb;  --maintenance-dot: #3b82f6;
  --unknown:     #8595ac;  --unknown-dot:     #b6c2d6;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 80% -10%, #eaf2ff, transparent),
    radial-gradient(900px 500px at 0% 110%, #eef5ff, transparent),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; color: var(--heading); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.85rem 1.6rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.85rem; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sub { color: var(--muted); font-size: 12px; border-left: 1px solid var(--border);
  padding-left: 0.85rem; }

.topnav { display: flex; gap: 0.4rem; margin-left: auto; }
.topnav a { color: var(--muted); padding: 0.4rem 0.9rem; border-radius: 8px; font-weight: 600;
  position: relative; }
.topnav a:hover { color: var(--heading); }
.topnav a.active { color: var(--brand); }
.topnav a.active::after { content: ""; position: absolute; left: 0.9rem; right: 0.9rem; bottom: -0.85rem;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }

.overall {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-weight: 700; font-size: 13px;
}
.overall .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--unknown-dot); }
.overall-operational { color: var(--operational); } .overall-operational .dot { background: var(--operational-dot); box-shadow: 0 0 0 4px rgba(34,197,94,0.15); }
.overall-degraded    { color: var(--degraded); }    .overall-degraded .dot    { background: var(--degraded-dot); box-shadow: 0 0 0 4px rgba(245,158,11,0.15); }
.overall-down        { color: var(--down); }         .overall-down .dot        { background: var(--down-dot); box-shadow: 0 0 0 4px rgba(239,68,68,0.15); }
.overall-maintenance { color: var(--maintenance); }  .overall-maintenance .dot { background: var(--maintenance-dot); }
.overall-unknown     { color: var(--unknown); }

/* ---------- map page layout ---------- */
.map-shell { display: flex; gap: 1.1rem; padding: 1.1rem; height: calc(100vh - 67px); }
.map-card { flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); padding: 0.6rem; overflow: hidden; }
.map-wrap { position: relative; height: 100%; border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(700px 380px at 50% 25%, #f3f7ff, #eef3fb); }
#weathermap { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#weathermap.grabbing { cursor: grabbing; }

.ocean { fill: transparent; }
.grat { stroke: #dde6f5; stroke-width: 0.5; vector-effect: non-scaling-stroke; }
.land { fill: #d6e0f1; stroke: #c6d3ea; stroke-width: 0.6; vector-effect: non-scaling-stroke; }

/* faint casing behind a whole bundle (scales with the map so it stays
   wrapped around the strands as they fan apart on zoom) */
.layer-links .link-casing { fill: none; opacity: 0.1; stroke-linecap: round; }
.link-casing.backbone { opacity: 0.14; }
.link-casing.s-operational { stroke: var(--operational-dot); }
.link-casing.s-degraded    { stroke: var(--degraded-dot); }
.link-casing.s-down        { stroke: var(--down-dot); }
.link-casing.s-maintenance { stroke: var(--maintenance-dot); }
.link-casing.s-unknown     { stroke: var(--unknown-dot); }

/* individual pipes — crisp constant width, fan apart as you zoom in */
.layer-links .strand { fill: none; stroke-width: 1.3; opacity: 0.8;
  vector-effect: non-scaling-stroke; cursor: pointer; }
.layer-links .strand.backbone { stroke-width: 1.6; opacity: 0.9; }
.strand.s-operational { stroke: var(--operational-dot); }
.strand.s-degraded    { stroke: var(--degraded-dot); }
.strand.s-down        { stroke: var(--down-dot); opacity: 0.5; stroke-dasharray: 4 5; }
.strand.s-maintenance { stroke: var(--maintenance-dot); }
.strand.s-unknown     { stroke: var(--unknown-dot); opacity: 0.45; stroke-dasharray: 4 6; }

/* moving dash overlay on each live strand */
.layer-links .strand-flow { fill: none; stroke-width: 1.5; opacity: 0.55; stroke-linecap: round;
  stroke-dasharray: 0.5 11; vector-effect: non-scaling-stroke;
  animation: flow 1s linear infinite; pointer-events: none; }
.strand-flow.s-operational { stroke: #0c7a37; }
.strand-flow.s-degraded    { stroke: #b9650a; }
@keyframes flow { to { stroke-dashoffset: -23; } }

.packet { stroke: none; }
.packet.s-operational { fill: #16a34a; filter: drop-shadow(0 0 3px rgba(34,197,94,0.8)); }
.packet.s-degraded    { fill: #d97706; filter: drop-shadow(0 0 3px rgba(245,158,11,0.8)); }

/* route labels along links (revealed when zoomed in) */
.layer-links .link-tag { opacity: 0; transition: opacity .2s; pointer-events: none; }
#weathermap.zoomed .layer-links .link-tag { opacity: 1; }
.link-tag-text { text-anchor: middle; fill: var(--muted); font-size: 7px; font-weight: 700;
  letter-spacing: 0.04em; paint-order: stroke; stroke: #fff; stroke-width: 2.6px; }
.link-tag.backbone .link-tag-text { fill: var(--brand); font-weight: 800; }

/* geographic context labels (revealed when zoomed in) */
.layer-regions .region { opacity: 0; transition: opacity .2s; pointer-events: none; }
#weathermap.zoomed .layer-regions .region { opacity: 1; }
.region-label { text-anchor: middle; fill: #9aabc6; font-weight: 800; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase; }
.region-ocean .region-label { fill: #b9c7dd; font-weight: 600; font-style: italic; letter-spacing: 0.28em; }

/* rotating accent ring marking hub sites */
.hub-ring { fill: none; stroke: var(--brand); stroke-width: 1.4; opacity: 0.55;
  stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; transform-origin: center;
  animation: hubspin 9s linear infinite; }
@keyframes hubspin { to { transform: rotate(360deg); } }

.node { cursor: pointer; }
.node-dot { fill: var(--unknown-dot); }
.node-ring { fill: #fff; stroke-width: 2.5; opacity: 0.9; vector-effect: non-scaling-stroke; }
.node-halo { fill: var(--unknown-dot); opacity: 0.18; }
.node-label { fill: var(--heading); font-size: 9px; font-weight: 800; text-anchor: middle;
  paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.node-sublabel { fill: var(--muted); font-size: 6px; font-weight: 700; text-anchor: middle;
  paint-order: stroke; stroke: #fff; stroke-width: 2.4px; opacity: 0; transition: opacity .15s; }
#weathermap.zoomed .node-sublabel { opacity: 1; }

.node.s-operational .node-dot { fill: var(--operational-dot); } .node.s-operational .node-halo { fill: var(--operational-dot); } .node.s-operational .node-ring { stroke: var(--operational-dot); }
.node.s-degraded    .node-dot { fill: var(--degraded-dot); }    .node.s-degraded    .node-halo { fill: var(--degraded-dot); }    .node.s-degraded    .node-ring { stroke: var(--degraded-dot); }
.node.s-down        .node-dot { fill: var(--down-dot); }        .node.s-down        .node-halo { fill: var(--down-dot); }        .node.s-down        .node-ring { stroke: var(--down-dot); }
.node.s-maintenance .node-dot { fill: var(--maintenance-dot); } .node.s-maintenance .node-halo { fill: var(--maintenance-dot); } .node.s-maintenance .node-ring { stroke: var(--maintenance-dot); }
.node.s-unknown     .node-dot { fill: var(--unknown-dot); }     .node.s-unknown     .node-ring { stroke: var(--unknown-dot); }

.pulse { fill: none; stroke-width: 2; opacity: 0.7; transform-origin: center;
  vector-effect: non-scaling-stroke; animation: pulse 1.6s ease-out infinite; }
.node.s-down .pulse { stroke: var(--down-dot); }
.node.s-degraded .pulse { stroke: var(--degraded-dot); }
@keyframes pulse { 0% { r: 6; opacity: 0.7; } 100% { r: 20; opacity: 0; } }

/* gentle radar ping marking live healthy sites */
.radar { fill: none; stroke: var(--operational-dot); stroke-width: 1.4; opacity: 0;
  transform-origin: center; vector-effect: non-scaling-stroke;
  animation: radar 3.2s ease-out infinite; }
@keyframes radar { 0% { r: 5; opacity: 0.5; } 70% { opacity: 0; } 100% { r: 17; opacity: 0; } }

/* ---------- overlays on the map ---------- */
.health-card { position: absolute; left: 16px; top: 16px; display: flex; align-items: center; gap: 0.7rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 0.7rem 0.95rem; box-shadow: var(--shadow); }
.health-globe { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e7efff, #e9fbf4); color: var(--brand); }
.health-globe svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.health-title { font-weight: 700; color: var(--heading); font-size: 13px; }
.health-status { display: flex; align-items: center; gap: 0.4rem; font-size: 12px; color: var(--muted); margin-top: 2px; }
.health-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown-dot); }
.health-card.overall-operational .health-status { color: var(--operational); } .health-card.overall-operational .dot { background: var(--operational-dot); }
.health-card.overall-degraded    .health-status { color: var(--degraded); }    .health-card.overall-degraded .dot    { background: var(--degraded-dot); }
.health-card.overall-down        .health-status { color: var(--down); }         .health-card.overall-down .dot        { background: var(--down-dot); }
.health-card.overall-maintenance .health-status { color: var(--maintenance); }  .health-card.overall-maintenance .dot { background: var(--maintenance-dot); }

.zoom-controls { position: absolute; right: 16px; top: 16px; display: flex; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 6px; box-shadow: var(--shadow); }
.zoom-controls button { width: 38px; height: 38px; font-size: 19px; line-height: 1; cursor: pointer;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; transition: .12s; }
.zoom-controls button:hover { color: var(--brand); background: #eef4ff; border-color: #d7e4ff; }
.zoom-controls button:active { transform: translateY(1px); }
.zoom-controls svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.zoom-level { position: absolute; right: 16px; top: 74px; padding: 0.3rem 0.6rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-sm); font-size: 12px; font-weight: 700; color: var(--muted);
  pointer-events: none; }

.stat-bar { position: absolute; left: 16px; right: 16px; bottom: 16px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 0.7rem 0.4rem; box-shadow: var(--shadow); }
.stat { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.9rem;
  border-right: 1px solid var(--border-2); }
.stat:last-child { border-right: none; }
.stat-ic { width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center; }
.stat-ic svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-nodes   { background: #eaf0ff; color: #3b6cff; }
.ic-links   { background: #e7faf1; color: #16a34a; }
.ic-latency { background: #f2ecff; color: #7c5cff; }
.ic-uptime  { background: #e7f7ef; color: #0fa968; }
.stat strong { display: block; font-size: 19px; color: var(--heading); line-height: 1.1; }
.stat small { color: var(--muted); font-size: 12px; }

.tooltip { position: absolute; z-index: 20; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.7rem 0.85rem; font-size: 12px; min-width: 190px;
  box-shadow: var(--shadow); color: var(--text); }
.tt-head { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 3px; color: var(--heading); }
.tt-row { color: var(--muted); }
.tt-reason { margin-top: 4px; color: var(--degraded); }
.tt-bb { color: var(--brand); font-weight: 700; }
.tt-feats { margin: 6px 0 0; padding: 6px 0 0 0; list-style: none; border-top: 1px solid var(--border-2); }
.tt-feats li { color: var(--muted); padding-left: 13px; position: relative; }
.tt-feats li::before { content: "›"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }

/* ---------- swatches / status text ---------- */
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--unknown-dot); flex: none; }
.swatch.s-operational { background: var(--operational-dot); }
.swatch.s-degraded    { background: var(--degraded-dot); }
.swatch.s-down        { background: var(--down-dot); }
.swatch.s-maintenance { background: var(--maintenance-dot); }
.swatch.s-unknown     { background: var(--unknown-dot); }
.s-operational { color: var(--operational); } .s-degraded { color: var(--degraded); }
.s-down { color: var(--down); } .s-maintenance { color: var(--maintenance); } .s-unknown { color: var(--unknown); }

/* ---------- sidebar ---------- */
.sidebar { width: 340px; flex: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); padding: 1.2rem 1.1rem; overflow-y: auto;
  display: flex; flex-direction: column; }
.sidebar h2 { margin: 0.2rem 0 1rem; font-size: 18px; }
.legend { list-style: none; padding: 0 0 0.9rem; margin: 0 0 0.6rem; border-bottom: 1px solid var(--border-2);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend-hub { width: 12px; height: 12px; border-radius: 50%; background: #fff;
  border: 2px solid var(--brand); flex: none; }
.legend-pipe { width: 16px; height: 6px; border-radius: 3px; flex: none;
  background: var(--operational-dot); opacity: 0.4; }

.node-list { list-style: none; padding: 0; margin: 0; flex: 1; }
.node-item { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 0.7rem;
  align-items: center; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border-2);
  border-radius: 10px; cursor: default; transition: background .12s; }
.node-item:hover { background: var(--surface-2); }
.ni-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2);
  border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.ni-icon svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ni-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--unknown-dot); }
.ni-name { font-weight: 650; color: var(--heading); }
.ni-status { font-size: 12px; font-weight: 600; text-align: right; }
.ni-chev { color: #b9c5d8; font-size: 16px; }
.ni-ms { display: none; }

.sidebar-foot { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border-2);
  color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }

/* ---------- status page ---------- */
.status-shell { max-width: 940px; margin: 0 auto; padding: 1.6rem 1.2rem 4rem; }
.overall-banner { display: flex; align-items: center; gap: 0.7rem;
  padding: 1.1rem 1.3rem; border-radius: 16px; margin-bottom: 1.5rem;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
  font-size: 17px; font-weight: 700; color: var(--heading); }
.overall-banner .dot { width: 13px; height: 13px; border-radius: 50%; background: var(--unknown-dot); }
.overall-banner .banner-time { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.banner-operational .dot { background: var(--operational-dot); } .banner-operational { color: var(--operational); }
.banner-degraded .dot    { background: var(--degraded-dot); }    .banner-degraded { color: var(--degraded); }
.banner-down .dot        { background: var(--down-dot); }        .banner-down { color: var(--down); }
.banner-maintenance .dot { background: var(--maintenance-dot); } .banner-maintenance { color: var(--maintenance); }
.banner-unknown .dot { background: var(--unknown-dot); }

.components h2, .incidents-open h2, .incident-history h2 { font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 1.8rem 0 0.8rem; }

.component { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.1rem; margin-bottom: 0.7rem; box-shadow: var(--shadow-sm); }
.component-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.component-name { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.component-meta { color: var(--muted); font-size: 12px; }
.component-status { display: flex; align-items: center; gap: 0.6rem; }
.reason { color: var(--muted); font-size: 12px; font-style: italic; }

.status-pill { font-size: 12px; font-weight: 700; padding: 0.25rem 0.7rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); }
.status-pill.s-operational { color: var(--operational); border-color: #b9ecca; background: #effbf3; }
.status-pill.s-degraded    { color: var(--degraded); border-color: #fde2b8; background: #fef7ec; }
.status-pill.s-down        { color: var(--down); border-color: #f6c4c4; background: #fdeded; }
.status-pill.s-maintenance { color: var(--maintenance); border-color: #c2d6fb; background: #eef4fe; }
.status-pill.s-unknown     { color: var(--unknown); }

.uptime-row { display: flex; align-items: flex-end; gap: 1rem; margin-top: 0.9rem; }
.bars { display: flex; gap: 2px; flex: 1; height: 30px; align-items: stretch; }
.bar { flex: 1; min-width: 2px; border-radius: 2px; background: var(--unknown-dot); opacity: 0.9; }
.bar.b-operational { background: var(--operational-dot); }
.bar.b-degraded    { background: var(--degraded-dot); }
.bar.b-down        { background: var(--down-dot); }
.bar.b-unknown     { background: #dde5f1; }
.uptime-num { text-align: right; font-weight: 800; white-space: nowrap; color: var(--heading); }
.uptime-num small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }

.incident { background: var(--surface); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 0.7rem; box-shadow: var(--shadow-sm); }
.incident.sev-minor { border-left-color: var(--degraded-dot); }
.incident.sev-major { border-left-color: #fb923c; }
.incident.sev-critical { border-left-color: var(--down-dot); }
.incident.resolved { border-left-color: var(--operational-dot); }
.incident header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.incident h3 { margin: 0; font-size: 15px; }
.incident p { color: var(--text); margin: 0.5rem 0 0; }
.incident footer { color: var(--muted); font-size: 12px; margin-top: 0.5rem; }
.inc-status { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.18rem 0.5rem; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); }
.inc-investigating { color: var(--down); } .inc-identified { color: var(--degraded); }
.inc-monitoring { color: var(--maintenance); } .inc-resolved { color: var(--operational); }
.inc-loc { font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 0.12rem 0.4rem; border-radius: 6px; }

.page-foot { color: var(--muted); text-align: center; margin-top: 2rem; font-size: 12px; }

@media (max-width: 860px) {
  .map-shell { flex-direction: column; height: auto; }
  .map-wrap { height: 60vh; }
  .sidebar { width: 100%; }
  .stat-bar { position: static; margin-top: 0.6rem; grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 0.4rem 0.6rem; }
  .topnav a.active::after { display: none; }
}
