/* =========================================
   HERO SCROLL SECTION
   =========================================
   Architecture:
   - .hero-scroll-section  : 100vh — full viewport, traps wheel events
   - .hero-sticky          : 100vh inner wrapper, clips overflow
   - .hero-inner           : absolute, constrained by header and indicators
   - .hero-title-mask      : overflow:hidden clipping window for titles
   - .hero-boxes-stage     : relative container for three boxes
   - .hero-cta-area        : arrow btn morphs to Join btn
   - .hero-indicators-bar  : pinned 32px above bottom

   State machine (JS-driven, 3 states, 400ms CSS transitions):
     State 0 → title 1, single box, arrow
     State 1 → title 2, box scaled 0.9, arrow
     State 2 → title 3, 3 boxes, Join CTA
   ========================================= */

/* ── Nav: always fixed on home page so the absolute→fixed jump never occurs ── */
.header-area {
  position: fixed !important;
}

/* ── Scroll architecture ── */
.hero-scroll-section {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.hero-sticky {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

/* ── Main inner content ── */
.hero-inner {
  position: absolute;
  top: 80px;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /*
    gap = min 24px so there's always breathing room.
    The stage height formula (100vh - 450px) is derived from:
      80px top + 52px bottom + 144px title + 54px subtext + 48px cta + 3×24px gaps = 450px
    This means the stage always gets exactly the remaining vertical space.
  */
  gap: clamp(24px, 3.5vh, 36px);
  z-index: 1;
}

/* ── Title mask ─────────────────────────────────
   height = exactly 2 lines of title text.
   overflow:hidden clips entering/exiting titles.
   ─────────────────────────────────────────────── */
.hero-title-mask {
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: center;
  font-size: 48px;
  line-height: 1.1;
  /* 3.5em = ~1em fade zone at top + 2.2em for two lines at 1.1 line-height + buffer */
  height: 3.5em;
  flex-shrink: 0;
  /* gradient: titles fade out as they exit upward, subtle fade on entry from below */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 28%,
    black 95%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 28%,
    black 95%,
    transparent 100%
  );
}

.hero-title {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  font-family: "Luckiest Guy", cursive;
  font-size: inherit;
  line-height: 1.1;
  color: #1a1a1a;
  will-change: transform;
  white-space: nowrap;
}

.hero-title span {
  color: #eb1f0b;
}

/* Initial transforms match State 0 — JS overrides on advance */
.hero-title--1 {
  transform: translateY(50%);
}
.hero-title--2 {
  transform: translateY(185%);
}
.hero-title--3 {
  transform: translateY(185%);
}

/* ── Box stage ───────────────────────────────────
   Fixed internal design size: 1080 × 400px.
   JS scales the entire stage uniformly via transform: scale()
   so every box size and animation offset is always identical.
   ─────────────────────────────────────────────── */
.hero-boxes-stage {
  position: relative;
  /* Design size — JS will scale this down on smaller viewports */
  width: 1080px;
  height: 400px;
  flex-shrink: 0;
  transform-origin: top center;
  /* JS sets transform: scale(var) inline */
  /* The stage's scaled visual height is set via margin-bottom by JS too */
}

/* All boxes are absolutely centred within the stage */
.hero-box {
  position: absolute;
  top: 50%;
}

.hero-box img {
  display: block;
  height: auto;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* ── Center box ── */
.hero-box--center {
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  will-change: transform;
  z-index: 2;
}

.hero-box--center img {
  width: 360px;
  height: auto;
}

/* ── Left box (70% of center) ── */
.hero-box--left {
  right: calc(50% + 164px);
  transform: translateY(-50%) translateX(-120%);
  opacity: 0;
  will-change: transform, opacity;
  z-index: 1;
}

.hero-box--left img {
  width: 224px;
  height: auto;
}

/* ── Right box (80% of center) ── */
.hero-box--right {
  left: calc(50% + 164px);
  transform: translateY(-50%) translateX(120%);
  opacity: 0;
  will-change: transform, opacity;
  z-index: 1;
}

.hero-box--right img {
  width: 256px;
  height: auto;
}

/* ── Hero subtext (state 3 reveal) ── */
.hero-subtext {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: #555;
  text-align: center;
  max-width: 480px;
  margin: 0;
  /* pull up so gap from title-mask is always 8px regardless of hero-inner gap */
  margin-top: calc(8px - clamp(24px, 3.5vh, 36px));
  /* controlled entirely by JS: height 0→auto, opacity 0→1 */
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  will-change: height, opacity, transform;
}

/* ── Inner parallax wrapper (mouse effect) ── */
.hero-box-inner {
  will-change: transform;
}

/* ── CTA area ── */
.hero-cta-area {
  position: relative;
  width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  flex-shrink: 0;
}

/* Round arrow button */
.hero-arrow-btn {
  position: absolute;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eb1f0b;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(235, 31, 11, 0.4);
  will-change: opacity, transform;
  padding: 0;
  outline: none;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-arrow-btn:hover {
  box-shadow: 0 4px 20px rgba(235, 31, 11, 0.4);
}

.hero-arrow-btn svg {
  animation: heroBounce 1.8s ease-in-out infinite;
}

@keyframes heroBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

/* Email form — morphs from circle to input + button */
.hero-email-form {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0;
  /* Circle (pre-morph) state — form is opacity:0 in states 0-2, so styling here
     only affects the morph start point. Keep white/no-shadow to avoid artifacts. */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  padding: 0;
  box-shadow: none;
  border: 1px solid #e1e4eb;
  overflow: hidden;
  pointer-events: none;
  will-change: width, height, border-radius, padding;
  transition:
    width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease;
}

/* ── Static variant: used outside the hero animation (e.g. subscribe section) ── */
.hero-email-form--static {
  position: relative !important;
  opacity: 1 !important;
  margin: 0 auto;
  overflow: hidden;
  transition: none;
  width: 420px !important;
  height: 48px !important;
  border-radius: 999px;
  pointer-events: auto !important;
}

/* Error tooltip needs to escape the clipped container */
.hero-email-form--static.is-error {
  overflow: visible;
}

/* Round the input so Chrome's autofill background follows the pill shape */
.hero-email-form--static .hero-email-input {
  border-radius: 999px 0 0 999px;
}

/* ── Expanded (post-morph) state ── */
.hero-email-form.is-expanded {
  z-index: 2;
  width: 420px;
  height: 48px;
  border-radius: 999px;
  padding: 4px;
  gap: 0;
  background: #ffffff;
  border: 1px solid #e1e4eb;
  box-shadow: none;
  overflow: visible;
  pointer-events: auto;
}

.hero-email-form.is-expanded:hover {
  border-color: #e1e4eb;
  box-shadow: none;
}

/* Focus state — blue border on form */
.hero-email-form.is-expanded.is-focused {
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.12);
}

/* Error state on form */
.hero-email-form.is-expanded.is-error {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

/* Error message below input */
.hero-email-form.is-error::after {
  content: attr(data-error);
  position: absolute;
  bottom: -28px;
  left: 0;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: #e74c3c;
  white-space: nowrap;
  opacity: 1;
  animation: slideInError 0.3s ease;
}

@keyframes slideInError {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Success overlay */
.hero-email-form.is-success {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-color: #e1e4eb;
  box-shadow: none;
}

.hero-email-form.is-success .hero-email-input,
.hero-email-form.is-success .hero-email-btn,
.hero-email-form.is-success .hero-email-placeholder {
  display: none;
}

.hero-email-form.is-success::before {
  content: none;
}

/* Success message inside hero form */
.hero-success-msg {
  display: none;
  align-items: center;
  gap: 10px;
  color: #222731;
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.hero-email-form.is-success .hero-success-msg {
  display: flex;
}

/* Input field — hidden until expanded */
.hero-email-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #1a1a1a;
  width: 0;
  opacity: 0;
  transition:
    opacity 0.3s ease 0.5s,
    width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  padding: 0 18px;
  height: 100%;
  display: flex;
  align-items: center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-shadow: none;
}

.hero-email-input::placeholder {
  color: transparent; /* hidden — animated span handles placeholder display */
}

/* Animated placeholder span — positioned over the input */
.hero-email-placeholder {
  position: absolute;
  left: 22px; /* match input padding-left */
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 400;
  pointer-events: none;
  white-space: nowrap;
  display: none; /* shown by JS when animation starts */
}

/* Blinking cursor after the animated text */
.hero-email-placeholder::after {
  content: "|";
  margin-left: 1px;
  animation: placeholderBlink 1s step-start infinite;
}

@keyframes placeholderBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.hero-email-form.is-expanded .hero-email-input {
  width: 100%;
  opacity: 1;
  pointer-events: auto;
  padding: 0 18px;
  border: none;
}

/* Focus state — blue border */
.hero-email-form.is-expanded .hero-email-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

/* When form is focused, input border becomes transparent (form border handles it) */
.hero-email-form.is-expanded.is-focused .hero-email-input {
  border: none;
}
/* Error state — red border */
.hero-email-form.is-expanded .hero-email-input.is-error,
.hero-email-form.is-expanded .hero-email-input.is-error:focus {
  border: none !important;
  box-shadow: none !important;
}

/* Suppress browser validation styling */
.hero-email-input:invalid {
  box-shadow: none !important;
  border-color: transparent !important;
}

.hero-email-input:invalid:focus {
  outline: none;
  box-shadow: none !important;
  border-color: transparent !important;
}

/* Success state — can be hidden or styled */
.hero-email-form.is-expanded .hero-email-input.is-success {
  border-color: transparent;
  color: transparent;
  pointer-events: none;
}

/* Remove autofill background color */
.hero-email-input:-webkit-autofill,
.hero-email-input:-webkit-autofill:hover,
.hero-email-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  -webkit-text-fill-color: #1a1a1a !important;
  border: none !important;
}

/* Submit button — locked as a 40px circle during phase 1 via max-width */
.hero-email-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  max-width: 40px; /* hard cap — button stays 40px circle during form expansion */
  height: 40px;
  border-radius: 999px;
  background: #eb1f0b;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* clips text that's wider than max-width */
  padding: 0;
  cursor: pointer;
  color: transparent; /* hidden during phase 1 */
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  box-shadow: none;
  white-space: nowrap;
  transition: background 0.2s cubic-bezier(0.42, 0, 0.18, 1);
}

/* Phase 2: JS adds is-btn-expanded AFTER form expansion finishes */
.hero-email-form.is-btn-expanded .hero-email-btn {
  max-width: 160px;
  padding: 0 16px;
  color: #fff;
  transition:
    max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.2s ease 0.3s,
    background 0.2s cubic-bezier(0.42, 0, 0.18, 1);
}

.hero-email-form.is-expanded .hero-email-btn:hover {
  background: #ff3520;
}

.hero-email-form.is-expanded .hero-email-btn:active {
  background: #c91a09;
}

.hero-email-btn:focus {
  outline: none;
}

/* ── Social bar (state 3 reveal) ── */
.hero-indicators-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  display: none; /* social icons removed from hero */
  align-items: center;
  gap: 40px;
  z-index: 2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.hero-social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #a4a7ae;
  text-decoration: none;
  background: transparent;
  border-radius: 50%;
  transition:
    color 0.25s ease,
    transform 0.25s ease;
  flex-shrink: 0;
}

.hero-social-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

.hero-social-icon:hover {
  color: #eb1f0b;
  transform: translateY(-3px);
}

/* =========================================
   RESPONSIVE ADJUSTMENTS
   ========================================= */

/* ── Short viewports: shrink font so title takes less vertical space ── */
@media (max-height: 700px) {
  .hero-title-mask {
    font-size: 38px;
  }
  .hero-inner {
    gap: clamp(24px, 3vh, 32px);
  }
}

@media (max-height: 560px) {
  .hero-title-mask {
    font-size: 30px;
  }
  .hero-inner {
    top: 80px;
  }
}

@media (max-width: 768px) {
  .hero-title {
    white-space: normal;
  }
  .hero-title-mask {
    font-size: 42px;
    height: 3.5em;
  }
}

@media (max-width: 480px) {
  /* Top-align hero content on mobile with breathing room from nav */
  .hero-inner {
    justify-content: flex-start;
    padding-top: 40px;
  }
  .hero-title-mask {
    font-size: 38px;
    height: 3.5em;
  }
  .hero-inner {
    gap: clamp(12px, 2.5vh, 28px);
  }
}
