@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #0d0d0d;
  --surface: #141414;
  --surface-raised: #1c1c1c;
  --border: #252525;
  --border-hover: #383838;
  --text: #eeeeee;
  --muted: #6e6e6e;
  --faint: #363636;

  --up: #3ddc84;
  --degraded: #f5a623;
  --down: #ff4f4f;
  --checking: #5c9eff;

  --font: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Cascadia Code', Menlo, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --r-card: 12px;
  --r-sm: 6px;
}

* { box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--up);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* legacy Edge */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }  /* Chromium, Safari */

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── top bar ─────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 10;
  background: var(--checking);
  transition: background 400ms var(--ease-out);
}
.topbar.is-checking {
  animation: sheen 1.6s linear infinite;
  background: linear-gradient(90deg,
    transparent, var(--checking) 40%, #9cd4ff 50%, var(--checking) 60%, transparent
  );
  background-size: 300% 100%;
}
.topbar.is-up       { background: var(--up); }
.topbar.is-degraded { background: var(--degraded); }
.topbar.is-down     { background: var(--down); }

@keyframes sheen { to { background-position: -300% 0; } }

/* ─── layout ──────────────────────────────────────── */
.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 88px) clamp(16px, 5vw, 28px) 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* stagger reveals on direct children */
.shell > [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal 400ms var(--ease-out) forwards;
}
.shell > [data-reveal]:nth-child(1) { animation-delay: 0ms; }
.shell > [data-reveal]:nth-child(2) { animation-delay: 60ms; }
.shell > [data-reveal]:nth-child(3) { animation-delay: 120ms; }
.shell > [data-reveal]:nth-child(4) { animation-delay: 180ms; }
.shell > [data-reveal]:nth-child(5) { animation-delay: 240ms; }

@keyframes reveal { to { opacity: 1; transform: none; } }

/* ─── summary banner ──────────────────────────────── */
.summary-bar {
  --state: var(--checking);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--state);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  transition: border-color 320ms var(--ease-out);
}
.summary-bar::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--state);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--state) 18%, transparent);
  flex-shrink: 0;
  transition: background 320ms var(--ease-out);
}
.summary-bar.is-up       { --state: var(--up); }
.summary-bar.is-degraded { --state: var(--degraded); }
.summary-bar.is-down     { --state: var(--down); }
.summary-bar.is-checking { --state: var(--checking); }

/* ─── services list ───────────────────────────────── */
.services {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* stagger the cards in rather than fading the whole block at once */
.services .svc {
  animation: svc-in 460ms var(--ease-out) both;
}
.services .svc:nth-child(1) { animation-delay: 70ms; }
.services .svc:nth-child(2) { animation-delay: 140ms; }
.services .svc:nth-child(3) { animation-delay: 210ms; }
@keyframes svc-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ─── masthead ────────────────────────────────────── */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand__mark {
  display: inline-flex;
  width: 30px; height: 30px;
  flex-shrink: 0;
}
.brand__mark svg { width: 100%; height: 100%; }
.brand__text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand__text p {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color 140ms, border-color 140ms, background 140ms, transform 100ms;
}
.ghost-btn:active { transform: scale(0.96); }
.masthead-actions { display: flex; align-items: center; gap: 8px; }
.discord-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: color 140ms, border-color 140ms, background 140ms, transform 100ms;
  flex-shrink: 0;
}
.discord-btn svg { width: 16px; height: 16px; }
.discord-btn:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) {
  .discord-btn:hover {
    color: #5865f2;
    border-color: #5865f2;
    background: color-mix(in srgb, #5865f2 10%, transparent);
  }
}
.ghost-btn__icon { width: 12px; height: 12px; }
.ghost-btn.is-spinning .ghost-btn__icon { animation: spin 600ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (hover: hover) and (pointer: fine) {
  .ghost-btn:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--surface);
  }
}

/* ─── service card ────────────────────────────────── */
.svc {
  --state: var(--checking);
  position: relative;
  overflow: hidden;
  padding: 15px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  transition: border-color 320ms var(--ease-out);
}
/* state accent rail down the left edge */
.svc::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 2px;
  background: var(--state);
  transition: background 320ms var(--ease-out);
}
.svc.is-up       { --state: var(--up);       border-color: color-mix(in srgb, var(--up)       20%, var(--border)); }
.svc.is-degraded { --state: var(--degraded);  border-color: color-mix(in srgb, var(--degraded) 20%, var(--border)); }
.svc.is-down     { --state: var(--down);      border-color: color-mix(in srgb, var(--down)     20%, var(--border)); }
.svc.is-checking { --state: var(--checking); }

.svc__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* left: orb + name + status */
.svc__identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.svc__orb {
  position: relative;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.svc__names {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.svc__name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.svc__status {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--state);
  transition: color 320ms var(--ease-out);
}

/* right: stats + toggle */
.svc__meta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}
.svc__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.svc__stat-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.svc__stat-val em {
  font-size: 10px;
  font-style: normal;
  color: var(--muted);
  margin-left: 1px;
}
.svc__stat-cap {
  font-family: var(--font-mono);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}
.svc__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition:
    color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    background 140ms var(--ease-out),
    transform 140ms var(--ease-out);
}
.svc__toggle:active { transform: scale(0.92); }
.svc__toggle svg {
  width: 14px; height: 14px;
  transition: transform 300ms var(--ease-out);
}
.svc.is-collapsed .svc__toggle svg { transform: rotate(-90deg); }

.svc__sub {
  margin: 11px 0 0;
  padding-left: 35px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  min-height: 1.4em;
}

/* collapsible detail (grid-rows reveal, no JS height math) */
.svc__detail {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 360ms var(--ease-out);
}
.svc.is-collapsed .svc__detail { grid-template-rows: 0fr; }
.svc__detail-inner {
  overflow: hidden;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  transition:
    margin-top 360ms var(--ease-out),
    padding-top 360ms var(--ease-out),
    border-color 360ms var(--ease-out);
}
.svc.is-collapsed .svc__detail-inner {
  margin-top: 0;
  padding-top: 0;
  border-top-color: transparent;
}
.detail-col { min-width: 0; }
.detail-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.detail-label__right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.detail-stats {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.detail-stats b { color: var(--text); font-weight: 500; }

/* pulsing orb dot (shared by every service) */
.core {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--state);
  transition: background 320ms var(--ease-out);
  z-index: 1;
}
.ring {
  position: absolute;
  inset: 0; margin: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid var(--state);
  opacity: 0;
  animation: signal 2.4s var(--ease-out) infinite;
}
.ring--2 { animation-delay: 0.8s; }
.ring--3 { animation-delay: 1.6s; }
@keyframes signal {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(6);   opacity: 0; }
}
.svc.is-down .ring { animation: none; }

/* ─── detail meta ─────────────────────────────────── */
.dotsep {
  display: inline-block;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--faint);
  margin: 0 5px 1px;
  vertical-align: middle;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
}
.legend__dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 1.5px;
  margin-left: 6px;
}
.legend__dot.is-up       { background: var(--up); }
.legend__dot.is-degraded { background: var(--degraded); }
.legend__dot.is-down     { background: var(--down); }

/* ─── timeline ────────────────────────────────────── */
.timeline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 44px;
}
.tl-bar {
  flex: 1;
  min-width: 0;
  height: 100%;
  border-radius: 2px 2px 1px 1px;
  background: var(--up);
  transform: scaleY(0.08);
  transform-origin: bottom;
  transition:
    transform 320ms var(--ease-out),
    background 200ms var(--ease-out),
    filter 120ms;
}
.tl-bar.is-degraded { background: var(--degraded); }
.tl-bar.is-down     { background: var(--down); transform: scaleY(1); }
.tl-bar.is-empty    { background: var(--faint); opacity: 0.5; transform: scaleY(0.08); }

/* ─── latency chart ───────────────────────────────── */
.chart { height: 76px; position: relative; }
.chart__svg {
  --state: var(--up);
  width: 100%; height: 100%;
  display: block;
  overflow: visible;
}
.chart__svg #fill-a stop,
.chart__svg #fill-b stop,
.chart__svg #fill-c stop { stop-color: var(--state); }

.chart__line {
  stroke: var(--state);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition:
    stroke 280ms var(--ease-out),
    stroke-dashoffset 580ms var(--ease-out);
}
.chart__area { transition: opacity 380ms var(--ease-out); }

/* hover readout: vertical cursor, point marker, tooltip */
.chart__cursor,
.chart__cursor-dot,
.chart__tip {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chart__cursor {
  top: 0; bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: color-mix(in srgb, var(--state) 55%, transparent);
  transition: opacity 120ms var(--ease-out);
}
.chart__cursor-dot {
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--state);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--state) 22%, transparent);
  transform: scale(0.4);
  /* slight overshoot so the marker snaps onto the point */
  transition:
    opacity 120ms var(--ease-out),
    transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* tooltip lives INSIDE the chart box so overflow:hidden can never clip it.
   Default pins to the top edge; --bottom pins to the bottom edge. */
.chart__tip {
  top: 5px;
  transform: translateX(-50%) scale(0.96);
  transform-origin: center top;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border-hover);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.8);
  font-family: var(--font-mono);
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  z-index: 3;
  transition:
    opacity 140ms var(--ease-out),
    transform 160ms var(--ease-out);
}
.chart__tip--bottom {
  top: auto;
  bottom: 5px;
  transform-origin: center bottom;
}
.chart__tip b {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.chart__tip span {
  font-size: 9.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chart.is-hovering .chart__cursor { opacity: 1; }
.chart.is-hovering .chart__cursor-dot { opacity: 1; transform: scale(1); }
.chart.is-hovering .chart__tip { opacity: 1; transform: translateX(-50%) scale(1); }

/* ─── player reports ──────────────────────────────── */
.report-section {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.rbar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 36px;
  margin-bottom: 10px;
}
.rbar {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 1px 1px;
  background: var(--down);
  opacity: 0.45;
  transition: opacity 120ms;
}
.rbar.is-empty {
  height: 2px !important;
  background: var(--faint);
  opacity: 0.35;
}
@media (hover: hover) and (pointer: fine) {
  .rbar:not(.is-empty):hover { opacity: 0.8; }
}

.report-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 140ms, border-color 140ms, background 140ms;
  white-space: nowrap;
  user-select: none;
}
.chip.is-selected {
  color: var(--down);
  border-color: color-mix(in srgb, var(--down) 45%, var(--border));
  background: color-mix(in srgb, var(--down) 9%, transparent);
}
@media (hover: hover) and (pointer: fine) {
  .chip:not(.is-selected):hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--surface-raised);
  }
}

.report-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.report-submit {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color 140ms, border-color 140ms, background 140ms;
}
.report-submit:not(:disabled) {
  color: var(--text);
  border-color: var(--border-hover);
  cursor: pointer;
}
.report-submit:disabled { opacity: 0.4; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .report-submit:not(:disabled):hover {
    background: var(--surface-raised);
  }
}
.report-msg {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}
.report-msg.is-ok  { color: var(--up); }
.report-msg.is-err { color: var(--down); }

/* ─── turnstile widget (only visible if a challenge is shown) ───────── */
.cf-widget { display: flex; justify-content: center; margin-top: 16px; }
.cf-widget:empty { display: none; }

/* ─── footer ──────────────────────────────────────── */
.legal {
  display: block;
  margin: 18px auto 0;
  max-width: 360px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--faint);
}

/* ─── hover ───────────────────────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .tl-bar:hover     { filter: brightness(1.4); }
  .svc:hover        { border-color: var(--border-hover); }
  .svc__toggle:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--surface-raised);
  }
}

/* ─── responsive ──────────────────────────────────── */
@media (max-width: 540px) {
  .svc__detail-inner { grid-template-columns: 1fr; gap: 16px; }
  .svc__meta { gap: 14px; }
  .detail-stats { font-size: 10px; }
}
@media (max-width: 380px) {
  /* drop the uptime stat on very narrow screens to keep the row tidy */
  .svc__stat:first-child { display: none; }
}

/* ─── reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shell > [data-reveal] { animation: none; opacity: 1; transform: none; }
  .services .svc { animation: none; opacity: 1; transform: none; }
  .ring, .topbar.is-checking, .ghost-btn.is-spinning .ghost-btn__icon { animation: none; }
  .ring { display: none; }
  .svc__detail, .svc__detail-inner { transition: none; }
  .chart__line { transition: stroke 280ms var(--ease-out); }
  /* keep the readout fades, drop the scale movement */
  .chart__cursor-dot,
  .chart.is-hovering .chart__cursor-dot { transform: none; }
  .chart__tip,
  .chart.is-hovering .chart__tip { transform: translateX(-50%); }
}
