/* =========================================================================
   EmberHound Status — aligned to the emberhound.com brand system.
   Tokens mirror the app's CSS variables (HSL), font Outfit, 1rem radii,
   violet primary + orange secondary on a deep-indigo ground.
   ========================================================================= */

:root {
  /* surfaces — from app: --background 268 43% 8%, --card 258 37% 16% */
  --bg:        hsl(268 43% 8%);
  --bg-2:      hsl(266 40% 6%);
  --panel:     hsl(258 36% 15%);
  --panel-2:   hsl(257 36% 19%);
  --panel-80:  hsl(258 37% 16% / .8);
  --line:      hsl(254 38% 23%);
  --line-soft: hsl(256 34% 17%);

  /* ink — foreground white, muted-foreground 262 23% 65% */
  --ink:       hsl(0 0% 100%);
  --ink-soft:  hsl(262 30% 82%);
  --ink-dim:   hsl(262 23% 65%);
  --ink-faint: hsl(262 18% 50%);

  /* brand — primary violet 268 40% 56%, secondary orange 24 95% 53% */
  --primary:      hsl(268 40% 56%);
  --primary-soft: hsl(268 52% 70%);
  --primary-glow: hsl(268 40% 56% / .40);
  --accent:       hsl(24 95% 53%);
  --accent-soft:  hsl(24 95% 62%);
  --accent-glow:  hsl(24 95% 53% / .32);

  /* semantic — app status tokens */
  --up:        hsl(142 69% 58%);
  --up-glow:   hsl(142 69% 58% / .30);
  --degraded:  hsl(38 92% 60%);
  --deg-glow:  hsl(38 92% 60% / .30);
  --down:      hsl(0 72% 55%);
  --down-glow: hsl(0 72% 55% / .35);

  /* type — Outfit everywhere, like the app */
  --display: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --body:    "Outfit", ui-sans-serif, system-ui, sans-serif;

  --radius:    16px;   /* app --radius: 1rem */
  --radius-sm: 10px;
  --radius-xs: 8px;
  --maxw:      1040px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--primary); color: #fff; }

a { color: var(--primary-soft); text-decoration: none; }
a:hover { color: #fff; }

:focus-visible {
  outline: 2px solid var(--primary-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- atmosphere */
.bg-glow {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(120% 75% at 50% -14%, var(--primary-glow), transparent 58%),
    radial-gradient(80% 50% at 88% 4%, var(--accent-glow), transparent 52%),
    radial-gradient(100% 60% at 10% 0%, hsl(268 45% 30% / .25), transparent 55%);
  animation: breathe 10s ease-in-out infinite;
}
.bg-grain {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  opacity: .035; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.bg-scan { display: none; }

@keyframes breathe {
  0%, 100% { opacity: .8;  transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(8px); }
}

/* ---------------------------------------------------------------- shell */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 40px) 64px;
}

/* ---------------------------------------------------------------- masthead */
.masthead {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  height: 64px;
  margin: 0 calc(-1 * clamp(16px, 5vw, 40px)) 8px;
  padding: 0 clamp(16px, 5vw, 40px);
  background: var(--panel-80);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wordmark__mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  filter: drop-shadow(rgba(134,104,181,.5) 0 0 9.6px) drop-shadow(rgba(251,115,20,.25) 0 0 4.8px);
}
.wordmark__mark img { width: 100%; height: 100%; object-fit: contain; }
.wordmark__text {
  font-family: var(--display);
  font-weight: 700; font-size: 1.18rem; letter-spacing: -.02em;
  color: var(--ink);
}
.wordmark__tag {
  font-weight: 600; font-size: .64rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--primary-soft);
  padding: 4px 8px; border-radius: 999px;
  border: 1px solid var(--line);
  background: hsl(268 40% 56% / .12);
}

.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav__link {
  font-size: .85rem; font-weight: 500;
  color: var(--ink-dim);
  padding: 8px 13px; border-radius: 10px;
  border: 1px solid transparent;
  transition: color .18s, border-color .18s, background .18s;
}
.nav__link:hover { color: #fff; background: hsl(257 41% 35% / .35); }
.nav__link--active { color: #fff; }
.nav__link--cta {
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}
.nav__link--cta:hover { background: var(--accent-soft); color: #2a1402; }

/* ---------------------------------------------------------------- verdict */
.verdict {
  position: relative;
  padding: clamp(44px, 9vw, 84px) 0 clamp(34px, 6vw, 52px);
}
.verdict::before {
  content: ""; position: absolute; z-index: -1;
  left: -6%; top: 12%; width: 56%; height: 74%;
  background: radial-gradient(closest-side, var(--primary-glow), transparent 72%);
  filter: blur(16px); opacity: .9;
  transition: background .6s ease;
}
.verdict[data-tone="up"]::before       { background: radial-gradient(closest-side, var(--up-glow), transparent 72%); }
.verdict[data-tone="down"]::before     { background: radial-gradient(closest-side, var(--down-glow), transparent 72%); }
.verdict[data-tone="degraded"]::before { background: radial-gradient(closest-side, var(--deg-glow), transparent 72%); }

.verdict__eyebrow {
  margin: 0 0 18px;
  font-size: .74rem; font-weight: 600;
  letter-spacing: .34em; text-transform: uppercase;
  color: var(--ink-faint);
}
.verdict__line { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 24px); }

.verdict__dot {
  flex: none;
  width: clamp(14px, 2.2vw, 20px); height: clamp(14px, 2.2vw, 20px);
  border-radius: 50%;
  background: var(--ink-faint);
  position: relative;
}
.verdict__dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: inherit; animation: ping 2.4s cubic-bezier(0,0,.2,1) infinite;
}
.verdict__dot[data-state="up"]       { background: var(--up);       box-shadow: 0 0 16px var(--up-glow); }
.verdict__dot[data-state="degraded"] { background: var(--degraded); box-shadow: 0 0 16px var(--deg-glow); }
.verdict__dot[data-state="down"]     { background: var(--down);     box-shadow: 0 0 16px var(--down-glow); }
@keyframes ping {
  0%   { transform: scale(1);   opacity: .7; }
  70%  { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

.verdict__headline {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 5rem);
  line-height: .98;
  letter-spacing: -.03em;
  color: var(--ink);
}
.verdict[data-tone="degraded"] .verdict__headline { color: var(--degraded); }
.verdict[data-tone="down"]     .verdict__headline { color: var(--down); }

.verdict__sub {
  margin: 22px 0 0; max-width: 56ch;
  color: var(--ink-dim); font-size: 1.05rem;
}
.verdict__sub b { color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- services */
.services { margin-top: 6px; }
.services__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.services__title {
  margin: 0;
  font-size: .8rem; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase;
  color: var(--ink-faint);
}
.services__legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend__item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .76rem; color: var(--ink-dim);
}
.legend__sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend__sw--up { background: var(--up); }
.legend__sw--degraded { background: var(--degraded); }
.legend__sw--down { background: var(--down); }

.services__list { display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------------- card */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px clamp(18px, 2.6vw, 26px);
  overflow: hidden;
  transition: border-color .22s, transform .22s, box-shadow .22s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ink-faint);
  transition: background .22s, box-shadow .22s;
}
.card[data-status="up"]::before   { background: var(--up);   box-shadow: 0 0 14px var(--up-glow); }
.card[data-status="down"]::before { background: var(--down); box-shadow: 0 0 14px var(--down-glow); }
.card:hover {
  border-color: hsl(268 35% 40%);
  transform: translateY(-2px);
  box-shadow: 0 16px 44px -24px hsl(268 60% 4% / .9), 0 0 0 1px var(--primary-glow);
}

.card__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.card__id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.card__icon {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--bg-2); border: 1px solid var(--line);
  object-fit: contain; padding: 3px;
}
.card__name {
  margin: 0; font-family: var(--display);
  font-weight: 600; font-size: 1.18rem; letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pill {
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600;
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--up   { color: var(--up);   border-color: hsl(142 60% 45% / .4); background: hsl(142 69% 58% / .10); }
.pill--down { color: var(--down); border-color: hsl(0 72% 55% / .45);   background: hsl(0 72% 55% / .12); }
.pill--down .pill__dot { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* metrics row */
.card__metrics {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) repeat(4, 1fr);
  gap: 14px 18px;
  align-items: end;
  padding-bottom: 18px;
}
.metric { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.metric__label {
  font-size: .66rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
}
.metric__value {
  font-weight: 600;
  font-size: 1.06rem; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.metric--latency .metric__value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.metric--latency .metric__value span { font-size: .72rem; font-weight: 500; color: var(--ink-dim); margin-left: 3px; }
.metric__value--good { color: var(--up); }
.metric__value--warn { color: var(--degraded); }
.metric__value--bad  { color: var(--down); }
.metric__value--limited { color: var(--ink-faint); }
.metric__mark {
  color: var(--accent); font-weight: 700;
  font-size: .7em; vertical-align: super; margin-left: 1px;
}
.metric { cursor: default; }

.uptime-note {
  margin: 16px 0 0; max-width: 70ch;
  font-size: .78rem; color: var(--ink-faint); line-height: 1.45;
}
.uptime-note span { color: var(--accent); font-weight: 700; }

/* history strip */
.history { padding-top: 16px; border-top: 1px solid var(--line-soft); }
.history__bar { display: flex; gap: 2px; align-items: stretch; height: 34px; }
.tick {
  flex: 1 1 0; min-width: 0; border-radius: 2px;
  background: var(--ink-faint); opacity: .85;
  transition: transform .12s, filter .12s;
  cursor: default;
}
.tick--up   { background: linear-gradient(180deg, var(--up), hsl(142 60% 46%)); }
.tick--degraded { background: linear-gradient(180deg, var(--degraded), hsl(38 88% 48%)); }
.tick--down { background: linear-gradient(180deg, hsl(0 80% 64%), var(--down)); }
.tick--none { background: var(--line); opacity: .55; }
.tick:hover { transform: scaleY(1.12); filter: brightness(1.22); }

.history__foot {
  display: flex; justify-content: space-between;
  margin-top: 9px;
  font-size: .72rem; font-weight: 500; letter-spacing: .02em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* skeleton */
.card--skeleton { height: 172px; border-style: dashed; opacity: .5; }
.card--skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, hsl(268 40% 70% / .06) 50%, transparent 70%);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* reveal */
.card--live {
  animation: reveal .5s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* error state */
.banner {
  border: 1px solid hsl(0 72% 55% / .35); background: hsl(0 72% 55% / .08);
  border-radius: var(--radius); padding: 18px 22px;
  font-size: .92rem; color: var(--ink);
}
.banner b { color: var(--down); font-weight: 600; }

/* ---------------------------------------------------------------- active incidents */
.active { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.incident-banner {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px clamp(18px, 2.5vw, 24px) 18px 22px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  overflow: hidden;
}
.incident-banner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.incident-banner--incident { border-color: hsl(0 72% 55% / .4); }
.incident-banner--incident::before { background: var(--down); box-shadow: 0 0 16px var(--down-glow); }
.incident-banner--maintenance { border-color: hsl(268 40% 56% / .45); }
.incident-banner--maintenance::before { background: var(--primary); box-shadow: 0 0 16px var(--primary-glow); }

.incident-banner__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.incident-banner__tag {
  font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.incident-banner--incident .incident-banner__tag { color: var(--down); background: hsl(0 72% 55% / .12); }
.incident-banner--maintenance .incident-banner__tag { color: var(--primary-soft); background: hsl(268 40% 56% / .15); }
.incident-banner__since {
  font-size: .78rem; color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
.incident-banner__title {
  display: inline-block; font-weight: 600; font-size: 1.08rem; color: var(--ink);
  letter-spacing: -.01em;
}
.incident-banner__title:hover { color: var(--primary-soft); }
.incident-banner__note { margin: 8px 0 0; color: var(--ink-dim); font-size: .9rem; }

.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: .7rem; font-weight: 500; color: var(--ink-soft);
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2);
}

/* ---------------------------------------------------------------- incident history */
.incidents { margin-top: 40px; }
.incidents__report { font-size: .82rem; font-weight: 500; color: var(--primary-soft); }
.incidents__report:hover { color: #fff; }
.incidents__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.incidents__loading { color: var(--ink-faint); font-size: .9rem; padding: 6px 0; }
.incidents__empty {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-dim); font-size: .92rem; padding: 14px 0;
}
.incidents__empty-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--up);
  box-shadow: 0 0 10px var(--up-glow);
}

.inc {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.inc:last-child { border-bottom: 0; }
.inc__dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px;
}
.inc--open .inc__dot     { background: var(--down); box-shadow: 0 0 10px var(--down-glow); animation: blink 1.1s steps(2,start) infinite; }
.inc--resolved .inc__dot { background: var(--up); }
.inc__main { flex: 1 1 auto; min-width: 0; }
.inc__title {
  display: inline-block; font-weight: 600; font-size: .98rem; color: var(--ink);
}
.inc__title:hover { color: var(--primary-soft); }
.inc__meta {
  display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px;
  font-size: .78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.inc__sep { color: var(--line); }
.inc__state {
  flex: none; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
}
.inc__state--open     { color: var(--down); background: hsl(0 72% 55% / .1); border-color: hsl(0 72% 55% / .35); }
.inc__state--resolved { color: var(--up);   background: hsl(142 69% 58% / .08); border-color: hsl(142 60% 45% / .3); }

/* ---------------------------------------------------------------- footer */
.footer { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.footer__meta {
  display: flex; align-items: center; gap: 12px;
  font-size: .8rem; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.footer__sync { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-dim); }
.footer__sync-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--up);
  box-shadow: 0 0 8px var(--up-glow);
  animation: ping 2.4s cubic-bezier(0,0,.2,1) infinite;
}
.footer__sep { color: var(--line); }
.footer__gen { color: var(--ink-dim); }
.footer__note { margin: 14px 0 0; max-width: 72ch; color: var(--ink-faint); font-size: .84rem; }

/* ---------------------------------------------------------------- tooltip */
.tip {
  position: fixed; z-index: 50; pointer-events: none;
  transform: translate(-50%, -120%);
  background: hsl(256 42% 13%); border: 1px solid var(--line);
  color: var(--ink); padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: .76rem; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 12px 34px -12px hsl(268 60% 3% / .85);
  opacity: 0; transition: opacity .12s;
}
.tip[data-show="1"] { opacity: 1; }
.tip b { color: var(--primary-soft); font-weight: 600; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 720px) {
  .card__metrics { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .metric--latency { grid-column: 1 / -1; }
  .verdict__sub { font-size: .98rem; }
}
@media (max-width: 440px) {
  .history__bar { height: 28px; }
  .nav__link { padding: 7px 10px; font-size: .8rem; }
  .wordmark__tag { display: none; }
}

/* ---------------------------------------------------------------- motion off */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .bg-glow { animation: none; }
}
