:root {
  --cream-wall: #f5ecd7;
  --brown-text: #6b4c3b;
  --green-button: #9acd8a;
  --green-hover: #88bb78;
  --input-bg: #fffdf7;
  --brick: #d4a574;
  --error-red: #d94f4f;
  /* Safe area insets for notches, rounded corners, home indicator (fallback 0 for browsers that don't support) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

html,
body {
  height: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  color: var(--brown-text);
}

/* Visually hidden but accessible to screen readers */
.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;
}

/* Full-screen background — padding keeps all content inside safe area */
.landing {
  min-height: 100vh;
  min-height: 100dvh;
  background: url("assets/references/mobile_background.png") top center / cover
    no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right))
    calc(var(--safe-bottom)) calc(1rem + var(--safe-left));
  position: relative;
}

/* Brand block top left — inside safe area */
.brand-block {
  position: absolute;
  top: calc(1.25rem + var(--safe-top));
  left: calc(1.25rem + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 0.15em;
}

.brand {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2rem, 6vw + 0.5rem, 3.25rem);
  font-weight: 600;
  color: #563527;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.brand-tagline {
  font-family: "Chiron GoRound TC", sans-serif;
  font-weight: 600;
  font-size: clamp(1.25rem, 3.5vw + 0.25rem, 2rem);
  color: #563527;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
  margin-left: 0.5rem;
  margin-top: -0.35em;
}

/* Form area positioned on the brick portion */
.form-area {
  width: 100%;
  max-width: min(540px, 100%);
  margin: 0 auto;
  margin-top: 2rem;
  padding: 0 1.25rem;
}

.tagline {
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  color: var(--brown-text);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* Features list (under brand tagline) */
.features-box {
  margin-top: 0.75rem;
  margin-left: 0.5rem;
  max-width: min(62vw, 28rem);
}

.features-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
  font-family: "Chiron GoRound TC", sans-serif;
  font-weight: 600;
  font-size: clamp(0.95rem, 2vw + 0.25rem, 1.25rem);
  line-height: 1.35;
  color: #563527;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.features-list li {
  margin-bottom: 0.2rem;
}

.features-list li:last-child {
  margin-bottom: 0;
}

/* Form layout — combined pill input + button */
.form-row {
  display: flex;
  flex-direction: row;
  border-radius: 999px;
  background: var(--input-bg);
  border: 2px solid transparent;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  overflow: hidden;
}

.form-row:focus-within {
  border-color: var(--green-button);
  box-shadow: 0 0 0 3px rgba(154, 205, 138, 0.3);
}

.form-row.input-error {
  border-color: var(--error-red);
}

.form-row.input-error:focus-within {
  box-shadow: 0 0 0 3px rgba(217, 79, 79, 0.2);
}

.input-wrapper {
  flex: 1;
  min-width: 0;
}

#email {
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: none;
  border-radius: 999px 0 0 999px;
  background: transparent;
  font-size: 1rem;
  color: var(--brown-text);
  outline: none;
}

#email::placeholder {
  color: #b8a99a;
}

button[type="submit"] {
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 0 999px 999px 0;
  background: var(--green-button);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  outline: none;
}

button[type="submit"]:hover {
  background: var(--green-hover);
}

button[type="submit"]:active {
  transform: scale(0.98);
}

/* Hide reCAPTCHA v3 badge (attribution text shown in footer instead) */
.grecaptcha-badge {
  visibility: hidden !important;
}

/* Error message */
.error-message {
  min-height: 1.5em;
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--error-red);
}

/* Success message */
.success-message {
  text-align: center;
  animation: fadeInUp 0.5s ease-out;
  padding: 1.25rem 1.5rem;
  margin-bottom: 3rem;
}

.paw-emoji {
  font-size: clamp(2rem, 5vw, 2.5rem);
  display: block;
  margin-bottom: 0.5rem;
}

.success-title {
  font-family: "Nunito", sans-serif;
  font-size: clamp(1.5rem, 3.5vw + 0.5rem, 2rem);
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: #fff;
  text-shadow:
    1px 1px 4px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(0, 0, 0, 0.6);
}

.success-sub {
  font-family: "Nunito", sans-serif;
  font-size: clamp(1.25rem, 3vw + 0.25rem, 1.5rem);
  font-weight: 700;
  color: #fff;
  text-shadow:
    1px 1px 4px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(0, 0, 0, 0.6);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .success-message {
    animation: none;
  }
}

/* Footer — below the background image, requires scrolling */
footer {
  text-align: center;
  padding: 1.5rem calc(1rem + var(--safe-right))
    calc(1.5rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
  font-size: 0.75rem;
  color: #3d2b1f;
  opacity: 0.85;
}

.recaptcha-notice {
  margin-top: 0.25rem;
  font-size: 0.6875rem;
}

.recaptcha-notice a {
  color: inherit;
  text-decoration: underline;
}

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

/* Very small phones (≤375px, e.g. iPhone SE, older Android) */
@media (max-width: 375px) {
  .landing {
    padding: calc(0.75rem + var(--safe-top)) calc(0.75rem + var(--safe-right))
      calc(0.75rem + var(--safe-bottom)) calc(0.75rem + var(--safe-left));
  }

  .brand-block {
    top: calc(0.75rem + var(--safe-top));
    left: calc(0.75rem + var(--safe-left));
  }

  .features-box {
    max-width: 75vw;
  }

  #email {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
  }

  button[type="submit"] {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
  }

  .tagline {
    font-size: 0.875rem;
  }

  .form-area {
    margin-top: 1.5rem;
  }
}

/* Short viewports */
@media (max-height: 600px) {
  .landing {
    min-height: auto;
    padding-bottom: calc(1rem + var(--safe-bottom));
  }

  .form-area {
    margin-top: 1rem;
  }
}

/* Switch to landscape background for wider screens */
@media (min-width: 768px) {
  .landing {
    background-image: url("assets/references/desktop_background.png");
  }
}

/* Tablet+ side-by-side layout */
@media (min-width: 600px) {
  .landing {
    padding: calc(1.5rem + var(--safe-top)) calc(1.5rem + var(--safe-right))
      calc(1.5rem + var(--safe-bottom)) calc(1.5rem + var(--safe-left));
  }

  .brand-block {
    top: calc(1.5rem + var(--safe-top));
    left: calc(1.5rem + var(--safe-left));
  }

  .form-area {
    margin-top: 3rem;
  }
}

/* Desktop (≥1024px) */
@media (min-width: 1024px) {
  .landing {
    padding: calc(2rem + var(--safe-top)) calc(2.5rem + var(--safe-right))
      calc(2rem + var(--safe-bottom)) calc(2.5rem + var(--safe-left));
  }

  .brand-block {
    top: calc(2rem + var(--safe-top));
    left: calc(2.5rem + var(--safe-left));
  }

  .form-area {
    max-width: 540px;
  }
}

/* Dev menu — only visible with ?dev query param */
.dev-menu {
  position: fixed;
  top: calc(0.5rem + var(--safe-top));
  right: calc(0.5rem + var(--safe-right));
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-family: monospace;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dev-menu summary {
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  list-style: none;
}

.dev-menu summary::before {
  content: "▶ ";
}

.dev-menu[open] summary::before {
  content: "▼ ";
}

.dev-menu button {
  all: unset;
  cursor: pointer;
  background: #444;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-align: center;
  font-size: 0.75rem;
}

.dev-menu button:hover {
  background: #666;
}

/* Large desktop (≥1440px) */
@media (min-width: 1440px) {
  .landing {
    padding: calc(2.5rem + var(--safe-top)) calc(3rem + var(--safe-right))
      calc(2.5rem + var(--safe-bottom)) calc(3rem + var(--safe-left));
  }

  .brand-block {
    top: calc(2.5rem + var(--safe-top));
    left: calc(3rem + var(--safe-left));
  }
}
