/* ==========================================================================
   What is down? — the anti-Downdetector.

   Design rule: the answer must be readable in two seconds from across a
   room. One giant headline, three colours, big dots, nothing else competing.
   Colour = status, always. Green / amber / red / grey, never anything else
   in those hues so the eye can trust them.
   ========================================================================== */

@font-face { font-family: 'Outfit'; src: url('/assets/fonts/outfit-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/assets/fonts/outfit-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/assets/fonts/outfit-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #0b0c10;
  --panel: #12141a;
  --panel-2: #171a21;
  --line: rgba(255, 255, 255, 0.07);
  --ink: #f3f4f6;
  --muted: rgba(243, 244, 246, 0.6);
  --dim: rgba(243, 244, 246, 0.38);

  --ok: #22c55e;
  --warn: #f5b100;
  --bad: #f97316;
  --down: #ef4444;
  --unk: #6b7280;

  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

:where(a, button):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0.1; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ nav */

.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 12, 16, 0.8);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-flex { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c, var(--ok));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--ok)) 18%, transparent), 0 0 16px color-mix(in srgb, var(--c, var(--ok)) 60%, transparent);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.credit { margin-top: 0.8rem; }
.credit a { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); }
.credit a:hover { border-color: var(--ink); }
.top-links { display: flex; gap: 1.2rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.top-links a { color: var(--muted); text-decoration: none; }
.top-links a:hover { color: var(--ink); }

/* -------------------------------------------------------------- overall */

.overall {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 4.5rem 0 3.5rem;
  --tint: var(--ok);
}
.overall.lvl-degraded { --tint: var(--warn); }
.overall.lvl-partial  { --tint: var(--bad); }
.overall.lvl-major    { --tint: var(--down); }
.overall.lvl-unknown  { --tint: var(--unk); }

/* The tint is the whole mood of the page: a soft wash of the overall status
   colour behind the headline. Green feels calm, red feels like a siren. */
.overall::before {
  content: ''; position: absolute; inset: -40% -10% auto; height: 520px; z-index: -1;
  background: radial-gradient(ellipse 55% 60% at 50% 30%, color-mix(in srgb, var(--tint) 34%, transparent), transparent 70%);
  filter: blur(6px);
  transition: background 0.8s ease;
}

.eyebrow {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 1rem;
}
.eyebrow time { color: var(--ink); }

.overall h1 {
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  font-weight: 800; letter-spacing: -0.04em; line-height: 0.98; margin: 0 0 0.8rem;
  color: var(--tint);
  text-shadow: 0 0 40px color-mix(in srgb, var(--tint) 35%, transparent);
}
.overall .sub { margin: 0; font-size: 1.15rem; color: var(--muted); max-width: 46ch; }

.down-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.6rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.9rem 0.45rem 0.7rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  transition: background 0.2s ease;
}
.chip:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.chip.lvl-degraded { --c: var(--warn); }
.chip.lvl-partial  { --c: var(--bad); }
.chip.lvl-major    { --c: var(--down); }

/* ---------------------------------------------------------------- dots */

.dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--c, var(--unk));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--unk)) 18%, transparent), 0 0 18px color-mix(in srgb, var(--c, var(--unk)) 55%, transparent);
}
.chip .dot { width: 9px; height: 9px; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); }

/* Anything not-OK breathes, so it draws the eye even in the periphery. */
.lvl-degraded .dot, .lvl-partial .dot, .lvl-major .dot { animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent), 0 0 18px color-mix(in srgb, var(--c) 55%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--c) 10%, transparent), 0 0 28px color-mix(in srgb, var(--c) 80%, transparent); }
}

/* --------------------------------------------------------------- groups */

.groups { padding: 1rem 0 5rem; display: grid; gap: 2.6rem; }
.group h2 {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--dim); font-weight: 600; margin: 0 0 0.9rem;
}

.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.75rem; align-items: start; }

.svc {
  --c: var(--ok);
  display: flex; align-items: flex-start; gap: 0.95rem;
  padding: 1.05rem 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  text-decoration: none; color: inherit;
  transition: transform 0.25s var(--ease), border-color 0.25s ease, background 0.25s ease;
}
.svc:hover { transform: translateY(-2px); background: var(--panel-2); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.svc.lvl-degraded { --c: var(--warn); }
.svc.lvl-partial  { --c: var(--bad); }
.svc.lvl-major    { --c: var(--down); }
.svc.lvl-unknown  { --c: var(--unk); }

/* Down services get a coloured left edge so a scan down the column catches
   them without reading a word. */
.svc.lvl-degraded, .svc.lvl-partial, .svc.lvl-major {
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 6%, var(--panel));
}

.svc .dot { margin-top: 0.42rem; }
.svc-main { flex: 1; min-width: 0; display: grid; gap: 0.15rem; }
.svc-name { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.svc-summary { color: var(--muted); font-size: 0.9rem; }
.svc-incidents { margin: 0.45rem 0 0; padding: 0 0 0 1rem; color: var(--muted); font-size: 0.84rem; display: grid; gap: 0.15rem; }
.svc-incidents li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; list-style: none; position: relative; }
.svc-incidents li::before { content: '•'; color: var(--c); position: absolute; left: -0.85rem; }

.svc-level {
  flex: none; align-self: flex-start;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--c); padding-top: 0.35rem; white-space: nowrap;
}

/* ---------------------------------------------------------------- foot */

.foot { border-top: 1px solid var(--line); padding: 2rem 0 2.5rem; color: var(--dim); font-size: 0.86rem; }
.foot p { margin: 0 0 0.4rem; max-width: 70ch; }
.foot a { color: var(--muted); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 640px) {
  .overall { padding: 3rem 0 2.5rem; }
  .svc-grid { grid-template-columns: 1fr; }
  .top-links a:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lvl-degraded .dot, .lvl-partial .dot, .lvl-major .dot { animation: none; }
  .svc { transition: none; }
}
