/* ---------- Colors ---------- */
:root {
  --ink: #07080c;
  --text: #f2f5f7;
  --muted: #97a1ab;
  --dim: #5d6670;
  --teal: #2ef2c8;
  --violet: #8b5cf6;
  --orange: #ff7a3d;
  --line: rgba(255, 255, 255, 0.08);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(139, 92, 246, 0.2), transparent 60%),
    radial-gradient(760px 420px at 100% 4%, rgba(46, 242, 200, 0.1), transparent 62%),
    var(--ink);
}

/* Film-grain texture over everything, so the black feels deep rather than flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.07;
  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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* The river canvas sits behind the content and ignores clicks */
#river {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* ---------- Layout ---------- */
.page {
  position: relative;
  z-index: 2;
  max-width: 640px;
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(56px, 13vh, 128px) 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* ---------- Living logo ---------- */
.mark { width: 56px; height: 56px; margin-bottom: 28px; }
.mark svg {
  width: 100%;
  height: 100%;
  display: block;
  transition: filter 0.4s, transform 0.4s var(--ease-out);
}
.brand:hover .mark svg {
  filter: drop-shadow(0 0 18px rgba(46, 242, 200, 0.55));
  transform: scale(1.05);
}
.wave {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linecap: round;
  animation: flow 4.5s linear infinite;
}
.wave-2 { animation-duration: 6.5s; }
@keyframes flow { to { transform: translateX(-28px); } }

/* ---------- Headline (split into letters by script.js) ---------- */
.title {
  margin: 0 0 18px;
  font-size: clamp(44px, 10vw, 80px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.word { display: inline-block; white-space: nowrap; }
.char {
  display: inline-block;
  animation: rise 0.9s var(--ease-out) both;
  animation-delay: calc(120ms + var(--i) * 38ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(0.55em) rotate(6deg); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
/* After the entrance finishes, letters sit still until hovered */
.title.is-settled .char { animation: none; }
.title.is-rippling .char {
  animation: bob 0.7s cubic-bezier(0.3, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i) * 28ms);
}
@keyframes bob {
  0%, 100% { transform: none; }
  35% { transform: translateY(-0.16em); }
  65% { transform: translateY(0.04em); }
}

.tagline {
  margin: 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: clamp(18px, 2.6vw, 22px);
  line-height: 1.5;
}

/* ---------- Staggered entrance ---------- */
.reveal {
  animation: fade-up 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0ms);
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Sections ---------- */
h2 {
  margin: 0 0 16px;
  color: rgba(46, 242, 200, 0.8);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
p { margin: 0 0 8px; }
/* A soft dark halo keeps text readable where it overlaps the river */
section p, footer { text-shadow: 0 0 6px var(--ink), 0 0 14px var(--ink), 0 0 24px var(--ink); }
.muted { color: var(--muted); }
a {
  color: var(--teal);
  text-decoration-color: rgba(46, 242, 200, 0.35);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s;
}
a:hover { text-decoration-color: currentColor; }

/* ---------- Simmer card (3D tilt + shine) ---------- */
.app {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(22, 25, 34, 0.92), rgba(12, 14, 20, 0.92));
  color: inherit;
  text-decoration: none;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease-out), border-color 0.3s, box-shadow 0.3s;
}
.app.is-tilting { transition: transform 0.1s linear, border-color 0.3s, box-shadow 0.3s; }
.app:hover {
  border-color: rgba(255, 122, 61, 0.45);
  box-shadow: 0 24px 60px -24px rgba(255, 122, 61, 0.45);
}
.app-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.14), transparent 45%);
}
.app:hover .app-shine { opacity: 1; }
.app img {
  flex-shrink: 0;
  border-radius: 15px;
  transform: translateZ(36px);
  box-shadow: 0 10px 28px -8px rgba(255, 110, 40, 0.6);
}
.app-text { display: flex; flex-direction: column; gap: 2px; transform: translateZ(20px); }
.app-name { font-size: 19px; font-weight: 650; }
.app-desc { color: var(--muted); font-size: 15px; line-height: 1.45; }
.arrow {
  margin-left: auto;
  padding-left: 8px;
  color: var(--dim);
  font-size: 22px;
  transform: translateZ(20px);
  transition: transform 0.3s var(--ease-out), color 0.3s;
}
.app:hover .arrow { color: var(--orange); transform: translateZ(20px) translateX(4px); }

/* Phones and tablets have no mouse, so the card gently sways on its own instead */
.app--idle { animation: sway 7s ease-in-out infinite; }
@keyframes sway {
  0%, 100% { transform: perspective(900px) rotateX(2deg) rotateY(-3deg); }
  50% { transform: perspective(900px) rotateX(-2deg) rotateY(3deg); }
}

/* ---------- Footer ---------- */
footer {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 14px;
}

@media (max-width: 480px) {
  .page { gap: 44px; }
  .app { gap: 14px; padding: 16px; }
}

/* Respect the "Reduce motion" accessibility setting: no animations at all */
@media (prefers-reduced-motion: reduce) {
  .reveal, .char, .wave, .app--idle { animation: none !important; }
  .app, .app .arrow, .mark svg { transition: none; }
}
