@import "tokens.css";

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--l360-plain-bg);
  color: var(--l360-text);
  font-family: var(--font-stack);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--l360-purple-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0 28px;
}

.brand-logo {
  height: var(--logo-h);
  width: auto;
  display: block;
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--l360-border);
}

.brand-page-name {
  font-weight: 700;
  color: var(--l360-eggplant);
  font-size: 1rem;
  letter-spacing: -0.01em;
}

/* Admin link slot, pushed to the far right of the header. Empty unless the
   Worker injects the pencil (allow-listed client only). */
.admin-slot {
  margin-left: auto;
  display: inline-flex;
}

.admin-pencil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--l360-purple);
  border: 1px solid var(--l360-border);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-pencil:hover,
.admin-pencil:focus-visible {
  background: var(--l360-purple);
  color: #fff;
}
.admin-pencil svg {
  width: 16px;
  height: 16px;
  display: block;
}

.overall-banner {
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  /* Neutral gray default (white on #666666 ≈ 5.7:1): shown only when the
     worker serves the static shell (content read failure) without injecting
     an is-* status class. */
  background: var(--l360-gray-50);
  color: var(--l360-white);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.overall-banner.is-operational { background: var(--status-operational); }
.overall-banner.is-degraded { background: var(--status-degraded); color: var(--l360-eggplant); }
/* Like .is-degraded, dark text: white on #f87c56 is only ~2.6:1, eggplant is ~6.9:1. */
.overall-banner.is-partial_outage { background: var(--status-partial-outage); color: var(--l360-eggplant); }
.overall-banner.is-major_outage { background: var(--status-major-outage); }
.overall-banner.is-maintenance { background: var(--status-maintenance); }

.overall-banner .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.overall-banner h1 {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.overall-banner .updated {
  margin-left: auto;
  font-size: 0.875rem;
  opacity: 0.85;
}

/* Optional status note (current.json message) directly under the banner.
   Server-injected; carries the [hidden] attribute when there is no message. */
.status-message {
  margin: 16px 4px 0;
  color: var(--l360-text-muted);
  white-space: pre-line;
}

section {
  margin-top: 36px;
}

section h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--l360-eggplant);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.services {
  background: var(--l360-white);
  border: 1px solid var(--l360-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--l360-border);
}
.service-row:first-child { border-top: none; }

.service-name {
  font-weight: 700;
  color: var(--l360-eggplant);
}

.service-desc {
  font-size: 0.875rem;
  color: var(--l360-text-muted);
  margin-top: 2px;
}

.service-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.service-status .pill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.s-operational .pill { background: var(--status-operational); }
.s-degraded .pill { background: var(--status-degraded); }
.s-partial_outage .pill { background: var(--status-partial-outage); }
.s-major_outage .pill { background: var(--status-major-outage); }
.s-maintenance .pill { background: var(--status-maintenance); }

/* Label text uses the darker -text variants (>= 4.5:1 on the white card);
   the vivid tokens remain on the .pill dots above. */
.s-operational { color: var(--status-operational-text); }
.s-degraded { color: var(--status-degraded-text); }
.s-partial_outage { color: var(--status-partial-outage-text); }
.s-major_outage { color: var(--status-major-outage-text); }
.s-maintenance { color: var(--status-maintenance-text); }

.incidents {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.incident {
  background: var(--l360-white);
  border: 1px solid var(--l360-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.incident-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.incident-title {
  font-weight: 700;
  color: var(--l360-eggplant);
  font-size: 1rem;
}

.incident-meta {
  font-size: 0.8125rem;
  color: var(--l360-text-muted);
}

.severity {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.severity-minor    { background: var(--l360-lilac); color: var(--l360-purple-dark); }
.severity-major    { background: #FEF3C7; color: #92400E; }
.severity-critical { background: #FEE2E2; color: #991B1B; }

.update {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--l360-border);
}

.update-time {
  font-size: 0.75rem;
  color: var(--l360-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.update-message {
  margin-top: 4px;
  color: var(--l360-text);
  white-space: pre-line;
}

/* Long unbroken tokens (pasted URLs) must wrap instead of overflowing the
   cards; min-width: 0 lets these shrink inside their flex rows. */
.incident-title,
.update-message,
.status-message,
.service-name,
.service-desc {
  overflow-wrap: anywhere;
  min-width: 0;
}

.empty {
  background: var(--l360-white);
  border: 1px dashed var(--l360-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  color: var(--l360-text-muted);
}

.site-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--l360-border);
  font-size: 0.8125rem;
  color: var(--l360-text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 560px) {
  .overall-banner { flex-wrap: wrap; }
  .overall-banner .updated { margin-left: 0; flex-basis: 100%; }
  .service-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .incident-head { flex-direction: column; }
}
