:root {
  color-scheme: dark;
  --bg: #06101c;
  --bg-strong: #020711;
  --surface: rgba(10, 20, 35, 0.82);
  --surface-strong: rgba(13, 25, 43, 0.96);
  --text: #f4f8ff;
  --muted: #9fb0c9;
  --soft: #d7e3f6;
  --border: rgba(137, 162, 205, 0.22);
  --accent: #3b82f6;
  --accent-strong: #7c3aed;
  --accent-2: #2dd4bf;
  --ok: #65d89f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --shell: min(1120px, calc(100% - 40px));
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8fc;
  --bg-strong: #e8f0fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --text: #0c1625;
  --muted: #526179;
  --soft: #1c2a3d;
  --border: rgba(33, 58, 92, 0.16);
  --shadow: 0 22px 70px rgba(27, 47, 75, 0.14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 74% 15%, rgba(59, 130, 246, 0.24), transparent 30rem),
    radial-gradient(circle at 18% 25%, rgba(45, 212, 191, 0.13), transparent 22rem),
    linear-gradient(180deg, var(--bg-strong), var(--bg) 42%, var(--bg-strong));
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(135, 164, 214, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 164, 214, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 78%);
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-strong) 84%, transparent);
  backdrop-filter: blur(20px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 76px;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.26rem;
  line-height: 1;
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vw, 34px);
}

.site-nav a {
  color: var(--soft);
  font-size: 0.94rem;
  font-weight: 650;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle,
.icon-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
}

.no-js .theme-toggle {
  display: none;
}

.theme-toggle {
  position: relative;
}

.theme-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 160ms ease, transform 160ms ease;
}

.theme-icon-moon {
  opacity: 0;
  transform: scale(0.72);
}

:root[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: scale(0.72);
}

:root[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: scale(1);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 10px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.96rem;
  font-weight: 760;
  line-height: 1.15;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 15px 36px rgba(59, 130, 246, 0.28);
}

.button-secondary,
.button-ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-small {
  min-height: 42px;
  padding-inline: 15px;
}

.button-small svg {
  width: 18px;
  height: 18px;
}

.section {
  position: relative;
  padding: clamp(72px, 10vw, 118px) 0;
}

.section-soft {
  border-block: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 54%, transparent);
}

.grid-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.grid-backdrop::before {
  position: absolute;
  right: 8%;
  bottom: 4%;
  width: min(520px, 65vw);
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.22), transparent 62%);
  box-shadow: 0 0 80px rgba(59, 130, 246, 0.16);
}

.hero {
  min-height: calc(100svh - 76px);
  display: grid;
  align-items: center;
  padding-top: clamp(62px, 9vw, 96px);
  padding-bottom: clamp(62px, 8vw, 88px);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  align-items: center;
  gap: clamp(36px, 6vw, 82px);
}

.hero-copy {
  max-width: 690px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(4rem, 12vw, 7.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.06;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.22;
}

.hero-subtitle {
  max-width: 680px;
  margin-bottom: 18px;
  color: var(--soft);
  font-size: clamp(1.35rem, 3vw, 2.05rem);
  line-height: 1.28;
}

.hero-description,
.lead,
.copy-block p {
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-description {
  max-width: 650px;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}

.tag-list,
.stack-grid,
.feature-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-list li,
.stack-grid li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--soft);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.tag-list li {
  padding: 8px 11px;
}

.hero-visual {
  position: relative;
  min-height: 520px;
}

.orbit {
  position: absolute;
  inset: 48px 18px auto auto;
  width: 390px;
  aspect-ratio: 1;
  border: 1px solid rgba(124, 58, 237, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 68% 22%, rgba(45, 212, 191, 0.2), transparent 6px),
    radial-gradient(circle, transparent 58%, rgba(59, 130, 246, 0.12) 59%, transparent 60%);
  opacity: 0.88;
}

.terminal-panel,
.code-panel,
.signal-panel,
.principle-card,
.link-grid a {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 94%, transparent), color-mix(in srgb, var(--surface) 92%, transparent));
  box-shadow: var(--shadow);
}

.terminal-panel {
  position: absolute;
  width: min(460px, 94%);
  overflow: hidden;
}

.panel-primary {
  top: 24px;
  right: 24px;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.terminal-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-bar span:nth-child(1) {
  background: #ff6b6b;
}

.terminal-bar span:nth-child(2) {
  background: #ffd166;
}

.terminal-bar span:nth-child(3) {
  background: #65d89f;
}

.terminal-bar strong {
  margin-left: auto;
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 750;
}

pre {
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: var(--soft);
  font: 700 0.95rem/1.7 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.code-panel {
  position: absolute;
  right: 108px;
  bottom: 54px;
  width: min(360px, 82%);
  padding: 22px 22px 22px 16px;
}

.code-panel ol {
  display: grid;
  gap: 8px;
  padding-left: 34px;
  margin: 0;
  color: var(--muted);
  font: 700 0.86rem/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.code-panel li::marker {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.code-panel span {
  color: var(--accent-2);
}

.signal-panel {
  position: absolute;
  right: 0;
  top: 226px;
  width: 245px;
  padding: 18px;
}

.signal-panel svg {
  width: 100%;
}

.signal-grid {
  stroke: color-mix(in srgb, var(--border) 70%, transparent);
  stroke-width: 1;
}

.signal-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.signal-panel circle {
  fill: var(--bg);
  stroke: var(--accent-strong);
  stroke-width: 4;
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 7vw, 96px);
  align-items: start;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-label::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  box-shadow: 0 0 22px currentColor;
}

.copy-block {
  max-width: 690px;
}

.copy-block p:last-child {
  margin-bottom: 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: clamp(28px, 5vw, 48px);
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  gap: clamp(24px, 5vw, 58px);
  align-items: center;
  padding: 0;
}

.lead {
  max-width: 610px;
  margin-bottom: 24px;
}

.feature-list {
  display: grid;
  gap: 13px;
  margin-bottom: 30px;
  color: var(--soft);
}

.feature-list li {
  position: relative;
  padding-left: 30px;
}

.feature-list li::before {
  position: absolute;
  top: 0.42em;
  left: 0;
  width: 16px;
  height: 16px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 80%, transparent);
  border-radius: 50%;
  content: "";
  background:
    linear-gradient(45deg, transparent 45%, var(--accent-2) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 51%, var(--accent-2) 52% 61%, transparent 62%);
}

.project-visual {
  position: relative;
  min-height: 270px;
}

.project-visual .terminal-panel {
  inset: 0;
  width: 100%;
}

.project-visual pre {
  color: color-mix(in srgb, var(--ok) 82%, var(--soft));
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.stack-grid li {
  display: grid;
  min-height: 54px;
  place-items: center;
  padding: 12px;
  text-align: center;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.principle-card {
  padding: 24px;
}

.card-icon {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: var(--radius);
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.card-icon svg {
  width: 25px;
  height: 25px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.principle-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.link-grid a {
  display: grid;
  gap: 8px;
  min-height: 122px;
  padding: 20px;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}

.link-grid a:hover {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  transform: translateY(-3px);
}

.link-grid span {
  font-size: 1rem;
  font-weight: 820;
}

.link-grid small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-strong);
}

.footer-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 116px;
  padding-block: 24px;
}

.footer-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.back-top {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
}

.back-top svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 940px) {
  .header-inner {
    grid-template-columns: auto auto 1fr;
  }

  .nav-toggle {
    display: inline-grid;
    grid-column: 2;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px var(--page-pad, 20px);
    border-bottom: 1px solid var(--border);
    background: var(--bg-strong);
  }

  .site-nav a {
    padding: 14px calc((100vw - var(--shell)) / 2);
  }

  .js .site-header.is-open .site-nav,
  .no-js .site-nav {
    display: flex;
  }

  .no-js .nav-toggle {
    display: none;
  }

  .header-actions {
    justify-self: end;
  }

  .hero-grid,
  .split,
  .project-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 470px;
  }

  .panel-primary {
    right: auto;
    left: 0;
  }

  .signal-panel {
    right: 0;
  }

  .code-panel {
    right: 7%;
  }

  .stack-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .principle-grid,
  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --shell: min(100% - 28px, 1120px);
  }

  .header-inner {
    min-height: 66px;
    gap: 10px;
  }

  .brand span {
    font-size: 1.08rem;
  }

  .button-small {
    width: 42px;
    padding: 0;
  }

  .button-small svg {
    margin: 0;
  }

  .button-small {
    font-size: 0;
  }

  .hero-actions .button {
    width: 100%;
  }

  h1 {
    font-size: clamp(3.6rem, 18vw, 5.1rem);
  }

  h2 {
    font-size: clamp(1.8rem, 10vw, 2.55rem);
  }

  .hero-visual {
    min-height: 410px;
  }

  .orbit {
    width: 300px;
    right: 0;
  }

  .terminal-panel {
    width: 100%;
  }

  .signal-panel {
    top: 206px;
    width: 170px;
  }

  .code-panel {
    right: 0;
    bottom: 0;
    width: 88%;
  }

  .project-layout {
    padding: 20px;
  }

  .stack-grid,
  .principle-grid,
  .link-grid,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    justify-items: start;
  }

  .back-top {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
