:root {
  --bg-base: #F5F5F4;
  --bg-card: #FFFFFF;
  --ink-primary: #18181B;
  --ink-secondary: #52525B;
  --ink-tertiary: #A1A1AA;
  --accent: #0F172A;
  --accent-subtle: #E2E8F0;
  --border: #E4E4E7;
  --radius-sm: 6px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --font-display: "Inter", var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--ink-primary);
  line-height: 1.7;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-stretch: 85%; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 1rem; }
h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 600; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 600; }
p { margin-bottom: 1.5rem; color: var(--ink-secondary); }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 1180px; margin-inline: auto; padding: 0 24px; }
section { padding: clamp(3rem, 8vh, 6rem) 0; border-bottom: 1px solid var(--border); }
section:last-child { border-bottom: none; }
.grid-split { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 64px; align-items: center; }
.grid-full { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.875rem 2rem; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 1rem; cursor: pointer; text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--ink-primary); }
.btn-secondary:hover { background: var(--bg-card); }

.card {
  background: var(--bg-card); padding: 2rem; border-radius: var(--radius-md);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg-base); font-weight: 600; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-secondary); }
td { background: var(--bg-card); }

details { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
summary { padding: 1rem 1.5rem; 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.25rem; color: var(--ink-tertiary); transition: transform 0.2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding: 0 1.5rem 1.5rem; margin-bottom: 0; }

header { position: sticky; top: 0; z-index: 100; background: rgba(245, 245, 244, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo-img { height: 32px; width: auto; vertical-align: middle; }
.brand-name { font-weight: 700; font-stretch: 90%; margin-left: 0.75rem; font-size: 1.125rem; vertical-align: middle; }
nav ul { display: flex; gap: 24px; list-style: none; }
nav a { text-decoration: none; color: var(--ink-secondary); font-weight: 500; padding: 0.5rem 0; position: relative; }
nav a:hover, nav a[aria-current="page"] { color: var(--ink-primary); }
nav a[aria-current="page"]::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--accent); }

footer { background: var(--ink-primary); color: #A1A1AA; padding: 48px 0; font-size: 0.875rem; }
footer .wrap { display: flex; flex-direction: column; gap: 24px; align-items: center; text-align: center; }
footer a { color: #E4E4E7; }

.svg-canvas { width: 100%; height: auto; max-width: 100%; display: block; }
.grid-node { transition: fill 0.4s ease, opacity 0.4s ease; }
@keyframes nodePulse {
  0%, 100% { fill: var(--border); opacity: 0.4; }
  50% { fill: var(--accent); opacity: 1; }
}
.n-1 { animation: nodePulse 6s infinite 0s; }
.n-2 { animation: nodePulse 6s infinite 0.5s; }
.n-3 { animation: nodePulse 6s infinite 1s; }
.n-4 { animation: nodePulse 6s infinite 1.5s; }
.n-5 { animation: nodePulse 6s infinite 2s; }

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.draw-line { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawLine 2s ease-in-out forwards; }

@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; }
  .grid-node { opacity: 0.8 !important; fill: var(--accent) !important; }
  .draw-line { stroke-dashoffset: 0 !important; }
}

@media (max-width: 768px) {
  .grid-split { grid-template-columns: 1fr; gap: 32px; }
  nav ul { gap: 16px; }
  .btn { width: 100%; }
}
