/*
 * g6-impeccable.css — capa final de rigor editorial.
 * Cargar al FINAL, después de g6-palette, g6-typography y el resto.
 *
 * Objetivos:
 *   1. Tokens OKLCH que respaldan la paleta HEX existente (sin romper nada).
 *   2. Sistema de espaciado 4pt con nombres semánticos.
 *   3. Tipografía numérica tabular en cifras (no "bailan" las columnas).
 *   4. Numerales romanos de sección — firma editorial de oficina de arquitectura.
 *   5. Dateline bajo el hero — ficha editorial del proyecto.
 *   6. Skip-link y utilitario sr-only para accesibilidad.
 *   7. Focus ring único y visible en toda la superficie interactiva.
 *   8. Entrada orquestada del hero (CSS fallback si JS está bloqueado).
 *   9. Respeto estricto a prefers-reduced-motion.
 */

/* ---------- 1. Tokens ---------- */
:root {
  /* OKLCH equivalentes a la paleta HEX, tintando neutros hacia el hue de la crema (~85°).
     Uso opcional: se pueden adoptar sin riesgo porque los HEX originales siguen vigentes. */
  --g6-ok-cream:        oklch(90% 0.020 85);
  --g6-ok-cream-deep:   oklch(86% 0.022 85);
  --g6-ok-ink:          oklch(48% 0.015 68);
  --g6-ok-ink-strong:   oklch(28% 0.015 68);
  --g6-ok-ink-muted:    oklch(62% 0.010 75);
  --g6-ok-accent:       oklch(64% 0.210 33);
  --g6-ok-accent-ink:   oklch(52% 0.190 33);
  --g6-ok-surface:      oklch(99% 0.006 85);
  --g6-ok-border:       oklch(48% 0.015 68 / 0.18);
  --g6-ok-border-strong:oklch(48% 0.015 68 / 0.32);

  /* Escala de espaciado 4pt con nombres semánticos. */
  --g6-space-3xs: 0.25rem;  /*  4px */
  --g6-space-2xs: 0.5rem;   /*  8px */
  --g6-space-xs:  0.75rem;  /* 12px */
  --g6-space-sm:  1rem;     /* 16px */
  --g6-space-md:  1.5rem;   /* 24px */
  --g6-space-lg:  2rem;     /* 32px */
  --g6-space-xl:  3rem;     /* 48px */
  --g6-space-2xl: 4rem;     /* 64px */
  --g6-space-3xl: 6rem;     /* 96px */

  /* Easing editorial: deceleración, sin rebote (evita “elásticos” de plantilla). */
  --g6-ease-out:      cubic-bezier(0.25, 1, 0.5, 1);
  --g6-ease-out-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --g6-ease-out-lg:   cubic-bezier(0.16, 1, 0.3, 1);
  --g6-dur-instant:   140ms;
  --g6-dur-fast:      200ms;
  --g6-dur-base:      360ms;
  --g6-dur-slow:      580ms;
  --g6-stagger-tight: 55ms;
}

/* ---------- 2. Utilitarios de accesibilidad ---------- */
.g6-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;
}

body.g6-brand .g6-skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  z-index: 2000;
  padding: 0.65rem 1.1rem;
  background: var(--g6-ok-ink-strong);
  color: #fffef9;
  font-family: var(--mariategui-font, "Montserrat", sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: top var(--g6-dur-fast) var(--g6-ease-out-smooth);
}

body.g6-brand .g6-skip-link:focus,
body.g6-brand .g6-skip-link:focus-visible {
  top: 0.75rem;
  outline: 2px solid var(--g6-ok-accent);
  outline-offset: 2px;
}

/* ---------- 3. Focus ring unificado ---------- */
body.g6-brand a:focus-visible,
body.g6-brand button:focus-visible,
body.g6-brand input:focus-visible,
body.g6-brand select:focus-visible,
body.g6-brand textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--g6-orange, #fe3b1f) 85%, transparent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- 4. Numerales romanos de sección ---------- */
/*
 * Patrón editorial inspirado en revistas de arquitectura:
 * un numeral romano pequeño, bien espaciado, como marca de capítulo.
 * Se inyectan como elementos <span class="g6-section-index">…</span>
 * ANTES del eyebrow/título de cada sección.
 */
body.g6-brand .g6-section-index {
  display: inline-block;
  font-family: var(--mariategui-font, "Montserrat", sans-serif);
  font-size: clamp(0.72rem, 0.85vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--g6-ink-muted, #8a8379);
  opacity: 0.9;
}

body.g6-brand .g6-section-index::before {
  content: "";
  display: inline-block;
  width: clamp(1.25rem, 2vw, 2rem);
  height: 1px;
  margin-right: 0.75rem;
  vertical-align: middle;
  background: currentColor;
  opacity: 0.65;
}

/* Ubicación del numeral dentro de cada sección específica, sin empujar el layout. */
body.g6-brand #cifras .g6-section-index,
body.g6-brand #estudio .g6-section-index,
body.g6-brand #proyectos .g6-section-index,
body.g6-brand #servicios .g6-section-index,
body.g6-brand #contacto .g6-section-index {
  margin-bottom: 0.9rem;
}

body.g6-brand #cifras .g6-section-index {
  display: block;
  text-align: center;
  margin: 0 auto 1.1rem;
}

body.g6-brand #estudio .g6-section-index {
  display: block;
  margin-bottom: 1.25rem;
}

body.g6-brand #proyectos .g6-section-index {
  display: block;
  margin-bottom: 1rem;
}

body.g6-brand #servicios .g6-section-index {
  display: block;
  margin-bottom: 1rem;
}

body.g6-brand #contacto .g6-section-index {
  display: block;
  text-align: center;
  margin: 0 auto 0.5rem;
}

/* ---------- 5. Dateline editorial ---------- */
/*
 * Tira fina que firma el proyecto, estilo ficha editorial de arquitectura.
 * Se ubica entre el hero slider y la sección de cifras.
 */
body.g6-brand .g6-dateline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: clamp(0.75rem, 2vw, 2.5rem);
  padding: clamp(1.1rem, 1.8vw, 1.6rem) clamp(1.5rem, 4vw, 3rem);
  border-top: 1px solid var(--g6-border, rgba(114, 108, 99, 0.18));
  border-bottom: 1px solid var(--g6-border, rgba(114, 108, 99, 0.18));
  background: color-mix(in srgb, var(--g6-cream, #e1ded0) 55%, #ffffff 45%);
  font-family: var(--mariategui-font, "Montserrat", sans-serif);
  font-size: clamp(0.7rem, 0.85vw, 0.82rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--g6-ink, #726c63);
  line-height: 1.6;
}

body.g6-brand .g6-dateline__item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

body.g6-brand .g6-dateline__label {
  color: var(--g6-ink-muted, #8a8379);
  opacity: 0.9;
}

body.g6-brand .g6-dateline__value {
  color: var(--g6-ink, #726c63);
  font-weight: 600;
  letter-spacing: 0.14em;
}

body.g6-brand .g6-dateline__item + .g6-dateline__item {
  position: relative;
  padding-left: clamp(0.75rem, 2vw, 2.5rem);
}

body.g6-brand .g6-dateline__item + .g6-dateline__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

@media (max-width: 720px) {
  body.g6-brand .g6-dateline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    text-align: left;
  }

  body.g6-brand .g6-dateline__item + .g6-dateline__item {
    padding-left: 0;
  }

  body.g6-brand .g6-dateline__item + .g6-dateline__item::before {
    display: none;
  }
}

/* ---------- 6. Cifras: tabular-nums ---------- */
body.g6-brand #cifras .item h2,
body.g6-brand #cifras .item h2 .odometer,
body.g6-brand #cifras .item h2 .odometer-digit,
body.g6-brand #cifras .item h2 .icon {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ---------- 7. Metadata del proyecto sobre #cifras ---------- */
body.g6-brand #cifras {
  padding-top: clamp(3rem, 5.5vw, 5rem) !important;
}

/* ---------- 8. Ritmo tipográfico mejor calibrado ---------- */
body.g6-brand #estudio .content p,
body.g6-brand #proyectos .project-title p,
body.g6-brand #servicios .g6-service-hero__text p {
  max-width: 62ch;
  text-wrap: pretty;
}

body.g6-brand #estudio .content p {
  margin-inline: 0;
}

/* ---------- 9. Entrada orquestada del hero (CSS fallback; sobreescribible por JS) ---------- */
@keyframes g6-fade-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

body.g6-brand .g6-dateline {
  animation: g6-fade-rise var(--g6-dur-slow) var(--g6-ease-out-lg) 120ms both;
}

/* Hero: alinear sensación con el resto (sin acelerar el autoplay de Swiper). */
body.g6-brand .wpo-hero-slider-s3 .swiper-slide-active .slide-sub-title,
body.g6-brand .wpo-hero-slider-s3 .swiper-slide-active .sub-title {
  animation-timing-function: var(--g6-ease-out-lg) !important;
}

/* ---------- 10. Reduced motion: todo calmo, nada desaparece ---------- */
@media (prefers-reduced-motion: reduce) {
  body.g6-brand *,
  body.g6-brand *::before,
  body.g6-brand *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  body.g6-brand .g6-dateline {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ---------- 11. Form: detalles finales de refinamiento ---------- */
body.g6-brand .g6-form-cta__form label {
  font-family: var(--mariategui-font, "Montserrat", sans-serif);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g6-ink, #726c63);
}

body.g6-brand .g6-form-cta__form .g6-optional {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--g6-ink-muted, #8a8379);
}

/* ---------- 12. Sección #proyectos: aire, solape galería; márgenes acordes a escala G6 (no 60px del tema full-bleed) ---------- */
body.g6-brand #proyectos.wpo-project-section-s3 .title {
  position: relative;
  z-index: 2;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

body.g6-brand #proyectos.wpo-project-section-s3 .title .project-title {
  margin-bottom: clamp(1.5rem, 2.5vw, 2.5rem) !important;
}

body.g6-brand #proyectos.wpo-project-section-s3 .sortable-gallery {
  position: relative;
  z-index: 1;
}

body.g6-brand #proyectos.wpo-project-section-s3 .gallery-container {
  padding-top: clamp(0.75rem, 2vw, 1.75rem);
}

/* ---------- 13. Footer: polish tipográfico ---------- */
body.g6-brand .wpo-upper-footer .widget-title h3 {
  font-family: var(--mariategui-font, "Montserrat", sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

body.g6-brand .wpo-lower-footer .copyright {
  font-size: clamp(0.72rem, 0.85vw, 0.82rem);
  letter-spacing: 0.02em;
}
