:root {
  --c-dark: #140E25;
  --c-paper: #F5F0E5;
  --c-text: #191523;
  --c-brand: #5214EB;
  --c-accent: #C8ED6E;
  --r-card: 8px;
  --r-btn: 6px;
  --shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --sec-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --max-w: 960px;
  --lh-body: 1.55;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--c-paper);
  color: var(--c-text);
  line-height: var(--lh-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--c-brand); text-decoration: none; transition: opacity 0.2s; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; }

/* Surface Overrides */
.surface-dark { background: var(--c-dark); color: var(--c-paper); }
.surface-dark .hl { color: var(--c-accent); }
.surface-dark a:not(.btn) { color: var(--c-accent); }
.surface-dark .badge { color: var(--c-accent); }
.surface-dark .card { background: var(--c-paper); color: var(--c-text); border: 1px solid rgba(25, 21, 35, 0.08); }
.surface-dark table th, .surface-dark table td { border-color: rgba(245, 240, 229, 0.15); }
.surface-dark .btn-secondary { color: var(--c-paper); border-color: var(--c-paper); }

.surface-paper { background: var(--c-paper); color: var(--c-text); }
.surface-paper .hl { color: var(--c-brand); }
.surface-paper a:not(.btn) { color: var(--c-brand); }
.surface-paper .badge { color: var(--c-brand); }
.surface-paper .card { background: var(--c-paper); color: var(--c-text); box-shadow: var(--shadow); border: 1px solid rgba(25, 21, 35, 0.06); }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gap); }
section { padding: var(--sec-y) 0; }

/* Typography */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; margin: 0 0 var(--gap) 0; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-top: calc(var(--sec-y) * 1.2); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 var(--gap) 0; max-width: 38em; }
.lead { font-size: 1.1rem; line-height: 1.6; opacity: 0.9; }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.5rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.6rem; border-radius: var(--r-btn);
  font-weight: 600; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none; font-size: 1rem; text-decoration: none; white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.btn-primary { background: var(--c-accent); color: var(--c-dark); }
.btn-secondary { background: transparent; border: 1px solid currentColor; color: inherit; }
.btn:hover { transform: translateY(-2px); }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: rgba(245, 240, 229, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(25, 21, 35, 0.1); padding: 1rem 0; }
.surface-dark header { background: rgba(20, 14, 37, 0.92); border-bottom-color: rgba(245, 240, 229, 0.1); }
.nav { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.2rem; color: inherit; text-decoration: none; }
.logo img { width: 32px; height: 32px; }
nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
nav a { color: inherit; font-weight: 500; padding: 0.5rem; border-radius: var(--r-btn); }
nav a:hover, nav a[aria-current="page"] { background: rgba(25, 21, 35, 0.06); text-decoration: none; }
footer { padding: var(--sec-y) 0; border-top: 1px solid rgba(25, 21, 35, 0.1); margin-top: var(--sec-y); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); }
.footer-col h4 { margin-bottom: 0.75rem; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.5rem; }

/* Pure CSS Tabs */
.tabs-wrapper { display: flex; gap: 0; overflow-x: auto; border-bottom: 2px solid rgba(25, 21, 35, 0.1); margin-bottom: var(--gap); }
.tabs-wrapper input[type="radio"] { display: none; }
.tabs-wrapper label { padding: 0.75rem 1.25rem; cursor: pointer; font-weight: 600; color: var(--c-text); opacity: 0.6; transition: 0.2s; white-space: nowrap; }
.tabs-wrapper input:checked + label { opacity: 1; border-bottom: 3px solid var(--c-brand); margin-bottom: -2px; }
.tab-panel { display: none; }
.tabs-wrapper input:checked + label ~ .tab-panel { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Table */
table { width: 100%; border-collapse: collapse; margin: var(--gap) 0; font-size: 0.95rem; table-layout: auto; overflow-wrap: anywhere; }
th, td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid rgba(25, 21, 35, 0.1); word-break: break-word; }
th { font-weight: 600; }
tr:last-child td { border-bottom: none; }

/* FAQ */
details { margin-bottom: var(--gap); border: 1px solid rgba(25, 21, 35, 0.1); border-radius: var(--r-card); overflow: hidden; }
summary { padding: 1rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; font-weight: 400; }
details[open] summary::after { content: "-"; }
details p { padding: 0 1rem 1rem; margin: 0; }

/* Flow Diagram */
.flow { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; justify-content: center; }
.flow-step { padding: 1rem; background: rgba(25, 21, 35, 0.04); border-radius: var(--r-card); text-align: center; flex: 1; min-width: 160px; }
.flow-arrow { font-size: 1.4rem; color: var(--c-brand); flex-shrink: 0; }

/* Cards Grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.news-card { display: flex; flex-direction: column; gap: 0.5rem; }
.news-card time { font-size: 0.85rem; opacity: 0.7; }
.news-card p { font-size: 0.95rem; line-height: 1.6; }

/* SVG Animations */
.svg-container { width: 100%; height: auto; max-width: 520px; }
.draw-path { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLoop 4s ease-in-out infinite alternate; }
@keyframes drawLoop { 0% { stroke-dashoffset: 1; } 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
.float-slow { animation: floatY 6s ease-in-out infinite alternate; transform-origin: center; }
.float-med { animation: floatY 5s ease-in-out infinite alternate; transform-origin: center; }
.breath { animation: breathe 2.5s ease-in-out infinite alternate; }
.slide-up { animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; transform-origin: bottom center; }
@keyframes floatY { 0% { transform: translateY(0); } 100% { transform: translateY(-10px); } }
@keyframes breathe { 0% { opacity: 0.3; } 100% { opacity: 1; } }
@keyframes slideUp { 0% { transform: translateY(24px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/* Reduced Motion */
@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; }
  .draw-path, .float-slow, .float-med, .breath, .slide-up { animation: none !important; }
}

/* Responsive Tweaks */
@media (max-width: 768px) {
  .nav ul { display: none; }
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); margin: 0.5rem 0; }
  .hero-layout { flex-direction: column; }
}
