/* ============================================
   CSS VARIABLES & TYPOGRAPHY
   ============================================ */

/* Import Roboto Font */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");

/* CSS Variables */
:root {
  /* Colors - From Style Guide */
  --primary-red: hsl(4, 100%, 67%);
  --primary-red-dark: hsl(4, 100%, 57%);
  --primary-red-light: hsl(4, 100%, 76%);
  --neutral-blue-800: hsl(234, 29%, 20%);
  --neutral-blue-700: hsl(235, 18%, 26%);
  --neutral-blue-600: hsl(235, 18%, 35%);
  --neutral-grey: hsl(0, 0%, 58%);
  --neutral-grey-light: hsl(231, 7%, 90%);
  --neutral-white: hsl(0, 0%, 100%);

  /* Typography */
  --font-family: "Roboto", sans-serif;
  --font-weight-regular: 400;
  --font-weight-bold: 700;
  --font-size-body: 16px;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Border radius */
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;

  /* Shadows */
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ============================================
   GLOBAL RESET & BASE
   ============================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: 1.6;
  color: var(--neutral-blue-800);
  /* Dark blue background as per design */
  background-color: var(--neutral-blue-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1,
h2,
h3 {
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  color: var(--neutral-blue-800);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -1px;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  letter-spacing: -1px;
  margin-bottom: 1.5rem;
}

p {
  color: var(--neutral-blue-700);
  line-height: 1.6;
}

a {
  color: var(--primary-red);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

ul,
ol {
  list-style: none;
}

li {
  color: var(--neutral-blue-700);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   LAYOUT - MAIN WRAPPER
   ============================================ */

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

/* ============================================
   SIGNUP SECTION - DESKTOP CARD
   ============================================ */

.signup-section {
  display: flex;
  flex-direction: row;
  background-color: var(--neutral-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  max-width: 928px;
  width: 100%;
  min-height: 580px;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.signup-section.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none;
}

/* LEFT: content side */
.content {
  flex: 1;
  padding: 4rem 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

/* Features list */
.features-list {
  margin: 1.5rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.features-list li {
  display: flex;
  align-items: flex-start;
  gap: 1.125rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--neutral-blue-700);
}

.features-list img {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  flex-shrink: 0;
  object-fit: contain;
}

/* RIGHT: illustration side */
.illustration {
  flex: 0 0 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Gradient matching design */
  background: linear-gradient(160deg,
      hsl(15, 100%, 61%) 0%,
      hsl(4, 100%, 67%) 55%,
      hsl(346, 100%, 63%) 100%);
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
}

/* Decorative blob behind illustration */
.illustration::before {
  content: "";
  position: absolute;
  bottom: -60px;
  left: -40px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle,
      hsla(45, 100%, 65%, 0.4) 0%,
      transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.desktop-img {
  width: 100%;
  max-width: 380px;
  height: auto;
  position: relative;
  z-index: 2;
  object-fit: contain;
  filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.18));
}

.mobile-img {
  display: none;
}

/* ============================================
   FORM STYLING
   ============================================ */

form {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
}

/* Label + error row */
form>div {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

label {
  font-weight: var(--font-weight-bold);
  font-size: 0.8125rem;
  color: var(--neutral-blue-800);
  letter-spacing: 0.3px;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

label.error-label {
  color: var(--neutral-blue-800);
}

/* Error message */
#emailError {
  font-size: 0.75rem;
  color: var(--primary-red);
  font-weight: var(--font-weight-regular);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

#emailError.show {
  opacity: 1;
}

/* Email input */
input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--neutral-grey-light);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--neutral-blue-800);
  background-color: var(--neutral-white);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
  margin-bottom: 1.25rem;
}

input[type="email"]::placeholder,
input[type="text"]::placeholder {
  color: var(--neutral-grey);
}

input[type="email"]:hover:not(:focus),
input[type="text"]:hover:not(:focus) {
  border-color: var(--neutral-grey);
}

input[type="email"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--neutral-blue-800);
  box-shadow: none;
}

/* Error state */
input[type="email"].error,
input[type="text"].error {
  border-color: var(--primary-red);
  background-color: hsl(4, 100%, 96%);
  color: var(--primary-red);
}

input[type="email"].error::placeholder,
input[type="text"].error::placeholder {
  color: var(--primary-red);
  opacity: 0.7;
}

input[type="email"].error:focus,
input[type="text"].error:focus {
  border-color: var(--primary-red);
}

/* Error shake animation */
input.error {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

/* Valid state */
input[type="email"].valid {
  border-color: hsl(143, 50%, 50%);
  background-color: var(--neutral-white);
}

/* Submit button */
input,
button {
  font-family: var(--font-family);
}

button {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
}

form button {
  width: 100%;
  padding: 16px 24px;
  background-color: var(--neutral-blue-800);
  color: var(--neutral-white);
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.3px;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    transform 0.15s ease,
    box-shadow 0.3s ease;
  min-height: 52px;
}

form button:hover:not(:disabled) {
  background: linear-gradient(90deg,
      hsl(4, 100%, 65%) 0%,
      hsl(346, 100%, 63%) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px hsla(4, 100%, 60%, 0.4);
}

form button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

form button:focus-visible {
  outline: 3px solid var(--primary-red);
  outline-offset: 3px;
}

form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   SUCCESS SECTION
   ============================================ */

.success-section {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  background-color: var(--neutral-white);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
  pointer-events: none;
}

/* When visible */
.success-section:not([hidden]) {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Desktop success — compact centered card */
@media (min-width: 769px) {
  .success-section {
    max-width: 500px;
    width: 100%;
    border-radius: var(--border-radius-lg);
    padding: 3.5rem 4rem;
    box-shadow: var(--shadow-card);
  }

  .success-section img {
    width: 64px;
    height: 64px;
    margin-bottom: 2.5rem;
  }

  .success-section h2 {
    font-size: 3.5rem;
    color: var(--neutral-blue-800);
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 1.5rem;
  }

  .success-section p {
    font-size: 1rem;
    color: var(--neutral-blue-700);
    line-height: 1.6;
    margin-bottom: 2.5rem;
  }

  .success-section strong {
    color: var(--neutral-blue-800);
    font-weight: var(--font-weight-bold);
  }

  .success-section button {
    width: 100%;
    padding: 16px 24px;
    background-color: var(--neutral-blue-800);
    color: var(--neutral-white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.3px;
    cursor: pointer;
    min-height: 52px;
    transition:
      background-color 0.3s ease,
      transform 0.15s ease,
      box-shadow 0.3s ease;
  }

  .success-section button:hover {
    background: linear-gradient(90deg,
        hsl(4, 100%, 65%) 0%,
        hsl(346, 100%, 63%) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px hsla(4, 100%, 60%, 0.4);
  }

  .success-section button:active {
    transform: translateY(0);
    box-shadow: none;
  }

  .success-section button:focus-visible {
    outline: 3px solid var(--primary-red);
    outline-offset: 3px;
  }
}

/* ============================================
   FOOTER
   ============================================ */

footer {
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.attribution {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.8;
}

.attribution a {
  color: var(--primary-red-light);
  font-weight: 600;
  transition: color 0.2s ease;
}

.attribution a:hover {
  color: var(--neutral-white);
}

/* ============================================
   SCREEN READER ONLY UTILITY
   ============================================ */

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

/* ============================================
   RESPONSIVE — MOBILE (768px and below)
   ============================================ */

@media (max-width: 768px) {
  body {
    background-color: var(--neutral-white);
  }

  main {
    padding: 0;
    align-items: flex-start;
    min-height: 100vh;
  }

  /* Full-width card that fills screen on mobile */
  .signup-section {
    flex-direction: column-reverse;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  .content {
    padding: 2.5rem 1.5rem 2rem;
    justify-content: flex-start;
  }

  h1 {
    font-size: 2.5rem;
    margin-bottom: 1.25rem;
  }

  .features-list {
    margin: 1.25rem 0 2rem;
    gap: 1rem;
  }

  .features-list li {
    gap: 1rem;
  }

  .features-list img {
    width: 21px;
    height: 21px;
  }

  /* Image on top for mobile */
  .illustration {
    flex: none;
    min-height: 280px;
    max-height: 320px;
    padding: 0;
    border-radius: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    overflow: hidden;
  }

  .illustration::before {
    display: none;
  }

  .desktop-img {
    display: none;
  }

  .mobile-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    max-width: none;
    filter: none;
  }

  /* Form mobile */
  form>div {
    margin-bottom: 0.375rem;
  }

  input[type="email"],
  input[type="text"] {
    font-size: 16px;
    /* prevent iOS zoom */
    padding: 14px 16px;
    min-height: 52px;
    margin-bottom: 1rem;
  }

  form button {
    width: 100%;
    padding: 16px;
    min-height: 52px;
    font-size: 1rem;
  }

  /* Success - mobile: full screen white */
  .success-section {
    min-height: 100vh;
    width: 100%;
    padding: 4rem 1.5rem 2rem;
    border-radius: 0;
    box-shadow: none;
    background-color: var(--neutral-white);
    align-items: flex-start;
  }

  .success-section img {
    width: 58px;
    height: 58px;
    margin-bottom: 2.5rem;
  }

  .success-section h2 {
    font-size: 2.5rem;
    color: var(--neutral-blue-800);
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 1.25rem;
  }

  .success-section p {
    font-size: 1rem;
    color: var(--neutral-blue-700);
    line-height: 1.65;
    margin-bottom: auto;
  }

  .success-section strong {
    color: var(--neutral-blue-800);
    font-weight: var(--font-weight-bold);
  }

  .success-section button {
    width: 100%;
    padding: 16px;
    background-color: var(--neutral-blue-800);
    color: var(--neutral-white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    min-height: 52px;
    margin-top: 2.5rem;
    transition:
      background-color 0.3s ease,
      box-shadow 0.3s ease;
  }

  .success-section button:hover {
    background: linear-gradient(90deg,
        hsl(4, 100%, 65%) 0%,
        hsl(346, 100%, 63%) 100%);
    box-shadow: 0 6px 20px hsla(4, 100%, 60%, 0.4);
  }

  footer {
    display: none;
  }
}

/* Smallest phones */
@media (max-width: 375px) {
  .content {
    padding: 2rem 1.25rem 1.5rem;
  }

  h1 {
    font-size: 2.125rem;
  }

  .success-section {
    padding: 3rem 1.25rem 1.5rem;
  }

  .success-section h2 {
    font-size: 2.25rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus visible outlines */
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--primary-red);
  outline-offset: 2px;
}

/* High contrast */
@media (prefers-contrast: more) {
  input:focus {
    border-width: 2px;
    box-shadow:
      0 0 0 2px var(--neutral-white),
      0 0 0 4px var(--neutral-blue-800);
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  form button:hover:not(:disabled),
  .success-section button:hover {
    transform: none;
  }
}