:root {
  --lab-bg-0: #060b12;
  --lab-bg-1: #0a1320;
  --lab-bg-2: #0d1c2d;
  --lab-accent-cyan: #36f2ff;
  --lab-accent-green: #6cffb8;
  --lab-accent-blue: #5ba2ff;
  --lab-text-main: #e7f3ff;
  --lab-text-soft: #8faeca;
  --lab-border: rgba(132, 187, 255, 0.28);
  --lab-glow: 0 0 32px rgba(54, 242, 255, 0.24);
}

html[data-theme='dark'] {
  --card-bg: rgba(12, 22, 35, 0.88);
  --sidebar-bg: rgba(9, 18, 28, 0.9);
  --sidebar-menu-bg: rgba(11, 21, 33, 0.92);
}

html[data-theme='dark'] body {
  color: var(--lab-text-main);
  background: radial-gradient(circle at 18% -8%, #173453 0%, #060b12 48%),
    radial-gradient(circle at 110% 120%, #102946 0%, #060b12 50%);
}

html[data-theme='dark'] #web_bg::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(92, 143, 208, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 143, 208, 0.09) 1px, transparent 1px);
  background-size: 42px 42px;
  mix-blend-mode: screen;
  opacity: 0.28;
  animation: lab-grid-move 20s linear infinite;
}

@keyframes lab-grid-move {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(42px, 42px, 0);
  }
}

html[data-theme='dark'] #nav {
  background: rgba(8, 16, 26, 0.62) !important;
  border-bottom: 1px solid var(--lab-border);
  backdrop-filter: blur(12px) saturate(130%);
}

html[data-theme='dark'] #nav .site-page,
html[data-theme='dark'] #nav .nav-site-title {
  color: var(--lab-text-main) !important;
}

html[data-theme='dark'] #nav .site-page:hover {
  color: var(--lab-accent-cyan) !important;
  text-shadow: 0 0 16px rgba(54, 242, 255, 0.42);
}

html[data-theme='dark'] .card-widget,
html[data-theme='dark'] .recent-post-item,
html[data-theme='dark'] .layout > div:first-child:not(.nc) {
  border: 1px solid var(--lab-border);
  box-shadow: var(--lab-glow);
}

html[data-theme='dark'] .recent-post-item .article-title {
  color: var(--lab-text-main) !important;
}

html[data-theme='dark'] .recent-post-item .article-title:hover {
  color: var(--lab-accent-green) !important;
}

html[data-theme='dark'] .recent-post-item:hover,
html[data-theme='dark'] .card-widget:hover {
  transform: translateY(-2px);
  border-color: rgba(108, 255, 184, 0.54);
  box-shadow:
    0 0 0 1px rgba(108, 255, 184, 0.2),
    0 0 26px rgba(108, 255, 184, 0.24);
}

.lab-hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 1.2rem;
  padding: 1.6rem 1.4rem;
  border: 1px solid var(--lab-border);
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(36, 82, 124, 0.26) 0%,
      rgba(13, 24, 38, 0.76) 48%,
      rgba(10, 33, 48, 0.74) 100%
    ),
    rgba(9, 17, 28, 0.75);
  box-shadow:
    inset 0 0 0 1px rgba(150, 199, 255, 0.14),
    0 18px 44px rgba(3, 9, 17, 0.48),
    0 0 42px rgba(54, 242, 255, 0.18);
}

#recent-posts > .lab-hero {
  width: 100%;
}

.lab-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 72% 22%, rgba(108, 255, 184, 0.18), transparent 32%);
  pointer-events: none;
}

.lab-hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(138, 192, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 192, 255, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.7;
}

.lab-hero-head {
  position: relative;
  z-index: 2;
}

.lab-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: #e6faff;
  background: rgba(22, 51, 76, 0.75);
  border: 1px solid rgba(124, 222, 255, 0.45);
}

.lab-title {
  margin: 0.65rem 0 0.45rem;
  font-size: clamp(1.55rem, 4.6vw, 2.45rem);
  line-height: 1.14;
  color: #ecf7ff;
  text-shadow: 0 0 24px rgba(54, 242, 255, 0.28);
}

.lab-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--lab-text-soft);
  font-size: 1rem;
}

.lab-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.95rem;
}

.lab-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(132, 187, 255, 0.38);
  background: rgba(9, 21, 35, 0.7);
  color: #d4ebff;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.77rem;
}

.lab-metrics {
  position: relative;
  z-index: 2;
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.lab-metric-card {
  border-radius: 12px;
  padding: 0.65rem 0.72rem;
  border: 1px solid rgba(114, 179, 255, 0.34);
  background: rgba(10, 20, 33, 0.74);
}

.lab-metric-label {
  font-size: 0.75rem;
  color: #95b9da;
  letter-spacing: 0.04em;
}

.lab-metric-value {
  margin-top: 0.22rem;
  font-size: 1.06rem;
  color: #ecf7ff;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
}

.lab-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.lab-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.78rem;
  border-radius: 10px;
  border: 1px solid rgba(124, 222, 255, 0.42);
  background: rgba(12, 25, 40, 0.75);
  color: #ecf7ff;
  font-size: 0.85rem;
  text-decoration: none;
}

.lab-cta:hover {
  color: #03151c;
  background: linear-gradient(90deg, var(--lab-accent-cyan), var(--lab-accent-green));
  box-shadow: 0 0 26px rgba(54, 242, 255, 0.33);
}

.lab-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.92;
}

html[data-theme='dark'] .pub-link {
  color: #c8ecff;
  border-color: rgba(116, 208, 255, 0.45);
  background: rgba(12, 28, 45, 0.68);
}

html[data-theme='dark'] .pub-link:hover {
  background: rgba(36, 102, 163, 0.35);
  border-color: rgba(102, 255, 201, 0.62);
}

html[data-theme='dark'] .pub-list {
  padding-left: 0;
  list-style: none;
}

html[data-theme='dark'] .pub-item {
  border: 1px solid rgba(117, 176, 255, 0.26);
  border-radius: 12px;
  padding: 0.82rem 0.86rem;
  background: rgba(9, 19, 31, 0.68);
  box-shadow: inset 0 0 0 1px rgba(117, 176, 255, 0.1);
}

html[data-theme='dark'] .pub-title {
  color: #eef7ff;
}

html[data-theme='dark'] .pub-meta {
  color: #9bb7d3;
}

html[data-theme='dark'] pre,
html[data-theme='dark'] code,
html[data-theme='dark'] .highlight,
html[data-theme='dark'] .highlight-tools {
  border-color: rgba(129, 188, 255, 0.28) !important;
}

html[data-theme='dark'] .highlight {
  box-shadow: inset 0 0 0 1px rgba(126, 196, 255, 0.14);
}

@media (max-width: 980px) {
  .lab-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lab-hero {
    padding: 1.2rem 1rem;
    margin-bottom: 0.9rem;
  }

  .lab-title {
    font-size: 1.34rem;
  }

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

@media (prefers-reduced-motion: reduce) {
  #web_bg::before,
  .lab-canvas,
  .recent-post-item,
  .card-widget {
    animation: none !important;
    transition: none !important;
  }
}
