/* Design tokens copied from frontend/app/globals.css. Keep them in sync when
   the palette changes - this page has no build step and cannot import them.
   Dark mode runs on the `.dark` class like the live site; the inline script in
   index.html sets it from localStorage or the operating system. */
:root {
  --radius: 1rem;
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);

  --background: #ffffff;
  --foreground: #191314;
  --card: #ffffff;
  --primary: #ecf95a;
  --primary-foreground: #191314;
  --secondary: #f4f4f4;
  --muted: #f4f4f4;
  --muted-foreground: #6b6668;
  --border: #ececec;
  --destructive: #dc2626;

  --mark: #1e1e21;
  --dot: color-mix(in oklab, var(--foreground) 12%, transparent);
  --dot-size: 24px;

  /* Status colours. Dark enough to stay readable as small uppercase labels on
     the white card; the panel versions below carry white text instead. */
  --up: #14764f;
  --down: var(--destructive);
  --pending: #8a5800;
  --maintenance: #1f57c4;
  --unknown: #9a9698;

  --panel-up: #17805a;
  --panel-down: #c62a20;
  --panel-pending: #8a5800;
  --panel-maintenance: #2760d0;
  --panel-unknown: #6b6668;
}

.dark {
  --background: #1e1e21;
  --foreground: #f4f4f4;
  --card: #212124;
  --secondary: #28282c;
  --muted: #1e1e21;
  --muted-foreground: #a8a3a4;
  --border: #2e2e33;
  --destructive: #f87171;

  --mark: var(--primary);
  --dot: color-mix(in oklab, var(--primary) 22%, transparent);
  --dot-size: 40px;

  --up: #34d399;
  --pending: #fbbf24;
  --maintenance: #60a5fa;
  --unknown: #6f6b6d;
}

/* High contrast, the same token swap globals.css does under [data-contrast]. */
[data-contrast="more"] {
  --muted-foreground: #2b2628;
  --border: #5c575a;
}
[data-contrast="more"].dark {
  --muted-foreground: #ededed;
  --border: #9a9599;
}
[data-contrast="more"] .dot-grid,
[data-contrast="more"] .panel { background-image: none; }
[data-contrast="more"] :focus-visible { outline-width: 4px; outline-offset: 3px; }
[data-contrast="more"] .toggle-shell button { color: var(--foreground); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--muted);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
  border-radius: 2px;
}
.dark :focus-visible { outline-color: var(--primary); }

button:not(:disabled), [role="button"] { cursor: pointer; }

/* Page texture, same rule and opacity as the marketing shell. */
.dot-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
  background-size: var(--dot-size) var(--dot-size);
}

.shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* Header ----------------------------------------------------------------
   Every value below is the px equivalent of the Tailwind class on the real
   header (components/layout/header.tsx, components/ui/theme-locale-toggles.tsx,
   components/ui/accessibility-toggle.tsx). Change one there, change it here. */

/* sticky top-0 z-50 overflow-hidden border-b border-border bg-card backdrop-blur-md */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(12px);
}

/* grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-4 py-3.
   Third column holds the toggles; on phones they drop to their own row. */
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.header-lead { grid-area: 1 / 1; }
.header-extra { grid-area: 1 / 2; }
.header-actions { grid-area: 1 / 3; }

/* flex min-w-0 items-center gap-2.5 */
.header-lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* flex items-center gap-3, same spacing as the real HeaderActions row */
.header-extra {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* flex shrink-0 items-center gap-1.5, mark text-[#1e1e21] dark:text-primary */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--mark);
  text-decoration: none;
}
.brand-mark { width: 40px; height: 40px; flex: none; }
/* font-mono text-base font-bold tracking-tight */
.brand-word {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* flex items-center gap-3 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* flex items-center gap-0.5 rounded-lg border border-border bg-muted p-0.5 */
.toggle-shell {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--muted);
}

/* size-7 rounded-md, inactive text-foreground/50, active bg-primary */
.toggle-shell button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-md);
  color: color-mix(in oklab, var(--foreground) 50%, transparent);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.toggle-shell button:hover { color: var(--foreground); }
.toggle-shell button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-foreground);
}
/* The accessibility button sits off at text-muted-foreground, not /50. */
#a11y button { color: var(--muted-foreground); }

.toggle-shell--icons button,
#a11y button { width: 28px; }
.toggle-shell svg { width: 14px; height: 14px; }

/* h-7 min-w-8 rounded-md px-1 font-mono text-[11px] font-semibold */
#langs button {
  min-width: 32px;
  padding: 0 4px;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
}

/* rounded-full bg-foreground px-4 py-2 font-mono text-xs font-medium text-background */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 9999px;
  background: var(--foreground);
  color: var(--background);
  padding: 8px 16px;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.3s ease;
}
.cta:hover { transform: scale(1.02); }
.cta-arrow { width: 14px; height: 14px; transition: transform 0.3s ease; }
.cta:hover .cta-arrow { transform: translate(2px, -2px); }

/* Main ------------------------------------------------------------------ */

.main { flex: 1; padding: 48px 0 80px; }

/* The marketing layout runs full width. A status page is a list, and a list
   reads better in a column, so this one is capped and centred. */
.article {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 16px;
}

.hero { margin-bottom: 48px; }

h1 {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: clamp(2rem, 4.6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  overflow-wrap: anywhere;
}

/* PageHero's meta slot: mt-4, TYPO.meta = font-mono text-[11px] leading-snug
   text-muted-foreground tabular-nums */
.hero-meta {
  margin: 16px 0 0;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.375;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.hero-intro {
  margin: 24px 0 0;
  max-width: 46rem;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted-foreground);
}

/* Overall state. Plain block in the status colour, no pattern, white text. */

.panel {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius-2xl);
  padding: 22px 28px;
  color: #ffffff;
  background-color: var(--panel-unknown);
}
.panel-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 9999px;
  background: currentColor;
}
.panel-text {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.panel--up { background-color: var(--panel-up); }
.panel--down { background-color: var(--panel-down); }
.panel--pending { background-color: var(--panel-pending); }
.panel--maintenance { background-color: var(--panel-maintenance); }
.panel--unknown { background-color: var(--panel-unknown); }

/* Incidents and maintenance windows -------------------------------------- */

.notices { margin-top: 20px; display: grid; gap: 16px; }

.notice {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--unknown);
  border-radius: var(--radius-2xl);
  padding: 24px 28px;
}
.notice--danger { border-left-color: var(--down); }
.notice--warning { border-left-color: var(--pending); }
.notice--info { border-left-color: var(--maintenance); }

.notice-title {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.notice-body {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0;
  white-space: pre-wrap;
}
.notice-time {
  display: block;
  margin-top: 12px;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
}

/* Services --------------------------------------------------------------- */

.groups { margin-top: 40px; display: grid; gap: 32px; }

.group-name {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
  margin: 0 0 12px 4px;
}

.group-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-3xl);
  padding: 8px;
}

.monitor { padding: 20px 24px; }
.monitor + .monitor { border-top: 1px solid var(--border); }

.monitor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.monitor-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.monitor-state {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.monitor-state--up { color: var(--up); }
.monitor-state--down { color: var(--down); }
.monitor-state--pending { color: var(--pending); }
.monitor-state--maintenance { color: var(--maintenance); }
.monitor-state--unknown { color: var(--muted-foreground); }

/* Full width, newest on the right. Rows with fewer beats are padded on the
   left, so every row has the same bar count and they line up. */
.bars {
  display: flex;
  gap: 2px;
  height: 26px;
  margin-top: 14px;
}
.bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--up);
}
.bar--down { background: var(--down); }
.bar--pending { background: var(--pending); }
.bar--maintenance { background: var(--maintenance); }
/* Padding for rows with fewer beats. Faint on purpose: it means "no data yet",
   and it must not compete with the real status. */
.bar--empty { background: color-mix(in oklab, var(--border) 55%, transparent); }

.monitor-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.monitor-rule {
  flex: 1 1 0;
  height: 1px;
  background: var(--border);
}

/* BoothMark equalizer pulse - copied from components/ui/booth-logo.tsx */
@keyframes booth-eq-top { 0%,100% { transform: scaleX(1) } 50% { transform: scaleX(1.12) } }
@keyframes booth-eq-mid { 0%,100% { transform: scaleX(1) } 50% { transform: scaleX(1.4) } }
@keyframes booth-eq-bot { 0%,100% { transform: scaleX(1) } 50% { transform: scaleX(0.9) } }
.booth-bar { transform-box: fill-box; transform-origin: left center; }
.booth-bar--top { animation: booth-eq-top 2.6s ease-in-out infinite; }
.booth-bar--mid { animation: booth-eq-mid 2.2s ease-in-out infinite; }
.booth-bar--bot { animation: booth-eq-bot 3s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Breakpoints mirror the marketing shell: sm 640, md 768, lg 1024, xl 1280 */
@media (max-width: 639px) {
  /* The real header hides the toggles below sm and moves them into the mobile
     menu. There is no menu here, so they get a second row, spread edge to edge. */
  .header-inner { grid-template-columns: minmax(0, 1fr) auto; row-gap: 12px; }
  .header-actions { grid-area: 1 / 2; }
  .header-extra { grid-area: 2 / 1 / 3 / 3; justify-content: space-between; }
  #themes { order: 1; }
  #a11y { order: 2; }
  #langs { order: 3; }
}
@media (min-width: 640px) { .article { padding: 0 24px; } }
@media (min-width: 768px) {
  .header-inner { gap: 24px; padding: 12px 32px; }
  .cta { padding: 10px 20px; font-size: 14px; }
  .main { padding: 80px 0 128px; }
  .hero-intro { font-size: 20px; }
  .panel { padding: 40px; border-radius: 2.5rem; }
}
@media (min-width: 1024px) { .article { padding: 0 32px; } }
@media (min-width: 1280px) { .article { padding: 0 48px; } }
@media (min-width: 1536px) { .article { padding: 0 64px; } }
@media (min-width: 1920px) {
  .header-inner { max-width: 1920px; margin: 0 auto; }
}

@media (max-width: 639px) {
  .monitor { padding: 16px 18px; }
  .group-body { padding: 4px; }
  /* Half the beats on a phone, so the bars keep a usable width. */
  .bar:nth-child(-n + 30) { display: none; }
  .bars { gap: 3px; height: 24px; }
  .monitor-meta { gap: 8px; font-size: 9px; }
}
