:root {
  --color-dark: #140E25;
  --color-paper: #F7F5F3;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --transition-base: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Layout & Container */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding: var(--section-y) 0; }
section.dark { background: var(--color-dark); color: var(--color-paper); }
section.light { background: var(--color-paper); color: var(--color-text); }

/* Typography */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 0.5em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.6em; }
p { max-width: 38em; margin-bottom: 1em; }
.hl { color: var(--color-brand); }
.dark .hl { color: var(--color-accent); }
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5em;
}
.light .eyebrow { color: var(--color-brand); }
.dark .eyebrow { color: var(--color-accent); }

/* Header & Footer */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 0.75rem 0;
}
.dark .site-header { background: rgba(20, 14, 37, 0.9); border-bottom-color: rgba(247, 245, 243, 0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: inherit; font-weight: 800; font-size: 1.2rem; }
.logo img { height: 32px; width: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { text-decoration: none; color: inherit; font-weight: 500; font-size: 0.95rem; transition: color var(--transition-base); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--color-brand); }
.dark .nav a:hover, .dark .nav a[aria-current="page"] { color: var(--color-accent); }
.header-actions { display: flex; align-items: center; gap: 1rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0 1.25em; min-height: 52px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; text-decoration: none; border: none; cursor: pointer;
  transition: transform var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
}
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); background: #b8dc5e; }
.btn-secondary { background: transparent; border: 1px solid var(--color-text); color: var(--color-text); }
.dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.dark .btn-secondary:hover { background: rgba(247, 245, 243, 0.1); }
.btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Components: Cards, Grid, Table, Details */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.card {
  background: var(--color-paper); border: var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow); padding: 1.5rem; transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.dark .card { background: var(--color-dark); border: 1px solid rgba(247, 245, 243, 0.1); box-shadow: none; }
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.4); }
.dark .card:hover { border-color: rgba(200, 237, 110, 0.3); }
.card h4 { font-size: 1.1rem; margin-bottom: 0.5em; }
.card time { font-size: 0.85rem; opacity: 0.8; display: block; margin-bottom: 0.75em; }
.card p { font-size: 0.95rem; line-height: 1.6; margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
thead, tbody { display: table; width: 100%; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.1); min-width: 0; word-break: break-word; }
.dark th, .dark td { border-bottom-color: rgba(247, 245, 243, 0.15); }
th { font-weight: 700; }
td:first-child { font-weight: 600; }

details { border: 1px solid rgba(25, 21, 35, 0.1); border-radius: var(--radius-card); margin-bottom: 0.75rem; overflow: hidden; }
.dark details { border-color: rgba(247, 245, 243, 0.15); }
summary {
  padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center;
  background: rgba(25, 21, 35, 0.03); transition: background var(--transition-base);
}
.dark summary { background: rgba(247, 245, 243, 0.05); }
summary:hover { background: rgba(25, 21, 35, 0.06); }
.dark summary:hover { background: rgba(247, 245, 243, 0.08); }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; font-size: 1.2rem; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 1rem 1.25rem; margin: 0; font-size: 0.95rem; line-height: 1.65; }

/* Layout Helpers */
.split-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: center; }
.split-row.reverse { direction: rtl; }
.split-row.reverse > * { direction: ltr; }
.visual-panel { background: var(--color-dark); border-radius: var(--radius-card); padding: 2rem; box-shadow: var(--card-shadow); }
.dark .visual-panel { background: rgba(247, 245, 243, 0.05); border: 1px solid rgba(247, 245, 243, 0.1); }
.timeline { position: relative; padding-left: 2rem; border-left: 2px solid rgba(25, 21, 35, 0.1); }
.dark .timeline { border-left-color: rgba(247, 245, 243, 0.15); }
.timeline-step { position: relative; margin-bottom: 2rem; }
.timeline-step::before {
  content: attr(data-step); position: absolute; left: -2.6rem; top: 0;
  width: 32px; height: 32px; background: var(--color-accent); color: var(--color-dark);
  border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem;
}
.flow-container { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 2rem 0; }
.flow-node { padding: 1rem 1.5rem; background: rgba(247, 245, 243, 0.1); border-radius: var(--radius-card); border: 1px solid rgba(247, 245, 243, 0.15); font-weight: 600; }
.flow-arrow { width: 40px; height: 24px; opacity: 0.6; }

/* SVG & Animations */
svg { width: 100%; height: auto; display: block; }
.node-light { animation: pulseNode 6s infinite alternate ease-in-out; }
.node-light:nth-child(odd) { animation-delay: 0.5s; }
.node-light:nth-child(even) { animation-delay: 1.2s; }
.float { animation: gentleFloat 5s infinite ease-in-out; }
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawDash 4s linear infinite; }
.bubble-rise { animation: riseUp 4s infinite ease-out; }
.rotate-center { transform-box: fill-box; transform-origin: center; animation: spinSlow 12s linear infinite; }

@keyframes pulseNode {
  0%, 100% { opacity: 0.4; r: 3; }
  50% { opacity: 1; fill: var(--color-accent); r: 5; }
}
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes drawDash {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes riseUp {
  0% { opacity: 0; transform: translateY(10px); }
  15%, 85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .draw-path { stroke-dashoffset: 0; }
}

/* Responsive */
@media (max-width: 768px) {
  .split-row, .split-row.reverse { grid-template-columns: 1fr; direction: ltr; }
  .nav { display: none; }
  h1 { font-size: 2.2rem; }
}
