:root {
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  --radius-card: 20px;
  --radius-btn: 12px;
  --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-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.65;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }

/* Surface Overrides */
.dark-surface { background: var(--color-dark); color: var(--color-paper); }
.dark-surface .hl { color: var(--color-accent); }
.dark-surface a:not(.btn) { color: var(--color-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.paper-surface { background: var(--color-paper); color: var(--color-text); }
.paper-surface .hl { color: var(--color-brand); }
.paper-surface a:not(.btn) { color: var(--color-brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Typography */
h1, h2, h3, h4 { line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: calc(var(--gap) * 0.6); }
p { margin-bottom: 1em; max-width: 38em; }
.subtitle { font-size: 0.9rem; opacity: 0.85; margin-bottom: var(--gap); }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.5em; text-transform: uppercase; }
.paper-surface .badge { color: var(--color-brand); }
.dark-surface .badge { color: var(--color-accent); }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid rgba(25,21,35,0.1); }
.dark-surface header { background: var(--color-dark); border-bottom-color: rgba(233,232,234,0.1); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: var(--gap); }
nav a { font-size: 0.95rem; font-weight: 500; transition: color 0.2s; }
nav a:hover, nav a[aria-current="page"] { color: var(--color-brand); }
.dark-surface nav a:hover, .dark-surface nav a[aria-current="page"] { color: var(--color-accent); }
footer { padding: var(--section-y) 0; border-top: 1px solid rgba(25,21,35,0.1); }
.dark-surface footer { border-top-color: rgba(233,232,234,0.1); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 24px; font-size: 1rem; font-weight: 600; border-radius: var(--radius-btn); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, background 0.2s; border: none; }
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(237,146,110,0.4); }
.btn-secondary { background: transparent; border: 1px solid currentColor; }
.paper-surface .btn-secondary { color: var(--color-text); border-color: var(--color-text); }
.dark-surface .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Cards & Grid */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.card { background: var(--color-paper); border-radius: var(--radius-card); box-shadow: var(--card-shadow); padding: var(--gap); border: var(--card-border); transition: box-shadow 0.2s; }
.dark-surface .card { background: rgba(233,232,234,0.08); border: 1px solid rgba(233,232,234,0.15); }
.card:hover { box-shadow: 0 14px 32px -12px rgba(25,21,35,0.35); }
.card h3 { margin-top: 0; }
.card time { font-size: 0.85rem; opacity: 0.7; display: block; margin-bottom: 0.5em; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; border-left: 2px solid currentColor; opacity: 0.3; }
.timeline-item { position: relative; margin-bottom: var(--gap); }
.timeline-item::before { content: ''; position: absolute; left: -29px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); }
.timeline-time { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.25em; color: var(--color-accent); }

/* Definition List */
dl { display: grid; gap: var(--gap); }
dt { font-weight: 700; margin-bottom: 0.25em; }
dd { margin: 0; opacity: 0.9; }

/* Table */
table { width: 100%; border-collapse: collapse; margin: var(--gap) 0; table-layout: auto; min-width: 0; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid currentColor; opacity: 0.8; overflow-wrap: break-word; word-break: break-all; min-width: 0; }
th { font-weight: 600; }

/* FAQ */
details { margin-bottom: 12px; border-bottom: 1px solid currentColor; opacity: 0.8; }
summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::marker { display: none; }
details p { margin-top: 0.5em; margin-bottom: 0; }

/* SVG Panel & Animation */
.svg-panel { width: 100%; height: auto; max-width: 100%; overflow: hidden; }
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-stroke 4s ease-out infinite alternate; }
.anim-geo { animation: geo-rotate 12s linear infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-slide { animation: slide-in 1.5s ease-out both; }

@keyframes draw-stroke { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes geo-rotate { 0% { transform: rotate(0deg) scale(0.9); } 50% { transform: rotate(180deg) scale(1.05); } 100% { transform: rotate(360deg) scale(0.9); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes slide-in { 0% { transform: translateX(-20px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .anim-draw, .anim-geo, .anim-float, .anim-slide { animation: none; }
}

@media (max-width: 768px) {
  .hero-layout { grid-template-columns: 1fr !important; }
  .nav-inner { flex-direction: column; height: auto; padding: 16px 0; }
  nav ul { flex-wrap: wrap; justify-content: center; }
}
