:root {
  color-scheme: light;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Manrope', system-ui, sans-serif;
  color: #0f172a;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.1), transparent 30%),
    radial-gradient(circle at 90% 12%, rgba(37, 99, 235, 0.08), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #ffffff 58%, #f8fafc 100%);
}

.font-display {
  font-family: 'Fraunces', Georgia, serif;
}

.grain::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.glass-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.glass-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 38%, rgba(37, 99, 235, 0.05));
}

.section-line {
  position: relative;
}

.section-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.6), transparent);
}

.fade-rise {
  opacity: 0;
  transform: translateY(20px);
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.delay-1 {
  animation-delay: 0.08s;
}

.delay-2 {
  animation-delay: 0.16s;
}

.delay-3 {
  animation-delay: 0.24s;
}

.delay-4 {
  animation-delay: 0.32s;
}

.reveal {
  opacity: 1;
  transform: translateY(22px);
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  transform: translateY(0);
}

.hover-lift {
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.24);
}

.prose-soft p,
.prose-soft li {
  color: #475569;
}

.prose-soft code {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.9);
  padding: 0.15rem 0.45rem;
  font-size: 0.85em;
  color: #0f172a;
}

.toc-link {
  display: block;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.7rem 0.95rem;
  font-size: 0.875rem;
  color: #475569;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.toc-link:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1e3a8a;
}

.section-anchor {
  scroll-margin-top: 6rem;
}

.code-panel {
  overflow-x: auto;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 1.25rem;
  background: #0f172a;
  padding: 1rem;
  font-size: 0.75rem;
  line-height: 1.55;
  color: #e2e8f0;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fade-rise,
  .reveal {
    transform: none;
    animation: none;
    transition: none;
  }

  .hover-lift:hover,
  .toc-link:hover {
    transform: none;
  }
}
