* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  overflow-x: hidden;
  min-height: 100vh;
}

img, video {
  max-width: 100%;
}

a {
  color: inherit;
}

h1, h2, h3, p {
  margin: 0;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 1rem;
  z-index: 200;
  background: var(--bg-2);
  color: var(--ink);
  padding: 0.75em 1.25em;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: 1rem;
}

/* background video layer */
.bg-video-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  overflow: hidden;
  background: var(--bg);
}

.bg-video-layer video,
.bg-video-layer .bg-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.bg-video-layer .bg-poster {
  opacity: 0;
}

/* No transition on the base rule above: during normal playback, JS drives
   video/poster opacity every frame for the loop crossfade, and a CSS
   transition on top of that would lag behind and desync the two. The
   fallback switch below is the one case that should visibly ease in. */
.bg-video-layer.is-poster-only .bg-poster {
  opacity: 1;
  transition: opacity var(--dur-med) var(--ease-soft);
}

.bg-video-layer.is-poster-only video {
  opacity: 1;
}

.bg-video-layer.is-poster-only video {
  display: none;
}

#fireflies {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.75;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(5, 6, 10, 0.15) 0%, rgba(5, 6, 10, 0.55) 55%, rgba(5, 6, 10, 0.92) 100%),
    linear-gradient(to bottom, rgba(5, 6, 10, 0.55) 0%, rgba(5, 6, 10, 0.1) 18%, rgba(5, 6, 10, 0.1) 70%, rgba(5, 6, 10, 0.75) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  position: relative;
  z-index: var(--z-content);
}

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