:root {
  color-scheme: light dark;
  --bg: #090d1f;
  --bg-elev: rgba(12, 17, 34, 0.24);
  --card: rgba(18, 25, 50, 0.2);
  --text: #ebf0ff;
  --text-dim: #9aa9c9;
  --line: rgba(96, 191, 255, 0.4);
  --accent: #00a2ff;
  --accent-2: #7de1ff;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  --glass-blur: 12px;
}

html {
  scroll-behavior: smooth;
}

html[data-theme="light"] {
  --bg: #f3f6ff;
  --bg-elev: rgba(255, 255, 255, 0.22);
  --card: rgba(255, 255, 255, 0.2);
  --text: #1b2a49;
  --text-dim: #627392;
  --line: rgba(108, 156, 228, 0.34);
  --accent: #2d83f2;
  --accent-2: #79c2ff;
  --shadow: 0 12px 24px rgba(22, 39, 80, 0.08);
  --glass-blur: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 80% -10%, rgba(0, 162, 255, 0.56), transparent 42%),
    radial-gradient(circle at 10% -20%, rgba(95, 211, 255, 0.4), transparent 40%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

html[data-theme="light"] body {
  background: radial-gradient(circle at 82% -10%, rgba(104, 175, 255, 0.18), transparent 52%),
    radial-gradient(circle at 8% -16%, rgba(139, 209, 255, 0.12), transparent 50%),
    var(--bg);
}

html[data-theme="light"] #gridCanvas {
  opacity: 0.22;
}

html[data-theme="light"] body::before {
  opacity: 0.24;
  filter: blur(18px) saturate(0.86);
}

#gridCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.58;
  display: none;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -12% -10%;
  pointer-events: none;
  z-index: -2;
}

body::before {
  background:
    radial-gradient(circle at 22% 14%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 33%),
    radial-gradient(circle at 84% 72%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 36%),
    radial-gradient(circle at 58% 106%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 42%);
  filter: blur(24px) saturate(1.04);
  opacity: 0.58;
}

body::after {
  background-image: none;
  opacity: 0;
  animation: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  backdrop-filter: blur(12px);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 6vw;
  isolation: isolate;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
}

.brand-mark {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent);
}

nav {
  display: flex;
  gap: 1.2rem;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 500;
}

nav a:hover {
  color: var(--text);
}

.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  position: relative;
  overflow: hidden;
}

.theme-toggle-icon {
  position: relative;
  width: 1.05rem;
  height: 1.05rem;
  display: inline-grid;
  place-items: center;
}

.theme-moon,
.theme-sun {
  position: absolute;
  font-size: 0.9rem;
  line-height: 1;
  transform-origin: 50% 50%;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms ease, filter 280ms ease;
}

.theme-toggle[data-theme="dark"] .theme-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  filter: drop-shadow(0 0 6px rgba(125, 185, 255, 0.3));
}

.theme-toggle[data-theme="dark"] .theme-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.theme-toggle[data-theme="light"] .theme-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.theme-toggle[data-theme="light"] .theme-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  filter: drop-shadow(0 0 8px rgba(116, 190, 255, 0.38));
}

.perf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  backdrop-filter: blur(var(--glass-blur)) saturate(1.06);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.06);
}

.perf-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1;
  border-radius: 999px;
  padding: 0.35rem 0.52rem;
  cursor: pointer;
}

.perf-btn.is-active {
  color: var(--text);
  border-color: var(--line);
}

.header-quota-badge {
  margin: 0;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 75%, transparent);
  color: var(--text-dim);
  font-size: 0.76rem;
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

.header-quota-badge.is-low {
  color: #ffb6bf;
  border-color: rgba(255, 143, 154, 0.45);
}

main {
  width: min(1100px, 90vw);
  margin: 0 auto;
  padding: 3rem 0 4rem;
  position: relative;
  z-index: 1;
}

.hero {
  padding: 3rem 0;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: 1.08;
  margin: 0;
  max-width: 18ch;
}

.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.word-slot {
  display: inline-block;
  white-space: nowrap;
}

.hero-tail {
  display: block;
}

#rotatingWord {
  display: inline-block;
  transition: opacity 240ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 240ms ease;
  transform-origin: 50% 60%;
}

#rotatingWord.is-exit {
  opacity: 0;
  transform: translateY(0.3em) scale(0.98);
  filter: blur(1px);
}

#rotatingWord.is-enter {
  opacity: 0;
  transform: translateY(-0.3em) scale(1.02);
  filter: blur(1px);
}

.hero p {
  color: var(--text-dim);
  max-width: 58ch;
  font-size: 1.04rem;
}

.hero-cta {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.btn {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-weight: 500;
}

.btn-primary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.metrics {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: 2.5rem 0;
}

.metrics article,
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.metrics h2 {
  margin: 0;
  font-size: 2rem;
}

.metrics p {
  margin: 0.35rem 0 0;
  color: var(--text-dim);
}

.panel {
  margin-top: 1.4rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  padding: 0.42rem 0.7rem;
  border-radius: 0.65rem;
  cursor: pointer;
}

.filter.is-active {
  color: var(--text);
  border-color: var(--accent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 1rem;
  position: relative;
  z-index: 0;
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  z-index: 2;
}

.card h3 {
  margin: 0;
}

.card p {
  color: var(--text-dim);
}

.card span {
  font-size: 0.84rem;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
}

.card-open {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0.45rem 0.72rem;
  border-radius: 0.6rem;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.status-note {
  color: var(--text-dim);
  margin: 0 0 1rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.status-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 1rem;
  position: relative;
  z-index: 0;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.status-card:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.status-card h3 {
  margin: 0 0 0.6rem;
}

.status-row {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.status-label {
  color: var(--text-dim);
}

.status-pill {
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-family: "IBM Plex Mono", monospace;
}

.status-pill.is-up {
  color: #7df6c7;
  border-color: rgba(125, 246, 199, 0.45);
}

.status-pill.is-down {
  color: #ff8f9a;
  border-color: rgba(255, 143, 154, 0.45);
}

.status-pill.is-warn,
.status-pill.is-pending {
  color: var(--text-dim);
}

.status-pill.is-archived {
  color: #f2d67b;
  border-color: rgba(242, 214, 123, 0.45);
}

html[data-theme="light"] .status-pill {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(116, 136, 196, 0.42);
  color: #314262;
}

html[data-theme="light"] .status-pill.is-up {
  color: #0e7a54;
  border-color: rgba(20, 148, 102, 0.45);
  background: rgba(25, 194, 130, 0.12);
}

html[data-theme="light"] .status-pill.is-down {
  color: #b43c53;
  border-color: rgba(196, 66, 90, 0.45);
  background: rgba(235, 92, 124, 0.12);
}

html[data-theme="light"] .status-pill.is-archived {
  color: #8b6a12;
  border-color: rgba(197, 151, 33, 0.44);
  background: rgba(235, 198, 80, 0.14);
}

html[data-theme="light"] .status-pill.is-warn,
html[data-theme="light"] .status-pill.is-pending {
  color: #4f5f82;
  border-color: rgba(116, 136, 196, 0.42);
  background: rgba(149, 170, 224, 0.14);
}

.status-detail {
  margin: 0.65rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.card.is-hidden {
  display: none;
}

.contact {
  text-align: center;
}

.contact-form {
  margin: 1rem auto 0;
  width: min(560px, 100%);
  display: grid;
  gap: 0.75rem;
  text-align: left;
}

.contact-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-dim);
}

.contact-form input,
.contact-form textarea {
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--card);
  color: var(--text);
  padding: 0.62rem 0.72rem;
  font-family: "Space Grotesk", sans-serif;
}

.contact-form textarea {
  resize: vertical;
}

.contact-feedback {
  margin: 0.1rem 0 0;
  min-height: 1.2em;
  color: var(--text-dim);
}

.embed-panel {
  margin-top: 1.4rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 100% -10%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 38%),
    radial-gradient(circle at -4% 100%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 45%),
    var(--bg-elev);
  animation: embed-panel-breathe 7.2s ease-in-out infinite;
}

.embed-panel::before,
.embed-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.embed-panel::before {
  inset: -30% -60%;
  background: linear-gradient(
    108deg,
    transparent 35%,
    color-mix(in srgb, var(--accent) 20%, transparent) 50%,
    transparent 65%
  );
  transform: translateX(-42%) rotate(3deg);
  animation: embed-panel-sheen 6.8s ease-in-out infinite;
}

.embed-panel::after {
  inset: 0;
  background-image: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 12%, transparent),
    transparent 22%
  );
  opacity: 0.5;
}

.embed-panel > * {
  position: relative;
  z-index: 1;
}

.embed-quota-badge {
  font-size: 0.78rem;
  align-self: flex-start;
}

.embed-panel .panel-head {
  flex-wrap: wrap;
}

.embed-note {
  margin: 0 0 0.9rem;
  color: var(--text-dim);
}

.embed-form {
  margin: 0;
}

.embed-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.embed-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.embed-input-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: linear-gradient(
      180deg,
      color-mix(in srgb, var(--card) 85%, white 3%),
      var(--card)
    )
    padding-box;
  color: var(--text);
  padding: 0.62rem 0.72rem;
  font-family: "Space Grotesk", sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 transparent;
  transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.embed-input-row input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent),
    0 0 20px color-mix(in srgb, var(--accent) 16%, transparent);
}

.embed-input-row input:disabled {
  opacity: 0.72;
  cursor: progress;
}

#embedSend {
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

#embedSend::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 25%,
    rgba(255, 255, 255, 0.36) 46%,
    transparent 65%
  );
  transform: translateX(-160%);
  transition: transform 520ms cubic-bezier(0.19, 1, 0.22, 1);
}

#embedSend:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.02);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 32%, transparent);
}

#embedSend:hover:not(:disabled)::before {
  transform: translateX(130%);
}

#embedSend:active:not(:disabled) {
  transform: translateY(0);
}

#embedSend:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}

#embedSend:disabled {
  cursor: progress;
  filter: saturate(0.6) brightness(0.9);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.embed-quota {
  margin: 0.8rem 0 0;
  color: var(--text-dim);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.embed-response {
  margin-top: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--card) 86%, white 4%),
    color-mix(in srgb, var(--card) 95%, var(--bg) 5%)
  );
  padding: 0.95rem;
  min-height: 3.8rem;
  color: var(--text);
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -12px 26px rgba(7, 14, 35, 0.32),
    0 14px 36px rgba(0, 0, 0, 0.24);
  animation: embed-response-breathe 6.6s ease-in-out infinite;
}

.embed-response::before,
.embed-response::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.embed-response::before {
  inset: 0;
  background:
    radial-gradient(circle at 16% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 44%),
    radial-gradient(circle at 90% 96%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 38%);
  opacity: 0.75;
}

.embed-response::after {
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 9%, transparent) 46%,
    transparent 100%
  );
  transform: translateY(-115%);
  opacity: 0;
}

.embed-form:has(#embedSend:disabled) ~ .embed-response::after {
  animation: embed-response-scan 1.3s ease-out infinite;
  opacity: 0.7;
}

.embed-response p {
  margin: 0;
  white-space: pre-wrap;
  position: relative;
  z-index: 1;
  line-height: 1.45;
}

.embed-response.is-thinking p {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  line-height: 1.1;
}

.embed-thinking-label {
  color: rgba(235, 240, 255, 0.92);
  font-size: 0.96rem;
  white-space: nowrap;
}

.embed-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  line-height: 1;
}

.embed-dots span {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: rgba(231, 238, 252, 0.84);
  box-shadow: 0 0 12px rgba(53, 208, 255, 0.16);
  animation: embed-dot-bounce 1s ease-in-out infinite;
}

.embed-dots span:nth-child(2) {
  animation-delay: 0.12s;
  opacity: 0.84;
}

.embed-dots span:nth-child(3) {
  animation-delay: 0.24s;
  opacity: 0.7;
}

.embed-placeholder {
  color: var(--text-dim);
}

.embed-response.is-error {
  border-color: rgba(255, 143, 154, 0.5);
  background: linear-gradient(
    155deg,
    color-mix(in srgb, #ff8f9a 11%, var(--card)),
    color-mix(in srgb, #ff8f9a 6%, var(--card))
  );
  color: #ffb6bf;
}

@keyframes embed-panel-breathe {
  0%,
  100% {
    box-shadow: var(--shadow);
  }
  50% {
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28),
      0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  }
}

@keyframes embed-panel-sheen {
  0%,
  24% {
    transform: translateX(-42%) rotate(3deg);
    opacity: 0;
  }
  31% {
    opacity: 0.8;
  }
  44% {
    transform: translateX(38%) rotate(3deg);
    opacity: 0;
  }
  100% {
    transform: translateX(38%) rotate(3deg);
    opacity: 0;
  }
}

@keyframes embed-response-breathe {
  0%,
  100% {
    border-color: var(--line);
  }
  50% {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  }
}

@keyframes embed-response-scan {
  0% {
    transform: translateY(-115%);
  }
  100% {
    transform: translateY(115%);
  }
}

@keyframes embed-dot-bounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.65;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 180;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(1, 5, 12, 0.72);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(820px, 94vw);
  margin: 8vh auto 0;
  max-height: 80vh;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  transform-origin: top left;
  opacity: 0;
  transform: translate(var(--pane-from-x, 0), var(--pane-from-y, 24px))
    scale(var(--pane-from-scale-x, 0.97), var(--pane-from-scale-y, 0.97));
}

.modal.is-opening .modal-card {
  animation: pane-expand 340ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.modal.is-open .modal-card {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

.modal.is-opening .modal-scrim,
.modal.is-open .modal-scrim {
  animation: pane-scrim-in 220ms ease forwards;
}

.modal.is-closing .modal-card {
  animation: pane-collapse 260ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal.is-closing .modal-scrim {
  animation: pane-scrim-out 180ms ease forwards;
}

@keyframes pane-expand {
  from {
    opacity: 0.35;
    transform: translate(var(--pane-from-x, 0), var(--pane-from-y, 24px))
      scale(var(--pane-from-scale-x, 0.97), var(--pane-from-scale-y, 0.97));
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pane-scrim-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pane-collapse {
  to {
    opacity: 0;
    transform: translate(var(--pane-from-x, 0), var(--pane-from-y, 24px))
      scale(var(--pane-from-scale-x, 0.97), var(--pane-from-scale-y, 0.97));
  }
}

@keyframes pane-scrim-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.theme-transition-layer {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
  opacity: 0;
}

.theme-transition-layer::before,
.theme-transition-layer::after,
.theme-transition-shimmer {
  content: "";
  position: absolute;
  inset: 0;
}

.theme-transition-layer::before {
  background: var(--theme-old-bg, transparent);
}

.theme-transition-layer::after {
  background: var(--theme-new-bg, transparent);
  clip-path: circle(var(--reveal-radius, 0px) at var(--reveal-x, 50%) var(--reveal-y, 50%));
}

.theme-transition-shimmer {
  left: calc(var(--reveal-x, 50%) - 120px);
  top: calc(var(--reveal-y, 50%) - 120px);
  width: 240px;
  height: 240px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 18%,
    rgba(255, 255, 255, 0.34) 50%,
    rgba(255, 255, 255, 0) 82%
  );
  border-radius: 999px;
  mix-blend-mode: screen;
  filter: blur(6px);
  transform: scale(calc(0.4 + var(--reveal-progress, 0) * 1.2));
  opacity: calc(0.16 + (1 - var(--reveal-progress, 0)) * 0.6);
}

.theme-transition-layer.is-active {
  opacity: 1;
}

.theme-transition-layer.is-fading {
  opacity: 0;
  transition: opacity 220ms ease;
}

@keyframes bg-orb-drift {
  0% {
    transform: translate3d(-2.2%, -1.2%, 0) scale(1);
  }
  100% {
    transform: translate3d(2.4%, 1.4%, 0) scale(1.04);
  }
}

.modal-card h3 {
  margin: 0.2rem 0 0.6rem;
}

.modal-tag,
.modal-note {
  color: var(--text-dim);
}

.modal-close {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  padding: 0.36rem 0.7rem;
  font-family: "IBM Plex Mono", monospace;
}

html[data-theme="light"] .modal-scrim {
  background: rgba(239, 245, 255, 0.52);
  backdrop-filter: blur(6px);
}

html[data-theme="light"] .modal-card {
  box-shadow: 0 10px 22px rgba(36, 58, 110, 0.1);
}

html[data-theme="light"] .modal-close {
  border-color: rgba(120, 138, 207, 0.36);
}

html[data-theme="light"] nav a {
  color: #485d83;
}

html[data-theme="light"] nav a:hover {
  color: #263b63;
}

html[data-theme="light"] .status-note,
html[data-theme="light"] .status-detail,
html[data-theme="light"] .card p,
html[data-theme="light"] .hero p,
html[data-theme="light"] .contact-form label,
html[data-theme="light"] .embed-note {
  color: #5f7090;
}

section {
  scroll-margin-top: 6.2rem;
}

/* Unified blur surfaces: transparent fill + header-level blur */
.site-header,
.metrics article,
.panel,
.card,
.status-card,
.embed-panel,
.embed-response,
.contact-form input,
.contact-form textarea,
.embed-input-row input,
.theme-toggle,
.filter,
.card-open,
.modal-card,
.modal-close,
.header-quota-badge,
.status-pill,
.btn {
  background: transparent !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(1.06);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.06);
}

.embed-panel::before,
.embed-panel::after,
.embed-response::before,
.embed-response::after {
  display: none;
}

body.perf-lite #gridCanvas {
  opacity: 0.42;
}

/* Remove backdrop-filter entirely in perf-lite — it's the #1 GPU cost on low-end devices */
body.perf-lite .site-header,
body.perf-lite .metrics article,
body.perf-lite .panel,
body.perf-lite .card,
body.perf-lite .status-card,
body.perf-lite .embed-panel,
body.perf-lite .embed-response,
body.perf-lite .contact-form input,
body.perf-lite .contact-form textarea,
body.perf-lite .embed-input-row input,
body.perf-lite .theme-toggle,
body.perf-lite .filter,
body.perf-lite .card-open,
body.perf-lite .modal-card,
body.perf-lite .modal-close,
body.perf-lite .header-quota-badge,
body.perf-lite .status-pill,
body.perf-lite .btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}

/* Restore solid backgrounds once blur is removed */
body.perf-lite .site-header,
body.perf-lite .metrics article,
body.perf-lite .panel,
body.perf-lite .embed-panel,
body.perf-lite .embed-response,
body.perf-lite .modal-card {
  background: var(--bg-elev) !important;
}

body.perf-lite .card,
body.perf-lite .status-card,
body.perf-lite .contact-form input,
body.perf-lite .contact-form textarea,
body.perf-lite .embed-input-row input {
  background: var(--card) !important;
}

/* Stop ambient orb animation — constant GPU repaint */
body.perf-lite::before {
  animation: none !important;
}

/* Stop embed/transition animations */
body.perf-lite .embed-panel,
body.perf-lite .embed-response,
body.perf-lite .theme-transition-layer {
  animation: none !important;
  transition: none !important;
}

/* Remove card hover lift — saves layout/composite work */
body.perf-lite .card:hover {
  transform: none;
}

@media (max-width: 760px) {
  .site-header {
    flex-wrap: wrap;
    gap: 0.7rem;
    justify-content: center;
  }

  nav {
    order: 2;
    width: 100%;
    justify-content: center;
  }

  .perf-toggle {
    order: 3;
  }

  .embed-quota-badge {
    width: 100%;
    text-align: center;
  }

  .hero-cta {
    flex-wrap: wrap;
  }
}

@media (max-width: 1020px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid .card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-grid .status-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .embed-input-row {
    grid-template-columns: 1fr;
  }

  .embed-input-row .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #rotatingWord {
    transition: none;
  }

  .embed-panel,
  .embed-response {
    animation: none;
  }

  .embed-panel::before,
  .embed-response::after,
  #embedSend::before {
    animation: none;
    transition: none;
  }

  body::before,
  body::after,
  .theme-transition-layer {
    animation: none;
    transition: none;
  }
}
