
:root {
  color-scheme: dark;
  --ink: #071923;
  --foam: #f4fbfa;
  --coral: #ff5c45;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
  scrollbar-width: none;
  touch-action: pan-y pinch-zoom;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--foam);
  -webkit-overflow-scrolling: touch;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 5px;
}

::selection {
  background: var(--coral);
  color: var(--ink);
}

.site-shell {
  position: relative;
  min-height: 300vh;
  background: var(--ink);
}

.scene-stack,
.scene-layer,
.scene-vignette,
.scene-grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
}

.scene-stack {
  z-index: 0;
  overflow: hidden;
  background: var(--ink);
}

.scene-camera {
  position: absolute;
  inset: 0;
  transform-origin: 50% 55%;
  will-change: transform;
}

.scene-layer--0 { z-index: 1; }
.scene-layer--1 { z-index: 2; }
.scene-layer--2 { z-index: 3; }

.scene-layer:not(.is-active) {
  pointer-events: none;
}

.scene-layer canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y pinch-zoom;
}

.scene-subject {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y pinch-zoom;
}

.scene-comment {
  position: fixed;
  z-index: 100;
  top: 40%;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 24px;
  background: rgba(7, 25, 35, 0.9);
  color: var(--foam);
  font: 600 clamp(13px, 1.5vw, 20px)/1.4 system-ui, sans-serif;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.scene-vignette {
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 38%, rgba(3, 17, 24, 0.16) 100%),
    linear-gradient(180deg, rgba(3, 17, 24, 0.07), transparent 24%, transparent 73%, rgba(3, 17, 24, 0.28));
  mix-blend-mode: multiply;
}

.scene-grain {
  z-index: 11;
  inset: -50%;
  width: 200%;
  height: 200%;
  opacity: 0.055;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.22s steps(2) infinite;
  mix-blend-mode: soft-light;
}

.cursor-glow {
  position: fixed;
  z-index: 12;
  top: 0;
  left: 0;
  width: 190px;
  height: 190px;
  margin: -95px 0 0 -95px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13), transparent 68%);
  mix-blend-mode: overlay;
}

.scene-dots {
  position: fixed;
  z-index: 100;
  top: 24px;
  left: 50%;
  display: flex;
  gap: 0;
  padding: 0 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(7, 25, 35, 0.14);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
  touch-action: manipulation;
}

.scene-dots button {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.scene-dots button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  transition: width 240ms ease, background 180ms ease;
}

.scene-dots button:hover::after { background: rgba(255, 255, 255, 0.55); }

.scene-dots button.is-active::after {
  width: 28px;
  border-color: var(--foam);
  border-radius: 999px;
  background: var(--foam);
}

.scroll-meter {
  position: fixed;
  z-index: 100;
  right: clamp(18px, 3.5vw, 54px);
  bottom: 26px;
  width: clamp(80px, 12vw, 170px);
  height: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.26);
  pointer-events: none;
}

.scroll-meter__fill {
  width: 100%;
  height: 100%;
  background: var(--coral);
  transform-origin: 0 50%;
}

.scroll-track {
  position: relative;
  z-index: -1;
  pointer-events: none;
}

.scroll-track section {
  height: 110svh;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2%, -3%); }
  50% { transform: translate(-3%, 2%); }
  75% { transform: translate(3%, 3%); }
  100% { transform: translate(-2%, -1%); }
}

@media (max-width: 720px) {
  .scene-dots {
    top: 15px;
  }

  .scroll-meter {
    right: 16px;
    bottom: 22px;
    width: 72px;
  }

  .cursor-glow {
    display: none;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scene-layer {
    opacity: 0 !important;
  }

  .scene-layer.is-active {
    opacity: 1 !important;
  }
}
