/* ---- Full-page two-column layout (/status/:id) ---- */

.sp-wrap {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Left column: MapLibre GL world map */
.sp-map {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #0d1117;
}

/* Placeholder shown when PROTOMAPS_KEY is not configured */
.sp-map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #8b949e;
  gap: 8px;
  padding: 24px;
}

.sp-map-placeholder p { margin: 0; }
.sp-map-hint { font-size: 13px; line-height: 1.5; }

/* Right column: scrollable info + vote panel */
.sp-panel {
  width: 360px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0f1117;
  border-left: 1px solid rgba(255, 255, 255, .08);
}

/* Solo layout (no map): centered, wider details panel */
.sp-wrap--solo { justify-content: center; }

.sp-panel--solo {
  width: 100%;
  max-width: 600px;
  flex: 0 1 600px;
  margin: 0 auto;
  border-left: none;
}

.sp-inner {
  padding: 16px 16px 40px;
  /* --status is set inline per-page to the current status colour. */
}

/* Top bar: back button + brand (left) · breadcrumbs (right) */
.sp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sp-top-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sp-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .04);
  color: #c9d1d9;
  transition: background .12s, border-color .12s, color .12s;
}

.sp-back-btn:hover {
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .22);
}

.sp-top .brand { font-size: 13px; gap: 6px; }
.sp-top .brand img { width: 20px; height: 20px; }
.sp-top .crumbs { margin: 0; font-size: 11px; flex-shrink: 0; }

/* Question headline */
.sp-q {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  margin: 0 0 12px;
}

/* Generic card shell (service card + community-reports card) */
.sp-card {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 14px;
  margin: 0 0 12px;
  background: rgba(255, 255, 255, .025);
}

/* Service card: subtle status-tinted top edge */
.sp-card--service {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--status) 12%, transparent), transparent 64px),
    rgba(255, 255, 255, .025);
  border-color: color-mix(in srgb, var(--status) 24%, rgba(255, 255, 255, .08));
}

/* Service identity row: logo · name/category · heartbeat */
.sp-svc {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sp-logo {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: contain;
  background: rgba(255, 255, 255, .06);
  padding: 5px;
  flex-shrink: 0;
}

.sp-svc-main { min-width: 0; flex: 1; }

/* Name + status indicator share the top line */
.sp-svc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sp-svc-name {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-svc-cat {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}

/* Heartbeat status indicator */
.sp-beat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  color: var(--status);
  cursor: default;
}

.sp-beat-label {
  font-size: 12px;
  font-weight: 600;
}

/* Pulsing status dot */
.sp-beat-dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status);
  flex-shrink: 0;
}

.sp-beat-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--status);
  animation: sp-beat 1.8s ease-out infinite;
}

/* Faster pulse when something is wrong. */
.sp-beat--down .sp-beat-dot::after,
.sp-beat--degraded .sp-beat-dot::after { animation-duration: 1.1s; }
/* No live pulse for an unknown status. */
.sp-beat--unknown .sp-beat-dot { opacity: .5; }
.sp-beat--unknown .sp-beat-dot::after { animation: none; }

@keyframes sp-beat {
  0%   { transform: scale(1);   opacity: .55; }
  70%  { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-beat-dot::after { animation: none; }
}

/* Status / incident note inside the service card */
.sp-svc-note {
  font-size: 12.5px;
  line-height: 1.45;
  color: #c9d1d9;
  margin: 11px 0 0;
}

/* Hairline divider used inside cards */
.sp-rule {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin: 12px 0;
}

/* Official status page link */
.sp-ext {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #e6edf3;
  font-size: 12.5px;
  font-weight: 500;
  transition: color .12s;
}

.sp-ext:hover { text-decoration: none; color: #fff; }
.sp-ext:hover .sp-ext-arrow { transform: translate(1px, -1px); }
.sp-ext-arrow { color: #58a6ff; font-size: 13px; flex-shrink: 0; transition: transform .12s; }

.sp-ext-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sp-ext-host {
  font-size: 11px;
  font-weight: 400;
  color: #8b949e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-inner footer {
  margin-top: 16px;
  padding-top: 12px;
  font-size: 11px;
}

/* Responsive: stack vertically on narrow screens */
@media (max-width: 700px) {
  .sp-wrap {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  /* Only relax html/body sizing on the report page (which has .sp-wrap).
     report.css is also loaded on the home page, where body must stay
     `height:100dvh; overflow:hidden` so the flex:1 treemap fills the screen. */
  html:has(.sp-wrap), body:has(.sp-wrap) {
    height: auto !important;
    overflow: visible !important;
  }

  .sp-map {
    flex: none;
    height: 55vw;
    min-height: 220px;
    max-height: 380px;
  }

  .sp-panel {
    width: auto;
    overflow: visible;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, .08);
  }
}

/* ---- MapLibre GL overrides ---- */

/* Keep attribution compact in the dark theme */
.maplibregl-ctrl-attrib {
  background: rgba(15, 17, 23, 0.75) !important;
  color: #8b949e !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a { color: #58a6ff !important; }

/* Report popup style */
.report-popup .maplibregl-popup-content {
  background: rgba(22, 27, 34, 0.96);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  color: #e6edf3;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 8px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
}

.report-popup .maplibregl-popup-tip {
  border-top-color: rgba(22, 27, 34, 0.96) !important;
  border-bottom-color: rgba(22, 27, 34, 0.96) !important;
}

/* ---- Community report card ---- */
/* The widget element is also a `.sp-card`, so card chrome is inherited. */

.report-widget__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
  margin: 0 0 12px;
}

.report-widget__help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  color: #8b949e;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
}

.report-widget__help:hover,
.report-widget__help:focus-visible {
  color: #e6edf3;
  border-color: rgba(255, 255, 255, .42);
  outline: none;
}

.report-widget__prompt {
  font-size: 12.5px;
  color: #8b949e;
  margin: 0 0 9px;
}

/* Reason picker */
.report-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.report-reason-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .04);
  color: #c9d1d9;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.report-reason-btn:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .22);
}

.report-reason-btn:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

/* Thanks / voted state */
.report-widget__thanks {
  font-size: 13px;
  color: #3fb950;
  margin: 0 0 12px;
}

/* Empty / loading state */
.report-widget__empty {
  font-size: 12.5px;
  color: #8b949e;
  margin: 0;
}

/* Donut + legend */
.report-donut {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 12px;
}

.report-donut__svg {
  width: 82px;
  height: 82px;
  flex-shrink: 0;
}

.report-donut__track { stroke: rgba(255, 255, 255, .07); }

.report-donut__seg {
  transition: stroke-dasharray .4s ease;
  transform-origin: center;
}

.report-donut__num {
  fill: #e6edf3;
  font: 700 8px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
}

.report-donut__cap {
  fill: #8b949e;
  font: 3.2px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
  letter-spacing: .12px;
  text-transform: uppercase;
}

.report-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.report-legend__row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #c9d1d9;
}

.report-legend__swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.report-legend__label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-legend__val {
  flex-shrink: 0;
  color: #8b949e;
  font-variant-numeric: tabular-nums;
}

.report-widget__total {
  font-size: 12.5px;
  color: #8b949e;
  margin: 0;
}

.report-widget__total strong { color: #e6edf3; }

.report-rule {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin: 12px 0;
}

/* Section heading shared by the 24h sub-sections */
.report-section__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #8b949e;
  margin: 0 0 8px;
}

.report-section__sub {
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  font-weight: 600;
  color: #8b949e;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
}

.report-section__empty {
  font-size: 12px;
  color: #8b949e;
  margin: 0;
}

/* 7d report-volume sparkline (bars) */
.report-spark {
  display: flex;
  align-items: stretch;
  gap: 3px;
  height: 44px;
  padding: 0;
}

/* Full-height hover/focus target per day bucket */
.report-spark__col {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  cursor: default;
}

.report-spark__bar {
  width: 100%;
  background: #f0883e;
  border-radius: 2px 2px 0 0;
  transition: height .3s ease, background .12s;
}

.report-spark__col:hover .report-spark__bar,
.report-spark__col:focus-visible .report-spark__bar { background: #ffa657; }

.report-spark__col:focus-visible { outline: none; }

.report-spark__bar.is-empty {
  height: 2px !important;
  background: rgba(255, 255, 255, .08);
  border-radius: 2px;
}

/* Tooltip bubble shown on hover/focus. Rendered BELOW the bars so it never
   clips against the top edge of a scrolling container (e.g. the detail modal). */
.report-spark__col::after {
  content: attr(data-tip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 6px);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(22, 27, 34, .97);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #e6edf3;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity .12s;
}

/* Little caret above the bubble */
.report-spark__col::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: rgba(22, 27, 34, .97);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity .12s;
}

.report-spark__col:hover::after,
.report-spark__col:hover::before,
.report-spark__col:focus-visible::after,
.report-spark__col:focus-visible::before { opacity: 1; }

.report-spark__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 10px;
  color: #6e7681;
}

/* Top countries (24h) ranked bars */
.report-topc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.report-topc__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.report-topc__flag { font-size: 14px; line-height: 1; flex-shrink: 0; }

.report-topc__name {
  flex: 1;
  min-width: 0;
  color: #c9d1d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-topc__count {
  flex-shrink: 0;
  color: #e6edf3;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.report-topc__track {
  flex-shrink: 0;
  width: 64px;
  height: 6px;
  background: rgba(255, 255, 255, .06);
  border-radius: 999px;
  overflow: hidden;
}

.report-topc__fill {
  display: block;
  height: 100%;
  background: #f0883e;
  border-radius: 999px;
  transition: width .3s ease;
}

/* Latest reports feed */
.report-latest__head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #8b949e;
  margin: 0 0 4px;
}

.report-latest {
  list-style: none;
  margin: 0;
  padding: 0;
}

.report-latest__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.report-latest__row:first-child { border-top: 0; }

.report-latest__flag { font-size: 14px; line-height: 1; flex-shrink: 0; }

.report-latest__country {
  flex: 1;
  min-width: 0;
  color: #c9d1d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-latest__reason {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
}

.report-latest__time {
  flex-shrink: 0;
  min-width: 46px;
  text-align: right;
  color: #8b949e;
  font-size: 11px;
}
