:root {
  --bg: #06070b;
  --panel: #0c1018;
  --panel-2: #101522;
  --text: #edf1ff;
  --muted: #97a1bb;
  --primary: #7a84ff;
  --primary-2: #989fff;
  --line: rgba(160, 176, 214, 0.18);
  --radius: 16px;
}

html[data-theme="light"] {
  --bg: #dfe4f0;
  --panel: #edf1fa;
  --panel-2: #e2e8f5;
  --text: #111624;
  --muted: #3f4963;
  --primary: #4e63da;
  --primary-2: #5b73ef;
  --line: rgba(58, 74, 126, 0.32);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% -10%, rgba(122, 132, 255, 0.14), transparent 34%),
    radial-gradient(circle at 84% -18%, rgba(122, 132, 255, 0.1), transparent 34%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  letter-spacing: -0.01em;
  text-rendering: optimizeLegibility;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  z-index: -1;
}

.bg-grid::before,
.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-grid::before {
  opacity: 0.045;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(220, 227, 255, 0.3) 1px, transparent 0);
  background-size: 3px 3px;
}

.bg-grid::after {
  opacity: 0.38;
  background:
    radial-gradient(circle at 74% 18%, rgba(136, 148, 224, 0.13), transparent 38%),
    radial-gradient(circle at 22% 74%, rgba(128, 139, 210, 0.08), transparent 36%);
}

html[data-theme="light"] .bg-grid::before {
  opacity: 0.035;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(68, 82, 132, 0.24) 1px, transparent 0);
}

html[data-theme="light"] .bg-grid::after {
  opacity: 0.32;
  background:
    radial-gradient(circle at 74% 18%, rgba(93, 112, 202, 0.12), transparent 38%),
    radial-gradient(circle at 22% 74%, rgba(106, 122, 194, 0.07), transparent 36%);
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(12px);
  background: rgba(6, 7, 11, 0.72);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}

html[data-theme="light"] .site-header {
  background: rgba(223, 228, 240, 0.86);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.logo {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-content: center;
  border: 1px solid var(--line);
  background: rgba(122, 132, 255, 0.12);
  color: var(--text);
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 1.3rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.22s ease;
  position: relative;
  font-size: 0.95rem;
}

.nav a:hover {
  color: var(--text);
}

.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.theme-toggle {
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 30;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: rgba(122, 132, 255, 0.14);
  border-color: rgba(152, 159, 255, 0.45);
}

.theme-toggle-icon {
  font-size: 0.98rem;
  line-height: 1;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
}

.lang-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 0.35rem 0.55rem;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.is-active {
  color: var(--text);
  background: rgba(122, 132, 255, 0.2);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  padding: 4.4rem 0 3rem;
}

.eyebrow {
  color: var(--muted);
  letter-spacing: 0.18em;
  font-weight: 600;
  margin: 0 0 1rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.62rem;
  background: rgba(255, 255, 255, 0.015);
}

.hero-slogan {
  margin: 0.15rem 0 1.1rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c6cdf0;
}

.hero-title {
  margin-bottom: 0.8rem;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.98;
  letter-spacing: 0.08em;
  max-width: none;
}

.system-block {
  margin: 0 0 1.2rem;
  font-family: "JetBrains Mono", "Consolas", "Courier New", monospace;
}

.system-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
  opacity: 1;
  transform: translateY(0);
}

.system-block.boot-animate p {
  opacity: 0;
  transform: translateY(6px);
  animation: systemBootLineIn 0.38s ease-out forwards;
}

.system-block.boot-animate p:nth-child(1) { animation-delay: 0.12s; }
.system-block.boot-animate p:nth-child(2) { animation-delay: 0.34s; }
.system-block.boot-animate p:nth-child(3) { animation-delay: 0.61s; }
.system-block.boot-animate p:nth-child(4) { animation-delay: 0.9s; }

.system-block p:nth-child(4) {
  color: color-mix(in srgb, var(--text) 88%, var(--muted) 12%);
}

.cursor {
  display: inline-block;
  width: 6px;
  height: 1em;
  background: #aaa;
  margin-left: 4px;
  vertical-align: -0.08em;
  animation: blink 1s infinite;
}

html[data-theme="light"] .cursor {
  background: #5d6888;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.35rem);
  letter-spacing: -0.03em;
  line-height: 1.03;
  font-weight: 650;
  max-width: 18ch;
}

h2 {
  font-size: clamp(1.55rem, 4vw, 2.4rem);
  letter-spacing: -0.022em;
}

.lead {
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 10px;
  padding: 0.78rem 1.15rem;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  color: var(--text);
  border-color: rgba(152, 159, 255, 0.32);
  background: rgba(122, 132, 255, 0.14);
  box-shadow: 0 10px 24px rgba(8, 10, 22, 0.48);
}

html[data-theme="light"] .btn-primary {
  color: #1a2445;
  border-color: rgba(78, 99, 218, 0.38);
  background: rgba(91, 115, 239, 0.22);
  box-shadow: 0 10px 24px rgba(49, 64, 126, 0.2);
}

html[data-theme="light"] .btn-primary:hover {
  color: #131c38;
  background: rgba(91, 115, 239, 0.3);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.hero-visual {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  perspective: 900px;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  transition: transform 0.25s ease-out;
  will-change: transform;
}

.orb-1 {
  width: 230px;
  height: 230px;
  background: rgba(122, 132, 255, 0.26);
  top: 10%;
  left: 4%;
  animation: floatY 7s ease-in-out infinite;
}

.orb-2 {
  width: 170px;
  height: 170px;
  background: rgba(152, 159, 255, 0.2);
  right: 8%;
  bottom: 6%;
  animation: floatY 7s ease-in-out infinite reverse;
}

.panel {
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease-out;
  will-change: transform;
  animation: floatY 7s ease-in-out infinite;
}

.system-panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #67708a;
}

.panel-head span:nth-child(2) {
  background: #586280;
}

.panel-head span:nth-child(3) {
  background: #4d5873;
}

.system-diagram {
  padding: 14px 14px 18px;
}

.system-diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

.sys-lines path {
  fill: none;
  stroke: rgba(142, 154, 231, 0.3);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation:
    flow 2.6s ease forwards,
    dataFlow 6s linear infinite 2.7s;
}

.sys-nodes rect {
  fill: rgba(112, 124, 206, 0.16);
  stroke: url(#nodeStroke);
  stroke-width: 1.1;
  animation: nodePulse 6s ease-in-out infinite;
}

.sys-nodes rect:nth-child(2),
.sys-nodes rect:nth-child(5),
.sys-nodes rect:nth-child(8) {
  fill: rgba(142, 154, 231, 0.22);
}

.sys-nodes rect:nth-child(1) { animation-delay: 0s; }
.sys-nodes rect:nth-child(2) { animation-delay: 0s; }
.sys-nodes rect:nth-child(3) { animation-delay: 0s; }
.sys-nodes rect:nth-child(4) { animation-delay: 0s; }
.sys-nodes rect:nth-child(5) { animation-delay: 0s; }
.sys-nodes rect:nth-child(6) { animation-delay: 0s; }
.sys-nodes rect:nth-child(7) { animation-delay: 0s; }
.sys-nodes rect:nth-child(8) { animation-delay: 0s; }
.sys-nodes rect:nth-child(9) { animation-delay: 0s; }

.card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(122, 132, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.card-icon svg {
  width: 18px;
  height: 18px;
}

.card-icon path,
.card-icon circle,
.card-icon rect {
  stroke: #cbd2f9;
  stroke-width: 1.55;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stats {
  margin: 1rem auto 2rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats article,
.card,
.project,
.about ul {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 21, 34, 0.8), rgba(12, 16, 24, 0.8));
}

html[data-theme="light"] .stats article,
html[data-theme="light"] .card,
html[data-theme="light"] .project,
html[data-theme="light"] .about ul,
html[data-theme="light"] .panel {
  background: linear-gradient(180deg, rgba(246, 249, 255, 0.88), rgba(232, 238, 249, 0.9));
}

html[data-theme="light"] .panel {
  border-color: rgba(58, 74, 126, 0.38);
  box-shadow: 0 18px 36px rgba(54, 71, 128, 0.18);
}

html[data-theme="light"] .panel-head {
  border-bottom-color: rgba(58, 74, 126, 0.32);
}

html[data-theme="light"] .sys-lines path {
  stroke: rgba(73, 90, 164, 0.62);
}

html[data-theme="light"] .sys-nodes rect {
  fill: rgba(96, 116, 200, 0.2);
  stroke: rgba(67, 86, 172, 0.86);
}

html[data-theme="light"] .sys-nodes rect:nth-child(2),
html[data-theme="light"] .sys-nodes rect:nth-child(5),
html[data-theme="light"] .sys-nodes rect:nth-child(8) {
  fill: rgba(82, 104, 197, 0.28);
}

html[data-theme="light"] .stats p,
html[data-theme="light"] .card p,
html[data-theme="light"] .project p,
html[data-theme="light"] .about p,
html[data-theme="light"] .footer p,
html[data-theme="light"] .footer-legal a {
  color: #323b54;
}

html[data-theme="light"] .project-tag {
  color: #1f2a4e;
  border-color: rgba(78, 99, 218, 0.34);
  background: rgba(91, 115, 239, 0.16);
}

html[data-theme="light"] .eyebrow {
  color: #445172;
  background: rgba(255, 255, 255, 0.55);
}

html[data-theme="light"] .hero-slogan {
  color: #3a4566;
}

.stats article {
  padding: 1.1rem;
}

.stats h3 {
  font-size: 1.65rem;
  margin-bottom: 0.2rem;
}

.stats p {
  margin: 0;
  color: var(--muted);
}

.section {
  padding: 3.4rem 0;
}

.section-head {
  margin-bottom: 1.3rem;
}

.cards,
.showcase {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.project {
  padding: 1.3rem;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.card:hover,
.project:hover {
  transform: translateY(-4px);
  border-color: rgba(122, 132, 255, 0.38);
  box-shadow: 0 18px 34px rgba(4, 8, 24, 0.5);
}

.card:hover .card-icon {
  border-color: rgba(152, 159, 255, 0.4);
  background: rgba(122, 132, 255, 0.14);
}

.card p,
.project p,
.about p {
  margin: 0;
  color: var(--muted);
}

.project-tag {
  display: inline-flex;
  border-radius: 999px;
  font-size: 0.76rem;
  color: #d9def8;
  border: 1px solid rgba(152, 159, 255, 0.25);
  background: rgba(122, 132, 255, 0.14);
  padding: 0.28rem 0.62rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.about {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 1rem;
  align-items: start;
}

.about ul {
  list-style: none;
  margin: 0;
  padding: 1.2rem;
}

.about li + li {
  margin-top: 0.7rem;
}

.footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
  margin-top: 2.5rem;
}

html[data-theme="light"] .footer {
  background: rgba(255, 255, 255, 0.45);
}

.footer-wrap {
  padding: 2.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-wrap > .btn {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.footer h3 {
  margin-bottom: 0.35rem;
}

.footer p {
  margin: 0;
  color: var(--muted);
}

.footer-legal {
  margin-top: 0.7rem;
  font-size: 0.86rem;
}

.footer-legal a {
  color: #b4bcdf;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.footer-legal a:hover {
  color: #d4dcff;
  border-bottom-color: rgba(212, 220, 255, 0.5);
}

.reveal {
  opacity: 0;
  transform: translateY(17px);
  transition: opacity 0.62s ease, transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 {
  transition-delay: 0.08s;
}

.reveal-delay-2 {
  transition-delay: 0.16s;
}

.reveal-delay-3 {
  transition-delay: 0.24s;
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8.5px);
  }
}

@keyframes nodePulse {
  0%,
  100% {
    opacity: 0.68;
  }
  50% {
    opacity: 0.94;
  }
}

@keyframes flow {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes dataFlow {
  0% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: -400;
  }
}

@keyframes systemBootLineIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal.is-visible,
  .system-block p,
  .card,
  .project,
  .panel,
  .orb {
    transition: none;
    animation: none;
    transform: none;
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .hero,
  .about {
    grid-template-columns: 1fr;
  }

  .cards,
  .showcase,
  .stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .nav {
    display: none;
    position: absolute;
    right: 4vw;
    top: 58px;
    background: #0f1326;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.7rem;
    flex-direction: column;
    min-width: 160px;
  }

  .nav.open {
    display: flex;
  }

  .menu-btn {
    display: inline-block;
  }

  .lang-switch {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 0.45rem;
  }

  .cards,
  .showcase,
  .stats {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 3.4rem;
  }

  .theme-toggle {
    top: 10px;
    left: 10px;
  }

  .footer-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-wrap > .btn {
    width: 100%;
  }
}
