@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg: #0B1126;
  --bg-soft: #0E1530;
  --card: #182443;
  --line: rgba(255, 255, 255, 0.1);
  --violet: #7868FF;
  --cyan: #37D9EF;
  --pink: #FF6A94;
  --text: #F5F9FF;
  --muted: #ADBAD9;
  --shell: 1200px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(520px 520px at 8% -6%, rgba(120, 104, 255, 0.22), transparent 70%),
    radial-gradient(560px 560px at 96% 22%, rgba(55, 217, 239, 0.12), transparent 70%),
    radial-gradient(420px 420px at 30% 108%, rgba(255, 106, 148, 0.1), transparent 70%);
}

img { max-width: 100%; display: block; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #fff; }

h1, h2, h3 {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

p { margin: 0 0 1.05em; }

/* ---------- navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(8, 15, 29, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.nav-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--violet);
  background: radial-gradient(circle at 50% 50%, var(--pink) 0 3px, transparent 3px);
  flex: 0 0 auto;
}

.logo em {
  display: block;
  font-family: Inter, sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
  font-size: 14px;
}

.nav-links a { color: #dfe7fa; white-space: nowrap; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: #fff; }
.nav-links a[aria-current="page"] { color: var(--cyan); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  background: linear-gradient(100deg, #6a5af5, var(--violet));
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-cta:hover { color: #fff; filter: brightness(1.08); }

/* ---------- shell ---------- */
.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* ---------- article header ---------- */
.article-head {
  border-bottom: 1px solid var(--line);
  background: rgba(14, 21, 48, 0.55);
}

.crumbs {
  font-size: 12.5px;
  color: var(--muted);
  padding: 22px 0 0;
}

.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.crumbs a { color: var(--muted); }
.crumbs a:hover { color: #fff; }
.crumbs li[aria-current] { color: var(--text); }

.head-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 36px;
  align-items: center;
  padding: 20px 0 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(55, 217, 239, 0.35);
  background: rgba(55, 217, 239, 0.09);
  color: #7fe7f7;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(28px, 3.6vw, 36px);
  font-weight: 700;
  margin: 18px 0 0;
  color: #fff;
}

.summary {
  margin: 16px 0 0;
  max-width: 620px;
  font-size: 15.5px;
  color: #dce6fa;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 500;
}

.hero-figure {
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--card);
}

.hero-figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

figcaption {
  padding: 10px 14px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- layout ---------- */
.article-body { padding: 40px 0 56px; }

.layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 92px;
  border: 1px solid var(--line);
  background: rgba(24, 36, 67, 0.7);
  border-radius: 16px;
  padding: 16px;
}

.toc h2 {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.toc ol {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 13px;
  display: grid;
  gap: 7px;
}

.toc li { display: flex; gap: 8px; color: var(--muted); }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--cyan); }

.content { max-width: 800px; min-width: 0; font-size: 16.5px; }
.content h2 {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin: 38px 0 12px;
  scroll-margin-top: 96px;
}

.content h2:first-child { margin-top: 0; }

.content a { text-decoration: underline; text-underline-offset: 4px; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.table-wrap {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(24, 36, 67, 0.8);
}

.table-hint {
  margin: 0;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

caption {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

thead tr {
  background: linear-gradient(90deg, rgba(120, 104, 255, 0.22), rgba(120, 104, 255, 0.1) 55%, rgba(55, 217, 239, 0.12));
  color: #eef3ff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th, td { padding: 12px 16px; vertical-align: top; }

thead th { font-weight: 500; }

tbody tr { border-top: 1px solid rgba(255, 255, 255, 0.07); }
tbody th { font-weight: 500; color: #fff; }
tbody td { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- figures, callouts, code ---------- */
figure.body-figure {
  margin: 26px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
}

figure.body-figure img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }

.callout {
  position: relative;
  margin: 26px 0;
  padding: 16px 18px 16px 22px;
  border: 1px solid rgba(55, 217, 239, 0.25);
  background: rgba(55, 217, 239, 0.07);
  border-radius: 16px;
}

.callout::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
}

.callout p { margin: 6px 0 0; font-size: 14.5px; }
.callout strong { display: block; color: #7fe7f7; font-family: "Space Grotesk", sans-serif; font-size: 14px; }

.code-block {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #080e1f;
}

.code-block p {
  margin: 0;
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text);
}

.note-box {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- faq ---------- */
.faq-block {
  margin-top: 40px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(24, 36, 67, 0.7);
}

.faq-block > h2 { padding: 16px 18px 0; margin: 0; font-size: 21px; }

.faq-block details { border-top: 1px solid var(--line); padding: 14px 18px; }
.faq-block details:first-of-type { margin-top: 12px; }

.faq-block summary {
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  color: #fff;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.faq-block summary::-webkit-details-marker { display: none; }
.faq-block summary::after { content: "+"; color: var(--muted); }
.faq-block details[open] summary::after { content: "−"; color: var(--cyan); }
.faq-block details p { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }

/* ---------- related ---------- */
.related {
  margin-top: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(24, 36, 67, 0.7);
  padding: 18px;
}

.related h2 { font-size: 17px; margin: 0 0 12px; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.related a.card-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
}

.related a.card-link:hover { border-color: rgba(55, 217, 239, 0.5); background: rgba(255, 255, 255, 0.06); }
.related strong { color: #fff; font-size: 13.5px; font-weight: 600; }
.related span { color: var(--muted); font-size: 12px; line-height: 1.6; }

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 21, 48, 0.9), #070c1c);
  margin-top: 24px;
}

.footer-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 40px) 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 28px;
}

.footer-h {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.footer-inner ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-inner li a { color: #cfd9f0; font-size: 13.5px; }
.footer-inner li a:hover { color: var(--cyan); }
.footer-note { font-size: 13px; color: var(--muted); max-width: 340px; }

.footer-legal {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) 32px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .head-grid { grid-template-columns: 1fr; gap: 24px; padding-bottom: 32px; }
  .layout { grid-template-columns: 1fr; gap: 24px; }
  .toc { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 84px; }
  body { font-size: 16px; }
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; height: 36px; font-size: 12.5px; padding: 0 12px; }
  .logo em { display: none; }
  .article-body { padding: 28px 0 40px; }
  .related ul { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; }
  table { min-width: 560px; }
  .content h2 { font-size: 20px; margin-top: 30px; }
}

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