/* === Design Tokens & Variables === */
:root {
  /* Palette */
  --color-bg-dark: #13102D;
  --color-bg-paper: #D6D4ED;
  --color-text-body: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;

  /* Structural Tokens */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(23, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;

  /* Typography Defaults */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Default Text Colors (Paper Face) */
  --color-text-main: var(--color-text-body);
  --color-text-muted: rgba(23, 21, 35, 0.65);
  --color-highlight: var(--color-brand);
  --color-link: var(--color-brand);
  --color-icon: var(--color-brand);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-paper);
  color: var(--color-text-main);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-highlight); }
ul, ol { list-style: none; }

/* Layout Containers */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.section + .section {
  border-top: 1px solid rgba(23, 21, 35, 0.08);
}
.grid-alt {
  display: grid;
  gap: var(--gap);
  align-items: center;
}
@media (min-width: 768px) {
  .grid-alt { grid-template-columns: 1fr 1fr; }
  .grid-alt.reverse .col-text { order: 2; }
  .grid-alt.reverse .col-visual { order: 1; }
}

/* Typography */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; color: var(--color-text-main); }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); text-wrap: balance; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin-bottom: 1.5rem; }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-bottom: 1rem; }
p { margin-bottom: 1.25rem; max-width: 38em; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }

/* Highlight & Badge */
.hl { color: var(--color-highlight); font-weight: 600; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--color-highlight);
}
.badge::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 2px;
  background-color: currentColor;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 52px;
  padding: 0 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  text-decoration: none;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 4px; }
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(137, 237, 110, 0.25);
}
.btn-secondary {
  background: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-text-main);
}
.btn-secondary:hover {
  background-color: rgba(23, 21, 35, 0.05);
  transform: translateY(-1px);
}
.btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* Cards & Panels */
.card {
  background: white;
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 2rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--color-brand); }
.visual-panel {
  background: var(--color-bg-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.visual-panel svg { width: 100%; height: auto; }

/* Table */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-card); border: var(--card-border); background: white; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid rgba(23, 21, 35, 0.08); }
th { font-weight: 600; background: rgba(23, 21, 35, 0.03); }
td:first-child { font-weight: 500; color: var(--color-text-muted); }

/* FAQ */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  background: white;
  transition: border-color 0.2s;
}
details:hover { border-color: var(--color-brand); }
summary {
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.5rem; font-weight: 300; transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details > p { padding: 0 1.5rem 1.5rem; color: var(--color-text-muted); }

/* Header & Footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(214, 212, 237, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(23, 21, 35, 0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.2rem; color: var(--color-text-main); }
.logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-weight: 500; color: var(--color-text-muted); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--color-text-main); }
@media (max-width: 640px) { .nav-links { display: none; } }

.site-footer {
  background: var(--color-bg-dark);
  color: var(--color-bg-paper);
  padding: 4rem 0 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}
.footer-col h4 { color: var(--color-accent); margin-bottom: 1.25rem; font-size: 1rem; }
.footer-col a { display: block; color: rgba(214, 212, 237, 0.7); margin-bottom: 0.75rem; font-size: 0.95rem; }
.footer-col a:hover { color: var(--color-accent); }
.footer-bottom { border-top: 1px solid rgba(214, 212, 237, 0.1); padding-top: 2rem; text-align: center; color: rgba(214, 212, 237, 0.5); font-size: 0.85rem; }

/* Dark Section Overrides */
.section-dark { background-color: var(--color-bg-dark); color: var(--color-bg-paper); }
.section-dark .container { color: var(--color-bg-paper); }
.section-dark h1, .section-dark h2, .section-dark h3, .section-dark p, .section-dark li { color: var(--color-bg-paper); }
.section-dark .badge { color: var(--color-accent); }
.section-dark .btn-secondary { color: var(--color-bg-paper); border-color: var(--color-bg-paper); }
.section-dark .btn-secondary:hover { background: rgba(214, 212, 237, 0.1); }
.section-dark .card { background: var(--color-bg-paper); border-color: rgba(23, 21, 35, 0.1); }
.section-dark .card h3, .section-dark .card p { color: var(--color-text-body); }
.section-dark table th, .section-dark table td { color: var(--color-text-body); border-color: rgba(23, 21, 35, 0.08); }
.section-dark table th { background: rgba(23, 21, 35, 0.05); }
.section-dark details { background: var(--color-bg-paper); border-color: rgba(23, 21, 35, 0.1); }
.section-dark summary, .section-dark details p { color: var(--color-text-body); }

/* SVG Animation Classes */
.svg-anim { width: 100%; height: auto; }
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-draw { animation: drawLine 4s ease-in-out infinite alternate; }
.anim-float { animation: floatBubble 6s ease-in-out infinite; }
.anim-float-delayed { animation: floatBubble 6s ease-in-out infinite 2s; }
.anim-breathe { animation: breatheDots 3s ease-in-out infinite; }
.anim-slide-in { animation: slideIn 5s ease-in-out infinite alternate; }
.anim-spin-slow { animation: spinSlow 20s linear infinite; transform-box: fill-box; transform-origin: center; }

@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes floatBubble { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breatheDots { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spinSlow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .svg-anim { animation: none !important; }
}
