:root {
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  --lh-body: 1.55;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: var(--lh-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Context Variables */
.bg-dark { --fg-text: var(--color-paper); --fg-accent: var(--color-accent); --fg-link: var(--color-accent); }
.bg-light { --fg-text: var(--color-text); --fg-accent: var(--color-brand); --fg-link: var(--color-brand); }
.light-card { --fg-text: var(--color-text); --fg-accent: var(--color-brand); --fg-link: var(--color-brand); }

/* Layout */
.container { max-width: var(--content-max); margin-inline: auto; padding-inline: var(--gap); }
.section { padding-block: var(--section-y); position: relative; }
.divider { border-top: 1px solid rgba(21, 23, 35, 0.15); margin-block: 0; }

/* Typography */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 0.6em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin-bottom: 0.8em; }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-bottom: 0.5em; }
p { margin-bottom: 1em; max-width: 38em; }
.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  margin-bottom: 0.5em; text-transform: uppercase;
}
.hl { font-weight: 600; }

/* Header & Footer */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(252, 252, 253, 0.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(21, 23, 35, 0.1);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo img { height: 32px; width: auto; vertical-align: middle; }
.logo span { margin-left: 8px; font-weight: 700; color: var(--color-text); }
nav ul { display: flex; gap: var(--gap); list-style: none; }
nav a {
  text-decoration: none; color: var(--fg-link); font-weight: 500; font-size: 0.95rem;
  padding: 4px 8px; border-radius: 4px; transition: background 0.2s;
}
nav a:hover, nav a[aria-current="page"] { background: rgba(20, 44, 235, 0.08); }
.site-footer {
  background: var(--color-dark); color: var(--color-paper);
  padding-block: var(--section-y); font-size: 0.9rem;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--gap); }
.footer-links a { color: var(--color-accent); text-decoration: none; margin-right: 16px; }
.footer-links a:hover { text-decoration: underline; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 20px; height: 48px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary {
  background: var(--color-accent); color: var(--color-dark);
  border: 2px solid transparent;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(0.95); }
.btn-secondary {
  background: transparent; color: var(--fg-text);
  border: 2px solid var(--fg-text);
}
.btn-secondary:hover { background: rgba(21, 23, 35, 0.05); }

/* Cards & Panels */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex; flex-direction: column;
}
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  overflow: hidden;
}

/* Tables */
.table-wrap { overflow-x: auto; margin-block: 1em; }
table { width: 100%; border-collapse: collapse; min-width: 300px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(21, 23, 35, 0.15); }
th { font-weight: 600; background: rgba(20, 44, 235, 0.04); }
td:first-child { font-weight: 600; }

/* FAQ */
details {
  border: 1px solid rgba(21, 23, 35, 0.2); border-radius: var(--radius-card);
  margin-bottom: 12px; padding: 16px; background: var(--color-paper);
}
summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 24px; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-weight: 400; transition: transform 0.2s;
}
details[open] summary::after { content: "-"; }
details p { margin-top: 12px; margin-bottom: 0; color: var(--fg-text); }

/* SVG Base */
.svg-container { width: 100%; height: auto; display: block; }
.hero-svg { max-width: 100%; }
.feature-svg { max-width: 100%; }
.security-svg { max-width: 100%; }

/* SVG Animations */
@keyframes drawLine { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes slideIn { 0% { transform: translateX(20px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes flowDash { to { stroke-dashoffset: -10; } }
@keyframes pulseScale { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.svg-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 2s ease-out forwards; }
.svg-float { animation: float 4s ease-in-out infinite; }
.svg-breathe { animation: breathe 3s ease-in-out infinite; }
.svg-slide { animation: slideIn 1.5s ease-out forwards; }
.svg-flow { stroke-dasharray: 4 6; animation: flowDash 1.5s linear infinite; }
.svg-pulse { animation: pulseScale 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .magazine-layout { display: flex; flex-direction: column-reverse; }
  .sidebar-toc { order: -1; margin-bottom: 1em; }
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); }
.text-center { text-align: center; }
.mt-1 { margin-top: 1em; }
.mb-1 { margin-bottom: 1em; }
