:root {
  --bg: #eef4ff;
  --surface: #ffffff;
  --surface-alt: #e2ecff;
  --text: #0f1f3d;
  --muted: #516585;
  --primary: #005fdf;
  --primary-strong: #0049ba;
  --accent: #12b9d4;
  --line: rgba(8, 53, 120, 0.16);
  --shadow: 0 14px 35px rgba(9, 39, 91, 0.15);
  --radius: 16px;
}

body.theme-dark {
  --bg: #0b1b3d;
  --surface: #1f304d;
  --surface-alt: #2a3e62;
  --text: #f3f7ff;
  --muted: #9ab0d0;
  --primary: #2f6bff;
  --primary-strong: #3bbdff;
  --accent: #20c9ff;
  --line: rgba(112, 150, 206, 0.34);
  --shadow: 0 14px 30px rgba(2, 8, 22, 0.38);
  background:
    radial-gradient(1000px 500px at 12% 28%, rgba(47, 107, 255, 0.14), transparent 62%),
    radial-gradient(900px 450px at 90% 84%, rgba(87, 55, 210, 0.14), transparent 62%),
    linear-gradient(135deg, #071630 0%, #102555 56%, #1c245b 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", "Inter", "Roboto", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 85% 0%, rgba(25, 177, 255, 0.14), transparent 35%), var(--bg);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  border-radius: 12px;
}

main {
  min-height: 60vh;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.section {
  padding: 4.75rem 0;
}

.section-title {
  margin: 0 0 0.8rem;
  font-size: clamp(1.55rem, 2.3vw, 2.1rem);
  line-height: 1.25;
}

.section-copy {
  margin: 0 0 1.8rem;
  color: var(--muted);
  max-width: 68ch;
}

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

.circuit-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.circuit-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, transparent 0, transparent 15%, rgba(80, 153, 255, 0.08) 15%, rgba(80, 153, 255, 0.08) 15.5%, transparent 15.5%),
    linear-gradient(0deg, transparent 0, transparent 30%, rgba(23, 208, 200, 0.08) 30%, rgba(23, 208, 200, 0.08) 30.4%, transparent 30.4%);
  pointer-events: none;
}

.progress-wrap {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1200;
  height: 4px;
  background: transparent;
}

.reading-progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.12s linear;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

body.theme-dark .site-header {
  background: #0b162c;
  backdrop-filter: none;
  border-bottom: 1px solid rgba(87, 121, 176, 0.22);
}

body.theme-dark .nav-link,
body.theme-dark .drop-toggle {
  color: #c2d2eb;
}

body.theme-dark .nav-link:hover,
body.theme-dark .drop-toggle:hover,
body.theme-dark .nav-link.active {
  color: #f5f9ff;
  background: rgba(88, 121, 177, 0.26);
}

body.theme-dark .btn-primary {
  background: #2a66f5;
  box-shadow: 0 10px 20px rgba(42, 102, 245, 0.32);
}

body.theme-dark .btn-secondary {
  background: #34496f;
  border-color: rgba(127, 160, 214, 0.38);
  color: #eaf1ff;
}

.nav-shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle, rgba(20, 208, 200, 0.35) 0%, rgba(0, 119, 255, 0.22) 45%, rgba(0, 119, 255, 0.03) 100%);
  border: 1px solid var(--line);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent), transparent 45%);
}

.brand-mark::before {
  width: 6px;
  height: 6px;
  top: 8px;
  left: 7px;
}

.brand-mark::after {
  width: 5px;
  height: 5px;
  right: 7px;
  bottom: 8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-links > li {
  position: relative;
}

.nav-link,
.drop-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.25s ease;
}

.nav-link:hover,
.drop-toggle:hover,
.nav-link.active {
  color: var(--text);
  background: var(--surface-alt);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.5rem;
  display: none;
}

.dropdown-menu a {
  display: block;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
}

.dropdown-menu a:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  display: block;
}

.theme-toggle,
.nav-toggle,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.nav-toggle {
  display: none;
}

.hero {
  padding: clamp(4rem, 8vw, 6.5rem) 0 4.5rem;
}

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

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 3.8vw, 3.3rem);
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.03rem;
}

.hero-cta {
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1.2rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  color: #f7fbff;
  background: linear-gradient(120deg, var(--primary), color-mix(in srgb, var(--primary), var(--accent) 38%));
  box-shadow: 0 10px 20px color-mix(in srgb, var(--primary), transparent 70%);
}

.btn-secondary {
  border-color: var(--line);
  background: var(--surface-alt);
}

.hero-panel {
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

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

.node {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary), transparent 88%), color-mix(in srgb, var(--accent), transparent 85%));
  position: relative;
  overflow: hidden;
}

.node::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent), transparent 35%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.8;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.18);
    opacity: 1;
  }
}

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

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

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--primary), transparent 62%);
}

.card-body {
  padding: 1.1rem 1.1rem 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary), transparent 92%);
  font-size: 0.78rem;
  font-weight: 600;
}

.card h3 {
  margin: 0.75rem 0 0.5rem;
  font-size: 1.12rem;
}

.card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
}

.icon-row img {
  width: 24px;
  height: 24px;
  border-radius: 0;
}

.topic-roadmap {
  position: relative;
  padding-left: 1.4rem;
}

.topic-roadmap::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}

.road-step {
  position: relative;
  margin-bottom: 1rem;
  padding: 1rem;
}

.road-step::before {
  content: "";
  position: absolute;
  top: 1.2rem;
  left: -1.75rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 68%);
}

.search-wrap,
.filter-wrap,
.newsletter-wrap,
.contact-grid,
.page-layout,
.blog-layout,
.share-row,
.download-panel {
  display: grid;
  gap: 1rem;
}

.search-wrap {
  grid-template-columns: 1fr 200px;
}

.search-input,
.select-input,
.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.textarea {
  min-height: 140px;
  resize: vertical;
}

.page-layout {
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}

.blog-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.toc-card {
  position: sticky;
  top: 96px;
}

.toc-title {
  margin-top: 0.2rem;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.toc-list a {
  color: var(--muted);
  font-size: 0.94rem;
}

.toc-list a:hover {
  color: var(--primary-strong);
}

.blog-content .card-body {
  padding: 1.35rem 1.35rem 1.5rem;
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.blog-content h2 {
  margin: 1.4rem 0 0.55rem;
  font-size: 1.3rem;
}

.blog-content h3 {
  margin: 0.95rem 0 0.45rem;
  font-size: 1.02rem;
}

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

.blog-content ul {
  margin: 0.3rem 0 0.9rem 1.2rem;
  padding: 0;
}

.blog-highlight {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--primary), transparent 93%);
  border-radius: 12px;
  padding: 0.9rem;
  margin: 0.85rem 0 1rem;
}

.sidebar h3 {
  margin-top: 0.2rem;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.sidebar-list a {
  color: var(--muted);
}

.sidebar-list a:hover {
  color: var(--text);
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--primary-strong);
}

.newsletter-box {
  padding: 1.2rem;
}

.newsletter-form {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr auto;
}

.footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 2.3rem 0;
}

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

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  color: var(--muted);
}

.footer p {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 900;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.to-top.visible {
  opacity: 1;
  visibility: visible;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.share-row {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .hero-grid,
  .grid-4,
  .grid-3,
  .page-layout,
  .blog-layout,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .toc-card {
    position: static;
  }

  .search-wrap {
    grid-template-columns: 1fr;
  }

  .newsletter-form {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    left: 4vw;
    right: 4vw;
    top: 74px;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.5rem;
    box-shadow: var(--shadow);
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
  }

  .nav-links.open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .dropdown-menu {
    position: static;
    display: none;
    box-shadow: none;
    margin-top: 0.25rem;
  }

  .dropdown.open .dropdown-menu {
    display: block;
  }
}
