:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #ecece8;
  --text: #111111;
  --muted: #6f6f69;
  --line: #d7d7d1;
  --line-strong: #b8b8b1;
  --button: #111111;
  --button-text: #ffffff;
  --success: #1f6b3a;
  --danger: #a63232;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  --bg: #090909;
  --surface: #111111;
  --surface-2: #171717;
  --text: #f1f1ed;
  --muted: #989892;
  --line: #2b2b2b;
  --line-strong: #424242;
  --button: #f1f1ed;
  --button-text: #0a0a0a;
  --success: #8bd2a4;
  --danger: #ef9696;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.eyebrow {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .18em;
}

.site-header {
  position: relative;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.header-inner {
  position: relative;
  min-height: 82px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 26px;
  padding: 10px 0;
}
.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; min-width: 0; }
.brand img { width: 36px; height: 36px; object-fit: contain; display: block; flex: 0 0 auto; }
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-copy strong { font-size: 14px; line-height: 1.15; letter-spacing: .1em; white-space: nowrap; }
.brand-copy small { color: var(--muted); font-size: 9px; line-height: 1.25; letter-spacing: .12em; white-space: nowrap; }
.main-nav { justify-self: end; display: flex; align-items: center; gap: 28px; }
.main-nav a { color: var(--muted); font-size: 13px; font-weight: 680; }
.main-nav a:hover, .main-nav a.active { color: var(--text); }
.header-controls { display: flex; align-items: center; gap: 8px; }
.theme-toggle,
.nav-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.theme-toggle:hover,
.nav-toggle:hover { background: var(--surface); border-color: var(--line-strong); }
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-toggle { display: none; position: relative; }
.nav-toggle span {
  position: absolute;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transition: transform .18s ease, top .18s ease;
}
.nav-toggle span:first-child { top: 16px; }
.nav-toggle span:last-child { top: 22px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 19px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
  transition: opacity .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
}
.button.primary { background: var(--button); color: var(--button-text); border-color: var(--button); }
.button.secondary { background: transparent; color: var(--text); }
.button.secondary:hover { background: var(--surface-2); }
.button:disabled { opacity: .55; cursor: wait; }
.button.full { width: 100%; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; }
.online .status-dot { background: var(--success); }
.offline .status-dot { background: var(--danger); }

.site-footer { margin-top: 92px; border-top: 1px solid var(--line); }
.footer-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .06em;
}
.footer-links { display: flex; gap: 22px; }
.footer-links a:hover { color: var(--text); }

.state-page { padding: 110px 0 40px; }
.state-code { color: var(--muted); font-size: 12px; letter-spacing: .16em; font-weight: 800; }
.state-page h1 { max-width: 680px; margin: 18px 0 16px; font-size: clamp(42px, 8vw, 76px); line-height: 1; letter-spacing: -.05em; }
.state-page p { max-width: 560px; margin: 0 0 30px; color: var(--muted); font-size: 16px; line-height: 1.7; }

@media (max-width: 760px) {
  .shell { width: min(100% - 30px, 1120px); }
  .header-inner {
    min-height: 88px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: 14px;
  }
  .brand img { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { font-size: 8.5px; letter-spacing: .1em; }
  .header-controls { justify-self: end; }
  .theme-toggle,
  .nav-toggle { width: 39px; height: 39px; }
  .nav-toggle { display: grid; }
  .main-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    z-index: 50;
    display: none;
    gap: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-top: 0;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: grid; }
  .main-nav a {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
  }
  .main-nav a:last-child { border-bottom: 0; }
  .main-nav a.active::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
  body.nav-open { overflow: hidden; }
  .site-footer { margin-top: 64px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; padding: 22px 0; }
}

@media (max-width: 380px) {
  .brand { gap: 9px; }
  .brand img { width: 31px; height: 31px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 7.7px; }
  .header-controls { gap: 6px; }
  .theme-toggle,
  .nav-toggle { width: 37px; height: 37px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
