/*
 * status.fxapis.com — the fxapis design system's tokens (apps/web globals.css),
 * light by default and dark when the system asks or the toggle says so.
 * Status colours are functional, never decoration.
 */

:root {
  color-scheme: light;
  --canvas: #f7f9fa;
  --panel: #ffffff;
  --raised: #eff3f5;
  --line: #e3e8ec;
  --line-strong: #cfd7dd;
  --fg: #111418;
  --fg-muted: #56626e;
  --fg-subtle: #65707c;
  --accent: #22d3d6;
  --accent-bright: #4be7e8;
  --accent-ink: #0a7a7d;
  --accent-soft: #e2f9f9;
  --on-accent: #111418;

  --ok: #0f9f6e;
  --ok-soft: #e3f6ee;
  --warn: #c98a12;
  --warn-soft: #fdf3e1;
  --partial: #d9622b;
  --partial-soft: #fdeee5;
  --bad: #d43d51;
  --bad-soft: #fdebed;
  --maint: #2f7fd3;
  --maint-soft: #e6f0fb;
  --none: #cfd7dd;

  --shadow: 0 1px 2px rgb(17 20 24 / 0.04), 0 8px 24px -12px rgb(17 20 24 / 0.08);
  --radius: 14px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0d1013;
    --panel: #111418;
    --raised: #1b2128;
    --line: #1f262e;
    --line-strong: #2d3640;
    --fg: #f7f9fa;
    --fg-muted: #9aa6b2;
    --fg-subtle: #848f9b;
    --accent-ink: #22d3d6;
    --accent-soft: rgb(34 211 214 / 0.12);
    --ok: #1fcf95;
    --ok-soft: rgb(31 207 149 / 0.12);
    --warn: #f5b84b;
    --warn-soft: rgb(245 184 75 / 0.12);
    --partial: #ff8a4c;
    --partial-soft: rgb(255 138 76 / 0.12);
    --bad: #ff6b7a;
    --bad-soft: rgb(255 107 122 / 0.12);
    --maint: #5fa8ff;
    --maint-soft: rgb(95 168 255 / 0.12);
    --none: #2d3640;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0d1013;
  --panel: #111418;
  --raised: #1b2128;
  --line: #1f262e;
  --line-strong: #2d3640;
  --fg: #f7f9fa;
  --fg-muted: #9aa6b2;
  --fg-subtle: #848f9b;
  --accent-ink: #22d3d6;
  --accent-soft: rgb(34 211 214 / 0.12);
  --ok: #1fcf95;
  --ok-soft: rgb(31 207 149 / 0.12);
  --warn: #f5b84b;
  --warn-soft: rgb(245 184 75 / 0.12);
  --partial: #ff8a4c;
  --partial-soft: rgb(255 138 76 / 0.12);
  --bad: #ff6b7a;
  --bad-soft: rgb(255 107 122 / 0.12);
  --maint: #5fa8ff;
  --maint-soft: rgb(95 168 255 / 0.12);
  --none: #2d3640;
  --shadow: none;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--fg);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only,
.hp {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--panel);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus {
  left: 16px;
}

.wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .wrap {
    padding: 0 24px;
  }
}

/* ------------------------------------------------------------------ */
/* Top bar and footer                                                   */
/* ------------------------------------------------------------------ */

.top {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.045em;
  line-height: 1;
}

.wordmark svg {
  width: 0.62em;
  height: 0.56em;
  margin: 0 0.015em;
}

.brand-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
}

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

.top-nav > a:not(.button) {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
}
.top-nav > a:not(.button):hover,
.top-nav > a[aria-current="page"] {
  color: var(--fg);
  background: var(--raised);
}

@media (max-width: 560px) {
  .top-nav > a[href^="https://fxapis.com"] {
    display: none;
  }
}

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-toggle:hover {
  background: var(--raised);
  color: var(--fg);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 24px 0 32px;
  color: var(--fg-subtle);
  font-size: 13px;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

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

/* ------------------------------------------------------------------ */
/* Building blocks                                                      */
/* ------------------------------------------------------------------ */

main {
  padding-top: 28px;
  padding-bottom: 48px;
  outline: none;
}

#view > * + * {
  margin-top: 20px;
}
#view > .section-head {
  margin-top: 36px;
}
.history-list > * + * {
  margin-top: 12px;
}
.chart-box {
  position: relative;
}
.chart-tabs {
  margin-left: auto;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 14px var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover {
  background: var(--accent-bright);
}
.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}
.button-small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  margin-left: 6px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 0 12px;
}

.section-head h2 {
  font-size: 18px;
}

.section-head p {
  color: var(--fg-muted);
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--raised);
  border-radius: 10px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font: 500 13px var(--font);
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 1px 2px rgb(17 20 24 / 0.08);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}

/* Status tones, shared by dots, pills, bars and cards. */
.t-operational { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.t-degraded { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.t-partial { --tone: var(--partial); --tone-soft: var(--partial-soft); }
.t-down { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.t-maintenance { --tone: var(--maint); --tone-soft: var(--maint-soft); }
.t-unknown { --tone: var(--fg-subtle); --tone-soft: var(--raised); }

.pill[class*="t-"] {
  color: var(--tone);
  background: var(--tone-soft);
}

.skeleton {
  background: linear-gradient(90deg, var(--raised), var(--line), var(--raised));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ------------------------------------------------------------------ */
/* Hero                                                                 */
/* ------------------------------------------------------------------ */

.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 22px;
  border-left: 4px solid var(--tone, var(--line-strong));
}

.hero-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--tone-soft, var(--raised));
  color: var(--tone, var(--fg-subtle));
}
.hero-icon svg {
  width: 24px;
  height: 24px;
}

.hero-title {
  font-size: 22px;
}

.hero-sub {
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: 13.5px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.live .dot {
  color: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  animation: pulse 2s infinite;
}
.live.stale .dot {
  color: var(--warn);
  animation: none;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
@media (prefers-reduced-motion: reduce) {
  .live .dot,
  .skeleton {
    animation: none;
  }
}

/* ------------------------------------------------------------------ */
/* Incidents                                                            */
/* ------------------------------------------------------------------ */

.incident {
  padding: 18px 20px;
  border-left: 4px solid var(--tone);
}

.incident-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  justify-content: space-between;
}

.incident-head h3 {
  font-size: 16px;
}
.incident-head h3 a {
  color: inherit;
  text-decoration: none;
}
.incident-head h3 a:hover {
  text-decoration: underline;
}

.incident-meta {
  margin-top: 6px;
  color: var(--fg-subtle);
  font-size: 13px;
}

.timeline {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 14px 18px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 17px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li:last-child::after {
  display: none;
}
.timeline li:first-child::before {
  background: var(--tone);
}

.update-status {
  font-weight: 600;
  font-size: 13.5px;
}
.update-time {
  color: var(--fg-subtle);
  font-size: 12.5px;
  margin-left: 6px;
}
.update-body {
  margin-top: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--fg);
  font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Components                                                           */
/* ------------------------------------------------------------------ */

.components {
  overflow: hidden;
}

.component {
  padding: 16px 20px 14px;
}
.component + .component {
  border-top: 1px solid var(--line);
}

.component-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.component-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.component-name h3 {
  font-size: 15px;
  font-weight: 600;
}
.component-name .desc {
  color: var(--fg-subtle);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .component-name .desc {
    display: none;
  }
}

.component-state {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  font-size: 13px;
}
.component-state .ms {
  color: var(--fg-subtle);
  font-family: var(--mono);
  font-size: 12px;
}
.component-state .label {
  color: var(--tone);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bars {
  display: flex;
  gap: 2px;
  height: 34px;
  margin-top: 12px;
  border-radius: 4px;
  outline-offset: 4px;
  touch-action: pan-y;
}

.bar {
  flex: 1 1 0;
  min-width: 1px;
  border-radius: 2px;
  background: var(--tone, var(--none));
  opacity: 0.9;
  transition: opacity 0.12s, transform 0.12s;
}
.bar.b-none {
  background: var(--none);
}
.bars:hover .bar {
  opacity: 0.55;
}
.bars .bar.active,
.bars:hover .bar.active {
  opacity: 1;
  transform: scaleY(1.08);
}

.bars-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-subtle);
}
.bars-legend .uptime {
  color: var(--fg-muted);
  font-weight: 500;
}

.latency-toggle {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font: 500 12.5px var(--font);
  padding: 4px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.latency-toggle:hover {
  color: var(--fg);
}
.latency-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
}
.latency-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.chart {
  margin-top: 8px;
  position: relative;
}
.chart svg {
  display: block;
  width: 100%;
  height: 150px;
  overflow: visible;
}
.chart .grid line {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart .avg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.chart .max {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: none;
}
.chart .cursor {
  stroke: var(--fg-subtle);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin-top: 4px;
  font-family: var(--mono);
}
.chart-y {
  position: absolute;
  left: 0;
  font-size: 11px;
  color: var(--fg-subtle);
  font-family: var(--mono);
  transform: translateY(-50%);
  background: var(--panel);
  padding-right: 4px;
  pointer-events: none;
}
.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.chart-stats b {
  color: var(--fg);
  font-family: var(--mono);
  font-weight: 500;
}
.chart-empty {
  font-size: 13px;
  color: var(--fg-subtle);
  padding: 20px 0;
}

.overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat {
  padding: 14px 16px;
}
.stat .k {
  font-size: 12px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.stat .v {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat .d {
  font-size: 12.5px;
  color: var(--fg-muted);
}

/* ------------------------------------------------------------------ */
/* Past incidents and history                                           */
/* ------------------------------------------------------------------ */

.days {
  padding: 4px 20px;
}
.day {
  padding: 14px 0;
}
.day + .day {
  border-top: 1px solid var(--line);
}
.day h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
}
.day .quiet {
  margin-top: 4px;
  color: var(--fg-subtle);
  font-size: 13.5px;
}
.day-item {
  margin-top: 8px;
}
.day-item a {
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}
.day-item a:hover {
  text-decoration: underline;
}
.day-item .why {
  color: var(--fg-muted);
  font-size: 13.5px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.day-item .when {
  color: var(--fg-subtle);
  font-size: 12.5px;
  margin-top: 2px;
}
.more {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.month-nav button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
}
.month-nav button[disabled] {
  opacity: 0.4;
  cursor: default;
}
.month-nav strong {
  min-width: 130px;
  text-align: center;
}

.uptime-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.uptime-table th,
.uptime-table td {
  text-align: left;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}
.uptime-table thead th {
  border-top: 0;
  font-size: 12px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.uptime-table td.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-scroll {
  overflow-x: auto;
}
@media (max-width: 560px) {
  .uptime-table th,
  .uptime-table td {
    padding: 10px 12px;
  }
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
}
.back:hover {
  color: var(--fg);
}

.incident-page {
  padding: 22px;
  border-left: 4px solid var(--tone);
}
.incident-page h1 {
  font-size: 22px;
  margin-top: 10px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
  font-size: 13.5px;
}
.facts .k {
  color: var(--fg-subtle);
  font-size: 12px;
}

.empty {
  padding: 18px 20px;
  color: var(--fg-muted);
}

.banner-warn {
  padding: 12px 16px;
  background: var(--warn-soft);
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-radius: 10px;
  font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Subscribe                                                            */
/* ------------------------------------------------------------------ */

.subscribe {
  margin-top: 36px;
  padding: 22px;
  display: grid;
  gap: 16px;
  scroll-margin-top: 80px;
}
@media (min-width: 760px) {
  .subscribe {
    grid-template-columns: 1fr 360px;
    align-items: center;
  }
}
.subscribe h2 {
  font-size: 17px;
}
.subscribe p {
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: 14px;
}
.subscribe-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.subscribe-form input[type="email"] {
  flex: 1 1 200px;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--fg);
  font: 14px var(--font);
}
.subscribe-form input[type="email"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
.form-note {
  flex-basis: 100%;
  font-size: 13px;
  color: var(--fg-muted);
  min-height: 1em;
}
.form-note.ok {
  color: var(--ok);
}
.form-note.err {
  color: var(--bad);
}

/* ------------------------------------------------------------------ */
/* Tooltip                                                              */
/* ------------------------------------------------------------------ */

.tip {
  position: fixed;
  z-index: 20;
  max-width: min(300px, calc(100vw - 24px));
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 12px 32px -12px rgb(17 20 24 / 0.35);
  pointer-events: none;
}
.tip .tip-title {
  font-weight: 600;
  font-size: 13px;
}
.tip .tip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--fg-muted);
}
.tip .tip-row b {
  color: var(--fg);
  font-weight: 500;
  font-family: var(--mono);
}
.tip .tip-note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--fg-muted);
}
.tip .tip-note .dot {
  display: inline-block;
  margin-right: 6px;
  color: var(--tone);
}

/* ------------------------------------------------------------------ */
/* Confirm / unsubscribe pages                                          */
/* ------------------------------------------------------------------ */

.notice {
  max-width: 520px;
  margin: 0 auto;
  padding: 48px 16px;
}
.notice .brand {
  margin-bottom: 20px;
}
.notice-card {
  padding: 24px;
}
.notice-card h1 {
  font-size: 20px;
  margin-bottom: 8px;
}
.notice-card p {
  color: var(--fg-muted);
}
.notice-card form,
.notice-card p + p {
  margin-top: 18px;
}
