/* ====================================================
   CRAFT.CSS — Ronda 2 "a tope"
   Tejido conectivo + secciones emocionales + el 1%.
   Todo aditivo, on-brand (papel · brasa · mantel),
   y respetuoso con prefers-reduced-motion.
==================================================== */

/* =========================================
   1) SEAMS — costuras suaves entre secciones
   El corte dark↔light deja de ser una línea dura
   y pasa a ser un desvanecido. Pseudo en la capa
   de fondo de cada sección oscura (no pisa las
   ::before/::after ya existentes de contenido).
========================================= */
.valores,
.prensa,
.reservas {
  /* punto de anclaje para las costuras */
  isolation: isolate;
}

.valores::after,
.prensa::after,
.reservas::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 120px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(13, 8, 5, 0.45), transparent);
}

/* La marquesina ya hace de costura entre hero y chef.
   El footer hereda el oscuro de reservas: sin costura ahí. */

/* =========================================
   2) ATMÓSFERA HILADA — el susurro de la brasa
   Unas pocas ascuas CSS (baratas) flotan en las
   secciones oscuras para que la firma del hero
   respire por toda la página. Sin canvas.
========================================= */
.ember-whisper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ember-whisper span {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 84, 0.9), rgba(237, 106, 43, 0) 70%);
  opacity: 0;
  animation: emberRise var(--qcv-dur, 14s) var(--qcv-delay, 0s) ease-in infinite;
}

.ember-whisper span:nth-child(1) { left: 12%; --qcv-dur: 15s; --qcv-delay: 0s;   width: 3px; height: 3px; }
.ember-whisper span:nth-child(2) { left: 28%; --qcv-dur: 19s; --qcv-delay: 4s;   width: 5px; height: 5px; }
.ember-whisper span:nth-child(3) { left: 47%; --qcv-dur: 13s; --qcv-delay: 7s; }
.ember-whisper span:nth-child(4) { left: 63%; --qcv-dur: 21s; --qcv-delay: 2s;   width: 3px; height: 3px; }
.ember-whisper span:nth-child(5) { left: 81%; --qcv-dur: 17s; --qcv-delay: 9s;   width: 5px; height: 5px; }
.ember-whisper span:nth-child(6) { left: 92%; --qcv-dur: 16s; --qcv-delay: 5s; }

@keyframes emberRise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  12%  { opacity: 0.8; }
  70%  { opacity: 0.5; }
  100% { transform: translateY(-78vh) translateX(24px); opacity: 0; }
}

/* Que el contenido quede por encima del susurro */
.valores > .container,
.prensa > .container,
.reservas > .container { position: relative; z-index: 1; }

/* =========================================
   3) "LA CHEF" — showpiece emocional
========================================= */

/* Capitular editorial en el primer párrafo (la 'V' de Valentina) */
.chef-text--lead::first-letter {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 3.4em;
  line-height: 0.78;
  float: left;
  margin: 0.06em 0.14em 0 0;
  color: var(--color-orange);
}

/* Foto como polaroid clavada: cinta de papel arriba */
.chef-photo-wrap::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  width: 96px;
  height: 26px;
  transform: translateX(-50%) rotate(-3deg);
  background: linear-gradient(135deg, rgba(234, 192, 114, 0.55), rgba(212, 162, 74, 0.35));
  border: 1px solid rgba(154, 115, 40, 0.25);
  z-index: 6;
  box-shadow: var(--shadow-sm);
}

/* Firma manuscrita bajo la cita */
.chef-signature {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.chef-signature-name {
  font-family: var(--font-hand);
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  line-height: 0.9;
  color: var(--color-orange);
  font-weight: 700;
}

.chef-signature-line {
  width: 160px;
  max-width: 60%;
  height: 14px;
  color: var(--color-orange);
  opacity: 0.6;
}

.chef-signature-role {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-text-faded);
  margin-top: 0.35rem;
}

/* El trazo de la firma se dibuja al revelarse */
.chef-signature-line path {
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  transition: stroke-dashoffset 1.4s var(--ease-out-expo) 0.5s;
}

.reveal.is-visible .chef-signature-line path { stroke-dashoffset: 0; }

/* =========================================
   4) RESERVAS — invitación cálida (cierre)
========================================= */

/* Nota manuscrita "Ti aspettiamo" sobre el formulario */
.reservas-note {
  font-family: var(--font-hand);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--color-orange-light);
  font-weight: 600;
  margin-bottom: 0.35rem;
  transform: rotate(-2deg);
  transform-origin: left center;
}

/* Botón de reservar con brillo cálido al reposo */
.reservas-form .btn-orange {
  box-shadow: 0 10px 30px rgba(237, 106, 43, 0.3);
}

/* Estado de éxito del formulario (lo aplica app.js al confirmar) */
.reservas-form .btn-orange:disabled {
  opacity: 1;
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 10px 30px rgba(95, 112, 56, 0.3);
}

/* Refuerzo de foco accesible en los campos (sobre el ya existente) */
.reservas-form .form-input:focus-visible,
.reservas-form .form-select:focus-visible,
.reservas-form .form-textarea:focus-visible {
  outline: 2px solid var(--color-orange-light);
  outline-offset: 2px;
}

/* Widget oficial Mesa4U (iframe) — marco crema que lo integra en
   la sección oscura de Reservas, con la marca arriba. */
.reservas-widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border-orange);
  border-radius: var(--border-radius-lg);
  padding: clamp(1.1rem, 2.2vw, 1.6rem);
  box-shadow: var(--shadow-lg);
}

.reservas-widget .reservas-note {
  color: var(--color-orange-dark); /* contraste sobre crema */
}

#mesa4u-widget {
  margin: 0.4rem 0 0.6rem;
  min-height: 480px; /* evita el salto mientras el iframe carga */
}

#mesa4u-widget iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
}

.reservas-widget .reservas-form-footer {
  color: var(--color-text-faded);
  margin-top: 0.5rem;
}

.reservas-widget .reservas-form-footer a {
  color: var(--color-orange-dark);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-smooth);
}

.reservas-widget .reservas-form-footer a:hover {
  border-bottom-color: var(--color-orange-dark);
}

/* =========================================
   TESTIMONIOS — refinamiento editorial
========================================= */
.testimonio-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: var(--space-md);
}

/* La fila superior ya gestiona el espaciado; las estrellas no llevan margen */
.testimonio-top .testimonio-stars { margin-bottom: 0; }

.testimonio-source {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-family: var(--font-ui);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faded);
  white-space: nowrap;
}

.testimonio-source svg {
  width: 14px;
  height: 14px;
  color: var(--color-accent); /* check en oliva = reseña verificada */
  flex-shrink: 0;
}

/* Autor con avatar de inicial */
.testimonio-author {
  justify-content: flex-start;
  gap: 0.75rem;
}

.testimonio-avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-content: center;
  background: linear-gradient(135deg, var(--color-orange-light), var(--color-orange-dark));
  color: var(--color-text-light);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.testimonio-author-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

/* =========================================
   NAV — estado activo (lo marca animations.js al
   hacer scroll, pero no tenía estilo: era invisible)
========================================= */
.nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.nav-link.active {
  opacity: 1;
}

/* =========================================
   GALERÍA — afordancia de "ampliar" + foco
========================================= */
.galeria-item::after {
  content: '';
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(13, 8, 5, 0.5)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6ecd6' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E")
    center / 18px no-repeat;
  border: 1px solid rgba(246, 236, 214, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
  z-index: 3;
  pointer-events: none;
}

.galeria-item:hover::after,
.galeria-item:focus-visible::after { opacity: 1; transform: scale(1); }

.galeria-item:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 3px;
}

/* =========================================
   HERO-META — los 3 datos como barra de credenciales
========================================= */
@media (min-width: 769px) {
  .hero-meta-item:nth-child(2) {
    border-left: 1px solid rgba(246, 236, 214, 0.16);
    border-right: 1px solid rgba(246, 236, 214, 0.16);
    padding: 0 clamp(1.5rem, 4vw, 3.5rem);
  }
}

/* =========================================
   FOOTER — toque de firma "dal 2018"
========================================= */
.footer-brand-est {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--color-gold-light);
  margin: -0.25rem 0 var(--space-md);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* =========================================
   CONSISTENCIA — focos y enlaces uniformes
========================================= */
/* Los items de galería son role=button: ya cubiertos arriba.
   Refuerzo de foco en el toggle del menú y el logo. */
.nav-logo:focus-visible,
.nav-toggle:focus-visible,
.footer-social:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Enlaces de datos de contacto: subrayado consistente al hover/focus */
.reservas-data-value a:focus-visible {
  outline: 2px solid var(--color-orange-light);
  outline-offset: 2px;
}

/* =========================================
   5) EL 1% — blur-up al cargar imágenes
   js/enhance.js añade .img-blur a la imagen y
   .img-loaded cuando termina de cargar.
========================================= */
.img-blur {
  opacity: 0;
  filter: blur(14px);
  transition: opacity 0.9s var(--ease-out-expo), filter 0.9s var(--ease-out-expo);
}

.img-blur.img-loaded {
  opacity: 1;
  filter: blur(0);
}

/* =========================================
   REDUCED MOTION — apagar lo cinético
========================================= */
@media (prefers-reduced-motion: reduce) {
  .ember-whisper { display: none; }
  .reservas-note { transform: none; }
  .chef-signature-line path { stroke-dashoffset: 0; transition: none; }
  .img-blur { opacity: 1; filter: none; transition: none; }
  .img-blur.img-loaded { filter: none; }
}

/* En móvil, el susurro de brasas es coste sin retorno visible */
@media (max-width: 768px) {
  .ember-whisper { display: none; }
}

/* === Remates móvil de la ronda de pulido === */
@media (max-width: 640px) {
  /* Capitular un poco menor para que respire en columna estrecha */
  .chef-text--lead::first-letter {
    font-size: 2.8em;
    margin: 0.05em 0.1em 0 0;
  }
  /* Testimonios: avatar y fuente algo más compactos */
  .testimonio-avatar { width: 38px; height: 38px; font-size: 1.05rem; }
  .testimonio-source { font-size: 0.6rem; }
  .testimonio-top { margin-bottom: 0.85rem; }
  /* El marco del widget pega menos a los bordes */
  .reservas-widget { padding: 1rem 0.85rem; }
}

/* ====================================================
   RONDA 3 — pulido fino: tipografía, conversión y a11y.
   Aditivo, on-brand, reduced-motion safe.
==================================================== */

/* 1) Offset de ancla nativo (coherente con el scroll JS de -80px) */
:where(section[id], #main) { scroll-margin-top: 84px; }

/* 2) Microtipografía 2025: equilibrado de títulos, viudas y puntuación colgante */
h1, h2, h3,
.hero-title, .section-title, .chef-title, .reservas-title,
.prensa-title, .reservas-mapa-title, .entorno-quote-text {
  text-wrap: balance;
}
p, .section-subtitle, .hero-description, .chef-text,
.plato-description, .testimonio-text {
  text-wrap: pretty;
}
.chef-quote, .prensa-cite, .entorno-quote, blockquote {
  hanging-punctuation: first last;
}

/* 3) Pastilla de estado Abierto/Cerrado en el hero (la pinta app.js) */
.hero-estado {
  margin: 0.25rem auto 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hero-estado[hidden] { display: none; }
.hero-estado .estado-texto { color: var(--color-text-dim); }
.hero-estado .estado-texto strong { color: var(--color-text-light); }

/* 4) Tira de credenciales sobre el widget de reservas (prueba social junto al CTA) */
.reservas-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.15rem;
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.25rem;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.reservas-trust li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  line-height: 1;
}
.reservas-trust strong {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--color-orange-dark);
  font-variant-numeric: tabular-nums;
}
.reservas-trust span {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* 5) Fallback resiliente del widget Mesa4U:
   si el loader externo tarda o falla, el usuario sigue pudiendo reservar.
   app.js lo oculta en cuanto Mesa4U inyecta su iframe. */
#mesa4u-widget { position: relative; }
.widget-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  min-height: 480px;
  text-align: center;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.5;
  border: 1px dashed var(--color-border-orange);
  border-radius: 12px;
  background: rgba(237, 106, 43, 0.04);
}
.widget-fallback strong { color: var(--color-orange-dark); }
.widget-fallback-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(237, 106, 43, 0.2);
  border-top-color: var(--color-orange);
  animation: qcvSpin 0.9s linear infinite;
}
@keyframes qcvSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .widget-fallback-spinner { animation: none; }
  .hero-estado { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
