:root {
  /* page (dark) */
  --bg: #1c1714;
  --ink: #f3ede0;
  --ink-soft: #a8a094;

  /* form card (cream) */
  --bg-card: #fbf7ee;
  --ink-card: #2b2622;
  --ink-card-soft: #6a625a;
  --line: #d9cfbe;

  /* shared */
  --accent: #db6e4d;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2),
    0 24px 60px -20px rgba(0, 0, 0, 0.6);

  --serif: "Fraunces", "Iowan Old Style", "Palatino", Georgia, serif;
  --hand: "Reenie Beanie", "Bradley Hand", "Segoe Print", cursive;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 24px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: radial-gradient(
      circle at 20% 5%,
      rgba(219, 110, 77, 0.08),
      transparent 50%
    ),
    radial-gradient(
      circle at 90% 90%,
      rgba(219, 110, 77, 0.06),
      transparent 55%
    );
  background-attachment: fixed;
}

.page {
  max-width: 580px;
  margin: 0 auto;
  padding: 88px 24px 96px;
}

@media (max-width: 540px) {
  .page {
    padding-top: 56px;
  }
}

/* ─── hero ───────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  margin-bottom: 44px;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 8vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  color: var(--ink);
}

h1 .line {
  display: block;
  clip-path: inset(0 100% -10% 0);
  animation: wipe 0.9s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

h1 .line:nth-child(1) {
  animation-delay: 0.55s;
}

h1 .line:nth-child(2) {
  animation-delay: 1.25s;
}

h1 em {
  font-style: italic;
  font-weight: 400;
  color: inherit;
}

@keyframes wipe {
  to {
    clip-path: inset(0 0 -10% 0);
  }
}

.lede {
  font-family: var(--hand);
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.45;
  color: var(--ink);
  margin: 0 auto 14px;
  max-width: 460px;
}

.lede:last-of-type {
  margin-bottom: 0;
}

.lede .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  animation: word-in 0.45s ease-out forwards;
}

@keyframes word-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── form ───────────────────────────────────────────────────────── */

.form-wrap {
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
  color: var(--ink-card);
}

@media (min-width: 540px) {
  .form-wrap {
    padding: 36px;
  }
}

.form-wrap.reveal,
footer.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 0.7s ease-out forwards;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

form {
  display: grid;
  gap: 20px;
}

.field {
  display: grid;
  gap: 4px;
}

label {
  font-family: var(--hand);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink-card);
  letter-spacing: 0;
  line-height: 1.1;
}

.hint {
  font-family: var(--hand);
  color: var(--ink-card-soft);
}

.req {
  color: var(--accent);
  margin-left: 1px;
}

.field-error {
  display: none;
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1.1;
  color: var(--accent);
  margin-top: 2px;
}

.field.has-error .field-error {
  display: block;
  animation: error-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.field.has-error .field-error::before {
  content: attr(data-error);
}

.field.has-error input,
.field.has-error textarea {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(219, 110, 77, 0.15);
  animation: nudge 0.4s ease-out;
}

@keyframes error-in {
  from {
    opacity: 0;
    transform: translateY(-4px) rotate(-1deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes nudge {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
}

input,
textarea {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-card);
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #aea69a;
  font-family: var(--sans);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(219, 110, 77, 0.18);
}

input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
  border-color: #c98a7a;
}

.submit {
  position: relative;
  margin-top: 4px;
  font-family: var(--hand);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 0;
  color: #fffdf7;
  background: var(--ink-card);
  border: none;
  border-radius: 10px;
  padding: 12px 20px 14px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
  line-height: 1;
}

.submit:hover {
  background: var(--accent);
}

.submit:active {
  transform: translateY(1px);
}

.submit:disabled {
  opacity: 0.7;
  cursor: progress;
}

.submit .sending {
  display: none;
}

.submit.is-sending .label {
  display: none;
}

.submit.is-sending .sending {
  display: inline;
}

.error {
  margin: 0;
  font-family: var(--hand);
  font-size: 20px;
  color: var(--accent);
}

.error a {
  color: var(--accent);
}

/* ─── thanks ─────────────────────────────────────────────────────── */

.thanks {
  text-align: center;
  padding: 32px 8px 16px;
  max-width: 460px;
  margin: 0 auto;
}

.thanks p {
  font-family: var(--hand);
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.45;
  margin: 0 0 6px;
  color: var(--ink);
}

.thanks .small {
  color: var(--ink-soft);
  font-size: 22px;
  margin-top: 22px;
}

.thanks:not([hidden]) {
  animation: reveal 0.55s ease-out;
}

.form-wrap.is-leaving,
footer.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s ease-out, transform 0.28s ease-out;
}

/* ─── footer + misc ──────────────────────────────────────────────── */

footer {
  margin-top: 32px;
  text-align: center;
  font-family: var(--hand);
  font-size: 22px;
  color: var(--ink-soft);
}

footer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

footer a:hover {
  color: var(--ink);
}

.error a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ─── reduced motion ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
  h1 .line {
    clip-path: none;
  }
  .lede .word {
    opacity: 1;
    transform: none;
  }
  .form-wrap.reveal {
    opacity: 1;
    transform: none;
  }
}
