/* ============================================================================
   ESSENTIA — Estudio de Pilates Reformer · Torrent, València
   Hoja de estilos principal
   ============================================================================ */

/* ----------------------------- TOKENS / MARCA ----------------------------- */
:root {
  /* Paleta de marca */
  --cream:        #F3EBDB;  /* fondo general */
  --cream-deep:   #ECE1CC;  /* secciones alternas */
  --cream-soft:   #F8F2E7;  /* tarjetas claras */
  --sage:         #79856B;  /* verde salvia — marca (acentos, labels, iconos) */
  --sage-deep:    #5C6650;  /* botones / hover (contraste AA) */
  --sage-soft:    #C9CFBF;  /* detalles, bordes, chips */
  --sage-soft-2:  #DDE1D3;  /* tinte suave */
  --ink:          #2C3227;  /* texto principal (verde-tinta, AA sobre cream) */
  --ink-soft:     #565F4B;  /* texto secundario */
  --white:        #FFFFFF;
  --black:        #1A1E18;

  /* Semánticos */
  --bg:            var(--cream);
  --surface:       var(--cream-soft);
  --text:          var(--ink);
  --text-muted:    var(--ink-soft);
  --accent:        var(--sage);
  --border:        rgba(121, 133, 107, 0.28);
  --border-strong: rgba(121, 133, 107, 0.5);

  /* Tipografía */
  --font-display: "Cormorant", "Garamond", Georgia, serif;
  --font-body:    "EB Garamond", "Garamond", Georgia, serif;

  /* Escala de espacio */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: 7rem;

  /* Otros */
  --container: 1200px;
  --radius:    14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 10px rgba(44, 50, 39, 0.06);
  --shadow-md: 0 14px 40px -18px rgba(44, 50, 39, 0.28);
  --shadow-lg: 0 30px 70px -30px rgba(44, 50, 39, 0.38);
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --header-h:  76px;
}

/* ------------------------------- RESET ------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 1.125rem;      /* 18px base — serif necesita algo más */
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }

/* Accesibilidad: foco visible */
:focus-visible {
  outline: 2px solid var(--sage-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  background: var(--sage-deep); color: var(--cream);
  padding: 0.6rem 1.2rem; border-radius: 0 0 10px 10px; z-index: 2000;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0; }

/* ------------------------------ LAYOUT ------------------------------------ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
.section { padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; }
.alt-bg { background: var(--cream-deep); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.grid-2-media { align-items: center; }

.section-head { max-width: 640px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head.center { margin-inline: auto; text-align: center; }

/* --------------------------- TIPOGRAFÍA ----------------------------------- */
.h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sage);
  margin-bottom: 1.2rem;
}
.eyebrow-light { color: var(--cream); opacity: 0.9; }
.lead {
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  color: var(--text-muted);
  margin-top: 1.2rem;
  line-height: 1.55;
}
.prose p { color: var(--text-muted); margin-bottom: 1.1rem; font-size: 1.15rem; }
.prose p:last-child { margin-bottom: 0; }

/* ------------------------------ BOTONES ----------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  font-family: var(--font-body);
  font-size: 1rem; font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.95rem 2rem;
  border-radius: 999px;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  min-height: 48px;
  will-change: transform;
}
.btn-sm { padding: 0.65rem 1.4rem; font-size: 0.95rem; min-height: 42px; }
.btn-lg { padding: 1.1rem 2.6rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--sage-deep); color: var(--cream); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--border-strong); }
.btn-ghost:hover { background: var(--sage); color: var(--cream); border-color: var(--sage); transform: translateY(-2px); }
.btn-ghost-light { color: var(--cream); border-color: rgba(243, 235, 219, 0.55); }
.btn-ghost-light:hover { background: var(--cream); color: var(--ink); border-color: var(--cream); }

/* ------------------------------- HEADER ----------------------------------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease), height 0.4s var(--ease);
}
.site-header.scrolled {
  background: rgba(243, 235, 219, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
  height: 64px;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.brand-mark {
  font-family: var(--font-display);
  font-size: 1.7rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink);
  transition: color 0.4s var(--ease);
}
.hero-lock .brand-mark, .hero-lock .nav-list a, .hero-lock .lang-btn { color: var(--cream); }
.hero-lock .menu-toggle span { background: var(--cream); }
.site-header.scrolled .brand-mark,
.site-header.scrolled .nav-list a,
.site-header.scrolled .lang-btn { color: var(--ink); }
.site-header.scrolled .menu-toggle span { background: var(--ink); }

.nav-list { display: flex; gap: clamp(1.2rem, 2.5vw, 2.2rem); }
.nav-list a {
  font-size: 1.02rem; color: var(--ink); position: relative; padding-block: 0.3rem;
  transition: color 0.25s var(--ease);
}
.nav-list a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1.5px; width: 0;
  background: currentColor; transition: width 0.3s var(--ease);
}
.nav-list a:hover::after { width: 100%; }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.lang-switch { display: flex; align-items: center; gap: 0.35rem; }
.lang-btn {
  font-size: 0.9rem; font-weight: 600; letter-spacing: 0.08em; color: var(--ink);
  opacity: 0.5; padding: 0.2rem 0.1rem; transition: opacity 0.25s var(--ease);
}
.lang-btn.is-active { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.lang-btn:hover { opacity: 0.85; }
.lang-sep { opacity: 0.4; }

.menu-toggle { display: none; flex-direction: column; gap: 5px; width: 30px; height: 30px; justify-content: center; align-items: center; }
.menu-toggle span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 0.3s var(--ease), opacity 0.3s var(--ease); }
.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menú móvil */
.mobile-menu {
  position: fixed; inset: 0; z-index: 900;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
}
.menu-open .mobile-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.mobile-menu nav { display: flex; flex-direction: column; align-items: center; gap: 1.6rem; text-align: center; }
.mobile-menu a { font-family: var(--font-display); font-size: 2rem; color: var(--ink); }
.mobile-menu .mobile-cta { font-family: var(--font-body); font-size: 1.05rem; margin-top: 1rem; }

/* -------------------------------- HERO ------------------------------------ */
.hero {
  position: relative; min-height: 100svh; min-height: 100vh;
  display: flex; align-items: flex-end;
  padding-bottom: clamp(3rem, 8vh, 6rem); padding-top: var(--header-h);
  overflow: hidden; color: var(--cream);
}
.hero-media { position: absolute; inset: 0; z-index: 0; }
.hero-img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(30,35,26,0.42) 0%, rgba(30,35,26,0.28) 38%, rgba(30,35,26,0.78) 100%);
}
.hero-content { position: relative; z-index: 2; max-width: 900px; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(3.4rem, 12vw, 8.5rem);
  line-height: 0.92; letter-spacing: -0.02em;
  color: var(--cream);
  margin-bottom: 1.6rem;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line .word { display: inline-block; }
.hero-title .line:nth-child(2) { font-style: italic; font-weight: 400; padding-left: 0.08em; }
.hero-sub { max-width: 540px; font-size: clamp(1.15rem, 2.2vw, 1.4rem); color: rgba(243,235,219,0.92); margin-bottom: 2.2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ----------------------------- MEDIA FRAME -------------------------------- */
.media-frame {
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md);
  position: relative; aspect-ratio: 4 / 5; background: var(--sage-soft);
}
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.benefits-inner .media-frame { aspect-ratio: 4 / 3; }

/* ---------------------------- MINI STATS ---------------------------------- */
.mini-stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 2.5rem; }
.mini-stat { display: flex; flex-direction: column; }
.mini-stat .num { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--sage); font-weight: 600; }
.mini-stat .lbl { font-size: 0.95rem; color: var(--text-muted); max-width: 12ch; margin-top: 0.4rem; }

/* ----------------------------- BENEFICIOS --------------------------------- */
.benefit-list { display: grid; gap: 0.5rem; }
.benefit-item { padding: 1.6rem 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: start; }
.benefit-item:last-child { border-bottom: 1px solid var(--border); }
.benefit-icon { width: 44px; height: 44px; flex: none; color: var(--sage); }
.benefit-icon svg { width: 100%; height: 100%; }
.benefit-item h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; color: var(--ink); margin-bottom: 0.3rem; }
.benefit-item p { color: var(--text-muted); font-size: 1.05rem; }

/* ------------------------------- CLASES ----------------------------------- */
.classes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.class-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 3 / 4; display: flex; align-items: flex-end; color: var(--cream);
  box-shadow: var(--shadow-sm); isolation: isolate;
}
.class-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform 0.8s var(--ease); }
.class-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(44,50,39,0) 30%, rgba(44,50,39,0.78) 100%); }
.class-card:hover img { transform: scale(1.06); }
.class-body { padding: 1.5rem; }
.class-people { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; opacity: 0.9; margin-bottom: 0.4rem; }
.class-body h3 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; margin-bottom: 0.5rem; }
.class-body p { font-size: 0.98rem; opacity: 0; max-height: 0; overflow: hidden; transition: opacity 0.4s var(--ease), max-height 0.4s var(--ease); }
.class-card:hover .class-body p, .class-card:focus-within .class-body p { opacity: 0.92; max-height: 8rem; }

/* -------------------------------- MÉTODO ---------------------------------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; list-style: none; }
.step { position: relative; }
.step .n { font-family: var(--font-display); font-size: 3rem; color: var(--sage); font-weight: 600; line-height: 1; display: block; margin-bottom: 0.8rem; }
.step h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--ink); margin-bottom: 0.4rem; }
.step p { color: var(--text-muted); font-size: 1.02rem; }
.step::before { content: ""; position: absolute; top: 1.4rem; left: -1rem; width: 6px; height: 6px; border-radius: 50%; background: var(--sage); opacity: 0; }

/* -------------------------------- EQUIPO ---------------------------------- */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.team-card { text-align: center; }
.team-photo { border-radius: 50%; overflow: hidden; aspect-ratio: 1; width: min(260px, 70%); margin: 0 auto 1.4rem; box-shadow: var(--shadow-md); background: var(--sage-soft); }
.team-photo img { width: 100%; height: 100%; object-fit: cover; }
.team-card h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; color: var(--ink); }
.team-card p { color: var(--sage); font-size: 0.95rem; letter-spacing: 0.02em; }

/* ------------------------------- GALERÍA ---------------------------------- */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding-inline: clamp(1rem, 3vw, 2rem); }
.gallery-item { border-radius: var(--radius); overflow: hidden; aspect-ratio: 3/4; background: var(--sage-soft); }
.gallery-item:nth-child(2), .gallery-item:nth-child(3) { aspect-ratio: 3/4; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.gallery-item:hover img { transform: scale(1.05); }

/* ----------------------------- TESTIMONIOS -------------------------------- */
.testi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.testi-card { background: var(--cream-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.2rem; display: flex; flex-direction: column; gap: 1.4rem; }
.testi-card .quote-mark { font-family: var(--font-display); font-size: 3.5rem; line-height: 0.5; color: var(--sage-soft); height: 1rem; }
.testi-card blockquote { font-family: var(--font-display); font-size: 1.4rem; line-height: 1.4; color: var(--ink); font-style: italic; }
.testi-card .author { font-size: 0.95rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sage); margin-top: auto; }

/* ------------------------------ CONTACTO ---------------------------------- */
.contact-grid { align-items: start; gap: clamp(2rem, 5vw, 4.5rem); }
.contact-block { margin-top: 2.2rem; }
.contact-sub { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; color: var(--ink); margin-bottom: 0.6rem; }
.contact-address { color: var(--text-muted); font-size: 1.1rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.1rem; }
.hours { display: grid; gap: 0.5rem; }
.hours li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 1.05rem; }
.hours li span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.map-frame { margin-top: 2.2rem; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16/10; }
.map-frame iframe { width: 100%; height: 100%; border: 0; filter: grayscale(0.25) sepia(0.12); }

/* Formulario */
.form-wrap { background: var(--cream-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.8rem, 4vw, 2.8rem); box-shadow: var(--shadow-sm); position: sticky; top: calc(var(--header-h) + 1rem); }
.field { margin-bottom: 1.2rem; display: flex; flex-direction: column; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field label { font-size: 0.9rem; letter-spacing: 0.04em; color: var(--ink); margin-bottom: 0.4rem; font-weight: 600; }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 1.05rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 0.8rem 1rem; min-height: 48px; width: 100%;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px rgba(121,133,107,0.16); }
.field.invalid input, .field.invalid select { border-color: #b0553f; }
.field-error { color: #b0553f; font-size: 0.85rem; margin-top: 0.35rem; min-height: 1rem; }
.form-privacy { font-size: 0.85rem; color: var(--text-muted); margin-top: 1rem; text-align: center; }
.form-status { text-align: center; margin-top: 0.9rem; font-size: 1rem; min-height: 1.4rem; }
.form-status.ok { color: var(--sage-deep); }
.form-status.err { color: #b0553f; }

/* ------------------------------ CTA FINAL --------------------------------- */
.final-cta { position: relative; padding-block: clamp(5rem, 12vw, 9rem); color: var(--cream); text-align: center; overflow: hidden; }
.final-cta-media { position: absolute; inset: 0; z-index: 0; }
.final-cta-media img { width: 100%; height: 100%; object-fit: cover; }
.final-cta::after { content: ""; position: absolute; inset: 0; background: rgba(44,50,39,0.6); z-index: 1; }
.final-cta-inner { position: relative; z-index: 2; max-width: 680px; }
.final-cta-title { color: var(--cream); }
.final-cta-text { font-size: clamp(1.15rem, 2.2vw, 1.4rem); margin: 1.2rem 0 2.2rem; color: rgba(243,235,219,0.92); }

/* ------------------------------- FOOTER ----------------------------------- */
.site-footer { background: var(--ink); color: rgba(243,235,219,0.8); padding-top: clamp(3.5rem, 7vw, 5.5rem); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2.5rem; padding-bottom: 3rem; border-bottom: 1px solid rgba(243,235,219,0.14); }
.brand-mark-lg { color: var(--cream); font-size: 2.2rem; }
.footer-tag { margin-top: 0.6rem; font-size: 1rem; color: rgba(243,235,219,0.6); }
.footer-col h4 { font-family: var(--font-body); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--sage-soft); margin-bottom: 1.1rem; }
.footer-col ul { display: grid; gap: 0.6rem; }
.footer-col a, .footer-col span { color: rgba(243,235,219,0.8); font-size: 1.02rem; transition: color 0.25s var(--ease); }
.footer-col a:hover { color: var(--cream); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; padding-block: 1.8rem; font-size: 0.9rem; color: rgba(243,235,219,0.55); }
.footer-legal { display: flex; gap: 1.2rem; }

/* =============================== ANIMACIÓN ================================ */
/* Estado inicial de reveal SOLO cuando JS está activo (no-JS = visible).
   El título del hero se oculta con GSAP (js) de forma síncrona en buildStructure,
   no con CSS, para evitar conflictos entre translateY(%) de CSS y yPercent de GSAP. */
.js-ready .reveal { opacity: 0; transform: translateY(28px); }

@media (prefers-reduced-motion: reduce) {
  .js-ready .reveal { opacity: 1 !important; transform: none !important; }
  .js-ready .hero-title .word { transform: none !important; }
  .hero-img { transform: scale(1); }
}

/* ============================== RESPONSIVE ================================ */
@media (max-width: 1024px) {
  .classes-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); gap: 2.5rem; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

@media (max-width: 860px) {
  .nav-list, .nav-cta { display: none; }
  .menu-toggle { display: flex; }
  .grid-2, .contact-grid { grid-template-columns: 1fr; }
  .grid-2-media .media-frame { order: -1; }
  .benefits-inner .media-frame { order: -1; }
  .form-wrap { position: static; }
  .team-grid { grid-template-columns: 1fr; gap: 3rem; }
  .team-photo { width: 220px; }
  .testi-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 1.08rem; }
  .classes-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .hero { align-items: flex-end; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; }
  .btn { width: 100%; }
  .hero-actions .btn { width: 100%; }
}
