@font-face {
  font-family: Moonhouse;
  src: url("assets/moonhouse.ttf") format("truetype");
  font-display: swap;
}

:root {
  --depth: 0;
  --water: #1c5a68;
  --ink: #e4eeeb;
  --muted: #9fb7b8;
  --line: rgba(228, 238, 235, 0.14);
  --glass: rgba(228, 238, 235, 0.06);
  --glow: #7fe3d6;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --display: Moonhouse, var(--sans);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; background: var(--water); }

body {
  margin: 0;
  background: var(--water);
  color: var(--ink);
  font: 400 clamp(1rem, 0.96rem + 0.2vw, 1.125rem) / 1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.8rem, 1.2rem + 2vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 560;
}

h3 { margin: 0 0 0.4rem; font-size: 1.05rem; letter-spacing: -0.02em; }

p { margin: 0 0 1rem; }

code { font-family: var(--mono); font-size: 0.92em; }

.wrap {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.spacer { flex: 1; }

.wordmark {
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
}

/* ---------- topbar ---------- */

/* A detached glass capsule. It firms up as you dive. */
.topbar {
  position: fixed;
  top: 0.9rem;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(880px, calc(100% - 1.5rem));
  padding: 0.4rem 0.45rem 0.4rem 0.95rem;
  transform: translateX(-50%);
  border: 1px solid rgba(228, 238, 235, 0.16);
  border-radius: 999px;
  background: color-mix(in srgb, rgb(7 18 24) min(88%, calc(28% + var(--depth) * 400%)), transparent);
  box-shadow: 0 10px 40px rgba(0, 10, 16, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  overflow: hidden;
}

.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--ink); }

.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--ink) !important; }
.brand img { filter: invert(1); }
.brand .wordmark { font-size: 1.35rem; }

.ver {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--glass);
  font: 500 0.72rem var(--mono);
}

.nav { position: relative; display: flex; gap: 0.15rem; margin-left: auto; }

.nav a {
  padding: 0.5rem 0.85rem 0.6rem;
  border-radius: 999px;
  font: 650 0.7rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 0.2s ease, background 0.2s ease;
}

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

.sonar {
  position: absolute;
  left: 0;
  bottom: 1px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 8px var(--glow);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.3s ease;
}

.sonar::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--glow);
  border-radius: 50%;
  opacity: 0;
}

.sonar.ping::after { animation: sonar 1s ease-out; }

@keyframes sonar {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(6); opacity: 0; }
}

.gh { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
.gh:hover { background: var(--glass); }
.gh svg { width: 17px; height: 17px; fill: currentColor; }

.depth-chip {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid rgba(127, 227, 214, 0.24);
  border-radius: 999px;
  background: rgba(127, 227, 214, 0.08);
  color: var(--glow);
}

.depth-chip b { font: 600 0.82rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.depth-chip span { font: 400 0.68rem/1 var(--display); }

.waterline {
  position: absolute;
  left: 1.4rem;
  right: 1.4rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(127, 227, 214, 0.15), var(--glow));
  box-shadow: 0 0 8px var(--glow);
  transform: scaleX(var(--depth));
  transform-origin: left;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 5.5rem 1.25rem 4.5rem;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(126, 206, 210, 0.42) 0%, rgba(126, 206, 210, 0.08) 55%, transparent 100%);
}

/* --lean comes from main.js (pointer x, eased); each ray breathes and drifts on its own clock. */
.rays {
  --lean: -11deg;
  position: absolute;
  inset: -10% 0 0;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: max(0, calc(1 - var(--depth) * 5));
}

.rays i {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--w, 8vw);
  height: 100%;
  background: linear-gradient(180deg, rgba(220, 255, 250, 0.24), transparent 72%);
  transform-origin: top center;
  transform: skewX(calc(var(--lean) + var(--tilt, 0deg)));
  filter: blur(6px);
  opacity: 0.6;
  animation: ray var(--dur, 36s) linear var(--del, 0s) infinite;
}

.rays i:nth-child(1) { --x: 14%; --w: 9vw; --del: -4s; }
.rays i:nth-child(2) { --x: 31%; --w: 5vw; --del: -22s; }
.rays i:nth-child(3) { --x: 47%; --w: 12vw; --del: -11s; }
.rays i:nth-child(4) { --x: 66%; --w: 6vw; --del: -30s; }
.rays i:nth-child(5) { --x: 80%; --w: 9vw; --del: -17s; }

/* Slow left-to-right sweep, like light refracting through a moving surface.
   Fades at both ends so the loop restart is invisible. */
@keyframes ray {
  0% { translate: -22vw 0; opacity: 0; }
  12% { opacity: 0.8; }
  30% { opacity: 0.45; }
  50% { opacity: 0.9; }
  70% { opacity: 0.5; }
  88% { opacity: 0.8; }
  100% { translate: 22vw 0; opacity: 0; }
}

.caustics {
  position: absolute;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(closest-side at 22% 28%, rgba(200, 255, 245, 0.16), transparent),
    radial-gradient(closest-side at 72% 18%, rgba(200, 255, 245, 0.12), transparent),
    radial-gradient(closest-side at 48% 62%, rgba(200, 255, 245, 0.09), transparent),
    radial-gradient(closest-side at 84% 70%, rgba(200, 255, 245, 0.08), transparent);
  background-size: 60% 60%, 50% 50%, 70% 70%, 45% 45%;
  background-repeat: no-repeat;
  filter: blur(24px);
  animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

#current {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-align: center;
}

.mark {
  width: min(290px, 62vw);
  aspect-ratio: 1;
  color: #eef6f3;
  background: currentColor;
  -webkit-mask: url("assets/sinkd-slim.svg") center / contain no-repeat;
  mask: url("assets/sinkd-slim.svg") center / contain no-repeat;
  filter: drop-shadow(0 10px 30px rgba(0, 20, 30, 0.45));
}

.mark.live {
  background: none;
  -webkit-mask: none;
  mask: none;
}

.mark svg { display: block; width: 100%; height: 100%; overflow: visible; }

.mark .coral {
  transform-box: fill-box;
  animation: current 6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

/* The logo group is flipped (scale 0.1, -0.1), so local top is the visual bottom. */
.mark .coral.l { transform-origin: 100% 0; }
.mark .coral.r { transform-origin: 0 0; }

@keyframes current {
  0%, 100% { transform: rotate(-3deg) skewX(-3deg); }
  50% { transform: rotate(7deg) skewX(6deg); }
}

.headline {
  margin: 0.4rem 0 0.6rem;
  font: 400 clamp(2.1rem, 1rem + 5.4vw, 5.2rem) / 1.02 var(--display);
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, #eaf7f3 0%, #eaf7f3 35%, #a4efe4 45%, #ffffff 50%, #a4efe4 55%, #eaf7f3 65%, #eaf7f3 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(127, 227, 214, 0.15);
  animation: shimmer 9s linear infinite, rise 1s ease-out both;
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.sub {
  max-width: 34rem;
  margin: 0 0 0.35rem;
  font-size: clamp(1.1rem, 0.95rem + 0.7vw, 1.45rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  animation: rise 1s 0.15s ease-out both;
}

.privacy {
  margin: 0;
  color: var(--muted);
  animation: rise 1s 0.3s ease-out both;
}

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Hugs the command; a light arc runs around the 1px ring. */
.cmd {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: 100%;
  margin-top: 1.9rem;
  padding: 0.4rem 0.4rem 0.4rem 1.15rem;
  border-radius: 999px;
  background: rgba(5, 18, 24, 0.58);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 44px rgba(0, 14, 20, 0.45), inset 0 0 0 1px rgba(228, 238, 235, 0.1);
  text-align: left;
  transition: box-shadow 0.35s ease;
  animation: rise 1s 0.45s ease-out both;
}

.cmd::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--angle), transparent 0 52%, rgba(127, 227, 214, 0.2) 66%, var(--glow) 80%, #fff 84%, rgba(127, 227, 214, 0.2) 92%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: ring 6s linear infinite;
}

@keyframes ring { to { --angle: 360deg; } }

.cmd:hover {
  box-shadow: 0 14px 44px rgba(0, 14, 20, 0.45), inset 0 0 0 1px rgba(127, 227, 214, 0.25), 0 0 36px rgba(127, 227, 214, 0.22);
}

.cmd-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}

.prompt { color: var(--glow); font-family: var(--mono); opacity: 0.8; }

.cmd code {
  overflow-x: auto;
  white-space: nowrap;
  font-size: clamp(0.8rem, 0.68rem + 0.45vw, 1rem);
  color: var(--ink);
}

.t-cmd { color: var(--glow); font-weight: 700; }
.t-flag { color: var(--muted); }
.t-url u { text-decoration-color: rgba(127, 227, 214, 0.5); text-underline-offset: 3px; }
.t-pipe { color: #f2c38b; }

.cmd-div { align-self: stretch; width: 1px; margin: 0.35rem 0; background: var(--line); }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1rem 0.6rem 0.85rem;
  background: var(--glow);
  color: #052229;
  font: 700 0.85rem var(--sans);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.copy:hover { background: #b2f5ec; }
.copy:active { transform: scale(0.96); }

.ico {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-check, .copy.done .ico-copy { display: none; }
.copy.done .ico-check { display: block; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  background: var(--ink);
  color: #0d1a20;
  font: 650 0.85rem var(--sans);
  cursor: pointer;
}

.btn:hover { background: #fff; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: var(--glass); }

:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

/* ---------- sections ---------- */

.section { padding: clamp(4rem, 9vw, 7rem) 0; }

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.num {
  font: 400 1rem/1 var(--display);
  letter-spacing: 0.04em;
  color: var(--glow);
}

.depth {
  margin-left: auto;
  font: 500 0.75rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.9rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.card {
  --mx: 50%;
  --my: 0%;
  position: relative;
  grid-column: span 2;
  padding: 1.2rem 1.25rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(127, 227, 214, 0.14), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.card:hover { transform: translateY(-3px); border-color: rgba(127, 227, 214, 0.35); }
.card:hover::before { opacity: 1; }

.card:nth-child(4),
.card:nth-child(5) { grid-column: span 3; }

.card p { margin: 0; color: var(--muted); }

.icon {
  width: 28px;
  height: 28px;
  margin-bottom: 0.7rem;
  fill: none;
  stroke: var(--glow);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- demo ---------- */

.demo {
  display: grid;
  grid-template-columns: 1fr minmax(90px, 1.1fr) 1fr;
  grid-template-areas: "a lane b" "tray tray tray";
  gap: 1rem 0;
  align-items: center;
  margin-top: 2rem;
}

#laptop { grid-area: a; }
#desktop { grid-area: b; }
.tray { grid-area: tray; }

.machine, .tray {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(6, 16, 22, 0.35);
}

.machine-name {
  margin: 0 0 0.6rem;
  font: 400 0.8rem/1 var(--display);
  letter-spacing: 0.08em;
  color: var(--glow);
}

.tray .machine-name { font: 500 0.78rem/1.3 var(--mono); letter-spacing: 0; }

.files { margin: 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 0.85rem; }

.files li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
}

.files time { color: var(--muted); }
.files .empty { color: var(--muted); }

.files li.edited { animation: edited 1.2s ease-out; }
.files li.synced { animation: synced 1.4s ease-out; }
.files li.aside { animation: aside 0.8s ease-out; color: #f2c38b; }

@keyframes edited { from { background: rgba(242, 195, 139, 0.35); } to { background: transparent; } }
@keyframes synced { from { background: rgba(127, 227, 214, 0.35); } to { background: transparent; } }
@keyframes aside { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.lane { position: relative; height: 40px; }

.wire {
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 11px);
}

.hub-node {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 1px solid rgba(127, 227, 214, 0.5);
  border-radius: 50%;
  background: #0b1a20;
  font: 400 0.62rem/1 var(--display);
  letter-spacing: 0.06em;
  color: var(--glow);
}

.hub-node.ping { animation: ping 0.7s ease-out; }

@keyframes ping {
  from { box-shadow: 0 0 0 0 rgba(127, 227, 214, 0.6); }
  to { box-shadow: 0 0 0 18px rgba(127, 227, 214, 0); }
}

.packet {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 14px var(--glow);
}

.packet.warm { background: #f2c38b; box-shadow: 0 0 14px #f2c38b; }

.demo-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.demo-status { min-height: 1.6em; margin-top: 0.9rem; color: var(--muted); }

/* ---------- how ---------- */

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.diagram { width: 100%; height: auto; color: var(--ink); }
.diagram .pkts circle { fill: var(--glow); filter: drop-shadow(0 0 4px var(--glow)); }
.diagram .hub-ring { stroke: var(--glow); animation: breathe 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.06); opacity: 1; }
}

/* ---------- install ---------- */

.term {
  margin-top: 1.5rem;
  border: 1px solid rgba(127, 227, 214, calc(0.08 + var(--depth) * 0.22));
  border-radius: 16px;
  overflow: hidden;
  background: #071014;
  box-shadow: 0 0 calc(var(--depth) * 80px) rgba(127, 227, 214, calc(var(--depth) * 0.22));
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  color: rgba(228, 238, 235, 0.5);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.term-bar i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: rgba(228, 238, 235, 0.22); }
.term-bar span { margin-left: 0.4rem; }

.term pre {
  margin: 0;
  padding: 0.2rem 1.15rem 1.15rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
}

.term .c { color: rgba(228, 238, 235, 0.45); }

.js .term .ln { display: inline-block; clip-path: inset(0 100% 0 0); }
.js .term.in .ln { animation: type 0.7s steps(28, end) forwards; animation-delay: calc(0.3s + var(--i) * 0.6s); }

@keyframes type { to { clip-path: inset(0 0 0 0); } }

.note { margin-top: 1rem; color: var(--muted); }

/* ---------- footer ---------- */

.footer { padding: 2.5rem 0 3rem; border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }
.foot-brand { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); }
.foot-brand img { filter: invert(1) opacity(0.85); }

/* ---------- reveal ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.js [data-reveal].in { opacity: 1; transform: none; }
.js .card[data-reveal]:nth-child(2) { transition-delay: 0.08s; }
.js .card[data-reveal]:nth-child(3) { transition-delay: 0.16s; }
.js .card[data-reveal]:nth-child(4) { transition-delay: 0.24s; }
.js .card[data-reveal]:nth-child(5) { transition-delay: 0.32s; }

@media (max-width: 680px) {
  .nav, .ver { display: none; }
  .gh { margin-left: auto; }
}

@media (max-width: 800px) {
  .cards { grid-template-columns: 1fr; }
  .card, .card:nth-child(4), .card:nth-child(5) { grid-column: auto; }
  .split { grid-template-columns: 1fr; }
  .depth { display: none; }
  .demo { grid-template-columns: 1fr 64px 1fr; }
  .files { font-size: 0.74rem; }
  .files li { padding: 0.25rem 0.3rem; }
  .machine, .tray { padding: 0.8rem; }
  .cmd {
    flex-direction: column;
    align-items: stretch;
    border-radius: 18px;
    padding: 0.8rem 0.8rem 0.7rem 0.9rem;
  }
  .cmd code { white-space: normal; overflow-wrap: anywhere; }
  .cmd-div { display: none; }
  .copy { align-self: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js .term .ln { clip-path: none; }
}
