@font-face {
  font-family: "Haskoy";
  src: url("assets/fonts/Haskoy-wght.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  /* colour */
  --ink: #03031c;
  --indigo: #4133ff;
  --indigo-2: #5a4dff;
  --teal: #7fe3da;
  --text-2: #313131;
  --grey-card: #5c5a73;
  --lavender: #eeecff;
  --lavender-2: #d9d5ff;
  --stroke-card: #d6d1ff;
  --error: #d92d4f;

  /* type (Figma 10875:71217) */
  --font: "Haskoy", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-display-size: clamp(44px, 5.56vw, 80px);
  --t-display: 600 var(--t-display-size) / 1 var(--font);
  --t-display-track: -0.03em;
  --t-deck-size: clamp(22px, 2.65vw, 38px);
  --t-deck: 400 var(--t-deck-size) / 1.25 var(--font);
  --t-deck-track: -0.01em;
  --t-button: 500 16px / 1.3 var(--font);
  --t-body: 400 15px / 1.3 var(--font);
  --t-note: 400 14px / 1.3 var(--font);
  --t-caption: 400 13px / 1.3 var(--font);
  --muted: #5c5a73;
  --note: #4a4860;

  /* layout */
  --gutter: 96px;
  --header-top: 56px;
  --logo-w: 116px;
  --copy-w: 640px;
  --form-w: 420px;
  --gap-title-deck: 16px; /* tight, so the two lines read as one headline (Figma had 30) */
  --gap-title-form: 40px;
  --control-h: 64px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #fbfbff; /* flat page colour (user, 27 Oct); the glass background shape is removed */
}

body {
  margin: 0;
  font: var(--t-body);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.t-display { font: var(--t-display); letter-spacing: var(--t-display-track); color: var(--ink); }
.t-deck { font: var(--t-deck); letter-spacing: var(--t-deck-track); color: var(--muted); }
.t-button { font: var(--t-button); }
.t-body { font: var(--t-body); }
.t-caption { font: var(--t-caption); }

/* ---------- background ---------- */
.backdrop { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; display: none; } /* the Figma background image replaces the glows */
.glow { position: absolute; border-radius: 50%; }
.glow--lilac {
  width: 70vw; height: 80vh; left: 45vw; top: 10vh;
  background: radial-gradient(closest-side, rgba(150, 140, 255, 0.16), rgba(150, 140, 255, 0));
}
.glow--soft {
  width: 60vw; height: 70vh; left: -14vw; top: 14vh;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
}

/* ---------- page shell ---------- */
.page {
  position: relative; z-index: 1;
  min-height: max(100svh, 720px);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: var(--header-top) var(--gutter) 56px;
  overflow: hidden; /* fallback for overflow: clip */
  overflow: clip;
}

.site-header { position: relative; z-index: 3; }
.logo { display: inline-block; width: var(--logo-w); color: var(--ink); line-height: 0; }
.logo svg { width: 100%; height: auto; }
.logo:focus-visible { outline: 2px solid var(--indigo); outline-offset: 6px; border-radius: 6px; }

.hero { display: grid; grid-template-columns: minmax(0, var(--copy-w)) 1fr; align-items: center; }

.hero__copy { position: relative; z-index: 2; padding: 45px 0 40px; } /* title cap top at y 318 in a 960-high window, as in Figma 10977:110274 */

/* Figma measures text tight to the letters (cap height to baseline), so trim the line boxes the same way:
   title 30 px above the deck, deck 40 px above the field, exactly as in 10914:71240 */
.title { margin: 0 0 var(--gap-title-form); display: grid; gap: var(--gap-title-deck); }
.title > span { display: block; text-box: trim-both cap alphabetic; }
@supports not (text-box: trim-both cap alphabetic) {
  /* older browsers: the same trim from Haskoy's metrics (ascender 0.991, descender 0.293, cap height 0.70 em):
     line height 1 trims 0.149 / 0.151 em, line height 1.25 trims 0.274 / 0.276 em */
  .title .t-display { margin: -0.149em 0 -0.151em; }
  .title .t-deck { margin: -0.274em 0 -0.276em; }
}

.site-footer { position: relative; z-index: 3; display: flex; gap: 24px; color: var(--muted); }
.site-footer a { color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:focus-visible { outline: 2px solid var(--indigo); outline-offset: 4px; border-radius: 4px; }

/* ---------- waitlist form ---------- */
.join { width: min(var(--form-w), 100%); min-width: 0; }

.field {
  height: var(--control-h); border-radius: 999px;
  background: rgba(78, 64, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.field input {
  width: 100%; height: 100%; padding: 0 26px;
  border: 0; background: transparent; border-radius: 999px; color: var(--ink);
}
.field input::placeholder { color: var(--muted); }
.field input:focus { outline: none; }
/* business-type dropdown (Figma 10977:110274): same pill as the email field, 14px below it, chevron 20px from the right */
.field--select { position: relative; z-index: 3; margin-top: 14px; } /* above the button, so the open menu covers it */
.field--select select {
  width: 100%; height: 100%; padding: 0 60px 0 26px;
  border: 0; background: transparent; border-radius: 999px; color: var(--ink);
  -webkit-appearance: none; appearance: none; cursor: pointer;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden; /* long answers end in … on small screens */
}
.field--select select:focus { outline: none; }
.field--select select:invalid { color: var(--muted); } /* the placeholder shows in the placeholder colour */
.field--select option { color: var(--ink); }
.field__chevron { position: absolute; right: 19px; top: 50%; translate: 0 -50%; pointer-events: none; }
/* ---------- custom dropdown (main.js enhances the native select; without JS the select still works) ---------- */
.field--select.is-enhanced select { display: none; }
.dd__trigger {
  display: block; min-width: 0; width: 100%; height: 100%; padding: 0 60px 0 26px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dd__trigger.is-placeholder { color: var(--muted); }
.dd__trigger:focus { outline: none; }
.dd__trigger:disabled { cursor: default; }
.field--select .field__chevron { transition: rotate 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.field--select.is-open .field__chevron { rotate: 180deg; }
.field--select.is-open { border-color: rgba(65, 51, 255, 0.55); box-shadow: 0 0 0 4px rgba(65, 51, 255, 0.14); }

.dd__panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 10;
  margin: 0; padding: 6px; list-style: none;
  background: #fff; border-radius: 20px;
  box-shadow: 0 22px 44px -14px rgba(30, 24, 120, 0.26), 0 4px 10px -4px rgba(30, 24, 120, 0.1);
  opacity: 0; translate: 0 -6px; scale: 0.985; transform-origin: 50% 0;
  visibility: hidden; pointer-events: none;
  transition: opacity 0.18s ease-out, translate 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              scale 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.24s;
}
.field--select.is-open .dd__panel {
  opacity: 1; translate: 0 0; scale: 1; visibility: visible; pointer-events: auto;
  transition: opacity 0.16s ease-out, translate 0.26s cubic-bezier(0.2, 0.8, 0.2, 1),
              scale 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
}
.dd__panel:focus { outline: none; }
.dd__option {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 14px 12px 20px;
  border-radius: 14px; font: var(--t-body); line-height: 1.35; color: var(--ink); cursor: pointer;
  transition: background-color 0.12s ease-out;
}
.dd__option + .dd__option { margin-top: 2px; }
.dd__option span { flex: 1; }
.dd__option.is-active { background: #f1f0ff; }
.dd__option[aria-selected="true"] { color: var(--indigo); font-weight: 500; }
.dd__check { flex: none; width: 20px; height: 20px; opacity: 0; color: var(--indigo); }
.dd__option[aria-selected="true"] .dd__check { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .dd__panel, .field--select.is-open .dd__panel, .field--select .field__chevron { transition: none; }
}

.join.is-error-business .field--select { border-color: rgba(217, 45, 79, 0.7); box-shadow: 0 0 0 4px rgba(217, 45, 79, 0.12); }
.field:focus-within { border-color: rgba(65, 51, 255, 0.55); box-shadow: 0 0 0 4px rgba(65, 51, 255, 0.14); }
.join.is-error .field:not(.field--select) { border-color: rgba(217, 45, 79, 0.7); box-shadow: 0 0 0 4px rgba(217, 45, 79, 0.12); }

.slide {
  position: relative; display: block; width: 100%; height: var(--control-h); margin-top: 12px;
  padding: 0 0 0 58px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(90deg, var(--indigo) 0%, var(--indigo-2) 55%, var(--teal) 100%);
  box-shadow: 0 12px 32px -6px rgba(89, 77, 255, 0.45);
  color: #fff;
  touch-action: pan-y;
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.slide:hover { box-shadow: 0 16px 36px -6px rgba(89, 77, 255, 0.55); }
.slide:active { transform: scale(0.99); }
.slide:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.slide__fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: rgba(255, 255, 255, 0.14); pointer-events: none;
}
.slide__label { position: relative; pointer-events: none; transition: opacity 0.2s; }
.slide__knob {
  position: absolute; left: 6px; top: 6px; width: 52px; height: 52px; border-radius: 50%;
  background: #fff; box-shadow: 0 4px 10px rgba(3, 3, 28, 0.20);
  display: grid; place-items: center; cursor: grab;
  transform: translateX(var(--kx, 0px));
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.slide.is-dragging .slide__knob { transition: none; cursor: grabbing; }
.slide.is-done .slide__knob, .slide.is-loading .slide__knob { transform: translateX(calc(var(--slide-w, 420px) - 64px)); }
.slide__knob > * { grid-area: 1 / 1; transition: opacity 0.2s, transform 0.3s; }
.i-check, .i-spin { opacity: 0; transform: scale(0.6); }
.i-spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.2px solid rgba(65, 51, 255, 0.2); border-top-color: var(--indigo);
}
.slide.is-loading .i-arrow, .slide.is-done .i-arrow { opacity: 0; transform: scale(0.6); }
.slide.is-loading .i-spin { opacity: 1; transform: scale(1); animation: spin 0.8s linear infinite; }
.slide.is-done .i-check { opacity: 1; transform: scale(1); }
.slide.is-done { cursor: default; }
.join.is-shake .slide__knob { animation: shake 0.42s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake {
  0%, 100% { translate: 0; }
  20% { translate: 10px; } 40% { translate: -6px; }
  60% { translate: 6px; } 80% { translate: -3px; }
}

.note { margin: 20px 0 0; font: var(--t-note); color: var(--note); min-height: 18px; }
.join.is-error .note { color: var(--error); }

/* ---------- 3D lineup ---------- */
.hero__visual {
  position: absolute; z-index: 1;
  top: 0; bottom: 0; right: 0; left: 40%;
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none; user-select: none;
}
.hero__visual.is-dragging { cursor: grabbing; }
.stage-wrap {
  position: absolute; left: 0; top: 0; width: 1440px; height: 960px;
  transform-origin: 0 0;
  visibility: hidden; /* shown by main.js once it is fitted */
}
.stage { position: absolute; left: 0; top: 0; width: 0; height: 0; perspective: 1000px; perspective-origin: 0 0; }
.ribbon { position: absolute; left: 0; top: 0; transform-style: preserve-3d; transform: rotateZ(-10deg); }

.card {
  position: absolute; left: -160px; top: -240px; width: 320px; height: 480px;
  transform-style: preserve-3d;
  transform-origin: 50% 100%; /* cards hinge on their bottom edge, like a fanned deck */
  will-change: transform;
  --far: 0; --a: 1;
}
/* opacity lives on the layers, not the card, so the card keeps its 3D edge while fading */
.card > * { position: absolute; inset: 0; border-radius: 24px; opacity: var(--a); }
.card__edge {
  transform: translateZ(-14px);
  border: 1.5px solid rgba(143, 242, 255, calc(0.8 - var(--far) * 0.4));
  background: linear-gradient(90deg, rgba(191, 250, 255, 0.30), rgba(140, 128, 255, 0.22));
  box-shadow: 0 0 18px rgba(115, 217, 255, calc(0.32 - var(--far) * 0.19));
}
.card__face {
  padding: 28px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.card__shade {
  background: linear-gradient(90deg, rgba(222, 219, 255, 0.9), rgba(222, 219, 255, 0.5) 70%, rgba(222, 219, 255, 0.35));
  opacity: calc(var(--a) * var(--shade, 0));
  pointer-events: none;
}
.card__glass {
  border: 1.2px solid rgba(255, 255, 255, calc(0.45 - var(--far) * 0.25));
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 30%); /* a light sheen; the colour stays solid */
  transform: translateZ(0.6px);
  pointer-events: none;
}

.card__top { display: flex; align-items: center; justify-content: space-between; }
.card__icon {
  width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-accent); color: var(--c-icon);
}
.card__icon svg { width: 40px; height: 40px; }
.card__face { background: var(--c-bg, #4336ff); color: var(--c-text, #f8f5f2); } /* never see-through, even with a missing tone */
.card__num { font: 500 14px / 1 var(--font); letter-spacing: 0.06em; color: var(--c-text); opacity: 0.72; }
.card__name { margin: 0; font: 600 52px / 1.05 var(--font); letter-spacing: -0.02em; }
.card__line { margin: 12px 0 0; height: 49px; font: 400 18px / 1.35 var(--font); color: var(--c-text); opacity: var(--c-line, 0.82); }

/* the six Happ brand tiles: card colour, text colour, accent (icon circle); the icon takes the card colour */
/* ink, crimson and teal are neutral clear glass: no strong colour, the cards behind show through, dark text on top */
.tone-ink      { --c-bg: rgba(246, 247, 252, 0.6); --c-text: #0b0b22; --c-accent: #4336ff; --c-icon: #f8f5f2; }
.tone-lavender { --c-bg: #d8dbff; --c-text: #0b0b22; --c-accent: #4336ff; --c-icon: #d8dbff; }
.tone-indigo   { --c-bg: #4336ff; --c-text: #d8dbff; --c-accent: #85e1de; --c-icon: #4336ff; }
.tone-crimson  { --c-bg: rgba(252, 248, 246, 0.6); --c-text: #0b0b22; --c-accent: #e91b58; --c-icon: #f8f5f2; }
/* the see-through cards show the cards behind them, not the glass edge's tint */
.tone-ink .card__edge, .tone-crimson .card__edge, .tone-teal .card__edge { background: none; }
/* clearest at the top, frostier at the bottom where the name and line sit, so text behind never competes */
.tone-ink .card__face {
  background: linear-gradient(180deg, rgba(246, 247, 252, 0.38) 0%, rgba(246, 247, 252, 0.5) 38%, rgba(246, 247, 252, 0.86) 62%, rgba(246, 247, 252, 0.9) 100%);
}
.tone-crimson .card__face {
  background: linear-gradient(180deg, rgba(252, 248, 246, 0.38) 0%, rgba(252, 248, 246, 0.5) 38%, rgba(252, 248, 246, 0.86) 62%, rgba(252, 248, 246, 0.9) 100%);
}
.tone-teal .card__face {
  background: linear-gradient(180deg, rgba(244, 250, 250, 0.38) 0%, rgba(244, 250, 250, 0.5) 38%, rgba(244, 250, 250, 0.86) 62%, rgba(244, 250, 250, 0.9) 100%);
}
/* a clear rim, and a soft white glow behind the letters so they stand out from what shows through */
.tone-ink .card__face, .tone-crimson .card__face, .tone-teal .card__face {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), inset 0 0 40px rgba(255, 255, 255, 0.35);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.95), 0 0 14px rgba(255, 255, 255, 0.7);
}
.tone-teal     { --c-bg: rgba(244, 250, 250, 0.6); --c-text: #0b0b22; --c-accent: #85e1de; --c-icon: #0b0b22; }
.tone-cream    { --c-bg: #f8f5f2; --c-text: #0b0b22; --c-accent: #4336ff; --c-icon: #f8f5f2; }
/* the light tiles get a hairline so they hold their edge on the white page */
.tone-cream .card__face, .tone-lavender .card__face { box-shadow: inset 0 0 0 1px rgba(11, 11, 34, 0.08); }

/* ---------- v2: the curve runs edge to edge ---------- */
/* the card area covers the whole page (behind the copy); only the cards take the pointer */
[data-deck="s"] .hero__visual { left: 0; pointer-events: none; cursor: auto; }
[data-deck="s"] .ribbon { transform: none; } /* the curve is drawn in page space; no global roll */
/* neighbours sit only ~5-8px apart in depth on the curve, so the glass edge stays close behind its face */
[data-deck="s"] .card__edge { transform: translateZ(-3px); }
/* thicker-looking glass rim, and a streak of light that runs along the ribbon (--sweep set by main.js) */
[data-deck="s"] .card__glass {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), inset 0 -10px 24px rgba(160, 230, 255, 0.18);
  overflow: hidden;
}
[data-deck="s"] .card__glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0) 58%);
  background-size: 250% 100%;
  background-position: calc(var(--sweep, 0) * 100%) 0;
}
[data-deck="s"] .card { will-change: transform, filter; }
[data-deck="s"] .card { pointer-events: auto; cursor: grab; transform-origin: 50% 50%; } /* centred on the curve */
[data-deck="s"] .hero__visual.is-dragging .card { cursor: grabbing; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  :root { --gutter: 64px; --header-top: 44px; --logo-w: 108px; }
}

/* tablet and phone: copy first, cards below */
@media (max-width: 1100px) {
  :root {
    --gutter: 40px; --gap-title-form: 36px; --gap-title-deck: 12px;
    --t-display-size: clamp(44px, 7vw, 64px); --t-deck-size: clamp(22px, 3.4vw, 30px);
  }
  .page { min-height: 0; padding-bottom: 32px; }
  .hero { grid-template-columns: minmax(0, 1fr); } /* never wider than the screen, even with a long answer chosen */
  .hero__copy { padding: 56px 0 8px; }
  .hero__visual {
    position: relative; left: auto; right: auto; height: 520px; margin: 0 calc(var(--gutter) * -1);
    overflow: hidden; /* keeps the front card's swoosh out of the form above */
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 20px; --header-top: 24px; --logo-w: 96px; --gap-title-form: 28px; --gap-title-deck: 8px;
    --t-display-size: clamp(36px, 10.6vw, 46px); --t-deck-size: clamp(19px, 5.4vw, 24px);
  }
  .hero__copy { padding-top: 40px; }
  .hero__visual { height: 380px; margin-top: -8px; margin-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .slide__knob { transition: none; }
}

/* spam trap (index.html): off screen, never focused, read by bots only */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
