:root {
  --bg: #09090b;
  --panel: rgba(20, 20, 22, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.03);
  --panel-soft-2: rgba(255, 255, 255, 0.04);
  --panel-nav: rgba(255, 255, 255, 0.03);
  --panel-nav-hover: rgba(255, 255, 255, 0.08);
  --panel-nav-active: #262626;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #dc2626;
  --accent-soft: rgba(220, 38, 38, 0.14);
  --warn-bg: rgba(120, 53, 15, 0.24);
  --warn-border: rgba(245, 158, 11, 0.34);
  --warn-text: #fcd34d;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --max: min(1460px, calc(100vw - 32px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(220, 38, 38, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.04), transparent 20%),
    linear-gradient(180deg, #111114 0%, var(--bg) 30%, #050507 100%);
  min-height: 100vh;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  background: rgba(12, 12, 14, 0.9);
}

.site-header-inner {
  width: var(--max);
  margin: 0 auto;
  min-height: 64px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  width: auto;
  height: 36px;
}

.brand-copy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1rem;
}

.brand-name span {
  color: var(--accent);
}

.brand-tag,
.hero-kicker,
.resource-meta,
.toc-eyebrow,
.doc-kicker {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
}

.brand-tag {
  padding: 4px 10px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  padding: 8px 12px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-nav);
  transition: 150ms ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--panel-nav-hover);
  color: var(--text);
}

.section-split {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-nav);
}

.section-split-link {
  padding: 8px 12px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: 150ms ease;
}

.section-split-link:hover,
.section-split-link.active {
  background: var(--panel-nav-hover);
  color: var(--text);
}

.section-split-link.active {
  background: var(--panel-nav-active);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.section-split-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, 0.08);
}

.page-shell {
  width: var(--max);
  margin: 0 auto;
  padding: 28px 6px 54px;
}

.hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  align-items: stretch;
}

.hero-panel,
.resource-card,
.toc-panel,
.doc-panel,
.info-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-panel,
.info-panel,
.resource-card {
  padding: 28px;
}

.hero-kicker,
.doc-kicker,
.toc-eyebrow {
  display: inline-flex;
  padding: 6px 12px;
  width: fit-content;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1,
.doc-title {
  margin: 14px 0 10px;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  max-width: 15ch;
}

.doc-title {
  font-size: clamp(1.9rem, 3vw, 3rem);
}

.hero p,
.doc-sub,
.resource-copy,
.info-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions,
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.toc-panel .doc-actions {
  flex-direction: column;
  margin-top: 18px;
}

.beta-note {
  margin-top: 18px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 140ms ease;
}

.button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 30px rgba(220, 38, 38, 0.25);
}

.button:hover {
  filter: brightness(1.06);
}

.button-secondary {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.hero-stat-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.hero-stat {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.hero-stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-stat-value {
  margin-top: 8px;
  font-size: 1.1rem;
  font-weight: 700;
}

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

.section-title {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.section-sub {
  margin: 6px 0 0;
  color: var(--muted);
}

.resource-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resource-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.resource-meta {
  display: inline-flex;
  padding: 6px 10px;
  width: fit-content;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.resource-title {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.resource-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: auto;
}

.resource-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.resource-link::after {
  content: "↗";
  margin-left: 8px;
  color: var(--accent);
}

.reference-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  align-items: start;
}

.toc-panel {
  position: sticky;
  top: 92px;
  padding: 22px 18px 18px;
}

.toc-eyebrow {
  margin-bottom: 14px;
}

.toc-panel h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.toc-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.toc-utility-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 14px;
}

.toc-utility-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: 150ms ease;
}

.toc-utility-link:hover {
  background: rgba(255, 255, 255, 0.07);
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 4px;
}

.toc-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

.toc-group-link,
.toc-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  color: var(--muted);
  line-height: 1.35;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition: 150ms ease;
}

.toc-group-link {
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.14);
  background: rgba(220, 38, 38, 0.08);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.toc-group-link.is-static {
  cursor: default;
}

.toc-item {
  font-size: 0.92rem;
}

.toc-panel .button,
.toc-panel .button-secondary {
  width: 100%;
}

.toc-item.depth-2 {
  color: #f3f4f6;
  font-weight: 600;
}

.toc-group-link:hover,
.toc-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.toc-item-main {
  flex: 1 1 auto;
  min-width: 0;
}

.toc-label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.toc-page {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 3px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.toc-group-link:hover .toc-page,
.toc-item:hover .toc-page {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
}

.toc-item.depth-3 {
  padding-left: 22px;
  font-size: 0.88rem;
}

.toc-item.depth-4 {
  padding-left: 32px;
  font-size: 0.85rem;
}

.doc-panel {
  padding: 30px 30px 28px;
}

.doc-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.doc-head-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.meta-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.025);
}

.meta-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta-value {
  margin-top: 8px;
  font-weight: 700;
  line-height: 1.4;
}

.article {
  color: #e5e7eb;
  line-height: 1.72;
  font-size: 0.98rem;
}

.article > *:first-child {
  margin-top: 0;
}

.article h2,
.article h3,
.article h4 {
  scroll-margin-top: 100px;
  letter-spacing: -0.03em;
}

.article h2 {
  margin-top: 38px;
  margin-bottom: 10px;
  font-size: 1.8rem;
}

.article h3 {
  margin-top: 28px;
  margin-bottom: 10px;
  font-size: 1.24rem;
}

.article h4 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 1rem;
  color: #fff;
}

.article p,
.article li,
.article blockquote {
  color: #d4d4d8;
}

.article hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 22px 0;
}

.article .article-table-scroll {
  margin: 18px 0 24px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.018);
  -webkit-overflow-scrolling: touch;
}

.article .article-table-scroll > .article-table {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.article .article-table-scroll-composite {
  padding: 18px;
}

.article .article-table-scroll-composite > .article-table {
  min-width: 1080px;
}

.article .article-table-scroll-composite > .article-table > tbody > tr > td {
  padding: 0 24px 0 0;
  border-bottom: 0;
  vertical-align: top;
}

.article .article-table-scroll-composite > .article-table > tbody > tr > td:last-child {
  padding-right: 0;
}

.article .article-subtable {
  width: max-content;
  min-width: 460px;
  margin: 0;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
}

.article thead {
  background: rgba(255, 255, 255, 0.04);
}

.article th,
.article td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  white-space: nowrap;
}

.article tr:last-child td {
  border-bottom: 0;
}

.article .article-table-scroll-composite > .article-table tr:last-child > td {
  border-bottom: 0;
}

.article img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px;
}

.article code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.14rem 0.34rem;
  border-radius: 6px;
}

.article pre {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  overflow: auto;
}

.article ul,
.article ol {
  padding-left: 1.3rem;
}

.doc-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.doc-footer a {
  color: #fff;
}

@media (max-width: 1440px) {
  .article .article-table-scroll-composite {
    overflow-x: visible;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .article .article-table-scroll-composite > .article-table,
  .article .article-table-scroll-composite > .article-table > tbody,
  .article .article-table-scroll-composite > .article-table > tbody > tr {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .article .article-table-scroll-composite > .article-table > tbody > tr > td {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
  }

  .article .article-table-scroll-composite > .article-table > tbody > tr > td + td {
    margin-top: 18px;
  }

  .article .article-subtable {
    width: 100%;
    min-width: 0;
  }
}

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

  .reference-layout {
    grid-template-columns: 1fr;
  }

  .toc-panel {
    position: static;
  }

  .doc-head {
    flex-direction: column;
  }

  .doc-head-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

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

@media (max-width: 760px) {
  .site-header-inner,
  .page-shell {
    width: calc(100vw - 20px);
  }

  .resource-grid,
  .doc-head-meta,
  .hero-stat-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .info-panel,
  .resource-card,
  .doc-panel {
    padding: 22px;
  }

  .doc-panel {
    padding: 22px 18px;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }

  .site-header-inner {
    padding: 12px 6px;
    flex-direction: column;
    align-items: flex-start;
  }

  .doc-footer {
    flex-direction: column;
  }
}
