:root {
  --yellow: #ffc900;
  --ink: #111111;
  --white: #ffffff;
  --pill-bg: #ffffff;
  --pill-border: rgba(0, 0, 0, 0.08);
  --pill-placeholder: rgba(26, 26, 26, 0.3);
  --pill-text: #1a1a1a;
  --btn-disabled-bg: rgba(0, 0, 0, 0.2);
  --btn-disabled-fg: rgba(255, 255, 255, 0.85);
  --btn-active-bg: #000000;
  --btn-active-fg: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--yellow);
  color: var(--ink);
  /* `ui-rounded` resolves to SF Pro Rounded on Apple platforms; Nunito is the
     loaded web fallback so non-Apple users still get the same rounded character. */
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 5vw, 80px) 24px;
}

.grid {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3vw, 36px);
}

.kicker {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 36px);
  font-weight: 700;
  letter-spacing: -0.012em;
  text-align: center;
  color: var(--ink);
}

.icon {
  width: clamp(180px, 28vw, 280px);
  aspect-ratio: 1 / 1;
  position: relative;
  display: grid;
  place-items: center;
  user-select: none;
  /* The squircle backdrop ships as a transparent PNG so we get continuous
     Apple-style curvature and the soft cast shadow that's baked into the asset. */
  background: url("assets/app-logo.png") center / contain no-repeat;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.06))
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.04));
}

.icon img {
  width: 60%;
  height: 60%;
  display: block;
  /* Pixel-art eyes — keep them sharp at any scale. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.wordmark {
  margin: 0;
  font-size: clamp(76px, 13.5vw, 152px);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.045em;
  color: var(--white);
  text-align: center;
  /* SF Pro Rounded's heaviest weight is Bold (700); Nunito's Black (900) is the
     web fallback. 800 lets the browser pick whichever sits closer to design. */
}

.copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.8vw, 22px);
  text-align: justify;
  padding: 0 clamp(8px, 2vw, 32px);
}

.copy p {
  margin: 0;
  font-size: clamp(20px, 2.7vw, 30px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.008em;
}

.email {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin-top: clamp(8px, 2vw, 24px);
  padding: 0 clamp(8px, 2vw, 16px);
}

#email {
  flex: 1;
  min-width: 0;
  height: clamp(56px, 7vw, 72px);
  padding: 0 clamp(20px, 2.5vw, 28px);
  border: none;
  outline: none;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-text);
  font: inherit;
  font-size: clamp(17px, 1.9vw, 22px);
  font-weight: 500;
  letter-spacing: -0.005em;
  box-shadow:
    0 0 0 1px var(--pill-border),
    0 6px 18px -12px rgba(0, 0, 0, 0.18);
  transition: box-shadow 160ms ease;
}

#email::placeholder {
  color: var(--pill-placeholder);
  font-weight: 500;
}

#email:focus-visible {
  box-shadow:
    0 0 0 2px var(--yellow),
    0 0 0 4px var(--ink),
    0 6px 18px -12px rgba(0, 0, 0, 0.18);
}

#submit {
  flex: 0 0 auto;
  width: clamp(56px, 7vw, 72px);
  height: clamp(56px, 7vw, 72px);
  border-radius: 50%;
  border: none;
  background: var(--btn-disabled-bg);
  color: var(--btn-disabled-fg);
  display: grid;
  place-items: center;
  cursor: not-allowed;
  transition:
    background 220ms ease,
    color 220ms ease,
    transform 140ms ease;
  padding: 0;
}

#submit .submit-icon {
  width: 44%;
  height: 44%;
  transition: opacity 160ms ease;
}

#submit .submit-spinner {
  position: absolute;
  width: 38%;
  height: 38%;
  border: 2.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0;
  animation: amigo-spin 0.7s linear infinite;
  transition: opacity 160ms ease;
}

/* Loading state: hide the icon, show the spinner. The button itself stays
   put — disabled pointer + locked cursor — so layout doesn't twitch. */
#email-form.is-loading #submit {
  cursor: progress;
}
#email-form.is-loading #submit .submit-icon {
  opacity: 0;
}
#email-form.is-loading #submit .submit-spinner {
  opacity: 1;
}

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

#submit {
  position: relative;
}

#submit:not(:disabled) {
  background: var(--btn-active-bg);
  color: var(--btn-active-fg);
  cursor: pointer;
}

#submit:not(:disabled):hover {
  transform: scale(1.06);
}

#submit:not(:disabled):active {
  transform: scale(0.96);
}

#submit:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

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

/* Status messages — error inline above the form on submit failure, success
   message replacing the form once Resend accepts the address. The status
   region is always in the DOM (aria-live needs it present) but invisible
   when empty. */
.status {
  width: 100%;
  max-width: 560px;
  padding: 0 clamp(8px, 2vw, 16px);
  font-size: clamp(17px, 1.9vw, 21px);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.3;
  text-align: center;
  min-height: 0;
}
.status:empty {
  display: none;
}
.status.is-error {
  color: var(--ink);
}
.status.is-success {
  color: var(--ink);
  font-size: clamp(20px, 2.4vw, 26px);
}
.status.is-success strong {
  color: var(--white);
  font-weight: 800;
}

@media (max-width: 520px) {
  .grid {
    gap: 18px;
  }
  .copy {
    text-align: left;
    padding: 0 4px;
  }
  .email {
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #submit,
  #email {
    transition: none;
  }
}
