:root {
  --bg: #030508;
  --bg-elevated: #070a10;
  --bg-soft: #0c1018;
  --border-subtle: rgba(255, 255, 255, 0.09);
  --brand-gradient: linear-gradient(
    125deg,
    rgb(17, 164, 250) 0%,
    rgb(56, 130, 255) 45%,
    rgb(23, 77, 248) 100%
  );
  --accent: rgb(17, 164, 250);
  --accent-soft: rgba(17, 164, 250, 0.22);
  --accent-strong: rgb(23, 77, 248);
  --text: #e8ecf4;
  --text-soft: #a1adbf;
  --text-softer: #6b7a90;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;
  --blur-backdrop: 18px;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  font-size: 120%;
  scroll-behavior: smooth;
  position: relative;
}

html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 100% 60% at 50% -15%, rgba(23, 77, 248, 0.2), transparent 55%),
    radial-gradient(ellipse 50% 45% at 100% 30%, rgba(17, 164, 250, 0.09), transparent 50%),
    radial-gradient(ellipse 45% 35% at 0% 85%, rgba(99, 102, 241, 0.08), transparent 45%),
    var(--bg);
  pointer-events: none;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(17, 164, 250, 0.35);
  color: #f8fafc;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(var(--blur-backdrop)) saturate(1.2);
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.92), rgba(3, 5, 12, 0.78));
  border-bottom: 1px solid rgba(17, 164, 250, 0.12);
  background-clip: padding-box;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0.32rem;
}

.branding,
.branding-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.branding-link {
  color: inherit;
  text-decoration: none;
}

.logo-image {
  width: auto;
  height: 23px;
  object-fit: contain;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: #9ca3af;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-home-logo {
  height: 26px;
  width: auto;
  display: block;
  object-fit: contain;
}

.header-nav-link {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  transition: color 0.16s ease;
}

.header-nav-link:hover {
  color: #e5e7eb;
}

.header-nav-btn {
  display: inline-block;
  padding: 0.5rem 1.15rem;
  background-image: var(--brand-gradient);
  color: #f8fafc;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: var(--radius-pill);
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.header-nav-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.header-nav-btn:active {
  transform: translateY(0);
}

.mobile-menu-btn {
  display: none;
  border: 1px solid rgba(17, 164, 250, 0.2);
  background: rgba(17, 164, 250, 0.06);
  color: var(--text-soft);
  font-size: 0.9rem;
  padding: 0.4rem 0.65rem;
  border-radius: 12px;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.mobile-menu-btn:hover {
  color: #f1f5f9;
  border-color: rgba(17, 164, 250, 0.4);
  background: rgba(17, 164, 250, 0.12);
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 22px;
  height: 18px;
}

.hamburger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  border-radius: 1px;
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: 1fr;
  gap: 15px;
  max-width: 1120px;
  margin: 1.75rem auto 3.5rem;
  padding: 0;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.toc-inner {
  position: sticky;
  top: 82px;
  padding: 0.85rem 0.85rem 0.9rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(165deg, rgba(12, 16, 28, 0.92), rgba(6, 8, 14, 0.96));
  backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid rgba(17, 164, 250, 0.14);
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 110px);
}

.toc-title {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #f1f5f9, #7dd3fc, #93c5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.toc-meta {
  margin: 0 0 0.9rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-softer);
}

.toc nav {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.35rem;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 164, 250, 0.55) rgba(15, 23, 42, 0.35);
}

.toc nav::-webkit-scrollbar {
  width: 9px;
}

.toc nav::-webkit-scrollbar-track {
  margin: 4px 0;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 999px;
  border: 1px solid rgba(17, 164, 250, 0.06);
}

.toc nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  background-image: linear-gradient(180deg, rgba(56, 189, 248, 0.75), rgba(17, 164, 250, 0.65) 45%, rgba(23, 77, 248, 0.7));
}

.toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.toc-overlay--show {
  opacity: 1;
  pointer-events: auto;
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
}

.toc li {
  margin-bottom: 0.2rem;
}

.toc a {
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.38rem 0.55rem 0.38rem 0.48rem;
  display: block;
  border-radius: 10px;
  border-left: 3px solid transparent;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.toc a:hover {
  color: #f1f5f9;
  background: rgba(17, 164, 250, 0.1);
  transform: translate(2px);
  border-left-color: rgba(17, 164, 250, 0.55);
}

.toc a.is-active {
  color: #f8fafc;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(17, 164, 250, 0.22), rgba(23, 77, 248, 0.08));
  border-left-color: rgba(17, 164, 250, 0.9);
}

.content {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.content::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.97), rgba(5, 7, 12, 0.99));
  border: 1px solid rgba(17, 164, 250, 0.1);
  z-index: -1;
}

.content-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.content-body {
  flex: 1;
  overflow-y: auto;
}

.hero {
  padding: 1.9rem 2.05rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: var(--text-softer);
  margin: 0 0 0.75rem;
}

.hero h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.65rem, 4vw, 2.15rem);
  letter-spacing: 0.02em;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(105deg, #f8fafc, #e0f2fe 38%, #7dd3fc 72%, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  margin: 0 0 1.4rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(17, 164, 250, 0.08), rgba(12, 16, 28, 0.85), rgba(23, 77, 248, 0.06));
  border: 1px solid rgba(17, 164, 250, 0.35);
  max-width: 540px;
}

.hero-meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(209, 213, 219, 0.9);
}

.meta-value {
  font-size: 0.82rem;
  font-weight: 500;
  color: #eef2ff;
}

.section {
  padding: 1.4rem 2.05rem 0.65rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.55);
}

.section--last {
  padding-bottom: 2.2rem;
  border-bottom: none;
  box-shadow: none;
}

.section h2 {
  margin: 0 0 0.9rem;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.section h2::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-image: var(--brand-gradient);
  outline: 2px solid rgba(17, 164, 250, 0.35);
  outline-offset: 1px;
  flex-shrink: 0;
}

.section h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.98rem;
}

.section h4 {
  margin: 0.9rem 0 0.25rem;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.section p {
  margin: 0 0 0.7rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-soft);
}

.section ul,
.section ol {
  margin: 0.3rem 0 0.9rem 1.15rem;
  padding: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.section li + li {
  margin-top: 0.2rem;
}

.section code,
.hero code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: rgba(17, 164, 250, 0.12);
  border: 1px solid rgba(17, 164, 250, 0.2);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.callout {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(17, 164, 250, 0.4);
  background: var(--bg-soft);
  color: #e5e7eb;
  font-size: 0.88rem;
}

.grid {
  display: grid;
  gap: 1.1rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.code-block {
  margin: 0.45rem 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  background: linear-gradient(165deg, #030712, #0a0f1a);
  border: 1px solid rgba(17, 164, 250, 0.15);
  color: #e5e7eb;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-x: auto;
}

.code-block--inline {
  white-space: pre-wrap;
}

.code-block code {
  white-space: pre;
}

.diagram {
  margin: 0.7rem 0 1.1rem;
  padding: 0.9rem;
  border-radius: 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.diagram-layer {
  padding: 0.55rem 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.96);
}

.diagram-arrow {
  text-align: center;
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.8rem;
  margin: 0.15rem 0;
}

.diagram-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(209, 213, 219, 0.9);
}

.diagram-body {
  font-size: 0.85rem;
  color: rgba(229, 231, 235, 0.95);
}

.stack-list {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}

.stack-list li {
  position: relative;
  padding-left: 1.4rem;
}

.stack-list li::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.55rem;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background-image: var(--brand-gradient);
  border: 1px solid rgba(17, 164, 250, 0.5);
}

.table {
  margin: 0.4rem 0 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(17, 164, 250, 0.12);
  background: var(--bg-elevated);
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  font-size: 0.86rem;
}

.table-header {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.96);
  color: rgba(209, 213, 219, 0.9);
}

.table-row:nth-child(odd):not(.table-header) {
  background: rgba(15, 23, 42, 0.92);
}

.table-row:nth-child(even):not(.table-header) {
  background: rgba(15, 23, 42, 0.8);
}

.table-row > div {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.95);
}

.table-row:not(.table-header):hover {
  background: rgba(17, 164, 250, 0.06) !important;
  transition: background 0.15s ease;
}

.flow-list {
  counter-reset: flow-counter;
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.flow-list li {
  counter-increment: flow-counter;
  position: relative;
  padding-left: 2.2rem;
  padding-bottom: 0.4rem;
}

.flow-list li::before {
  content: counter(flow-counter);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 164, 250, 0.8);
  background-image: var(--brand-gradient);
  color: #e5e7eb;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-nav {
  margin-top: auto;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.page-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-nav-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.page-nav-link:hover {
  color: #7dd3fc;
}

.page-nav-disabled {
  color: var(--text-softer);
  cursor: default;
  pointer-events: none;
}

.site-footer {
  border-top: 1px solid rgba(17, 164, 250, 0.1);
  padding: 1rem 0;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  backdrop-filter: blur(22px) saturate(1.1);
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.95), rgba(0, 0, 0, 0.98));
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  width: 100%;
  max-width: 1120px;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  box-sizing: border-box;
}

.footer-container {
  flex-wrap: wrap;
}

.footer-copy {
  text-align: left;
  flex-shrink: 1;
  min-width: 0;
}

.footer-social {
  flex-shrink: 0;
}

.footer-social-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.35rem;
  border-radius: 10px;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.footer-social-link:hover {
  color: var(--accent);
  background-color: rgba(17, 164, 250, 0.1);
}

.footer-social-icon {
  display: block;
  flex-shrink: 0;
}

.site-footer .footer-link {
  color: inherit;
  text-decoration: none;
}

.site-footer .footer-link:hover {
  color: #e5e7eb;
  text-decoration: underline;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 1.1rem;
  }

  .page-nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .page-nav-prev {
    align-self: flex-start;
  }

  .page-nav-next {
    align-self: flex-end;
    text-align: right;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-inner {
    padding: 0.72rem 14px;
  }

  .header-nav {
    gap: 0.48rem;
  }

  .header-nav-btn {
    padding: 0.35rem 0.72rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
  }

  .toc {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 88vw);
    z-index: 70;
    transform: translate(-110%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .toc--open {
    transform: translate(0);
  }

  .toc-inner {
    position: relative;
    top: 0;
    height: 100vh;
    border-radius: 0;
    padding: 1rem 1rem 1.1rem;
  }

  .toc-overlay {
    display: block;
  }

  .hero {
    padding: 1.5rem 1.4rem 1.1rem;
  }

  .section {
    padding: 1.1rem 1.4rem 0.55rem;
  }

  .hero-meta {
    border-radius: 1rem;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .hero {
    padding: 1.1rem 1rem 0.9rem;
  }

  .section {
    padding: 0.9rem 1rem 0.45rem;
  }

  .logo-image {
    height: 15px;
  }

  .header-inner {
    padding: 0.62rem 14px;
  }

  .header-nav {
    gap: 0.36rem;
  }

  .header-nav-btn {
    padding: 0.28rem 0.55rem;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
  }

  .hero-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .content::after {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .site-footer .footer-container {
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.85rem;
  }

  .footer-copy {
    text-align: center;
  }

  .footer-social-list {
    justify-content: center;
  }
}
