:root {
  --bg: #05060a;
  --surface: #0d1018;
  --text: #ecebe6;
  --muted: #8b8f9c;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #f2a65a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 18px/1.55 "Geist", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
header, main, footer { position: relative; z-index: 1; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* Starfield (rendered by stars.js with three.js) */
#space { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 0; pointer-events: none; display: block; }

/* Mobile: still layers rendered once by earth.js, moved on scroll for parallax */
.space-layers { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 0; pointer-events: none; overflow: hidden; background: #05060a; }
.space-layers canvas { position: absolute; top: 0; left: 0; width: 100%; display: block; will-change: transform; }

/* Distant comets (comets.js): above the starfield and nebula, below the content */
#comets { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 0; pointer-events: none; display: block; }

/* Ghost nebula: faint pale clouds, fixed between the starfield and the content */
.nebula {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  opacity: .14; mix-blend-mode: screen; filter: blur(6px); will-change: transform;
}

/* Nav */
.nav { display: flex; justify-content: space-between; align-items: center; height: 80px; }
.logo { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 10px; }
.logo__mark { width: 28px; height: 28px; flex: none; overflow: visible; }
/* Time tunnel: on hover each ring swirls around the mouth at its own pace, so
   the vanishing point orbits and the tunnel appears to twist. */
.logo__mark circle { transform-box: view-box; transform-origin: 16px 16px; }
.logo:hover .logo__mark circle, .logo:focus-visible .logo__mark circle { animation: tunnel-swirl 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.logo:hover .logo__mark circle:nth-child(2), .logo:focus-visible .logo__mark circle:nth-child(2) { animation-delay: -.12s; }
.logo:hover .logo__mark circle:nth-child(3), .logo:focus-visible .logo__mark circle:nth-child(3) { animation-delay: -.24s; }
.logo:hover .logo__mark circle:nth-child(4), .logo:focus-visible .logo__mark circle:nth-child(4) { animation-delay: -.36s; }
.logo:hover .logo__mark circle:nth-child(5), .logo:focus-visible .logo__mark circle:nth-child(5) { animation-delay: -.48s; }
.logo:hover .logo__mark circle:nth-child(n+6), .logo:focus-visible .logo__mark circle:nth-child(n+6) { animation-delay: -.6s; }
@keyframes tunnel-swirl { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .logo .logo__mark circle { animation: none !important; } }
.nav nav, .footer nav { display: flex; gap: 28px; }
.nav nav a, .footer nav a { text-decoration: none; color: var(--muted); }
.nav nav a:hover, .footer nav a:hover { color: var(--text); }
@media (max-width: 520px) { .nav nav { gap: 18px; font-size: 16px; } }

/* Hero */
.hero { position: relative; padding: 120px 24px 80px; }
.hero h1 {
  position: relative;
  font-size: clamp(40px, 6.4vw, 76px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 15ch;
}
.hero p { position: relative; color: var(--muted); font-size: 20px; margin: 28px 0 0; max-width: 42ch; }
.hero .button { position: relative; }
@media (max-width: 600px) { .hero { padding: 64px 16px 48px; } }

/* Hero layout: copy + liquid-chrome ship */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 40px; align-items: center; }
.ship { top: -56px; width: 100%; height: auto; overflow: visible; animation: ship-drift 9s ease-in-out infinite; transform-origin: 60% 50%; will-change: translate, scale, opacity; position: relative; z-index: -1; }
.hero__copy { grid-row: 1; grid-column: 1; align-self: end; }
.ship { grid-row: 1; grid-column: 2; }
.ship__waist, .ship__glint {
  fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round;
}
.ship__waist { stroke: rgba(0, 0, 0, 0.55); stroke-width: 1.2; }
.ship__glint { stroke: rgba(242, 166, 90, 0.7); stroke-width: 1; }
.ship__liquid { animation: ship-flow 16s ease-in-out infinite alternate; }
@keyframes ship-drift { 50% { transform: translate(-6px, -10px); } }
@keyframes ship-flow { to { transform: translateX(500px); } }
@media (prefers-reduced-motion: reduce) { .ship, .ship__liquid { animation: none; } }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .ship { max-width: 360px; justify-self: end; order: -1; margin-bottom: -20px; }
  .ship { top: -24px; }
  .hero__copy, .ship { grid-row: auto; grid-column: 1; }
}

.planet {
  position: absolute;
  right: -120px;
  top: 20px;
  width: 560px;
  height: 560px;
  overflow: visible;
}
.orbit { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 1; }
.moon {
  fill: var(--accent);
  offset-path: path("M 15 300 A 285 90 0 1 1 585 300 A 285 90 0 1 1 15 300");
  animation: orbit 24s linear infinite;
}
@keyframes orbit { to { offset-distance: 100%; } }
@media (max-width: 960px) { .planet { width: 380px; height: 380px; right: -140px; top: 0; opacity: 0.6; } }
@media (max-width: 600px) { .planet { width: 280px; height: 280px; right: -120px; top: -20px; opacity: 0.45; } }

.button {
  display: inline-block;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  padding: 14px 22px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 16px;
  transition: background 0.2s;
}
.button:hover { background: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Blocks */
.block {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding-top: 32px;
  padding-bottom: 112px;
  border-top: 1px solid var(--line);
}
.block > h2 { font-size: 16px; font-weight: 500; color: var(--muted); }
@media (max-width: 760px) { .block { grid-template-columns: 1fr; padding-bottom: 80px; } }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.rows li:first-child { padding-top: 0; }
.rows li h3 { font-size: inherit; font-weight: 500; line-height: inherit; }
.rows li p { color: var(--muted); }
@media (max-width: 600px) { .rows li { grid-template-columns: 1fr; gap: 4px; } }

.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.cols h3 { font-size: 18px; font-weight: 500; margin-bottom: 8px; }
.cols p { color: var(--muted); }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; gap: 28px; } }

.contact .big {
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 32px;
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .moon { animation: none; }
}

/* Contact form */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.form { display: grid; gap: 20px; max-width: 720px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 600px) { .form__row { grid-template-columns: 1fr; } }

.field { display: grid; gap: 8px; font-size: 15px; color: var(--muted); }
.field em { font-style: normal; opacity: 0.6; margin-left: 4px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.field select:invalid { color: var(--muted); }
.field ::placeholder { color: var(--muted); opacity: 0.7; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(255, 255, 255, 0.2); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.form--checked .field :invalid { border-color: #e5675f; }

.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; }
.form .button { cursor: pointer; font-family: inherit; }
.form .button:not(.button--glass) { border: 0; }
.form .button:disabled { opacity: 0.6; cursor: progress; transform: none; }
.form .button:disabled::after { display: none; }
.form__status { font-size: 15px; color: var(--muted); }
.form__status[data-kind="success"] { color: #8fd19e; }
.form__status[data-kind="error"] { color: #e5675f; }

/* Liquid glass button */
.button--glass {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 14px 28px;
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  backdrop-filter: blur(14px) saturate(170%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 18px rgba(255, 255, 255, 0.05),
    0 8px 28px rgba(0, 0, 0, 0.35);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}
/* specular highlight across the top */
.button--glass::before {
  content: "";
  position: absolute;
  inset: 1px 1px 50% 1px;
  border-radius: 999px 999px 40% 40% / 999px 999px 100% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  z-index: -1;
  pointer-events: none;
}
/* light sweep on hover */
.button--glass::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  z-index: -1;
  pointer-events: none;
  transition: left 0.7s ease;
}
.button--glass:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(242, 166, 90, 0.12));
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 0 22px rgba(242, 166, 90, 0.12),
    0 10px 34px rgba(242, 166, 90, 0.18);
  transform: translateY(-1px);
}
.button--glass:hover::after { left: 120%; }
.button--glass:active { transform: translateY(0) scale(0.98); }
@media (prefers-reduced-motion: reduce) {
  .button--glass, .button--glass::after { transition: none; }
  .button--glass:hover { transform: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .button--glass { background: rgba(30, 33, 44, 0.85); }
}

/* Legal pages (privacy, terms) */
.legal { max-width: 760px; padding-top: 64px; padding-bottom: 120px; }
.legal h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 500; line-height: 1.08; letter-spacing: -0.03em; }
.legal__updated { color: var(--muted); font-size: 15px; margin: 12px 0 48px; }
.legal h2 { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; margin: 48px 0 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.legal p, .legal li { color: #c9c8c2; }
.legal p + p, .legal ul + p { margin-top: 14px; }
.legal ul { margin: 14px 0 0; padding-left: 20px; }
.legal li + li { margin-top: 6px; }
.legal strong { color: var(--text); font-weight: 500; }
.legal a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.legal a:hover { color: var(--accent); }
.footer nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 600px) { .legal { padding-top: 32px; padding-bottom: 80px; } }
