/* === Design Tokens & Variables === */
:root {
  /* Colors */
  --color-dark-bg: #140E25;
  --color-paper: #FCFCFD;
  --color-text-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #6EEDD2;
  
  /* Derived/UI Colors */
  --color-border: #E0E0E0;
  --color-card-shadow: rgba(25, 21, 35, 0.1);

  /* Spacing & Layout */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1280px;
  --header-height: 72px;

  /* Radius */
  --radius-card: 8px;
  --radius-btn: 6px;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* === 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-paper);
  color: var(--color-text-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text-body);
}

.dark-theme h1, .dark-theme h2, .dark-theme h3 {
  color: var(--color-paper);
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: var(--gap);
  position: relative;
  padding-top: 1rem;
}

h2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background-color: var(--color-brand);
  border-radius: 2px;
}

.dark-theme h2::before {
  background-color: var(--color-accent);
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1.5rem;
  max-width: 70ch;
}

.highlight {
  color: var(--color-brand);
  font-weight: 600;
}

.dark-theme .highlight {
  color: var(--color-accent);
}

/* === Layout Containers === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding: var(--section-y) 0;
  position: relative;
}

.section-dark {
  background-color: var(--color-dark-bg);
  color: var(--color-paper);
}

.section-light {
  background-color: var(--color-paper);
  color: var(--color-text-body);
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(252, 252, 253, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text-body);
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-menu {
  display: flex;
  gap: 2rem;
}

.nav-link {
  font-weight: 500;
  color: var(--color-text-body);
  transition: color 0.2s;
}

.nav-link:hover, .nav-link[aria-current="page"] {
  color: var(--color-brand);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-brand);
  color: var(--color-paper);
  border: none;
}

.btn-primary:hover {
  background-color: #3f10c4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(82, 20, 235, 0.3);
}

.btn-accent {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  border: none;
}

.btn-accent:hover {
  background-color: #5bdcc0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(110, 237, 210, 0.3);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--color-text-body);
  color: var(--color-text-body);
}

.btn-outline:hover {
  background-color: rgba(25, 21, 35, 0.05);
}

/* === Cards (Hard Shadow Style) === */
.card {
  background-color: var(--color-paper);
  border: 2px solid var(--color-text-body);
  border-radius: var(--radius-card);
  box-shadow: 4px 4px 0 var(--color-text-body);
  padding: 1.5rem;
  transition: transform 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--color-text-body);
}

.dark-theme .card {
  background-color: #1e1633;
  border-color: var(--color-paper);
  box-shadow: 4px 4px 0 var(--color-paper);
  color: var(--color-paper);
}

.dark-theme .card:hover {
  box-shadow: 6px 6px 0 var(--color-paper);
}

/* === Grid Systems === */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

/* === Features / Definition List === */
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-item {
  border-left: 4px solid var(--color-brand);
  padding-left: 1rem;
}

.dark-theme .feature-item {
  border-left-color: var(--color-accent);
}

.feature-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* === FAQ (Details/Summary) === */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

details {
  background-color: var(--color-paper);
  border: 2px solid var(--color-text-body);
  border-radius: var(--radius-card);
  padding: 1rem;
  transition: all 0.3s ease;
}

.dark-theme details {
  background-color: #1e1633;
  border-color: var(--color-paper);
}

summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 300;
  transition: transform 0.3s;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  margin-top: 1rem;
  margin-bottom: 0;
  color: var(--color-text-body);
  opacity: 0.9;
}

.dark-theme details p {
  color: var(--color-paper);
}

/* === Table === */
.table-container {
  overflow-x: auto;
  border: 2px solid var(--color-text-body);
  border-radius: var(--radius-card);
  box-shadow: 4px 4px 0 var(--color-text-body);
}

.dark-theme .table-container {
  border-color: var(--color-paper);
  box-shadow: 4px 4px 0 var(--color-paper);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-paper);
}

.dark-theme table {
  background-color: #1e1633;
  color: var(--color-paper);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.dark-theme th, .dark-theme td {
  border-bottom-color: rgba(255,255,255,0.1);
}

th {
  background-color: rgba(82, 20, 235, 0.05);
  font-weight: 700;
}

.dark-theme th {
  background-color: rgba(110, 237, 210, 0.1);
  color: var(--color-accent);
}

/* === News Cards === */
.news-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.news-date {
  font-size: 0.85rem;
  color: var(--color-brand);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.dark-theme .news-date {
  color: var(--color-accent);
}

/* === Steps (Horizontal on desktop) === */
.steps-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  counter-reset: step-counter;
}

.step-item {
  flex: 1 1 250px;
  position: relative;
  padding-left: 4rem;
  min-height: 150px;
}

.step-number {
  position: absolute;
  left: 0;
  top: 0;
  width: 3rem;
  height: 3rem;
  background-color: var(--color-brand);
  color: var(--color-paper);
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.dark-theme .step-number {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

/* === Footer === */
.site-footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper);
  padding: 4rem 0 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: var(--color-paper);
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.footer-links li {
  margin-bottom: 0.8rem;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
}

/* === SVG Animations === */
svg {
  overflow: visible;
}

.flow-dot {
  fill: var(--color-accent);
  animation: flowDash 3s linear infinite;
}

.flow-line {
  stroke: var(--color-accent);
  stroke-width: 2;
  fill: none;
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s ease-in-out infinite alternate;
}

.pulse-circle {
  fill: var(--color-brand);
  animation: pulseOpacity 2s ease-in-out infinite;
}

.bubble-float {
  animation: floatY 4s ease-in-out infinite;
}

@keyframes flowDash {
  to { stroke-dashoffset: -20; }
}

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0.8; }
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Transform origin for SVG sub-elements */
svg [class*="anim-"] {
  transform-box: fill-box;
  transform-origin: center;
}

/* === Responsive Adjustments === */
@media (max-width: 768px) {
  .nav-menu {
    display: none; /* Simplified for mobile, ideally a hamburger menu */
  }
  
  h1 {
    font-size: 2.5rem;
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .steps-container {
    flex-direction: column;
  }
  
  .step-item {
    padding-left: 0;
    padding-top: 4rem;
    min-height: auto;
  }
  
  .step-number {
    top: 0;
    left: 0;
  }
}

@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;
  }
}
