/* Palette pulled from the Parlingo business card (v4 gradient) */
:root {
  --bg-0: #09071f;
  --bg-1: #120e3a;
  --bg-2: #1d1757;
  --teal: #27ece9;
  --teal-hi: #86e6e4;
  --teal-deep: #009694;
  --text: #f4f5fb;
  --muted: #b9b6d6;
  --faint: #8d89b3;
  --danger: #ff8a9a;
  --card: rgba(255, 255, 255, 0.045);
  --card-line: rgba(255, 255, 255, 0.12);
  --field: rgba(10, 8, 30, 0.45);
  --field-line: rgba(255, 255, 255, 0.14);
  --radius: 14px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

[hidden] { display: none !important; }

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  /* deep, even indigo: richest in the centre, darkening evenly to every edge */
  background: radial-gradient(120% 90% at 50% 38%, var(--bg-2) 0%, var(--bg-1) 50%, var(--bg-0) 100%) fixed;
  background-color: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--teal-hi); text-underline-offset: 3px; }
a:hover { color: var(--teal); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Background ---------- */

.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.glow-a {
  width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax;
  background: radial-gradient(circle, rgba(39, 236, 233, 0.35), transparent 65%);
  animation: drift-a 22s ease-in-out infinite alternate;
}
.glow-b {
  width: 52vmax; height: 52vmax; right: -16vmax; bottom: -20vmax;
  background: radial-gradient(circle, rgba(52, 36, 160, 0.5), transparent 65%);
  animation: drift-b 26s ease-in-out infinite alternate;
}
.glow-c {
  width: 30vmax; height: 30vmax; right: 8vmax; top: 10vmax;
  background: radial-gradient(circle, rgba(39, 236, 233, 0.18), transparent 70%);
  animation: drift-c 30s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(10vmax, 8vmax) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-8vmax, -10vmax) scale(1.05); } }
@keyframes drift-c { to { transform: translate(-14vmax, 12vmax) scale(0.9); } }

/* Drifting tiles echo the blocks in the logo */
.tiles { position: absolute; inset: 0; }
.tile {
  position: absolute;
  bottom: -80px;
  width: var(--s);
  height: calc(var(--s) * 1.08);
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 45%, var(--teal-hi), var(--teal) 75%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 2px 0 0 rgba(255, 255, 255, 0.25),
    inset -2px 0 0 rgba(0, 69, 69, 0.55),
    inset 0 -2px 0 rgba(0, 110, 108, 0.7),
    0 0 18px rgba(39, 236, 233, 0.35);
  opacity: 0;
  filter: blur(var(--b));
  animation: rise var(--d) linear var(--delay) infinite;
}
@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: var(--o); }
  85%  { opacity: var(--o); }
  100% { transform: translate3d(var(--x), -115vh, 0) rotate(var(--r)); opacity: 0; }
}

.grain {
  position: absolute; inset: 0;
  opacity: 0.06;
  mix-blend-mode: overlay;
  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='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Layout ---------- */

.page {
  position: relative;
  width: 100%;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 4vh, 48px) 16px clamp(10px, 2.5vh, 28px);
}

.stage {
  width: 100%;
  flex: none;
  transform-origin: 50% 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 3vh, 32px);
}

.hero { text-align: center; max-width: 620px; }

.logo {
  display: block;
  width: min(300px, 70vw, 30vh);
  height: auto;
  margin: 0 auto clamp(10px, 2.6vh, 28px);
  overflow: visible;
}

.logo-wrap { will-change: transform; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(8px, 1.8vh, 18px);
  padding: 7px 14px;
  border: 1px solid rgba(39, 236, 233, 0.35);
  border-radius: 999px;
  background: rgba(39, 236, 233, 0.08);
  color: var(--teal-hi);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(39, 236, 233, 0.6);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 10px rgba(39, 236, 233, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 236, 233, 0); }
}

.sub {
  margin: 0 0 clamp(12px, 2vh, 20px);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- CTA + reveal ---------- */

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  margin: clamp(16px, 3vh, 28px) auto 0;
  padding: 0 30px;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s, filter 0.2s, translate 0.35s var(--ease-out), opacity 0.25s;
}
.cta .arrow { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s var(--ease-out); }
.cta:hover .arrow { transform: translateX(3px); }
.cta.leaving { opacity: 0; transform: scale(0.96); pointer-events: none; }

/* Collapsed until the CTA is clicked; height animates via grid rows */
.reveal {
  display: grid;
  grid-template-rows: 0fr;
  width: 100%;
  max-width: 520px;
  transition: grid-template-rows 0.6s var(--ease-out);
}
.reveal > .reveal-inner { min-height: 0; overflow: hidden; }
.reveal.open { grid-template-rows: 1fr; }
.reveal.settled > .reveal-inner { overflow: visible; }
.reveal.instant, .reveal.instant .card { transition: none; }
.reveal .card {
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.45s var(--ease-out) 0.1s, transform 0.6s var(--ease-out) 0.05s;
}
.reveal.open .card { opacity: 1; transform: none; }
.reveal:not(.open) { visibility: hidden; margin-top: calc(-1 * clamp(12px, 3vh, 32px)); }
.reveal { transition: grid-template-rows 0.6s var(--ease-out), margin-top 0.6s var(--ease-out); }

.opt { color: var(--faint); font-weight: 500; }

/* ---------- Card + form ---------- */

.card {
  width: 100%;
  max-width: 520px;
  padding: clamp(16px, 3vh, 28px);
  border: 1px solid var(--card-line);
  border-radius: 22px;
  background: var(--card);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

form { display: grid; gap: clamp(10px, 1.7vh, 16px); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.7vh, 16px); }

.field { display: grid; gap: clamp(4px, 0.8vh, 7px); min-width: 0; }

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

input[type="text"], input[type="email"], select {
  width: 100%;
  height: clamp(40px, 5vh, 48px);
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: rgba(255, 255, 255, 0.24); }
input:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(39, 236, 233, 0.16);
  background: rgba(10, 8, 30, 0.6);
}
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field.invalid input:focus, .field.invalid select:focus { box-shadow: 0 0 0 4px rgba(255, 138, 154, 0.16); }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
select { padding-right: 40px; cursor: pointer; }
select:invalid { color: var(--faint); }
select option { color: #111; background: #fff; }

.error {
  margin: 0;
  min-height: 0;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}
.error:empty { display: none; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Custom checkbox */
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.45;
}
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 1px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: var(--field);
  display: grid; place-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.check .box::after {
  content: "";
  width: 5px; height: 10px;
  border-right: 2px solid var(--bg-0);
  border-bottom: 2px solid var(--bg-0);
  transform: translateY(-1px) rotate(45deg) scale(0);
  transition: transform 0.15s var(--ease-out);
}
.check input:checked + .box { background: var(--teal); border-color: var(--teal); }
.check input:checked + .box::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px rgba(39, 236, 233, 0.25); }

/* Button */
.btn {
  position: relative;
  height: clamp(42px, 5.4vh, 52px);
  margin-top: 4px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #4ff3f0 0%, var(--teal) 45%, #13c9c6 100%);
  color: #0c0a24;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(39, 236, 233, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s, filter 0.2s;
}
.btn::before {
  /* light sweep on hover */
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s var(--ease-out);
}
.btn:hover::before { left: 120%; }
.btn:hover { box-shadow: 0 14px 36px -10px rgba(39, 236, 233, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn[disabled] { cursor: progress; filter: saturate(0.8); }

.spinner, .tick {
  position: absolute; left: 50%; top: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}
.spinner {
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2.5px solid rgba(12, 10, 36, 0.25);
  border-top-color: #0c0a24;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.tick { width: 26px; height: 26px; margin: -13px 0 0 -13px; fill: none; stroke: #0c0a24; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
.btn-label { transition: opacity 0.2s; }
.btn.loading .btn-label { opacity: 0; }
.btn.loading .spinner { opacity: 1; }
.btn.done .btn-label { opacity: 0; }
.btn.done .tick { opacity: 1; animation: draw 0.4s var(--ease-out) forwards; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

.fine { margin: 0; color: var(--faint); font-size: 12.5px; line-height: 1.5; text-align: center; }
.status { margin: 0; font-size: 14px; font-weight: 500; text-align: center; color: var(--danger); }
.status:empty { display: none; }

/* Success state */
.success { text-align: center; padding: 18px 4px 10px; animation: fade-up 0.6s var(--ease-out) both; }
.success-mark { display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; height: 30px; }
.success-mark span {
  width: 26px; height: 28px; border-radius: 3px;
  background: radial-gradient(circle at 50% 45%, var(--teal-hi), var(--teal) 75%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -2px 0 rgba(0, 110, 108, 0.7), 0 0 20px rgba(39, 236, 233, 0.45);
  animation: drop 0.55s var(--ease-out) both;
}
.success-mark span:nth-child(2) { animation-delay: 0.08s; }
.success-mark span:nth-child(3) { animation-delay: 0.16s; }
.success-mark span:nth-child(4) { animation-delay: 0.24s; }
.success-title { margin: 0 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.success-sub { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

.foot { color: var(--faint); font-size: 12.5px; text-align: center; }
.foot a { color: var(--faint); }
.foot a:hover { color: var(--teal-hi); }

/* ---------- Entrance animation ---------- */

.hero .eyebrow, .cta, .foot {
  animation: fade-up 0.9s var(--ease-out) both;
}
.hero .eyebrow  { animation-delay: 1.15s; }
.cta            { animation-delay: 1.3s; }
.foot           { animation-delay: 1.7s; }

/* Logo builds itself: tiles drop in top-to-bottom, P slides in, wordmark fades up */
.logo #tile-3, .logo #tile-4, .logo #tile-1, .logo #tile-2 {
  transform-box: fill-box;
  animation: drop 0.6s var(--ease-out) both;
}
.logo #tile-2 { animation-delay: 0.10s; }
.logo #tile-1 { animation-delay: 0.22s; }
.logo #tile-4 { animation-delay: 0.34s; }
.logo #tile-3 { animation-delay: 0.46s; }
.logo #chrome-letters {
  transform-box: fill-box;
  animation: slide-in 0.8s var(--ease-out) 0.62s both;
}
.logo #wordmark, .logo #trademark {
  animation: fade-up-sm 0.8s var(--ease-out) 0.85s both;
}
/* gentle idle float once built */
.logo { animation: float 6s ease-in-out 2s infinite; }

@keyframes drop {
  0%   { transform: translateY(-160%); opacity: 0; }
  60%  { opacity: 1; }
  80%  { transform: translateY(6%); }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes slide-in {
  from { transform: translateX(-30%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fade-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fade-up-sm {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ---------- Cursor interactions (mouse/trackpad only, enabled from main.js) ---------- */

.btn { translate: var(--mx, 0) var(--my, 0); transition: transform 0.15s var(--ease-out), box-shadow 0.2s, filter 0.2s, translate 0.35s var(--ease-out); }
.btn.magnet { transition: transform 0.15s var(--ease-out), box-shadow 0.2s, filter 0.2s, translate 0.12s linear; }

/* ---------- Responsive ---------- */

@media (max-width: 520px) {
  .card { padding: clamp(14px, 2.6vh, 22px) 16px; border-radius: 18px; }
  .row { gap: 10px; }
  .sub { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .tiles { display: none; }
}
