/* Design tokens (light theme). The dark override block below only redefines
   what actually changes between themes - anything not listed there (e.g. the
   status colors) is shared by both themes. */
:root {
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --ink: #0d1b2a;
  --muted: #64748b;

  --header-from: #020408;
  --header-to: #040810;
  --header-border: rgba(255, 255, 255, 0.05);
  --header-accent: #60a5fa;
  --header-link: #ffffff;
  --header-link-hover: #ffffff;
  --header-divider: rgba(255, 255, 255, 0.2);
  --header-divider-soft: rgba(255, 255, 255, 0.15);
  --header-toggle-hover: rgba(255, 255, 255, 0.1);

  /* One color per status app.js understands (operational/partial_outage/down);
     see STATUS_LABELS in app.js. The *-text variants exist for future use on
     light backgrounds - the pills/dots below currently use the base color. */
  --operational: #00bc7d;
  --operational-text: #007a55;
  --partial_outage: #ffb900;
  --partial_outage-text: #a16207;
  --down: #fb2c36;
  --down-text: #b91c1c;

  --banner-operational-from: #009966;
  --banner-operational-to: #00b377;
  --banner-partial_outage-from: #b45309;
  --banner-partial_outage-to: #d97706;
  --banner-down-from: #b91c1c;
  --banner-down-to: #dc2626;

  --shadow: 0 1px 2px rgba(13, 27, 42, 0.04);
}

/* data-theme is set on <html> by the inline script in index.html (from a
   saved preference) or by initThemeToggle() in app.js (defaulting to the OS
   preference, then toggled by the header button). */
:root[data-theme="dark"] {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  transition: background-color 0.15s ease, color 0.15s ease;
}

code, .mono {
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.container {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.site-header {
  background: linear-gradient(to bottom, var(--header-from), var(--header-to));
}

.header-accent {
  height: 2px;
  background: linear-gradient(to right, #1a56db, #3b82f6 40%, #38bdf8);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.header-divider {
  width: 1px;
  height: 14px;
  background: var(--header-divider);
  border-radius: 999px;
}

.brand-suffix {
  margin: 0;
  color: var(--header-accent);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--header-link);
  font-size: 14px;
  text-decoration: none;
}

.header-nav a:hover {
  color: var(--header-link-hover);
}

.header-nav-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--header-divider-soft);
  border-radius: 999px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--header-toggle-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.theme-toggle img {
  width: 18px;
  height: 18px;
  display: block;
}

/* Show the moon in light mode (click it to go dark) and the sun in dark mode. */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.header-hairline {
  height: 1px;
  background: var(--header-border);
}

/* Main */

main.container {
  padding: 40px 24px 24px;
}

/* Hero banner */

.hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px;
  border-radius: 16px;
  color: #ffffff;
  background: radial-gradient(circle at 20% 45%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(to bottom, var(--banner-operational-from), var(--banner-operational-to));
  margin-bottom: 32px;
}

.hero-banner--partial_outage {
  background: radial-gradient(circle at 20% 45%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(to bottom, var(--banner-partial_outage-from), var(--banner-partial_outage-to));
}

.hero-banner--down {
  background: radial-gradient(circle at 20% 45%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(to bottom, var(--banner-down-from), var(--banner-down-to));
}

.hero-banner-left {
  min-width: 0;
}

.hero-banner-heading {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.hero-banner-right {
  text-align: right;
  flex-shrink: 0;
}

.hero-banner-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.hero-banner-value {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 500;
}

/* Panels */

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 32px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--ink);
}

/* Component / service rows */

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

.component-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}

.component-list li:last-child > .component-row {
  border-bottom: none;
}

.component-row--expandable {
  cursor: pointer;
}

.component-row--expandable:hover {
  background: color-mix(in srgb, var(--border) 30%, transparent);
}

.component-chevron {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.component-row[aria-expanded="true"] .component-chevron {
  transform: rotate(180deg);
}

.component-chevron--placeholder {
  visibility: hidden;
}

.component-regions {
  list-style: none;
  margin: 0;
  padding: 4px 24px 12px 48px;
  border-bottom: 1px solid var(--border);
}

.component-list li:last-child .component-regions {
  border-bottom: none;
}

.component-region {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Extra right padding matches the chevron (16px) + its gap (16px) reserved
     on the main rows, so status pills line up in the same column. */
  padding: 8px 32px 8px 0;
  font-size: 13px;
  color: var(--ink);
}

.component-info {
  flex: 1 1 auto;
  min-width: 0;
}

.component-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.component-description {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.94;
}

.dot--operational { background: var(--operational); }
.dot--partial_outage { background: var(--partial_outage); }
.dot--down { background: var(--down); }

.status-pill--operational { color: var(--operational); }
.status-pill--partial_outage { color: var(--partial_outage); }
.status-pill--down { color: var(--down); }

/* Footer */

.site-footer {
  padding: 8px 0 40px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* Small screens */

@media (max-width: 640px) {
  .hero-banner { flex-direction: column; align-items: flex-start; }
  .hero-banner-right { text-align: left; }
  /* Support/secureflag.com links don't fit the mobile header; drop both. */
  .header-nav a { display: none; }
}
