:root {
  --bg: #fafaf8;
  --text: #000000;
  /* Design specifies #868686, but that is 3.48:1 on --bg (below the 4.5:1
     WCAG AA minimum). #5f6368 keeps the neutral grey at 5.79:1. */
  --text-muted: #5f6368;
  --input-text: #31353b;
  --border: #e5e7eb;
  --button-bg: #171717;
  --white: #ffffff;

  --font-sans: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-variation-settings: "GRAD" 0, "ROND" 0, "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

/* An explicit display rule (e.g. flex) beats the hidden attribute, so restate
   it — otherwise [hidden] elements like .signup__row stay on screen. */
[hidden] {
  display: none !important;
}

.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;
}

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

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 44px 0 80px;
  padding-inline: clamp(20px, 6vw, 96px);
  text-align: left;
}

/* Hero artwork ------------------------------------------------------------ */

/* Decorative, so it sits last in the flow on narrow screens and is lifted
   into the top-right corner only once there is room beside the headline. */
.hero-art {
  position: absolute;
  opacity: 1;
  top: 0;
  right: 0;
  /* Small enough that it clears the headline at every width in this band:
     the artwork's bottom lands at roughly its own width in px, while the
     headline never starts above ~179px. */
  width: clamp(150px, 16vw, 240px);
  /* A definite box (rather than height:auto) so the shadow layers below can
     be sized and placed in percentages of the artwork. */
  aspect-ratio: 399 / 442;
  /* The canopy's flat cut sits 2.5% down from the top edge, so bleeding up
     11% puts the truncation outside the viewport at any size. */
  /* GSAP owns the entry and idle motion (hero-motion.js); this transform is
     static and must stay on the wrapper, which GSAP never animates. */
  transform: translateY(-11%);
  pointer-events: none;
}

.hero-art.is-launched::before,
.hero-art.is-launched::after {
  opacity: 0;
}

.hero-art__svg {
  display: block;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Cast shadow well below the basket — the gap between object and shadow is
   what reads as height, so it sits clear of the artwork rather than under it. */
.hero-art::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 99%;
  width: 56%;
  height: 8%;
  transform: translateX(-50%);
  background: radial-gradient(
    50% 50% at 50% 50%,
    rgba(23, 23, 23, 0.17) 0%,
    rgba(23, 23, 23, 0) 72%
  );
  filter: blur(9px);
  transition: opacity 2.2s ease;
}

/* Broad, very soft halo giving the balloon some atmosphere to sit in. */
.hero-art::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 4% -2% 0;
  background: radial-gradient(
    52% 44% at 50% 52%,
    rgba(23, 23, 23, 0.075) 0%,
    rgba(23, 23, 23, 0) 72%
  );
  filter: blur(20px);
  transition: opacity 2.2s ease;
}

@media (min-width: 1360px) {
  /* Compose the page as one screen rather than hanging content from the top. */
  .page {
    min-height: 100vh;
    justify-content: center;
    padding-block: 64px;
  }

  /* Room beside the 819px headline, so the artwork can carry real weight. */
  .hero-art {
    width: clamp(320px, 27vw, 440px);
  }
}

/* Logo -------------------------------------------------------------------- */

.logo {
  display: block;
  width: 168px;
  flex-shrink: 0;
}

/* The source SVG already carries the design's framing, so it is drawn at its
   own aspect ratio — scaling the box alone keeps the wordmark unclipped. */
.logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* Hero -------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 36px;
  /* 840px, not the design's 818px: "Technology, built alongside" measures 819px,
     so 818 forces a third line. The extra 22px keeps the intended two-line break. */
  max-width: 840px;
  margin-top: 40px;
  overflow-wrap: break-word;
}

.hero__title {
  margin: 0;
  font-size: clamp(34px, 11vw, 74px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.hero__subtitle {
  margin: 0;
  max-width: 599px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Email signup ------------------------------------------------------------ */

.signup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 444px;
  margin-top: 54px;
}

.signup__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 56px;
  padding: 0 4px 0 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  filter: drop-shadow(0 16px 16px rgba(0, 0, 0, 0.03))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.04));
}

.signup__input {
  flex: 1 0 0;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.442;
  letter-spacing: 0.32px;
  color: var(--input-text);
  text-align: left;
}

.signup__input::placeholder {
  color: var(--input-text);
  opacity: 0.55;
}

.signup__row:focus-within {
  border-color: #d1d5db;
}

.signup__button {
  flex-shrink: 0;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 11.65px;
  font-weight: 500;
  line-height: 1.442;
  letter-spacing: 0.233px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.08));
}

.signup__button:hover {
  background: #262626;
}

.signup__note {
  margin: 0;
  width: 100%;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: left;
}

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

@media (max-width: 720px) {
  .hero {
    margin-top: 32px;
    gap: 32px;
  }

  /* Target 56px, but scale down below ~414px: "changemakers." is ~6.4x the
     font size, so a flat 56px (357px wide) breaks mid-word on a 375px phone. */
  .hero__title {
    font-size: clamp(38px, 13vw, 56px);
  }

  .hero__subtitle {
    font-size: 17px;
  }

  .signup {
    margin-top: 40px;
  }

  .signup__note {
    font-size: 14px;
  }

  /* Keep the input itself at 16px so iOS doesn't zoom on focus, but shrink the
     placeholder: "you@yourorganization.org" overflows a narrow field at 16px. */
  .signup__input::placeholder {
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .signup__row {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    gap: 8px;
  }

  .signup__input {
    padding: 8px;
  }

  .signup__button {
    width: 100%;
  }
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise-blur {
  from {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* Each element starts hidden and is revealed by its own animation, staggered
   down the page so the eye lands on the logo, then the headline, then the form. */
.logo,
.hero__title,
.hero__subtitle,
.signup__row,
.signup__note {
  /* "both" (not "forwards") so the from-state covers the start delay without
     needing a base opacity: 0. That base would resurface — blanking the
     element — whenever another rule overrides the animation shorthand, as
     .is-shaking does. */
  animation: rise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.logo {
  animation-delay: 0.05s;
}

.hero__title {
  animation-name: rise-blur;
  animation-duration: 0.9s;
  animation-delay: 0.18s;
}

.hero__subtitle {
  animation-delay: 0.42s;
}

.signup__row {
  animation-delay: 0.58s;
}

.signup__note {
  animation-delay: 0.7s;
}

/* Interaction polish ------------------------------------------------------ */

.signup__row {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.signup__row:focus-within {
  box-shadow: 0 0 0 4px rgba(23, 23, 23, 0.06);
}

.signup__button {
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.signup__button:active {
  transform: scale(0.97);
}

.logo img {
  transition: opacity 0.2s ease;
}

.logo:hover img {
  opacity: 0.75;
}

/* Respect users who prefer reduced motion: show everything, skip the motion. */
@media (prefers-reduced-motion: reduce) {
  .logo,
  .hero__title,
  .hero__subtitle,
  .signup__row,
  .signup__note,
  .hero-art {
    animation: none;
  }

  .signup__button,
  .signup__row,
  .logo img {
    transition: none;
  }
}

/* Signup states ----------------------------------------------------------- */

/* Honeypot — kept out of view and out of the a11y tree, never display:none,
   which some bots detect and skip. */
.signup__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.signup__button {
  position: relative;
}

.signup__button:disabled {
  cursor: default;
}

.signup__button.is-loading .signup__button-label {
  opacity: 0;
}

.signup__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.6s linear infinite;
}

.signup__button.is-loading .signup__spinner {
  opacity: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.signup__error {
  margin: 0;
  font-size: 13px;
  color: #b3261e;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.signup__row.is-shaking {
  animation: shake 0.4s ease;
  border-color: #e7b0ab;
}

/* Success ----------------------------------------------------------------- */

.signup__success {
  display: flex;
  align-items: center;
  gap: 14px;
  animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.signup__plane {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  overflow: visible;
}

.signup__plane path {
  fill: none;
  stroke: var(--button-bg);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The plane draws itself outline-first, then the fold, by retracting each
   dash offset in turn. Lengths are rounded up from the real path lengths. */
.signup__plane-outline {
  stroke-dasharray: 135;
  stroke-dashoffset: 135;
  animation: draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) 0.08s forwards;
}

.signup__plane-fold {
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: draw 0.28s cubic-bezier(0.65, 0, 0.35, 1) 0.6s forwards;
}

/* Once drawn, it launches up and to the right, overshooting slightly before
   settling — so it reads as "sent" without leaving an empty slot behind. */
.signup__plane-body {
  animation: launch 0.7s cubic-bezier(0.34, 1.3, 0.64, 1) 0.88s both;
}

@keyframes launch {
  0% {
    transform: none;
  }
  55% {
    transform: translate(9px, -9px);
  }
  100% {
    transform: translate(5px, -5px);
  }
}

/* Speed lines trailing the launch, drawn then faded out. */
.signup__plane-trail path {
  stroke-width: 2.5;
  opacity: 0;
}

.signup__plane-trail path:nth-child(1) {
  animation: trail 0.7s ease-out 0.92s both;
}

.signup__plane-trail path:nth-child(2) {
  animation: trail 0.7s ease-out 1s both;
}

@keyframes trail {
  0% {
    opacity: 0;
    transform: translate(6px, -6px);
  }
  35% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
    transform: translate(-5px, 5px);
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.signup__success-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.signup__success-title {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) 0.35s both;
}

.signup__success-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
  animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) 0.47s both;
}

@media (prefers-reduced-motion: reduce) {
  .signup__spinner,
  .signup__row.is-shaking,
  .signup__success,
  .signup__success-title,
  .signup__success-text {
    animation: none;
  }

  /* Without motion the strokes must still be drawn. */
  .signup__plane-outline,
  .signup__plane-fold {
    stroke-dashoffset: 0;
    animation: none;
  }

  .signup__plane-body,
  .signup__plane-trail path {
    animation: none;
  }

  .signup__plane-trail {
    display: none;
  }
}
