html {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;

  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar-thumb) var(--color-bg);
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar-thumb);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-muted-dim);
}

body {
  overflow-x: hidden;
  background-color: var(--color-bg);
  background-image: url('../assets/bg-blueprint.svg');
  background-repeat: no-repeat;
  background-position: top center;
  background-size: cover;
  background-attachment: fixed;
}

:root[data-theme="light"] body {
  background-image: url('../assets/bg-blueprint-light.svg');
}

@media (hover: none) and (pointer: coarse) {
  body {
    background-attachment: scroll;
    background-image:
      url('../assets/bg-blueprint.svg'),
      repeating-linear-gradient(0deg,
        transparent 0,
        transparent 39px,
        rgba(255, 255, 255, 0.04) 39px,
        rgba(255, 255, 255, 0.04) 40px),
      repeating-linear-gradient(90deg,
        transparent 0,
        transparent 39px,
        rgba(255, 255, 255, 0.04) 39px,
        rgba(255, 255, 255, 0.04) 40px);
    background-size: 200% auto, auto, auto;
    background-position: top center, 0 0, 0 0;
    background-repeat: no-repeat, repeat, repeat;
  }
  :root[data-theme="light"] body {
    background-image:
      url('../assets/bg-blueprint-light.svg'),
      repeating-linear-gradient(0deg,
        transparent 0,
        transparent 39px,
        rgba(0, 0, 0, 0.045) 39px,
        rgba(0, 0, 0, 0.045) 40px),
      repeating-linear-gradient(90deg,
        transparent 0,
        transparent 39px,
        rgba(0, 0, 0, 0.045) 39px,
        rgba(0, 0, 0, 0.045) 40px);
  }
}

body::after {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.038;
  pointer-events: none;
  z-index: 9000;
  animation: grain 8s steps(10) infinite;
  will-change: transform;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10%  { transform: translate(-5%, -10%); }
  20%  { transform: translate(-15%, 5%); }
  30%  { transform: translate(7%, -25%); }
  40%  { transform: translate(-5%, 25%); }
  50%  { transform: translate(-15%, 10%); }
  60%  { transform: translate(15%, 0%); }
  70%  { transform: translate(0%, 15%); }
  80%  { transform: translate(3%, 35%); }
  90%  { transform: translate(-10%, 10%); }
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.3;
}

em {
  font-family: var(--font-display);
  font-style: italic;
}

p {
  max-width: 65ch;
  color: var(--color-muted);
}

strong {
  font-weight: 600;
  color: var(--color-text);
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-style: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--color-accent);
}

.section-title {
  font-size: var(--text-4xl);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-muted);
  max-width: 55ch;
  line-height: 1.6;
}

.reveal {
  transition: opacity var(--dur-slow) var(--ease-out-expo),
              transform var(--dur-slow) var(--ease-out-expo);
}

.js .reveal {
  opacity: 0;
  transform: translateY(40px);
}

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

.anchor-pulse {
  animation: anchor-pulse 0.6s var(--ease-out-expo);
}

@keyframes anchor-pulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.7; }
  100% { opacity: 1; }
}

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

  body::after {
    animation: none;
  }
}

button, a, [role="button"] {
  touch-action: manipulation;
}

@media (min-width: 3840px) {
  :root {
    font-size: 20px;
    --container-width: 2400px;
  }
}

@media (min-width: 7680px) {
  :root {
    font-size: 28px;
    --container-width: 3600px;
  }
}

html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.16s ease,
              color 0.16s ease,
              border-color 0.16s ease,
              fill 0.16s ease,
              stroke 0.16s ease,
              box-shadow 0.16s ease !important;
}

@media (hover: none) and (pointer: coarse) {
  html.theme-transitioning,
  html.theme-transitioning *,
  html.theme-transitioning *::before,
  html.theme-transitioning *::after {
    transition: none !important;
  }
}

::view-transition-old(root) {
  animation: none;
}

::view-transition-new(root) {
  animation: theme-circle-reveal 380ms cubic-bezier(0.16, 1, 0.3, 1);

  mix-blend-mode: normal;
}

@keyframes theme-circle-reveal {
  from {
    clip-path: circle(0 at var(--theme-x, 50%) var(--theme-y, 50%));
  }
  to {
    clip-path: circle(var(--theme-r, 150vmax) at var(--theme-x, 50%) var(--theme-y, 50%));
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}
