:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3f9;
  --text: #0b1220;
  --text-muted: #425167;
  --line: #d6deea;
  --brand: #0f8f6f;
  --brand-strong: #0b7a5f;
  --accent: #1f8fff;
  --warning: #a0431d;
  --radius: 18px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-hard: 0 22px 48px rgba(15, 23, 42, 0.14);
  --max: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #050914;
    --surface: #0c1526;
    --surface-muted: #101c31;
    --text: #edf4ff;
    --text-muted: #a8bdd8;
    --line: #243554;
    --brand: #2cd4a7;
    --brand-strong: #27c094;
    --accent: #5cb4ff;
    --warning: #ffac86;
    --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.35);
    --shadow-hard: 0 26px 58px rgba(0, 0, 0, 0.5);
  }
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050914;
  --surface: #0c1526;
  --surface-muted: #101c31;
  --text: #edf4ff;
  --text-muted: #a8bdd8;
  --line: #243554;
  --brand: #2cd4a7;
  --brand-strong: #27c094;
  --accent: #5cb4ff;
  --warning: #ffac86;
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.35);
  --shadow-hard: 0 26px 58px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "SF Pro Text", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(31, 143, 255, 0.14), transparent 38%),
    radial-gradient(circle at 88% 16%, rgba(15, 143, 111, 0.18), transparent 34%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  color: var(--text);
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.nav a {
  color: var(--text-muted);
  font-weight: 500;
  border-radius: 999px;
  padding: 0.48rem 0.8rem;
}

.nav a.is-current,
.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
  background: var(--surface-muted);
  text-decoration: none;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.button,
button.theme-toggle {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.button.primary:hover,
.button.primary:focus-visible {
  filter: brightness(1.05);
  text-decoration: none;
}

.button.ghost,
.theme-toggle {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

main {
  width: min(var(--max), 100% - 2rem);
  margin: 1.2rem auto 3.4rem;
}

.hero {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 82%, var(--accent) 18%), var(--surface)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-hard);
  padding: clamp(1.25rem, 3vw, 2.6rem);
  margin-bottom: 1.35rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-family: "Avenir Next", "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-size: clamp(2rem, 4.6vw, 3.5rem);
}

.hero p {
  margin: 0;
  max-width: 70ch;
  color: var(--text-muted);
}

.hero-cta {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: clamp(1.2rem, 2.3vw, 2.1rem);
}

.content h1,
.content h2,
.content h3,
.content h4 {
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.content h1 {
  margin-top: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-family: "Avenir Next", "SF Pro Display", "Segoe UI", sans-serif;
}

.content h2 {
  margin-top: 1.75rem;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.content h3 {
  margin-top: 1.35rem;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
}

.content p,
.content li {
  color: var(--text-muted);
}

.content ul,
.content ol {
  padding-left: 1.15rem;
}

.content strong {
  color: var(--text);
}

.content code {
  font-family: "SF Mono", "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 0.94em;
  background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08rem 0.36rem;
  color: var(--text);
}

.content pre {
  margin: 1rem 0;
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  padding: 0.9rem;
}

.content pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.notice {
  margin: 1rem 0;
  padding: 0.88rem 0.95rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--line));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  color: var(--text);
}

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

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  padding: 0.95rem;
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.footer-inner {
  width: min(var(--max), 100% - 2rem);
  margin: 0 auto;
  padding: 1.2rem 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: space-between;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 0.8rem;
  border-radius: 0 0 8px 8px;
}

.skip-link:focus {
  left: 0.8rem;
}

@media (max-width: 930px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button,
  .top-actions .theme-toggle {
    flex: 1;
    text-align: center;
  }

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