/* ==========================================
   CARTA PARA FERNANDO
   Tipografía: Cormorant (display) + Outfit (body)
   Paleta: Carbón cálido, crema, terracota
   ========================================== */

/* --- Custom Properties --- */
:root {
  --bg: #0c0a08;
  --bg-subtle: #131110;
  --text: #e8e0d4;
  --text-muted: #6b635a;
  --accent: #b8734a;
  --accent-glow: rgba(184, 115, 74, 0.06);
  --divider: #1e1b17;
  --font-display: 'Cormorant', Georgia, 'Times New Roman', serif;
  --font-body: 'Outfit', system-ui, -apple-system, sans-serif;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: auto;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.loaded {
  opacity: 1;
}

/* --- Grain Overlay (SVG noise) --- */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
}

/* --- Vignette --- */
.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
  z-index: 9998;
}

/* --- Ambient Light --- */
.ambient-light {
  position: fixed;
  top: 20%;
  left: 40%;
  width: 1000px;
  height: 1000px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
}

/* --- Fixed Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  padding: 0.9rem 2rem;
  background: rgba(12, 10, 8, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(30, 27, 23, 0.4);
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.nav.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav__link {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.3s;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}

.nav__link:hover {
  color: var(--text);
}

.nav__link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Reading Time --- */
.reading-time {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: 3.5rem;
  opacity: 0;
}

/* --- Sections --- */
.section {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 12vh 10vw;
  z-index: 1;
  scroll-margin-top: 50px;
}

.section__inner {
  width: 100%;
  max-width: 660px;
}

.section__inner--center {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

/* --- Section Dividers --- */
.section-line {
  width: 50px;
  height: 1px;
  background: var(--divider);
  margin: 0 10vw;
  position: relative;
  z-index: 1;
}

/* --- Custom Selection --- */
::selection {
  background: rgba(184, 115, 74, 0.25);
  color: var(--text);
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 2px;
}

/* --- Emphasis --- */
em {
  font-style: normal;
  color: var(--accent);
}

/* ==========================================
   BLOQUE 1 — LA APERTURA (pinned cinematic)
   ========================================== */

#apertura {
  min-height: 100vh;
  min-height: 100dvh;
}

.apertura__nombre {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(3.5rem, 9vw, 8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(30px) scale(1.08);
}

.apertura__subtexto {
  margin-top: 3.5rem;
}

.apertura__subtexto p,
.apertura__line {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.5;
  color: var(--text);
  opacity: 0;
  transform: translateY(30px);
}

.apertura__subtexto p + p {
  margin-top: 0.6rem;
}

/* ==========================================
   BLOQUE 2 — QUIÉN SOY
   ========================================== */

#quien-soy .section__content p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1.05rem, 1.35vw, 1.2rem);
  line-height: 1.85;
  margin-bottom: 2.8rem;
}

#quien-soy .section__content p:last-child {
  margin-bottom: 0;
}

#quien-soy .frase-corta {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1.35;
  margin-bottom: 3rem;
  letter-spacing: -0.005em;
}

#quien-soy .fragmentos {
  display: flex;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

#quien-soy .fragmentos span {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ==========================================
   BLOQUE 3 — SU HIJA
   ========================================== */

#su-hija .lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.25;
  margin-bottom: 4rem;
  letter-spacing: -0.01em;
}

#su-hija .section__content p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1.05rem, 1.35vw, 1.2rem);
  line-height: 1.85;
  margin-bottom: 2.8rem;
}

#su-hija .section__content p:last-child {
  margin-bottom: 0;
}

/* --- Pinned Quote Wrapper --- */
.cita-pinned-wrapper {
  position: relative;
  margin: 3.5rem 0;
}

/* --- Word-level animation for quote --- */
.cita .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(12px);
  transition: none;
}

.cita .word.visible {
  opacity: 0.9;
  transform: translateY(0);
}

/* ==========================================
   BLOQUE 4 — LAS INTENCIONES
   ========================================== */

#intenciones {
  text-align: center;
}

#intenciones .section__inner {
  max-width: 720px;
  margin: 0 auto;
}

#intenciones .intencion {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.35;
  margin-bottom: 3rem;
}

#intenciones .intencion:last-child {
  margin-bottom: 0;
}

/* ==========================================
   BLOQUE 5 — EL CIERRE (pinned climax)
   ========================================== */

#cierre {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

#cierre .section__inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.cierre__reveal-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
}

.cierre__line {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.3rem, 2.3vw, 1.85rem);
  line-height: 1.5;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(25px);
}

.cierre__line--pause {
  margin-top: 2.5rem;
}

/* --- Agenda Picker --- */
.section--agenda {
  min-height: auto;
  padding-top: 6vh;
  padding-bottom: 12vh;
}

.agenda {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.agenda__prompt {
  font-family: var(--font-body) !important;
  font-size: 0.9rem !important;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 1.8rem !important;
}

.agenda__dates {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.agenda__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.3s;
  min-width: 62px;
}

.agenda__date:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.agenda__date.selected {
  border-color: var(--accent);
  background: rgba(184, 115, 74, 0.1);
  color: var(--text);
}

.agenda__date-day {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.agenda__date-num {
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1;
}

.agenda__date-month {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  opacity: 0.6;
}

.agenda__times {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.5s ease;
}

.agenda__times.visible {
  min-height: auto;
  max-height: 200px;
  opacity: 1;
}

.agenda__time {
  padding: 8px 18px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.3s;
}

.agenda__time:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.agenda__time.selected {
  border-color: var(--accent);
  background: rgba(184, 115, 74, 0.1);
  color: var(--text);
}

.agenda .btn-final {
  opacity: 1;
  transform: none;
  margin-top: 0.5rem;
  transition: all 0.4s ease;
  display: inline-block;
}

.agenda .btn-final:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.section--agenda .cierre__confirmacion {
  margin-top: 2rem;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.2rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.section--agenda .cierre__confirmacion.visible {
  opacity: 1;
}

.agenda.confirmed .agenda__dates,
.agenda.confirmed .agenda__times,
.agenda.confirmed .agenda__prompt,
.agenda.confirmed .btn-final {
  display: none;
}

/* --- Botón Final --- */
.btn-final {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 18px 60px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(25px);
}

.btn-final::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: -1;
}

.btn-final:hover {
  color: var(--bg);
  border-color: var(--accent);
}

.btn-final:hover::before {
  transform: scaleX(1);
}

.btn-final:active {
  transform: scale(0.97);
}

.btn-final.clicked {
  pointer-events: none;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
  opacity: 1;
}

.btn-final.clicked::before {
  transform: scaleX(1);
}

.cierre__confirmacion {
  margin-top: 2rem;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.2rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.cierre__confirmacion.visible {
  opacity: 1;
}

/* ==========================================
   VERSION TOGGLE (temporal — quitar antes de desplegar)
   ========================================== */

.version-toggle {
  position: fixed;
  top: 3.5rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(14, 12, 10, 0.95);
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 3px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.version-toggle__label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 3px 8px;
  opacity: 0.5;
  white-space: nowrap;
}

.version-toggle__btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.version-toggle__btn:hover {
  color: var(--text);
}

.version-toggle__btn.active {
  background: var(--accent);
  color: var(--bg);
}

/* ==========================================
   CITA / BLOCKQUOTE
   ========================================== */

.cita {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.65;
  padding: 2rem 0 2rem 2.5rem;
  border-left: 2px solid var(--accent);
  opacity: 0.9;
}

.cita p {
  margin: 0 !important;
  font-family: var(--font-display) !important;
  font-style: italic;
  font-size: inherit !important;
  line-height: inherit !important;
}

.cita-intro {
  font-family: var(--font-body) !important;
  font-weight: 300;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem) !important;
  color: var(--text-muted);
  margin-bottom: 0.5rem !important;
}

.cita-cierre {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.25rem, 1.9vw, 1.6rem) !important;
  line-height: 1.35 !important;
  margin-top: 0.5rem;
  margin-bottom: 3rem !important;
}

/* --- Internal Section Divider --- */
.section-line--inner {
  width: 40px;
  height: 1px;
  background: var(--divider);
  margin: 3.5rem 0;
}

/* ==========================================
   BLOQUE 4 — SUPPORTING TEXT
   ========================================== */

#intenciones .intencion-body {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.2rem, 1.9vw, 1.55rem);
  line-height: 1.5;
  margin-bottom: 2.5rem;
}

#intenciones .intencion-body:last-child {
  margin-bottom: 0;
}

/* ==========================================
   ANIMATION STATES
   ========================================== */

/* Sin JS: todo visible */
.reveal {
  opacity: 1;
  transform: translateY(0);
}

/* Con JS: ocultar para animar */
.js-loaded .reveal {
  opacity: 0;
  transform: translateY(28px);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 1024px) {
  .section {
    padding: 10vh 7vw;
  }
  .section-line {
    margin: 0 7vw;
  }
}

@media (max-width: 768px) {
  .nav {
    gap: 1.2rem;
    padding: 0.8rem 1rem;
  }

  .nav__link {
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }

  .version-toggle {
    top: 3rem;
  }

  .section {
    padding: 10vh 8vw;
  }

  .section__inner {
    max-width: 100%;
  }

  .section-line {
    margin: 0 8vw;
  }

  .apertura__nombre {
    font-size: clamp(2.5rem, 13vw, 4.5rem);
  }

  .apertura__subtexto {
    margin-top: 2.5rem;
  }

  .grain {
    opacity: 0.02;
  }

  .ambient-light {
    width: 600px;
    height: 600px;
    top: 15%;
    left: 50%;
  }

  #quien-soy .fragmentos {
    gap: 1.2rem;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 8vh 7vw;
  }

  .btn-final {
    padding: 16px 44px;
    font-size: 1.15rem;
  }

  .apertura__subtexto p,
  .apertura__line {
    font-size: clamp(1.1rem, 4.5vw, 1.4rem);
  }
}
