/* ==========================================================================
   YN Estética · base
   Tokens, tipografía, botones, cabecera, menú, WhatsApp flotante y cursor.
   ========================================================================== */

/* ---------- Fuente autoalojada (sin Google Fonts: RGPD) ---------- */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --white: #FFFFFF;
  --ivory: #FAF7F2;
  --sand: #EFE6DA;
  --beige: #DCCAB4;
  --taupe: #A88B6A;        /* decorativo: líneas y adornos */
  --taupe-deep: #7A5F43;   /* funcional: botones, enlaces y texto pequeño (contraste AA) */
  --ink: #241E1B;          /* texto principal, nunca negro puro */
  --ink-soft: #5E544C;     /* texto secundario (AA en fondos claros) */
  --line: color-mix(in srgb, var(--beige) 70%, transparent);

  /* Una sola familia limpia, como el logo YN, y sin cursivas */
  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display-weight: 300;
  --display-tracking: -0.035em;
  --display-scale: 0.92;
  --display-leading: 1.02;

  /* Escala fluida */
  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.25rem + 1.1vw, 2.3rem);
  --step-3: clamp(2rem, 1.5rem + 2.4vw, 3.75rem);
  --step-4: clamp(2.6rem, 1.6rem + 4.6vw, 6rem);

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 3rem);
  --section: clamp(5rem, 3rem + 8vw, 11rem);
  --radius: 2px;
  --radius-pill: 999px;
  --header-h: 5.5rem;
  --header-h-compact: 4rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------- Reset mínimo ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* overflow-x: clip en html y body: la página nunca se desplaza de lado en el móvil */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, video { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; }
em, i { font-style: normal; }
::selection { background: var(--sand); color: var(--ink); }

:focus-visible { outline: 2px solid var(--taupe-deep); outline-offset: 3px; border-radius: 2px; }

.screen-reader-text, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: var(--gutter); top: -4rem; z-index: 200;
  background: var(--ink); color: var(--ivory); padding: 0.7rem 1rem; border-radius: var(--radius);
  transition: top 0.3s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* ---------- Tipografía ---------- */
.display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: var(--display-leading);
  margin: 0;
  text-wrap: balance;
}
.display em, .display i { font-weight: 400; color: var(--taupe-deep); }
.eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  display: inline-flex; align-items: center; gap: 0.9em;
}
.eyebrow::before, .eyebrow::after { content: ""; width: 2.2rem; height: 1px; background: currentColor; opacity: 0.6; }
.lead { font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); max-width: 34ch; margin: 0; text-wrap: pretty; }

/* Palabras partidas para el revelado de la portada (las crea base.js) */
.w { display: inline-block; overflow: clip; overflow-clip-margin: 0.1em; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.w-i { display: inline-block; will-change: transform; }

.container { width: 100%; max-width: 92rem; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Botones (los de las plantillas y los del editor de bloques) ---------- */
.btn,
.wp-block-button .wp-block-button__link {
  --btn-bg: var(--taupe-deep);
  --btn-fg: var(--white);
  --btn-fill: var(--ink);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.7em;
  min-height: 3.25rem;
  padding: 0.95rem 1.7rem;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: none;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  transition: color 0.3s var(--ease-out), border-color 0.3s var(--ease-out), scale 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
/* Respuesta inmediata al pulsar */
.btn:active, .wp-block-button .wp-block-button__link:active { scale: 0.97; }
/* Relleno que sube desde abajo al pasar el ratón */
.btn::before,
.wp-block-button .wp-block-button__link::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--btn-fill);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform: translateY(101%);
  transition: transform 0.4s var(--ease-out), border-radius 0.4s var(--ease-out);
  z-index: -1;
}
.btn:focus-visible::before, .wp-block-button .wp-block-button__link:focus-visible::before { transform: translateY(0); border-radius: 0; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }

.btn--ghost,
.wp-block-button.is-style-outline > .wp-block-button__link.wp-block-button__link {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-fill: var(--ink);
  background: transparent;
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  padding: 0.95rem 1.7rem;
}
.btn--ghost:focus-visible,
.wp-block-button.is-style-outline > .wp-block-button__link:focus-visible { color: var(--ivory); border-color: var(--ink); }
.btn--sm { min-height: 2.75rem; padding: 0.6rem 1.15rem; font-size: 0.88rem; }

/* Icono de WhatsApp en los botones de cita que llevan a WhatsApp */
.wa-icon::after,
.home-hero .wp-block-button__link[href*="wa.me"]::after {
  content: ""; order: -1; flex: none; width: 1.15em; height: 1.15em; background: currentColor;
  -webkit-mask: var(--wa-svg) center / contain no-repeat; mask: var(--wa-svg) center / contain no-repeat;
}
:root { --wa-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2Zm0 18.2a8.2 8.2 0 0 1-4.2-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2Zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.2-.4.7-1.3.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.2 5.2 0 0 0 1.1 2.7 11.8 11.8 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.2-1.2-.1-.1-.3-.2-.5-.3Z'/%3E%3C/svg%3E"); }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }

/* Efectos de "pasar el ratón" solo con ratón: en el móvil el toque los dejaría "pegados" */
@media (hover: hover) and (pointer: fine) {
  .btn:hover::before, .wp-block-button .wp-block-button__link:hover::before { transform: translateY(0); border-radius: 0; }
  .btn--ghost:hover, .wp-block-button.is-style-outline > .wp-block-button__link:hover { color: var(--ivory); border-color: var(--ink); }
  .nav a:hover::after { transform: scaleX(1); transform-origin: left; }
  .icon-btn:hover { border-color: currentColor; }
  .wa-float:hover { background: var(--taupe-deep); }
}

/* ---------- Cabecera ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center;
  color: var(--ink);
  transition: height 0.35s var(--ease-out), background-color 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}
.admin-bar .site-header { top: var(--wp-admin--admin-bar--height, 32px); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; width: 100%; }
.site-header.is-compact {
  height: var(--header-h-compact);
  background: color-mix(in srgb, var(--ivory) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 1px 0 var(--line);
}

/* Marca YN dibujada en vector */
.brand-mark { display: inline-flex; align-items: center; gap: 0.8rem; text-decoration: none; color: inherit; }
.brand-mark__yn { display: inline-flex; padding-right: 0.85rem; border-right: 1px solid color-mix(in srgb, currentColor 40%, transparent); }
.brand-mark__yn svg { height: 2.3rem; width: auto; display: block; transition: height 0.35s var(--ease-out); }
.is-compact .brand-mark__yn svg { height: 1.9rem; }
.brand-mark__text { display: grid; gap: 0.2rem; }
.brand-mark__name { font-weight: 400; font-size: 0.86rem; letter-spacing: 0.3em; line-height: 1; white-space: nowrap; }
.brand-mark__sub { font-weight: 500; font-size: 0.62rem; letter-spacing: 0.32em; text-transform: uppercase; line-height: 1; opacity: 0.7; white-space: nowrap; }
@media (max-width: 30em) {
  .brand-mark { gap: 0.6rem; }
  .brand-mark__yn { padding-right: 0.6rem; }
  .brand-mark__yn svg { height: 1.9rem; }
  .brand-mark__name { letter-spacing: 0.18em; font-size: 0.8rem; }
  .brand-mark__sub { letter-spacing: 0.22em; }
}

.nav { display: none; }
.nav ul { list-style: none; display: flex; gap: clamp(1.2rem, 2vw, 2.4rem); margin: 0; padding: 0; }
.nav a { text-decoration: none; font-size: 0.92rem; font-weight: 500; letter-spacing: 0.01em; position: relative; padding-block: 0.4rem; white-space: nowrap; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform 0.3s var(--ease-out); }
.nav .has-sub { position: relative; }
.nav .has-sub > a span { font-size: 0.7em; margin-left: 0.2em; }
.nav .sub {
  position: absolute; top: calc(100% + 0.6rem); left: -0.8rem; min-width: 15rem;
  display: grid; gap: 0; padding: 0.5rem; margin: 0; list-style: none;
  background: var(--white); border-radius: 12px; box-shadow: 0 0 0 1px var(--line), 0 24px 48px -24px rgb(36 30 27 / 0.35);
  opacity: 0; visibility: hidden; translate: 0 6px;
  transition: opacity 0.2s ease, translate 0.2s var(--ease-out), visibility 0s linear 0.2s;
}
.nav .sub::before { content: ""; position: absolute; inset: -0.8rem 0 auto 0; height: 0.8rem; }
.nav .has-sub:hover .sub, .nav .has-sub:focus-within .sub { opacity: 1; visibility: visible; translate: 0 0; transition: opacity 0.2s ease, translate 0.2s var(--ease-out), visibility 0s; }
.nav .sub a { display: block; padding: 0.6rem 0.75rem; border-radius: 8px; color: var(--ink); }
.nav .sub a::after { display: none; }
@media (hover: hover) and (pointer: fine) { .nav .sub a:hover { background: var(--ivory); } }

.header-actions { display: flex; align-items: center; gap: 0.6rem; }
.icon-btn {
  width: 2.9rem; height: 2.9rem; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  background: transparent; color: inherit; text-decoration: none; cursor: pointer;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), scale 160ms var(--ease-out);
}
.icon-btn:active { scale: 0.94; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.header-cta { display: none; white-space: nowrap; }
@media (min-width: 40em) { .header-cta { display: inline-flex; } }
@media (max-width: 30em) { .header-actions .icon-btn--phone { display: none; } }

/* Botón "Menú" (más claro que el icono de rayas) */
.menu-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.75rem; padding: 0 1rem;
  border-radius: var(--radius-pill); border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  background: var(--white); color: var(--ink); font: 600 0.9rem/1 var(--font-body); cursor: pointer;
  transition: scale 160ms var(--ease-out), border-color 0.2s ease;
}
.menu-btn:active { scale: 0.96; }
.menu-btn__label::before { content: "Menú"; }
.menu-open .menu-btn__label::before { content: "Cerrar"; }
.menu-btn__chev { width: 0.45rem; height: 0.45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; rotate: 45deg; translate: 0 -2px; transition: rotate 0.3s var(--ease-out), translate 0.3s var(--ease-out); }
.menu-open .menu-btn__chev { rotate: -135deg; translate: 0 2px; }

/* Con 5 enlaces y la marca, el menú completo solo cabe desde 1200 px */
@media (min-width: 75em) {
  .nav { display: block; }
  .menu-btn { display: none; }
}

/* ---------- Menú desplegable desde arriba (móvil y tablet) ---------- */
.mobile-menu {
  position: fixed; inset: 0 0 auto 0; z-index: 45;
  max-height: 100svh; overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 1.4rem;
  padding: calc(var(--header-h) + 0.25rem) var(--gutter) 1.4rem;
  background: var(--ivory); box-shadow: 0 30px 60px -30px rgb(36 30 27 / 0.4);
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  /* Se cierra más rápido de lo que se abre: responde sin hacer esperar */
  transition: clip-path 0.25s var(--ease-out), visibility 0s linear 0.25s;
}
.menu-open .mobile-menu { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path 0.4s var(--ease-out), visibility 0s; }
.menu-open { overflow: hidden; }
.menu-open .site-header { background: var(--ivory); box-shadow: none; backdrop-filter: none; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.mm-title { margin: 0 0 0.6rem; font-size: var(--step--1); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.mobile-menu .mm-grid { margin: 0 0 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.mm-grid a { display: flex; align-items: center; min-height: 3rem; padding: 0.6rem 0.85rem; border-radius: 10px; background: var(--sand); text-decoration: none; font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.mobile-menu .mm-list { border-top: 1px solid var(--line); }
.mm-list a { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.95rem 0.2rem; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 1.05rem; font-weight: 500; color: var(--ink); }
.mm-list small { font-size: 0.78rem; color: var(--ink-soft); font-weight: 400; }
.mobile-menu__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.mobile-menu__foot .btn { width: 100%; padding-inline: 0.8rem; font-size: 0.86rem; }
@media (max-width: 22em) { .mobile-menu__foot { grid-template-columns: 1fr; } }
@media (min-width: 75em) { .mobile-menu { display: none; } }

/* ---------- WhatsApp flotante: siempre visible en el móvil ---------- */
.wa-float {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: 0.6rem;
  height: 3.4rem; padding: 0 1.05rem;
  border-radius: var(--radius-pill);
  background: var(--ink); color: var(--ivory);
  text-decoration: none; font-weight: 600; font-size: 0.9rem;
  box-shadow: 0 10px 30px -12px rgb(36 30 27 / 0.45);
  transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out), background-color 0.2s ease, scale 160ms var(--ease-out);
}
.wa-float:active { scale: 0.95; }
.wa-float svg { width: 1.35rem; height: 1.35rem; }
@media (min-width: 48em) {
  .wa-float { transform: translateY(140%); opacity: 0; }
  .wa-float.is-visible { transform: none; opacity: 1; }
}
.menu-open .wa-float { opacity: 0; pointer-events: none; }

/* Aviso de web en pruebas (solo mientras los buscadores están desactivados) */
.draft-badge {
  position: fixed; left: max(1rem, env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 39;
  margin: 0; padding: 0.45rem 0.8rem; border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.92); border: 1px dashed var(--taupe-deep);
  font: 600 0.7rem/1.2 var(--font-body); letter-spacing: 0.06em; color: var(--ink); pointer-events: none;
}
@media (max-width: 47.99em) { .draft-badge { bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 0.9rem); font-size: 0.65rem; padding: 0.35rem 0.6rem; } }

/* ---------- Cursor discreto (solo escritorio con ratón) ---------- */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .has-cursor .cursor {
    display: block; position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none;
    width: 2.4rem; height: 2.4rem; margin: -1.2rem 0 0 -1.2rem; border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--taupe-deep) 70%, transparent);
    transition: width 0.5s var(--ease-out), height 0.5s var(--ease-out), margin 0.5s var(--ease-out), background-color 0.5s var(--ease-out), opacity 0.4s;
    opacity: 0;
  }
  .has-cursor .cursor.is-active { opacity: 1; }
  .has-cursor .cursor.is-hover { width: 4.2rem; height: 4.2rem; margin: -2.1rem 0 0 -2.1rem; background: color-mix(in srgb, var(--beige) 35%, transparent); border-color: transparent; }
}

/* ---------- Grano de papel ---------- */
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.14 0 0 0 0 0.11 0 0 0 0 0.09 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.16; mix-blend-mode: multiply;
}

/* ---------- Pie ---------- */
.site-footer { background: var(--ink); color: var(--ivory); padding: clamp(2.5rem, 5vw, 4rem) 0 1.5rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer a { text-decoration: none; color: rgb(250 247 242 / 0.88); }
@media (hover: hover) and (pointer: fine) { .site-footer a:hover { color: var(--white); text-decoration: underline; } }
.footer-compact { display: grid; gap: 1.4rem; margin-bottom: 2rem; }
.footer-contact { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; font-size: 0.92rem; color: rgb(250 247 242 / 0.75); }
@media (min-width: 56em) { .footer-compact { grid-auto-flow: column; justify-content: space-between; align-items: center; } }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding-top: 1.6rem; border-top: 1px solid rgb(250 247 242 / 0.15); font-size: 0.82rem; color: rgb(250 247 242 / 0.6); }
.footer-bottom a { color: rgb(250 247 242 / 0.75); }
.site-footer .brand-mark { color: var(--ivory); }
.site-footer .brand-mark__yn svg { height: 3.2rem; }
.site-footer :focus-visible { outline-color: var(--beige); }

/* ---------- Movimiento reducido: sin desplazamientos, con fundidos suaves ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important;
    transition-property: opacity, color, background-color, border-color, box-shadow !important;
    transition-duration: 0.2s !important; transition-delay: 0s !important;
  }
  .btn:active, .wp-block-button .wp-block-button__link:active, .icon-btn:active, .wa-float:active, .menu-btn:active { scale: none; }
  .wa-float { transform: none; opacity: 1; }
}
