/* Brand tokens mirror @reef-support/theme (packages/theme/src/brand.ts, typography.ts). */
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/alegreya-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/alegreya-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/alegreya-sans-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Caudex";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/caudex-latin-700-normal.woff2") format("woff2");
}

:root {
  --abyss-navy: #112641;
  --deep-ocean-teal: #023e59;
  --the-reef: #156581;
  --midnight-void: #020e11;
  --stone-current: #c1c1c1;
  --soft-mist: #f4f4f4;
  --sea-glass: #4db8d1;
  --sea-glass-light: #7fd0e2;
  --text: var(--soft-mist);
  --text-soft: rgba(244, 244, 244, 0.78);
  --text-faint: rgba(244, 244, 244, 0.52);
  --error: #ffb4ab;

  --font-display: "Alegreya Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Caudex", ui-serif, Georgia, Cambria, "Times New Roman", serif;

  --radius-card: 20px;
  --radius-control: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--midnight-void);
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(120% 55% at 50% -12%, rgba(77, 184, 209, 0.32), transparent 62%),
    linear-gradient(180deg, #0b4b68 0%, var(--deep-ocean-teal) 24%, var(--abyss-navy) 58%, var(--midnight-void) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg {
  display: block;
}

/* ── Ocean backdrop ─────────────────────────────────────────────── */
.ocean {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.surface {
  position: absolute;
  inset: 0 0 auto;
  height: 180px;
  background:
    radial-gradient(40% 60% at 20% 0%, rgba(180, 230, 245, 0.16), transparent 70%),
    radial-gradient(35% 50% at 70% 0%, rgba(180, 230, 245, 0.12), transparent 70%),
    radial-gradient(30% 45% at 45% 0%, rgba(180, 230, 245, 0.1), transparent 70%),
    linear-gradient(180deg, rgba(244, 244, 244, 0.08), transparent);
  background-size: 200% 100%, 200% 100%, 200% 100%, 100% 100%;
  mask-image: linear-gradient(180deg, #000 10%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 10%, transparent);
  animation: shimmer 24s ease-in-out infinite alternate;
}

.rays,
.rays::before {
  position: absolute;
  top: -10vh;
  left: 50%;
  width: 160vmax;
  height: 110vh;
  translate: -50% 0;
  transform-origin: 50% 0;
  background: repeating-linear-gradient(
    96deg,
    transparent 0 5%,
    rgba(180, 230, 245, 0.07) 6% 8%,
    transparent 9% 13%,
    rgba(180, 230, 245, 0.04) 14% 15%,
    transparent 16% 22%
  );
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
  filter: blur(5px);
  animation: sway 16s ease-in-out infinite alternate;
}

.rays::before {
  content: "";
  top: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    84deg,
    transparent 0 7%,
    rgba(180, 230, 245, 0.05) 8% 10%,
    transparent 11% 19%
  );
  animation-duration: 22s;
  animation-direction: alternate-reverse;
}

.bubbles span {
  position: absolute;
  bottom: -40px;
  left: var(--x, 50%);
  width: var(--s, 8px);
  height: var(--s, 8px);
  border-radius: 50%;
  border: 1px solid rgba(244, 244, 244, 0.35);
  background: radial-gradient(circle at 32% 30%, rgba(244, 244, 244, 0.55), rgba(244, 244, 244, 0.06) 60%, transparent 70%);
  opacity: 0;
  animation: rise var(--d, 14s) linear var(--delay, 0s) infinite;
}

.bubbles span:nth-child(1)  { --x: 6%;  --s: 6px;  --d: 15s; --delay: -2s; }
.bubbles span:nth-child(2)  { --x: 12%; --s: 10px; --d: 19s; --delay: -9s; }
.bubbles span:nth-child(3)  { --x: 19%; --s: 4px;  --d: 12s; --delay: -5s; }
.bubbles span:nth-child(4)  { --x: 27%; --s: 7px;  --d: 17s; --delay: -13s; }
.bubbles span:nth-child(5)  { --x: 36%; --s: 5px;  --d: 21s; --delay: -3s; }
.bubbles span:nth-child(6)  { --x: 58%; --s: 4px;  --d: 16s; --delay: -11s; }
.bubbles span:nth-child(7)  { --x: 66%; --s: 9px;  --d: 20s; --delay: -6s; }
.bubbles span:nth-child(8)  { --x: 73%; --s: 5px;  --d: 13s; --delay: -1s; }
.bubbles span:nth-child(9)  { --x: 81%; --s: 12px; --d: 23s; --delay: -15s; }
.bubbles span:nth-child(10) { --x: 88%; --s: 6px;  --d: 18s; --delay: -7s; }
.bubbles span:nth-child(11) { --x: 93%; --s: 4px;  --d: 14s; --delay: -10s; }
.bubbles span:nth-child(12) { --x: 46%; --s: 3px;  --d: 24s; --delay: -18s; }

.reef {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: clamp(140px, 26vh, 280px);
}

.coral-back { stroke: #0b3a55; stroke-width: 12; opacity: 0.85; }
.coral-front { stroke: #072638; stroke-width: 16; }
.dune-back { fill: #0a2034; }
.dune-front { fill: #03121b; }

/* ── Layout ─────────────────────────────────────────────────────── */
.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding:
    max(28px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.brand {
  width: 100%;
  display: flex;
  justify-content: center;
  animation: fade-up 0.9s var(--ease-out) both;
}

.logo {
  width: clamp(168px, 30vw, 236px);
  height: auto;
  filter: drop-shadow(0 6px 24px rgba(2, 14, 17, 0.45));
}

.hero {
  width: 100%;
  max-width: 640px;
  margin-block: auto;
  padding-block: clamp(32px, 7vh, 72px) clamp(24px, 5vh, 48px);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 6px 14px;
  border: 1px solid rgba(77, 184, 209, 0.38);
  border-radius: 999px;
  background: rgba(77, 184, 209, 0.1);
  color: var(--sea-glass-light);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  animation: fade-up 0.9s var(--ease-out) 0.08s both;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sea-glass);
  box-shadow: 0 0 0 0 rgba(77, 184, 209, 0.6);
  animation: pulse 2.4s ease-out infinite;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.3rem, 7vw, 3.9rem);
  line-height: 1.04;
  letter-spacing: -0.012em;
  text-wrap: balance;
  animation: fade-up 0.9s var(--ease-out) 0.16s both;
}

.lede {
  max-width: 50ch;
  margin: 20px auto 0;
  color: var(--text-soft);
  font-size: clamp(1.06rem, 2.4vw, 1.22rem);
  line-height: 1.55;
  text-wrap: pretty;
  animation: fade-up 0.9s var(--ease-out) 0.24s both;
}

/* ── Card & form ────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 480px;
  margin: 36px auto 0;
  padding: clamp(20px, 4.5vw, 32px);
  text-align: left;
  border: 1px solid rgba(244, 244, 244, 0.14);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(244, 244, 244, 0.09), rgba(244, 244, 244, 0.04));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 32px 80px -24px rgba(2, 14, 17, 0.75),
    inset 0 1px 0 rgba(244, 244, 244, 0.1);
  animation: fade-up 0.9s var(--ease-out) 0.32s both;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.optional {
  margin-left: 6px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-faint);
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(2, 14, 17, 0.42);
  border: 1px solid rgba(193, 193, 193, 0.24);
  border-radius: var(--radius-control);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(244, 244, 244, 0.38);
}

input:hover,
textarea:hover {
  border-color: rgba(193, 193, 193, 0.4);
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--sea-glass);
  background: rgba(2, 14, 17, 0.55);
  box-shadow: 0 0 0 3px rgba(77, 184, 209, 0.28);
}

input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(255, 180, 171, 0.18);
}

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

.submit {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--midnight-void);
  background: linear-gradient(135deg, var(--sea-glass-light), var(--sea-glass));
  box-shadow: 0 12px 32px -12px rgba(77, 184, 209, 0.7);
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease, filter 0.2s ease;
}

.submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 16px 36px -12px rgba(77, 184, 209, 0.85);
}

.submit:active {
  transform: translateY(0);
}

.submit:focus-visible {
  outline: 3px solid var(--soft-mist);
  outline-offset: 3px;
}

.submit:disabled {
  cursor: progress;
  filter: saturate(0.6);
  transform: none;
}

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 0.95rem;
  text-align: center;
}

.status.is-error {
  color: var(--error);
}

.fineprint {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
  text-align: center;
}

.success {
  padding: 12px 0 8px;
  text-align: center;
  outline: none;
  animation: fade-up 0.6s var(--ease-out) both;
}

.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--sea-glass);
}

.success h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.7rem;
  line-height: 1.15;
}

.success-text {
  margin: 10px 0 0;
  color: var(--text-soft);
}

.footer {
  width: 100%;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

/* ── Motion ─────────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes sway {
  from { transform: rotate(-3deg); }
  to { transform: rotate(3deg); }
}

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

@keyframes rise {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  10% { opacity: 0.8; }
  50% { transform: translate3d(14px, -55vh, 0); }
  90% { opacity: 0.5; }
  100% { opacity: 0; transform: translate3d(-6px, -110vh, 0); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(77, 184, 209, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(77, 184, 209, 0); }
  100% { box-shadow: 0 0 0 0 rgba(77, 184, 209, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .bubbles {
    display: none;
  }
}
