/* ====================
   Base Reset & Defaults
==================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background: #faf7f2;
  color: #3a2f2f;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ====================
   Page Layout
==================== */

.page {
  min-height: 100dvh;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  z-index: 1;

  animation: pageFadeIn 0.8s ease-out both;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================
   Welcome Section
==================== */

.welcome {
  text-align: center;
}

.welcome .icon {
  font-size: 28px;
  margin-bottom: 8px;
  animation: softGlow 2.5s ease-in-out infinite;
}

@keyframes softGlow {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
}

.welcome h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}

.welcome p {
  margin: 0;
  font-size: 15px;
  color: #5a4b4b;
}

/* ====================
   Form Section
==================== */

.form-section {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.form-section.hidden {
  opacity: 0;
  transform: translateY(-10px);
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.error-message {
  font-size: 13px;
  color: #d32f2f;
  padding-left: 4px;
  transition: opacity 0.2s ease;
  margin-top: -2px;
}

.error-message:empty {
  display: none;
}

input,
textarea {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid #e2d8d0;
  background: #ffffff;
  color: #3a2f2f;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #9a8f8f;
}

input:focus,
textarea:focus {
  border-color: #b43c3c;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ====================
   Submit Button
==================== */

button {
  margin-top: 6px;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #b43c3c;
  color: #faf7f2;
  box-shadow: 0 6px 18px rgba(180, 60, 60, 0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button:active {
  transform: scale(0.97);
  box-shadow: 0 4px 12px rgba(180, 60, 60, 0.2);
}

/* ====================
   Confirmation Section
==================== */

.confirmation {
  text-align: center;
  padding: 28px 20px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(180, 60, 60, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);

  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.confirmation:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

.confirmation .icon.success {
  font-size: 26px;
  margin-bottom: 6px;
}

.confirmation h2 {
  margin: 6px 0 4px;
  font-size: 20px;
  font-weight: 600;
}

.confirmation p {
  margin: 0;
  font-size: 15px;
  color: #5a4b4b;
}

.instagram-box {
  margin-top: 18px;
}

.instagram-box p {
  margin: 0 0 4px;
  font-size: 14px;
}

.instagram-box a {
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  color: #b43c3c;
}

/* ====================
   Footer
==================== */

.footer {
  margin-top: auto;
  text-align: center;
  font-size: 13px;
  color: #7a6b6b;
}

.footer a {
  display: block;
  margin-top: 4px;
  text-decoration: none;
  font-weight: 600;
  color: #b43c3c;
}

/* ====================
   Utilities
==================== */

.hidden {
  display: none;
}

/* ====================
   TRUE RANDOM SNOWFALL
==================== */

.snow-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.flake {
  position: absolute;
  top: -10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 0.8;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes fall {
  from {
    transform: translateY(-10px) translateX(0);
  }
  to {
    transform: translateY(110vh) translateX(var(--drift));
  }
}

/* ====================
   Night Mode (Auto)
==================== */

@media (prefers-color-scheme: dark) {
  body {
    background: #0f1115;
    color: #ededed;
  }

  .welcome p {
    color: #b5b5b5;
  }

  input,
  textarea {
    background: #1a1d23;
    border-color: #2a2e36;
    color: #ededed;
  }

  input::placeholder,
  textarea::placeholder {
    color: #8a8f98;
  }

  input:focus,
  textarea:focus {
    border-color: #f5c77a;
  }

  button {
    background: #f5c77a;
    color: #1a1d23;
    box-shadow: 0 6px 18px rgba(245, 199, 122, 0.25);
  }

  .confirmation {
    background: #1a1d23;
    border-color: rgba(245, 199, 122, 0.15);
    box-shadow: none;
  }

  .confirmation p {
    color: #b5b5b5;
  }

  .error-message {
    color: #ff6b6b;
  }

  .instagram-box a,
  .footer a {
    color: #f5c77a;
  }

  .footer {
    color: #9a9a9a;
  }

  .flake {
    opacity: 0.6;
  }
}
