/* Shared look for the hazptr.github.io pages. Each page sets --accent, --accent-2 and --glow. */
:root {
  --bg: #07090f;
  --ink: #eef3f7;
  --muted: #9aa8b5;
  --accent: #2dd4bf;
  --accent-2: #f5b84b;
  --glow: rgba(45, 212, 191, 0.35);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --radius: 22px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Decorations overhang their boxes on purpose; never let them widen the page (phones zoom out) */
html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* A slow-moving colour field behind everything */
body::before {
  content: "";
  position: fixed;
  inset: -8vmax;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(40vmax 40vmax at 15% 20%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 60%),
    radial-gradient(35vmax 35vmax at 85% 30%, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 60%),
    radial-gradient(45vmax 45vmax at 50% 95%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
  /* Transform-only animation stays on the compositor; a blur filter here was the most expensive layer on phones */
  will-change: transform;
  animation: drift 28s ease-in-out infinite alternate;
}

@keyframes drift {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(3vmax, -2vmax, 0) rotate(4deg) scale(1.04); }
  100% { transform: translate3d(-2vmax, 3vmax, 0) rotate(-3deg) scale(1.02); }
}

canvas.bubbles {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
}

/* With WebGL the canvas draws the colour field and grain itself, as one opaque layer */
.bubbles-gl body::before,
.bubbles-gl .grain { display: none; }

/* Grain, so the gradients do not band */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* Top bar */
.nav {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px auto 0;
  padding: 10px 14px 10px 18px;
  width: min(1120px, calc(100% - 28px));
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  /* Solid rather than a backdrop blur: the bubbles behind it move every frame, so a blur would be redone every frame */
  background: rgba(10, 14, 22, 0.9);
}

.nav a.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.nav a.brand img { width: 28px; height: 28px; }

.nav .links { display: flex; gap: 6px; align-items: center; }

.nav .links a,
.nav .links button {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.nav .links a:hover,
.nav .links button:hover { color: var(--ink); background: var(--glass); }

.sound-toggle[data-on="true"] { color: var(--accent) !important; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  text-align: center;
  min-height: min(92vh, 900px);
  padding: 80px 0 40px;
}

.hero h1 {
  margin: 0.2em 0 0.1em;
  font-size: clamp(56px, 11vw, 148px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  background: linear-gradient(110deg, var(--ink) 20%, var(--accent) 45%, var(--accent-2) 60%, var(--ink) 80%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* One sweep, then still: a running shimmer repaints this huge text on every frame */
  animation: shimmer 2.6s cubic-bezier(.3, .7, .2, 1) 0.4s 1 both;
}

@media (hover: hover) {
  .hero h1:hover { animation: shimmer-again 2.6s cubic-bezier(.3, .7, .2, 1) 1 both; }
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -150% 0; }
}

@keyframes shimmer-again {
  from { background-position: 100% 0; }
  to { background-position: -150% 0; }
}

/* A soft dark halo behind the hero text keeps it readable over the bubbles */
.hero > div {
  position: relative;
  min-width: 0;
  max-width: 100%;
  padding: 40px 20px;
}

.hero > div::before {
  content: "";
  position: absolute;
  inset: -10% -25%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(7, 9, 15, 0.82), rgba(7, 9, 15, 0.55) 55%, transparent);
  pointer-events: none;
}

.hero p.lead {
  max-width: 640px;
  margin: 0.6em auto 1.6em;
  color: var(--muted);
  font-size: clamp(17px, 2.2vw, 21px);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
}

/* The shadow sits on the child so the bob only moves an already-drawn layer */
.float {
  animation: float 6s ease-in-out infinite;
}

.float > * {
  filter: drop-shadow(0 30px 60px var(--glow));
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-16px) rotate(2deg); }
}

.actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 26px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.2, .8, .2, 1), box-shadow 0.25s, background 0.25s;
}

.btn:hover { box-shadow: 0 10px 40px -10px var(--glow); }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: #04120f;
  box-shadow: 0 12px 40px -12px var(--glow);
}

.btn.primary::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  background: inherit;
  filter: blur(18px);
  opacity: 0.55;
}

.btn small { font-weight: 500; opacity: 0.75; }

.btn:focus-visible,
.nav a:focus-visible,
.card:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }

/* Sections */
section { padding: 70px 0; }

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 0 0 28px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 18px;
}

/* Glass cards that tilt towards the pointer and catch a moving highlight */
.card {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: block;
  padding: 24px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  background:
    radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.10), transparent 45%),
    linear-gradient(160deg, rgba(22, 28, 40, 0.86), rgba(10, 13, 20, 0.82));
  color: inherit;
  text-decoration: none;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 30px 60px -30px var(--glow);
}

/* Depth only while a pointer is tilting the card. At rest there is no perspective, so the layers
   (icon, title, text) sit flat and line up instead of drifting by their different depths */
@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .card.reveal.is-visible:hover {
    transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  }
}

.card h3 {
  margin: 0 0 6px;
  font-size: 20px;
  transform: translateZ(30px);
}

.card p {
  margin: 0;
  color: var(--muted);
  transform: translateZ(18px);
}

.card .icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 40%, transparent), color-mix(in srgb, var(--accent-2) 30%, transparent));
  font-size: 22px;
  transform: translateZ(40px);
}

.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  transform: translateZ(12px);
}

.chip {
  padding: 3px 10px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.98);
  transition: opacity 0.8s cubic-bezier(.2, .8, .2, 1) var(--delay, 0ms), transform 0.8s cubic-bezier(.2, .8, .2, 1) var(--delay, 0ms);
}

.reveal.is-visible { opacity: 1; transform: none; }

.card.reveal.is-visible { transform: rotateX(var(--rx)) rotateY(var(--ry)); }

code, .mono {
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.92em;
}

.copy {
  display: flex;
  align-items: center;
  justify-self: stretch;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
}

.copy code {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--accent);
}

.copy button {
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--glass);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.copy button:hover { background: rgba(255, 255, 255, 0.12); }

footer {
  padding: 50px 0 60px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

footer a { color: var(--ink); }

.hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .nav .links a.hide-sm { display: none; }
  section { padding: 50px 0; }
}
