:root {
  --c-dark: #240F29;
  --c-paper: #F6F3F7;
  --c-body: #201523;
  --c-brand: #A711CF;
  --c-accent: #ED6E73;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  --lh-body: 1.55;
  --font-main: 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-main);
  background: var(--c-paper);
  color: var(--c-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--c-brand); text-decoration: none; transition: opacity .2s ease; }
a:hover { opacity: .85; }

.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-block: var(--section-y); }

/* Typography */
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: var(--gap); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: var(--gap); margin-top: var(--section-y); }
h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; margin-bottom: var(--gap); }
p { margin-bottom: var(--gap); max-width: 38em; }
.tag { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; color: var(--c-brand); margin-bottom: 0.5em; text-transform: uppercase; }
.hl { color: var(--c-brand); }

/* Layout & Components */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.card { background: rgba(0,0,0,.03); border: var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--radius-card); padding: var(--gap); margin-bottom: var(--gap); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap); min-width: 500px; }
th, td { padding: var(--gap); text-align: left; border-bottom: 1px solid rgba(0,0,0,.1); vertical-align: top; }
th { font-weight: 700; white-space: nowrap; }

details { margin-bottom: var(--gap); border-bottom: 1px solid rgba(0,0,0,.1); padding-bottom: var(--gap); }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5em; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
details[open] summary { margin-bottom: 0.5em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.8em 1.5em; font-size: 1rem; font-weight: 600; border-radius: var(--radius-btn); cursor: pointer; transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease; border: none; line-height: 1; }
.btn-primary { background: var(--c-accent); color: var(--c-dark); }
.btn-primary:hover { transform: translateY(-2px); background: #d95b60; }
.btn-secondary { background: transparent; color: var(--c-body); border: 1px solid var(--c-body); }
.btn-secondary:hover { background: rgba(0,0,0,.05); }
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* Theme Overrides */
.theme-dark { background: var(--c-dark); color: var(--c-paper); }
.theme-dark .tag, .theme-dark a, .theme-dark .hl { color: var(--c-accent); }
.theme-dark .btn-secondary { color: var(--c-paper); border-color: var(--c-paper); }
.theme-dark .btn-secondary:hover { background: rgba(255,255,255,.1); }
.theme-dark .card { background: rgba(255,255,255,.05); }
.theme-dark table th, .theme-dark table td { border-bottom-color: rgba(255,255,255,.15); }
.theme-dark details { border-bottom-color: rgba(255,255,255,.15); }

/* Header & Footer */
.header { position: sticky; top: 0; z-index: 10; background: var(--c-paper); border-bottom: 1px solid rgba(0,0,0,.1); padding: 0.5em 0; }
.theme-dark .header { background: var(--c-dark); border-color: rgba(255,255,255,.1); }
.nav { display: flex; justify-content: space-between; align-items: center; }
.nav-links { display: flex; gap: var(--gap); list-style: none; }
.nav-links a { color: inherit; font-weight: 500; }
.nav-links a[aria-current="page"] { color: var(--c-accent); font-weight: 700; }
.footer { background: var(--c-dark); color: var(--c-paper); padding: var(--section-y) 0; margin-top: var(--section-y); }
.footer a { color: var(--c-accent); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.5em; color: var(--c-accent); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.4em; }

/* SVG Animations */
@keyframes nodePulse {
  0%, 100% { fill: rgba(255,255,255,0.15); transform: scale(0.8); }
  50% { fill: var(--c-accent); transform: scale(1.2); }
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes dashDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid-node { animation: nodePulse 4s infinite ease-in-out; transform-origin: center; }
.grid-node:nth-child(odd) { animation-delay: 0.6s; }
.grid-node:nth-child(even) { animation-delay: 1.4s; }
.chat-bubble { animation: bubbleFloat 6s infinite ease-in-out; }
.draw-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: dashDraw 2.5s ease forwards; }
.fade-in { animation: fadeInUp 0.8s ease forwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .grid-node, .chat-bubble, .draw-line, .fade-in { animation: none !important; }
}
