:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #0f0f0f;
  --text-muted: #52525b;
  --border: #e4e4e7;
  --accent: #18181b;
  --accent-hover: #27272a;
  --focus-ring: rgba(24, 24, 27, 0.15);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-base: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  --space-xxl: 8rem;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
  letter-spacing: -0.025em;
  color: var(--text);
}

h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.8rem); margin-bottom: var(--space-md); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: var(--space-sm); }

p {
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

section {
  padding: var(--space-xl) 0;
}

/* Header & Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-link img {
  width: 110px;
  height: 32px;
  object-fit: contain;
}

.main-nav ul {
  display: flex;
  gap: var(--space-md);
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s ease;
}

.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--accent);
}

.main-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  border: none;
  text-align: center;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #f4f4f5;
}

/* Grid & Layout Utilities */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-md); }
.flex-col { display: flex; flex-direction: column; }
.text-center { text-align: center; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transform: translateY(-2px);
}

.card-icon {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-sm);
  stroke: var(--text);
  stroke-width: 1.5;
  fill: none;
}

.card-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-family: var(--font-mono);
}

/* Table */
.data-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th, .table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: #f4f4f5;
  font-weight: 600;
  color: var(--text);
}

.table tr:last-child td {
  border-bottom: none;
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item summary {
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  position: relative;
  padding-right: 32px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 20px;
  font-weight: 300;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  padding-bottom: 20px;
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0 var(--space-md);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer-brand img {
  width: 90px;
  height: 28px;
  object-fit: contain;
  margin-bottom: var(--space-sm);
}

.footer-links h4 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
}

.footer-links ul li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text);
  font-size: 0.95rem;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* SVG Animations */
.grid-node {
  fill: var(--border);
  transition: fill 0.3s ease, transform 0.3s ease;
}

.animate-grid .grid-node {
  animation: nodeLightUp 8s infinite alternate ease-in-out;
}

.node-delay-1 { animation-delay: 0s; }
.node-delay-2 { animation-delay: 0.8s; }
.node-delay-3 { animation-delay: 1.6s; }
.node-delay-4 { animation-delay: 2.4s; }
.node-delay-5 { animation-delay: 3.2s; }
.node-delay-6 { animation-delay: 4.0s; }
.node-delay-7 { animation-delay: 4.8s; }
.node-delay-8 { animation-delay: 5.6s; }

@keyframes nodeLightUp {
  0%, 100% { fill: var(--border); transform: scale(1); }
  50% { fill: var(--accent); transform: scale(1.15); }
}

.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.animate-draw .draw-path {
  animation: drawStroke 6s infinite alternate ease-in-out;
}

@keyframes drawStroke {
  0% { stroke-dashoffset: 1; }
  50%, 80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}

.flow-line {
  stroke: var(--text-muted);
  stroke-width: 1.5;
  fill: none;
  pathLength: 1;
  stroke-dasharray: 1;
}

.animate-flow .flow-line {
  animation: drawFlow 4s infinite alternate ease-in-out;
}

@keyframes drawFlow {
  0% { stroke-dashoffset: 1; }
  50%, 70% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 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;
  }
  .animate-grid .grid-node, .animate-draw .draw-path, .animate-flow .flow-line {
    animation: none;
    fill: var(--text);
    stroke-dashoffset: 0;
  }
}

/* Utility for hiding visually but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
