:root {
  --bg: #06080b;
  --text: #e4e7eb;
  --muted: #8a919b;
  --line: rgb(255 255 255 / 9%);
  --glass: rgb(255 255 255 / 4.5%);
  --accent: #9fb0c4;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(120% 70% at 50% 0%, #121820 0%, var(--bg) 65%);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- background: deep water ---------- */
.fx-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Soft dark blobs: radial gradients (no CSS blur filter, which Firefox recomputes every frame). */
.depths { position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: 0.7; }
.depths span {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; will-change: transform;
  animation: drift 30s ease-in-out infinite alternate;
}
.depths span:nth-child(1) { background: radial-gradient(closest-side, #1a2633, transparent); top: -10%; left: -5%; }
.depths span:nth-child(2) { background: radial-gradient(closest-side, #132029, transparent); top: 25%; right: -10%; animation-duration: 38s; animation-delay: -8s; }
.depths span:nth-child(3) { background: radial-gradient(closest-side, #1d1a26, transparent); bottom: -15%; left: 20%; animation-duration: 44s; animation-delay: -16s; }
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(6vw, -4vh, 0); }
  100% { transform: translate3d(-5vw, 6vh, 0); }
}
/* Light caustics: a pre-rendered image (water.webp) that only slides, so every browser just
   moves a bitmap on the GPU instead of re-running an SVG filter each frame. */
.water { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; opacity: 0.09; }
.water span {
  position: absolute; left: -15%; top: -15%; width: 130%; height: 130%;
  background: url(/water.webp?v=2) center / cover no-repeat;
  will-change: transform; animation: flow 50s ease-in-out infinite alternate;
}
@keyframes flow {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(-5%, 3%, 0); }
  100% { transform: translate3d(4%, -4%, 0); }
}

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 1; max-width: 46rem; margin: 0 auto; padding: 4rem 1rem 3rem; }

/* ---------- hero ---------- */
.hero { text-align: center; margin-bottom: 2rem; }
.logo-wrap {
  z-index: 2; /* above the title canvas, which reaches up behind the logo */
  position: relative; display: inline-grid; place-items: center;
  width: 128px; height: 128px;
  animation: float 7s ease-in-out infinite, pop 0.9s cubic-bezier(.2,1.3,.3,1) both;
}
.logo { position: relative; border-radius: 22px; box-shadow: 0 0 0 1px rgb(255 255 255 / 7%), 0 10px 40px rgb(0 0 0 / 55%); transition: box-shadow 0.6s ease; }
/* while the title pours out of the logo, the logo glows softly */
.logo.pouring { box-shadow: 0 0 0 1px rgb(255 255 255 / 14%), 0 0 36px rgb(159 176 196 / 35%), 0 10px 40px rgb(0 0 0 / 55%); }
/* orbit: a faint track and a small light circling the logo */
.logo-wrap::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / 7%); }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 62%, rgb(220 226 235 / 0%) 62%, rgb(220 226 235 / 55%) 100%);
  -webkit-mask: radial-gradient(circle closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px), #000 100%, transparent 100%);
          mask: radial-gradient(circle closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px), #000 100%, transparent 100%);
  animation: spin 10s linear infinite;
}
.logo-wrap::after {
  content: ""; position: absolute; top: -2px; left: calc(50% - 2.5px); width: 5px; height: 5px; border-radius: 50%;
  background: #e8ecf1; box-shadow: 0 0 8px 1px rgb(220 226 235 / 55%);
  transform-origin: 2.5px 66px; animation: spin 10s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes pop { from { opacity: 0; scale: 0.6; filter: blur(10px); } }

/* title: particle text (fx.js); plain text without JS */
.title { position: relative; z-index: 1; margin: 0.75rem 0 0; font-size: clamp(2.6rem, 11vw, 4.4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.15; }
.title-canvas { display: none; }
.particles .title-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
/* The canvas reaches up behind the logo and a little below the text, so it ignores the pointer
   (cards stay clickable); the title element takes the clicks for the burst. */
.particles .title-canvas { display: block; margin-left: auto; margin-right: auto; pointer-events: none; }
.particles .title { cursor: crosshair; touch-action: pan-y; }

/* ---------- glass cards ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; perspective: 900px; }
@media (min-width: 40rem) { .cards { grid-template-columns: 1fr 1fr; } }
.cards li { animation: enter 0.9s cubic-bezier(.2,1,.3,1) both; }
.cards li:nth-child(1) { animation-delay: 0.5s; }
.cards li:nth-child(2) { animation-delay: 0.6s; }
.cards li:nth-child(3) { animation-delay: 0.7s; }
.cards li:nth-child(4) { animation-delay: 0.8s; }
.cards li:nth-child(5) { animation-delay: 0.9s; }
@keyframes enter { from { opacity: 0; transform: translateY(30px) scale(0.95); filter: blur(8px); } }

.card {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; gap: 1rem; height: 100%;
  padding: 1.1rem;
  color: inherit; text-decoration: none;
  border-radius: 20px;
  background: linear-gradient(140deg, rgb(255 255 255 / 8%) 0%, rgb(255 255 255 / 2.5%) 45%, rgb(255 255 255 / 4%) 100%);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 12%),
    inset 0 -1px 0 rgb(0 0 0 / 25%),
    0 20px 40px -18px rgb(0 0 0 / 70%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.25s ease-out, border-color 0.3s, background-color 0.3s;
}
/* a still reflection on the top of the glass, stronger on hover */
.card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(130% 70% at 50% -18%, rgb(255 255 255 / 13%), rgb(255 255 255 / 4%) 55%, transparent 72%),
    linear-gradient(180deg, rgb(255 255 255 / 5%), transparent 38%);
  opacity: 0.55; transition: opacity 0.4s ease;
}
.card:hover::after, .card:focus-visible::after { opacity: 1; }
.spot {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgb(255 255 255 / 7%), transparent 70%);
}
.card:hover, .card:focus-visible { border-color: rgb(255 255 255 / 16%); }
.card:hover .spot, .card:focus-visible .spot { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.icon { flex: none; border-radius: 14px; filter: saturate(0.85); transition: transform 0.4s cubic-bezier(.2,1.4,.3,1), filter 0.3s; }
.card:hover .icon { transform: scale(1.06); filter: saturate(1); }
.text { display: flex; flex-direction: column; min-width: 0; }
.name { font-weight: 650; font-size: 1.05rem; }
.desc { color: var(--muted); font-size: 0.925rem; }
.arrow { margin-left: auto; flex: none; font-size: 1.2rem; color: var(--muted); opacity: 0; transform: translateX(-8px); transition: opacity 0.3s, transform 0.3s; }
.card:hover .arrow, .card:focus-visible .arrow { opacity: 1; transform: translateX(0); }

/* ---------- footer / github ---------- */
.foot { margin-top: 2.5rem; text-align: center; animation: enter 0.9s 1s cubic-bezier(.2,1,.3,1) both; }
.github {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 1.15rem; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 550;
  background: linear-gradient(140deg, rgb(255 255 255 / 8%), rgb(255 255 255 / 3%));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%), 0 12px 30px -14px rgb(0 0 0 / 70%);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: transform 0.3s cubic-bezier(.2,1.4,.3,1), border-color 0.3s;
}
.github:hover { transform: translateY(-2px); border-color: rgb(255 255 255 / 18%); }

/* ---------- 404 page ---------- */
.lead { margin: 0; color: var(--muted); }

/* ---------- leaving: the page dissolves like water, then a dark veil ---------- */
.leaving main { filter: url(#melt); animation: sink 0.9s ease-in forwards; }
@keyframes sink { to { opacity: 0; transform: scale(0.97); } }
.veil {
  position: fixed; inset: 0; z-index: 10; pointer-events: none; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, #10161d, var(--bg) 70%);
  opacity: 0; visibility: hidden;
}
.veil-label { color: var(--muted); font-weight: 600; font-size: clamp(1.2rem, 4vw, 1.8rem); letter-spacing: 0.02em; opacity: 0; filter: blur(8px); }
.leaving .veil { visibility: visible; animation: veil-in 0.5s 0.45s ease-out forwards; }
.leaving .veil-label { animation: label-in 0.5s 0.6s ease-out forwards; }
@keyframes veil-in { to { opacity: 1; } }
@keyframes label-in { to { opacity: 1; filter: blur(0); } }

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { transform: none; }
  .water, .veil { display: none; }
}
