@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap");

:root,
html[data-theme="dark"] {
  --body-background-color: #03040b;
  --body-text-color: #eeeaf6;
  --card-background-color: #12131c;
  --nav-background-color: rgba(8, 9, 16, 0.88);
  --nav-border-bottom-color: rgba(255, 255, 255, 0.08);
  --nav-current-border-bottom-color: #e879f9;
  --card-border-color: rgba(255, 255, 255, 0.08);
  --down-border-left-color: #fb7185;
  --down-background-color: rgba(251, 113, 133, 0.12);
  --degraded-border-left-color: #fbbf24;
  --up-border-left-color: #34d399;
  --tag-color: #03040b;
  --tag-up-background-color: #34d399;
  --tag-down-background-color: #fb7185;
  --tag-degraded-background-color: #fbbf24;
  --change-background-color: #a78bfa;
  --error-button-border-color: #7c3aed;
  --error-button-background-color: #8b5cf6;
  --error-button-color: #ffffff;
  --submit-button-border-color: #7c3aed;
  --submit-button-background-color: #8b5cf6;
  --submit-button-color: #ffffff;
  --graph-opacity: 1;
  --graph-filter: none;
  --accent: #e879f9;
  --accent-soft: rgba(232, 121, 249, 0.16);
  --muted: #9b96ad;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(232, 121, 249, 0.28);
  --graph-wash: 0.3;
  color-scheme: dark;
}

html[data-theme="light"] {
  --body-background-color: #f3f0ea;
  --body-text-color: #16151c;
  --card-background-color: #ffffff;
  --nav-background-color: rgba(255, 255, 255, 0.86);
  --nav-border-bottom-color: rgba(22, 21, 28, 0.08);
  --nav-current-border-bottom-color: #c026d3;
  --card-border-color: rgba(22, 21, 28, 0.08);
  --down-border-left-color: #e11d48;
  --down-background-color: #ffe4e6;
  --degraded-border-left-color: #d97706;
  --up-border-left-color: #059669;
  --tag-color: #ffffff;
  --tag-up-background-color: #059669;
  --tag-down-background-color: #e11d48;
  --tag-degraded-background-color: #d97706;
  --change-background-color: #ede9fe;
  --error-button-border-color: #6d28d9;
  --error-button-background-color: #7c3aed;
  --error-button-color: #ffffff;
  --submit-button-border-color: #6d28d9;
  --submit-button-background-color: #7c3aed;
  --submit-button-color: #ffffff;
  --accent: #c026d3;
  --accent-soft: rgba(192, 38, 211, 0.12);
  --muted: #5e5a6b;
  --shadow: 0 16px 40px rgba(22, 21, 28, 0.08);
  --ring: 0 0 0 3px rgba(192, 38, 211, 0.2);
  --graph-wash: 0.38;
  color-scheme: light;
}

html {
  background: var(--body-background-color);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Outfit, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.011em;
  background:
    radial-gradient(1100px 520px at 8% -12%, var(--accent-soft), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(129, 140, 248, 0.14), transparent 52%),
    var(--body-background-color);
  color: var(--body-text-color);
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.03em;
  font-weight: 600;
}

h1 { font-size: 2.15rem; }

.container {
  max-width: 880px;
}

/* Header: big centered logo, links below, toggle in the top-right with space above the divider */
nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  margin-bottom: 1.5rem !important;
  padding: 1rem 0 1.15rem !important;
}

nav .container {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  position: relative !important;
  row-gap: 0.85rem;
}

nav .logo {
  float: none !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0 auto !important;
  margin-right: auto !important;
  padding: 0 !important;
  font-size: 0 !important;
  font-weight: inherit;
  color: transparent;
  position: relative;
  z-index: 1;
}

nav .logo img {
  height: 5.75rem !important;
  width: auto !important;
  max-width: min(220px, 56vw);
  margin-right: 0 !important;
  border-radius: 20px !important;
  background: #03040b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 30px rgba(0, 0, 0, 0.28);
}

nav ul {
  display: flex !important;
  justify-content: center !important;
  flex-wrap: wrap;
  width: 100%;
  gap: 0.2rem;
  margin: 0 !important;
  padding: 0.15rem 0 0.1rem !important;
}

nav a {
  padding: 0.55rem 0.95rem !important;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

nav [aria-current] {
  border-bottom: 0;
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--nav-current-border-bottom-color);
}

.theme-toggle {
  appearance: none;
  position: absolute !important;
  top: 0.2rem !important;
  right: 0 !important;
  z-index: 2;
  margin: 0 !important;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 2.55rem;
  border: 1px solid var(--card-border-color);
  border-radius: 999px;
  background: var(--card-background-color);
  color: var(--body-text-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun,
html[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun,
html[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

header {
  text-align: center;
  margin-bottom: 1.75rem;
}

header h1 {
  margin-bottom: 0.35rem;
}

header p,
header .lead {
  color: var(--muted);
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.05rem;
}

/* Site cards: keep sparkline graphs visible without washing out the text */
.live-status article.graph,
article.graph.link {
  position: relative;
  overflow: hidden;
  background-image: none !important;
  isolation: isolate;
}

.live-status article.graph::after,
article.graph.link::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--background);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center right;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  opacity: var(--graph-wash);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 38%, #000 78%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 38%, #000 78%);
}

html[data-theme="dark"] .live-status article.graph,
html[data-theme="dark"] article.graph.link {
  text-shadow: 0 1px 1px rgba(3, 4, 11, 0.7), 0 0 14px var(--card-background-color);
}

.live-status article.graph > *:not(h4),
article.graph.link > *:not(h4) {
  position: relative;
  z-index: 1;
}

.live-status article.graph h4,
article.graph.link h4 {
  position: static;
  z-index: 1;
}

article {
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

article.link {
  cursor: pointer;
}

article.link:hover,
article.link:focus-within {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--card-border-color));
  box-shadow: var(--shadow), var(--ring);
}

/* Stretch the existing history <a> across the whole tile so the card is the hit target. */
article.link h4 a {
  position: static;
}

article.link h4 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
}

article.link h4 a:focus {
  outline: none;
}

article.link h4 a:focus-visible {
  outline: none;
}

article.up,
article.down,
article.degraded {
  border-left-width: 0.28rem;
}

.tag {
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.changed + section .data {
  color: #16151c;
  border-radius: 8px;
  padding: 0.1rem 0.35rem;
}

form.f,
form.svelte-fqsq6s {
  gap: 0.35rem;
}

form label {
  cursor: pointer;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  color: var(--muted);
}

form input[type="radio"]:checked + label {
  color: var(--body-text-color);
  background: var(--accent-soft);
}

footer {
  color: var(--muted);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

article .graph,
img[alt*="Response time"],
img[src*="graphs/"] {
  border-radius: 12px;
}

@media (max-width: 640px) {
  nav {
    padding: 0.9rem 0 1.15rem !important;
  }
  nav .container {
    row-gap: 0.75rem;
  }
  nav .logo img {
    height: 4.4rem !important;
    border-radius: 16px !important;
  }
  nav a {
    padding: 0.45rem 0.7rem;
  }
  .theme-toggle {
    width: 2.4rem;
    height: 2.4rem;
    top: 0.15rem !important;
    right: 0 !important;
  }
}

/* History-page site blurb + visible backlink (not used on Control Plane) */
.site-profile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0 0 1.35rem;
  padding: 0.95rem 1.15rem;
  max-width: 40rem;
  border: 1px solid var(--card-border-color);
  border-radius: 16px;
  background: var(--card-background-color);
  box-shadow: var(--shadow);
}

.site-profile-desc {
  margin: 0;
  color: var(--body-text-color);
  font-size: 1.02rem;
  line-height: 1.55;
}

.site-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: var(--accent-soft);
  border: 1px solid transparent;
}

.site-profile-link::after {
  content: "↗";
  font-weight: 500;
  font-size: 0.95em;
}

.site-profile-link:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.site-profile-link:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

@media (max-width: 640px) {
  .site-profile {
    padding: 0.85rem 1rem;
  }
  .site-profile-desc {
    font-size: 0.98rem;
  }
}
