:root {
  --color-dark: #240F29;
  --color-paper: #F6F3F7;
  --color-text: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

section {
  padding-block: var(--section-y);
}

/* Typography */
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: calc(var(--gap) * 1.5);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: calc(var(--gap) * 0.5);
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
}

.dark-bg {
  background: var(--color-dark);
  color: var(--color-paper);
}

.dark-bg h1, .dark-bg h2, .dark-bg h3, .dark-bg p, .dark-bg span, .dark-bg li {
  color: var(--color-paper);
}

.dark-bg .hl {
  color: var(--color-accent);
}

.dark-bg a {
  color: var(--color-accent);
}

.paper-bg {
  background: var(--color-paper);
  color: var(--color-text);
}

/* Header & Footer */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid rgba(32, 21, 35, 0.1);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75em;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text);
  text-decoration: none;
}

.brand img {
  height: 32px;
  width: auto;
}

.nav ul {
  display: flex;
  gap: var(--gap);
  list-style: none;
}

.nav a {
  color: var(--color-text);
  font-weight: 500;
  padding: 0.25em 0.5em;
}

.nav a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: var(--section-y) 0;
  border-top: 1px solid rgba(246, 243, 247, 0.1);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}

.footer-grid a {
  color: var(--color-paper);
  display: block;
  margin-bottom: 0.5em;
}

.footer-grid a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 1.5em;
  height: 48px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #d95a5f;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.btn-secondary:hover {
  background: rgba(32, 21, 35, 0.05);
}

.focus-visible:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

.dark-bg .focus-visible:focus-visible {
  outline-color: var(--color-accent);
}

/* Cards */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
}

.dark-bg .card {
  background: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

/* Panels */
.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dark-bg .panel {
  background: rgba(246, 243, 247, 0.05);
  border: 1px solid rgba(246, 243, 247, 0.2);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--gap);
}

th, td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid rgba(32, 21, 35, 0.2);
}

th {
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

/* FAQ */
details {
  border: var(--card-border);
  background: var(--color-paper);
  margin-bottom: var(--gap);
}

summary {
  padding: 1em;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 1.5em;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+";
  position: absolute;
  left: 0.5em;
  font-weight: 700;
  color: var(--color-brand);
}

details[open] summary::before {
  content: "-";
  color: var(--color-accent);
}

details[open] summary {
  border-bottom: 1px solid rgba(32, 21, 35, 0.2);
}

details p {
  padding: 1em;
  color: var(--color-text);
}

/* SVG Animation Utilities */
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 4s ease-in-out infinite alternate;
}

.anim-float {
  animation: float 6s ease-in-out infinite;
}

.anim-pulse {
  animation: pulse-opacity 4s ease-in-out infinite;
}

.anim-slide {
  animation: slide-in-right 5s ease-in-out infinite alternate;
}

.anim-puzzle {
  animation: rotate-puzzle 15s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes slide-in-right {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes rotate-puzzle {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@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;
  }
}
