/*
 * status.rostack.app
 *
 * Roblox's status page structure (a verdict banner, the services grouped and
 * listed with their state, then the history) in Rostack's own palette, with
 * ninety days of availability under every service.
 *
 * Plain CSS and no framework: this page exists for the moment everything else
 * is broken, so it depends on as little as possible.
 */

:root {
  --canvas: #0b0b0d;
  --surface: #131316;
  --surface-hi: #1a1a1e;
  --border: #232327;
  --border-hi: #33333a;
  --ink: #f4f5f7;
  --muted: #9a9aa4;
  --faint: #70707a;
  --argent: #c6ccd6;

  /* One hue per level, the vocabulary Roblox uses. */
  --operational: oklch(76% 0.16 158);
  --degraded: oklch(86% 0.15 95);
  --partial: oklch(74% 0.16 45);
  --major: oklch(66% 0.2 25);
  --nodata: #26262b;

  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-underline-offset: 3px;
}

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

/* ------------------------------------------------------------ header -- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 0 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  padding: 7px;
  border-radius: 12px;
  background: var(--surface-hi);
  box-shadow: inset 0 0 0 1px var(--border);
}

.brand-name {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.top-link {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}

.top-link:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------ banner -- */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  color: var(--canvas);
  background: var(--operational);
}

.banner[data-level="degraded"] {
  background: var(--degraded);
}

.banner[data-level="partial"] {
  background: var(--partial);
}

.banner[data-level="major"] {
  background: var(--major);
  color: #fff;
}

.banner[data-level="loading"] {
  background: var(--surface-hi);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.banner-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.banner-sub {
  margin: 0.1rem 0 0;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.8;
}

.banner-updated {
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.85;
}

.notice {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-hi);
}

.notice strong {
  color: var(--ink);
}

/* --------------------------------------------------------- incidents -- */

.active {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.incident {
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}

.incident-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 1rem 1.25rem 0.25rem;
}

.incident-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.incident[data-impact="degraded"] .incident-title,
.impact[data-level="degraded"] {
  color: var(--degraded);
}

.incident[data-impact="partial"] .incident-title,
.impact[data-level="partial"] {
  color: var(--partial);
}

.incident[data-impact="major"] .incident-title,
.impact[data-level="major"] {
  color: var(--major);
}

.incident.resolved .incident-title {
  color: var(--ink);
}

.impact {
  font-size: 12.5px;
  font-weight: 500;
}

.incident-meta {
  padding: 0 1.25rem;
  font-size: 12.5px;
  color: var(--faint);
}

.updates {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0 1.25rem 1rem;
  display: grid;
  gap: 0.85rem;
}

.update {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.2rem 1rem;
}

.phase {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--argent);
  padding-top: 0.15rem;
}

.update-body p {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.update-body time {
  font-size: 12px;
  color: var(--faint);
}

.auto {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* -------------------------------------------------------- components -- */

.card {
  margin-top: 2rem;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.group + .group {
  border-top: 1px solid var(--border);
}

.group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.group > summary::-webkit-details-marker {
  display: none;
}

.group-name {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 16px;
  font-weight: 600;
}

.group-name::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.group[open] .group-name::before {
  transform: rotate(0deg);
}

.group > summary:focus-visible {
  outline: 2px solid var(--argent);
  outline-offset: -2px;
  border-radius: 12px;
}

.component {
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}

.component-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.component-name {
  font-size: 14.5px;
}

.component-desc {
  display: block;
  font-size: 12.5px;
  color: var(--faint);
}

.state {
  /* Wraps inside its half rather than squeezing the name to nothing when a
     long level like "Partial Service Disruption" lands on a phone. */
  max-width: 50%;
  font-size: 13.5px;
  font-weight: 500;
  text-align: right;
}

.state[data-level="operational"] {
  color: var(--operational);
}

.state[data-level="degraded"] {
  color: var(--degraded);
}

.state[data-level="partial"] {
  color: var(--partial);
}

.state[data-level="major"] {
  color: var(--major);
}

.state[data-level="nodata"] {
  color: var(--faint);
}

.state small {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--faint);
}

/* The ninety-day strip. */
.bars {
  display: flex;
  gap: 2px;
  height: 30px;
  margin-top: 0.7rem;
}

.bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px;
  background: var(--nodata);
  transition: opacity 0.1s ease;
}

.bar[data-level="operational"] {
  background: var(--operational);
}

.bar[data-level="degraded"] {
  background: var(--degraded);
}

.bar[data-level="partial"] {
  background: var(--partial);
}

.bar[data-level="major"] {
  background: var(--major);
}

.bars:hover .bar {
  opacity: 0.55;
}

.bars .bar:hover {
  opacity: 1;
}

.axis {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
  font-size: 11.5px;
  color: var(--faint);
}

.axis .rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.axis .uptime {
  color: var(--muted);
}

.span-30 {
  display: none;
}

/* Ninety bars do not fit a phone. Show the last thirty, and say so. */
@media (max-width: 640px) {
  .bars .bar:nth-child(-n + 60) {
    display: none;
  }

  .span-90 {
    display: none;
  }

  .span-30 {
    display: inline;
  }
}

.monitoring-note {
  margin: 0.75rem 0 0;
  font-size: 12.5px;
  color: var(--faint);
}

/* The day tooltip. */
.tip {
  position: fixed;
  z-index: 10;
  width: 250px;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: var(--surface-hi);
  box-shadow:
    inset 0 0 0 1px var(--border-hi),
    0 16px 40px rgb(0 0 0 / 0.5);
  font-size: 12.5px;
  pointer-events: none;
}

.tip-date {
  font-weight: 600;
  color: var(--ink);
}

.tip-uptime {
  color: var(--muted);
}

.tip ul {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.tip li {
  color: var(--ink);
}

.tip li span {
  display: block;
  color: var(--faint);
}

/* ----------------------------------------------------------- history -- */

.section-title {
  margin: 3rem 0 1rem;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 15px;
  color: var(--ink);
}

.history-list {
  display: grid;
  gap: 0.75rem;
}

.month {
  margin: 2rem 0 0.75rem;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.history-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.history-tools select,
.history-tools button {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 14px;
  color: var(--muted);
}

.back {
  display: inline-block;
  margin: 1.25rem 0 0;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}

.back:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------ footer -- */

.foot {
  margin-top: 4rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  font-size: 13px;
  color: var(--faint);
}

.foot nav {
  display: flex;
  gap: 1.25rem;
}

.foot a {
  color: var(--muted);
  text-decoration: none;
}

.foot a:hover {
  color: var(--ink);
}

/* On a phone the timeline stacks: the phase above its update, not beside it. */
@media (max-width: 520px) {
  .update {
    grid-template-columns: 1fr;
  }

  .top {
    padding-top: 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
