:root {
  --bg: #EAEFF0;
  --box: #B9BDC0;
  --text: #000;
  --input-height: 44px;
  --input-width: 240px;
  --radius: 2px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

main {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

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

/* Container — the gray box */
.capture {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--box);
  border-radius: var(--radius);
  width: var(--input-width);
  height: var(--input-height);
  overflow: hidden;
  cursor: text;
}

/* Idle state — bare gray box, no visible input text */
.capture[data-state="idle"] .email-input {
  color: transparent;
}
.capture[data-state="idle"] .email-input::placeholder {
  color: transparent;
}

/* Input field */
.email-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 16px;
  background: transparent;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  letter-spacing: 0.01em;
}

/* Placeholder — 30% opacity, becomes 100% (black text) when focused */
.email-input::placeholder {
  color: var(--text);
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.capture[data-state="editing"] .email-input,
.capture[data-state="ready"] .email-input {
  color: var(--text);
}

/* Submit button — hidden until user has typed something valid */
.submit-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) scale(0.6);
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.capture[data-state="ready"] .submit-btn,
.capture[data-state="submitted"] .submit-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.capture[data-state="ready"] .email-input,
.capture[data-state="submitted"] .email-input {
  padding-right: 40px;
}

/* Icons */
.icon-arrow, .icon-check {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

.icon-check {
  opacity: 0;
  transform: scale(0.5);
}

.capture[data-state="submitted"] .icon-arrow {
  opacity: 0;
  transform: scale(0.5);
}

.capture[data-state="submitted"] .icon-check {
  opacity: 1;
  transform: scale(1);
}

.capture[data-state="submitted"] .submit-btn {
  cursor: default;
}

.capture[data-state="submitted"] .email-input {
  pointer-events: none;
}

@media (max-width: 380px) {
  :root {
    --input-width: 220px;
  }
}

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