:root {
  color-scheme: dark;
  --bg: #07111f;
  --fg: #f3f8ff;
  --muted: #b3c4d4;
  --soft: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.18);
  --panel: rgba(7, 15, 28, 0.58);
  --panel-strong: rgba(9, 19, 35, 0.74);
  --lime: #8fd6ff;
  --mint: #a7ffe5;
  --blue: #8fb7ff;
  --amber: #ffc857;
  --danger: #ff5c7a;
  --shadow: 0 28px 90px rgba(45, 88, 127, 0.24);
}

body.light {
  color-scheme: light;
  --bg: #dbefff;
  --fg: #101724;
  --muted: #516174;
  --soft: rgba(255, 255, 255, 0.22);
  --line: rgba(255, 255, 255, 0.42);
  --panel: rgba(255, 255, 255, 0.54);
  --panel-strong: rgba(255, 255, 255, 0.72);
  --lime: #1d8cff;
  --mint: #13b7a4;
  --blue: #4777ff;
  --shadow: 0 28px 90px rgba(45, 88, 127, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

.anime-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #07111f;
  pointer-events: none;
}

.anime-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: brightness(0.86) saturate(0.98) contrast(1.03);
  transform: scale(1.02);
}

.anime-bg::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(2, 6, 14, 0.16), rgba(2, 7, 16, 0.3) 56%, rgba(1, 4, 10, 0.64)),
    radial-gradient(circle at 50% 10%, transparent 0 32%, rgba(2, 7, 15, 0.14) 74%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 18% 18%, rgba(143, 214, 255, 0.16), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(255, 220, 160, 0.1), transparent 30%);
  background-size: 56px 56px, 56px 56px, auto, auto;
  opacity: 0.46;
  animation: ambientShift 14s ease-in-out infinite alternate;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 10%, transparent 0 28%, rgba(2, 7, 15, 0.24) 70%),
    linear-gradient(180deg, rgba(3, 8, 16, 0.12) 0, rgba(3, 8, 16, 0.34) 62%, rgba(1, 3, 8, 0.64) 100%);
}

#dotField,
#pixelTrail {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#pixelTrail {
  z-index: 3;
  mix-blend-mode: screen;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 16px;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  width: min(1180px, calc(100% - 40px));
  margin: 16px auto 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 18px 50px rgba(0, 10, 24, 0.28);
  backdrop-filter: blur(22px) saturate(145%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(143, 214, 255, 0.82));
  color: #10233a;
  font-size: 13px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 14px;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.nav {
  display: inline-flex;
  justify-self: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.nav a,
.theme-button,
.button,
.filter,
.lab-item,
.post-link {
  touch-action: manipulation;
}

.nav a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.nav a:hover {
  background: var(--soft);
  color: var(--fg);
}

.theme-button {
  justify-self: end;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.theme-button span {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fg) 0 50%, transparent 50%);
  box-shadow: inset -2px 0 0 var(--fg);
}

main {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  min-height: 58vh;
  padding: 72px 0 40px;
}

.hero--compact {
  min-height: 52vh;
  padding-bottom: 24px;
}

.kicker {
  margin: 0 0 14px;
  color: color-mix(in srgb, var(--blue) 80%, var(--fg));
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.split-title {
  display: grid;
  gap: 4px;
  margin: 0 0 24px;
  font-size: clamp(48px, 8vw, 112px);
  line-height: 0.9;
  letter-spacing: 0;
}

.split-title span {
  display: block;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  animation: titleIn 900ms cubic-bezier(0.2, 0.84, 0.2, 1) forwards;
}

.split-title span:nth-child(2) {
  animation-delay: 120ms;
}

.hero-text {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 800;
}

.button.primary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(145, 213, 255, 0.92));
  color: #10233a;
  box-shadow: 0 18px 42px rgba(71, 119, 255, 0.22);
}

.button.ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
}

.motion-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 42%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(145%);
}

.motion-panel::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(120deg, transparent 0 38%, rgba(255, 255, 255, 0.16), transparent 52%);
  transform: translateX(-120%);
  animation: glare 5.8s ease-in-out infinite;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}

.metric {
  min-height: 150px;
  padding: 24px;
  background: color-mix(in srgb, var(--panel-strong) 94%, transparent);
}

.metric.wide {
  grid-column: 1 / -1;
}

.metric span {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: clamp(30px, 6vw, 64px);
  line-height: 1;
}

.metric.wide strong {
  color: color-mix(in srgb, var(--blue) 70%, var(--fg));
  font-size: clamp(22px, 3vw, 34px);
}

.wave-lines {
  display: grid;
  gap: 9px;
  padding: 24px;
}

.wave-lines span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92), #8fd6ff, transparent);
  transform-origin: left center;
  animation: lineWave 2.6s ease-in-out infinite;
}

.wave-lines span:nth-child(2) {
  animation-delay: 120ms;
}

.wave-lines span:nth-child(3) {
  animation-delay: 240ms;
}

.wave-lines span:nth-child(4) {
  animation-delay: 360ms;
}

.wave-lines span:nth-child(5) {
  animation-delay: 480ms;
}

.section-head {
  margin: 24px 0 22px;
}

.section-head h2,
.lab-section h2,
.about-section h2 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.05;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.filter {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.filter.active {
  background: rgba(255, 255, 255, 0.88);
  color: #10233a;
}

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

.post-card {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 360px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.3), transparent 46%),
    var(--panel);
  box-shadow: 0 18px 60px rgba(0, 10, 24, 0.3);
  transform-style: preserve-3d;
  transition:
    opacity 240ms ease,
    transform 240ms ease,
    border-color 240ms ease;
  backdrop-filter: blur(22px) saturate(145%);
}

.post-card:nth-child(1) {
  grid-column: span 2;
}

.post-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(500px circle at var(--card-x, 50%) var(--card-y, 50%), rgba(255, 255, 255, 0.36), transparent 42%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.post-card:hover::before {
  opacity: 1;
}

.post-card.hidden-soft {
  transform: scale(0.96);
  opacity: 0;
  pointer-events: none;
}

.post-card[hidden] {
  display: none !important;
}

.post-index {
  margin-bottom: auto;
  color: rgba(255, 255, 255, 0.48);
  font-size: 74px;
  font-weight: 900;
  line-height: 0.86;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 18px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.post-card h3 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.18;
}

.post-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.post-empty {
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 14, 28, 0.66);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.post-empty[hidden] {
  display: none;
}

.post-empty strong,
.post-empty span {
  display: block;
}

.post-empty span {
  margin-top: 8px;
  color: var(--muted);
}

.post-empty__link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--accent);
  font-weight: 800;
}

.post-link {
  position: relative;
  width: fit-content;
  margin-top: auto;
  color: color-mix(in srgb, var(--blue) 82%, var(--fg));
  font-weight: 800;
}

.post-link::after {
  display: inline-block;
  margin-left: 7px;
  content: "->";
  transition: transform 180ms ease;
}

.post-link:hover::after {
  transform: translateX(5px);
}

.category-section {
  margin-top: 76px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.section-head--inline {
  margin-bottom: 22px;
}

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

.category-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.22), transparent 48%),
    var(--panel);
  box-shadow: 0 18px 60px rgba(0, 10, 24, 0.24);
  backdrop-filter: blur(22px) saturate(145%);
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
}

.category-card:hover {
  border-color: rgba(143, 214, 255, 0.5);
  transform: translateY(-4px);
}

.category-card span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.category-card strong {
  font-size: 24px;
  line-height: 1.18;
}

.category-card small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.github-section {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 0.7fr);
  gap: 28px;
  align-items: center;
  margin-top: 72px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.github-section h2 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.05;
}

.github-section p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.github-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background:
    radial-gradient(circle at 12% 20%, rgba(143, 214, 255, 0.22), transparent 34%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.2), transparent 48%),
    var(--panel);
  box-shadow: 0 18px 60px rgba(0, 10, 24, 0.28);
  backdrop-filter: blur(22px) saturate(145%);
}

.github-card__mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #10233a;
  font-weight: 900;
}

.github-card strong,
.github-card small {
  display: block;
}

.github-card strong {
  color: var(--fg);
  font-size: 22px;
  line-height: 1.15;
}

.github-card small {
  color: var(--muted);
  font-size: 14px;
}

.github-card em {
  color: var(--blue);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.lab-section,
.about-section {
  display: grid;
  grid-template-columns: 0.78fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 96px;
  border-top: 1px solid var(--line);
  padding-top: 34px;
}

.lab-list {
  display: grid;
  gap: 10px;
}

.lab-item {
  display: grid;
  grid-template-columns: 0.45fr 1fr;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  background: var(--panel);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(22px) saturate(145%);
}

.lab-item.active {
  border-color: color-mix(in srgb, var(--lime) 50%, var(--line));
  background: color-mix(in srgb, var(--lime) 10%, var(--panel));
}

.lab-item span {
  font-weight: 900;
}

.lab-item small,
.about-section p {
  color: var(--muted);
  font-size: 16px;
}

.about-section {
  margin-bottom: 64px;
}

.about-section .kicker {
  grid-column: 1 / -1;
  margin-bottom: -22px;
}

.about-section p {
  margin: 0;
}

.site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.magnetic {
  will-change: transform;
}

.reveal {
  transform: translateY(26px);
  opacity: 0;
  transition:
    transform 760ms cubic-bezier(0.2, 0.84, 0.2, 1),
    opacity 760ms ease;
}

.reveal.visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes titleIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes ambientShift {
  to {
    filter: hue-rotate(22deg);
    transform: translateY(-2%);
  }
}

@keyframes glare {
  0%,
  58% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes lineWave {
  0%,
  100% {
    transform: scaleX(0.18);
    opacity: 0.28;
  }

  50% {
    transform: scaleX(1);
    opacity: 0.9;
  }
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
    border-radius: 24px;
  }

  .nav {
    display: none;
  }

  .hero,
  .github-section,
  .lab-section,
  .about-section {
    grid-template-columns: 1fr;
  }

  .post-grid,
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    min-height: auto;
    padding-top: 54px;
  }

  .split-title {
    font-size: 52px;
  }

  .post-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }

  .post-card:nth-child(1) {
    grid-column: auto;
  }

  .lab-item {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
  }
}

@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;
  }

  #dotField,
  #pixelTrail {
    display: none;
  }
}
