/* ============================================================
   Tokens
   ============================================================ */
:root {
  --black: #070502;
  --bronze-deep: #1c1305;
  --bronze-light: #5c3f12;
  --ivory: #f4ecdf;
  --ivory-dim: rgba(244, 236, 223, 0.66);
  --gold: #c9a227;
  --gold-light: #d4af37;
  --gold-deep: #b8942e;
  --rose: #cf9a95;

  --font-serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-sans: 'Manrope', -apple-system, 'Segoe UI', sans-serif;

  --ease-premium: cubic-bezier(0.16, 0.7, 0.2, 1);
}

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

html {
  background: var(--black);
  scrollbar-width: thin;
  scrollbar-color: var(--bronze-light) transparent;
}

body {
  background: var(--black);
  color: var(--ivory);
  font-family: var(--font-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

input {
  font-family: inherit;
}

/* ============================================================
   Stage — the eagle's world, fixed behind every section so it
   reads as one continuous backdrop no matter how tall the page
   grows with copy. Scroll still drives its flight (see script.js);
   it just no longer needs to be pinned inside a specific section.
   ============================================================ */
.stage {
  position: fixed;
  inset: 0;
  height: 100svh;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
}

/* ---- backdrop: flat black, so the hero and letter read at full
   contrast before the eagle ever appears near the form ---- */
.stage__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--black);
}

/* ---- eagle layer ----
   No z-index here on purpose: a stacking context would trap the video's
   screen blend and paint its black frame as an opaque rectangle instead of
   letting it dissolve into the backdrop. */
.stage__eagle-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage__eagle {
  width: 145vw;
  max-width: 1900px;
  height: auto;
  mix-blend-mode: screen;
  filter: sepia(0.16) saturate(1.18) brightness(1.06) contrast(1.08);
  opacity: 0;
  /* The bird sits in the left quarter of the frame; anchoring the origin
     there keeps it in place as it scales instead of drifting to centre. */
  transform-origin: 25% 50%;
  will-change: opacity, transform;
}

/* ---- fine film grain, extremely subtle ---- */
.stage__grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================================================
   Content — normal document flow, stacked above the fixed stage.
   Each section is free to be as tall as its own copy needs; the
   page's scroll range is just whatever these add up to.
   ============================================================ */
.content {
  position: relative;
  z-index: 1;
}

/* ---- hero: the one-screen flash before the letter ---- */
.hero-section {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8vh clamp(20px, 6vw, 64px);
}

.hero__kicker {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-light);
  max-width: 460px;
  margin: 0 auto clamp(22px, 3.6vh, 34px);
  text-shadow: 0 2px 20px rgba(7, 5, 2, 0.7);
  opacity: 0;
  animation: rise-in 1.2s var(--ease-premium) 0.15s forwards;
}

.hero__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(34px, 6.6vw, 92px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ivory);
  text-shadow: 0 4px 40px rgba(7, 5, 2, 0.55), 0 1px 4px rgba(7, 5, 2, 0.4);
}

.hero__title .line {
  display: block;
  overflow: hidden;
  opacity: 0;
  transform: translateY(46px);
  animation: rise-in 1.15s var(--ease-premium) forwards;
}

.hero__title em {
  font-style: italic;
  color: var(--gold-light);
}

.hero__title .line:nth-child(1) { animation-delay: 0.32s; }
.hero__title .line:nth-child(2) { animation-delay: 0.5s; }

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

/* ---- scroll cue ---- */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(28px, 5vh, 48px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-premium);
}

.scroll-cue.is-visible {
  opacity: 1;
}

.scroll-cue.is-hidden {
  opacity: 0;
}

.scroll-cue__label {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  font-weight: 500;
}

.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  overflow: hidden;
}

.scroll-cue__dot {
  position: absolute;
  top: 0;
  left: -1.5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 6px var(--gold-light);
  animation: cue-drop 2.2s ease-in-out infinite;
}

@keyframes cue-drop {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: 1; }
  85% { opacity: 0; }
  100% { transform: translateY(34px); opacity: 0; }
}

/* ============================================================
   Letter — the personal application copy. Left-aligned running
   prose reads far better than centred text at this length; the
   card is only as tall as the words need, so nothing ever clips.
   ============================================================ */
.letter {
  display: flex;
  justify-content: center;
  padding: 14vh clamp(24px, 7vw, 64px) 16vh;
}

.letter__content {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.letter__content p {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(16px, 1.9vw, 18px);
  line-height: 1.75;
  letter-spacing: 0.005em;
  color: var(--ivory);
  text-shadow: 0 2px 16px rgba(7, 5, 2, 0.6);
}

.letter__greeting {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(24px, 3.2vw, 32px) !important;
  line-height: 1.3 !important;
  color: var(--gold-light) !important;
}

.letter__closing {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.8vw, 28px) !important;
  color: var(--gold-light) !important;
  margin-top: 10px;
}

/* ---- generic scroll reveal, used by the letter and the form ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease-premium), transform 1s var(--ease-premium);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Form section
   ============================================================ */
.form-section {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10vh clamp(20px, 6vw, 64px) 14vh;
}

.form {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(32px, 4vw, 44px) clamp(26px, 3.4vw, 40px);
  border-radius: 2px;
  background: linear-gradient(155deg, rgba(28, 19, 5, 0.55), rgba(7, 5, 2, 0.5));
  border: 1px solid rgba(212, 175, 55, 0.22);
  backdrop-filter: blur(22px) saturate(1.1);
  -webkit-backdrop-filter: blur(22px) saturate(1.1);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* El control envuelve sólo input + label, para que la línea dorada quede
   anclada al input y no se desplace cuando aparece el mensaje de error. */
.field__control {
  position: relative;
  display: block;
}

.field input {
  width: 100%;
  padding: 14px 2px 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(244, 236, 223, 0.28);
  color: var(--ivory);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.01em;
  border-radius: 0;
  transition: border-color 0.5s var(--ease-premium);
}

.field input:focus {
  outline: none;
  border-bottom-color: var(--gold-light);
}

.field label {
  position: absolute;
  left: 2px;
  top: 14px;
  font-size: 15px;
  color: var(--ivory-dim);
  letter-spacing: 0.01em;
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.35s var(--ease-premium), color 0.35s var(--ease-premium);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  transform: translateY(-18px) scale(0.72);
  color: var(--gold-light);
}

.field__control::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1px;
  width: 0;
  background: var(--gold-light);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.7);
  transition: width 0.5s var(--ease-premium);
}

.field__control:focus-within::after {
  width: 100%;
}

/* ---- validación ---- */
.field__error {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--rose);
  margin-top: 7px;
  min-height: 13px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.4s var(--ease-premium), transform 0.4s var(--ease-premium);
}

.field.is-invalid .field__error {
  opacity: 1;
  transform: translateY(0);
}

.field.is-invalid input {
  border-bottom-color: var(--rose);
}

/* Especificidad alta a propósito: tiene que ganarle a la regla del label
   flotante, que si no deja la etiqueta en dorado sobre un campo con error. */
.field.is-invalid .field__control input + label {
  color: var(--rose);
}

.form__notice {
  font-size: 12px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: var(--rose);
  text-align: center;
  min-height: 0;
}

.form__notice:not(:empty) {
  margin-top: -4px;
}

.cta {
  position: relative;
  overflow: hidden;
  margin-top: 8px;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: var(--bronze-deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 1px;
  transition: transform 0.35s var(--ease-premium), box-shadow 0.35s var(--ease-premium), filter 0.35s var(--ease-premium);
  box-shadow: 0 10px 30px -12px rgba(201, 162, 39, 0.55);
}

.cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 16px 38px -14px rgba(201, 162, 39, 0.7);
}

.cta:active {
  transform: translateY(0);
}

.cta.is-busy {
  cursor: default;
  transform: none;
  filter: none;
  color: rgba(28, 19, 5, 0.75);
}

/* Un brillo lento cruza el botón mientras se envía. */
.cta.is-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  animation: cta-sheen 1.5s var(--ease-premium) infinite;
}

@keyframes cta-sheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.cta:focus-visible {
  outline: 1px solid var(--gold-light);
  outline-offset: 3px;
}

/* ---- success state ---- */
.form__success {
  display: none;
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: clamp(40px, 6vw, 56px) clamp(26px, 3.4vw, 40px);
}

.form__success.is-visible {
  display: block;
  animation: rise-in 0.9s var(--ease-premium) forwards;
}

.form__success-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 42px);
  color: var(--gold-light);
  margin-bottom: 12px;
}

.form__success-text {
  font-size: 14px;
  color: var(--ivory-dim);
  letter-spacing: 0.02em;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .hero__title .line,
  .hero__kicker,
  .scroll-cue,
  .reveal,
  .form__success.is-visible {
    animation: none;
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .stage__eagle {
    width: 260vw;
  }

  .form__row {
    grid-template-columns: 1fr;
  }

  .hero__title {
    font-size: clamp(30px, 9vw, 44px);
  }

  .hero__kicker {
    max-width: 320px;
  }

  .letter {
    padding: 10vh clamp(20px, 6vw, 40px) 12vh;
  }

  .letter__content p {
    font-size: 16px;
    line-height: 1.7;
  }
}

@media (max-width: 480px) {
  .form {
    max-width: 100%;
    padding: 30px 22px;
  }

  .hero__kicker {
    max-width: 280px;
    letter-spacing: 0.06em;
  }
}

@media (min-width: 1600px) {
  .stage__eagle {
    width: 1500px;
  }
}
