/* ==========================================================================
   SAGASTA PALACIO RESIDENCIAL - MADRID
   Luxury Editorial Architecture - Professional Web Scale & Harmony
   ========================================================================== */

:root {
  /* Soporte nativo de modo oscuro del sistema y controles de formularios */
  color-scheme: dark;
  accent-color: var(--color-luxury-line);

  /* Paleta cromática oficial */
  --color-charcoal: #201e1f;
  --color-charcoal-dark: #151415;
  --color-luxury-line: #eae7e4;
  --color-luxury-text: #eae7e4;
  --color-field-text: #eae7e4;
  --color-white: #ffffff;
  --color-white-90: rgba(255, 255, 255, 0.9);
  --color-white-80: rgba(255, 255, 255, 0.8);
  --color-white-65: rgba(255, 255, 255, 0.65);
  --color-white-50: rgba(255, 255, 255, 0.5);
  --color-white-30: rgba(255, 255, 255, 0.3);
  --color-white-20: rgba(255, 255, 255, 0.2);
  --color-white-10: rgba(255, 255, 255, 0.1);

  /* Tipografías */
  --font-display: 'Aviano', Georgia, serif;
  --font-sans: 'Gotham', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Transiciones */
  --ease-luxury: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-slow: 0.6s var(--ease-luxury);
  --transition-normal: 0.38s var(--ease-luxury);
  --transition-fast: 0.2s ease;
}

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

/* Tipografía moderna: text-wrap balance en titulares y pretty en párrafos (Modern Web Guidance) */
h1, h2, h3, h4, h5, h6,
.editorial-title,
.editorial-subtitle,
.members-title,
.members-subtitle,
.contact-title,
.contact-subtitle,
.brand-title {
  text-wrap: balance;
}

p,
.editorial-paragraph,
.members-description,
.disclaimer-text,
.copyright-text,
.pretty-text {
  text-wrap: pretty;
}

/* Utilidad canónica para accesibilidad WCAG y lectores de pantalla */
.visually-hidden {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

html {
  font-family: var(--font-sans);
  background-color: var(--color-charcoal);
  color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  background-color: var(--color-charcoal);
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

img, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   HEADER FIJO (Selector de idioma + Hamburguesa)
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  padding: 0 clamp(24px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  z-index: 100;
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

/* Selector de idioma ES | EN */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--color-white-50);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  cursor: pointer;
  padding: 4px 2px;
  position: relative;
  transition: color var(--transition-fast);
}

.lang-btn:hover {
  color: var(--color-white-90);
}

.lang-btn.active {
  color: var(--color-white);
}

.lang-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background-color: var(--color-white);
}

.lang-divider {
  color: var(--color-white-30);
  font-size: 12px;
  user-select: none;
}

/* Botón Hamburguesa ☰ ⇄ ✕ */
.menu-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  color: var(--color-white);
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.menu-toggle-btn:hover {
  opacity: 0.85;
}

.hamburger-icon {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
  pointer-events: none;
}

.h-line {
  vector-effect: non-scaling-stroke;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  will-change: transform, opacity;
}

.h-line-1 {
  transform-origin: 11px 5px;
}

.h-line-2 {
  transform-origin: 11px 11px;
}

.h-line-3 {
  transform-origin: 11px 17px;
}

/* Transformación a ✕ simétrica perfecta con grosor 100% constante antes, durante y después */
.menu-toggle-btn.is-active .h-line-1 {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle-btn.is-active .h-line-2 {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle-btn.is-active .h-line-3 {
  transform: translateY(-6px) rotate(-45deg);
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */
#sagasta-app {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* ==========================================================================
   SECCIÓN SUPERIOR DE VIDEO (100vh) - PERSISTENTE
   ========================================================================== */
.hero-video-section {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  background-color: var(--color-charcoal);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-video-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 1;
  background-color: var(--color-charcoal);
}

/* Capa de overlay: sutil en Home, gris oscuro al 50% en Estado 2 */
.hero-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(32, 30, 31, 0.12);
  z-index: 2;
  pointer-events: none;
  transition: background-color var(--transition-normal);
}

#sagasta-app.is-open .hero-overlay {
  background-color: rgba(32, 30, 31, 0.50);
}

/* --------------------------------------------------------------------------
   ESTADO 1 (HOME): LOGO PRINCIPAL SAGASTA
   -------------------------------------------------------------------------- */
.hero-state-home {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.hero-logo-wrapper {
  position: absolute;
  top: 66.6%; /* Centrado a 2/3 de la altura de la pantalla de arriba hacia abajo */
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 24px;
}

.hero-logo-img {
  width: 100%;
  max-width: clamp(260px, 24vw, 360px);
  height: auto;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.28));
}

#sagasta-app.is-open .hero-state-home {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   ESTADO 2 (EDITORIAL): TÍTULO, DESCRIPCIÓN Y LOGO SOBRE EL VIDEO (100vh)
   -------------------------------------------------------------------------- */
.hero-state-editorial {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(80px, 12vh, 120px) clamp(24px, 5vw, 64px) clamp(40px, 6vh, 64px);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

#sagasta-app.is-open .hero-state-editorial {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.editorial-top-inner {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto;
}

.editorial-logo {
  margin-bottom: clamp(20px, 3.5vh, 36px);
}

.editorial-logo-img {
  width: 100%;
  max-width: clamp(156px, 15.6vw, 195px);
  height: auto;
  aspect-ratio: 307 / 226;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.3));
}

.editorial-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.8vw, 38px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: var(--color-white);
  line-height: 1.25;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.editorial-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-white-90);
  margin-bottom: clamp(28px, 4.5vh, 44px);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.editorial-content {
  max-width: 720px;
  margin: 0 auto clamp(28px, 4.5vh, 48px);
}

.editorial-paragraph {
  font-size: clamp(13.5px, 1.15vw, 15.5px);
  line-height: 1.85;
  font-weight: 400;
  color: var(--color-white);
  margin-bottom: 20px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.editorial-paragraph:last-child {
  margin-bottom: 0;
}

.editorial-luxury-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.editorial-luxury-brand .luxury-collection-img {
  height: clamp(34px, 3.4vw, 40px);
  width: auto;
  opacity: 0.95;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
}

@keyframes chevronFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

.editorial-scroll-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: clamp(24px, 3.5vh, 36px);
  color: var(--color-luxury-line);
  cursor: pointer;
  animation: chevronFloat 2.6s ease-in-out infinite;
  transition: opacity var(--transition-fast);
}

.editorial-scroll-chevron:hover {
  opacity: 0.75;
}

/* ==========================================================================
   SECCIÓN INFERIOR ESTADO 1 (HOME / PÁGINA 1 DEL MOCKUP)
   ========================================================================== */
.home-lower-section {
  width: 100%;
  background-color: var(--color-charcoal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(80px, 11vh, 140px) clamp(24px, 5vw, 64px) clamp(56px, 7vh, 84px);
  text-align: center;
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

#sagasta-app.is-open .home-lower-section {
  display: none;
}

/* The Luxury Collection Residences (+30% escala) */
.luxury-collection-block {
  margin-bottom: clamp(60px, 8vh, 96px);
}

.luxury-collection-img {
  width: clamp(224px, 23.7vw, 274px);
  height: auto;
  aspect-ratio: 318 / 51;
  margin: 0 auto;
  opacity: 0.95;
}

/* Promotes / Commercialises (+30% escala) */
.partners-grid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(64px, 12vw, 150px);
  margin-bottom: clamp(60px, 8vh, 96px);
}

.partner-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.partner-label {
  font-size: clamp(13px, 1.15vw, 14.5px);
  letter-spacing: 0.22em;
  color: var(--color-luxury-text);
  margin-bottom: 18px;
  text-transform: uppercase;
  font-weight: 500;
}

.partner-logo-img {
  width: clamp(149px, 15vw, 178px);
  height: auto;
  aspect-ratio: 267 / 93;
  opacity: 0.92;
  transition: opacity var(--transition-fast);
}

.partner-logo-img:hover {
  opacity: 1;
}

/* Bloque Legal */
.legal-block {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.disclaimer-text {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--color-luxury-text);
  margin-bottom: 12px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.copyright-text {
  font-size: 12.5px;
  color: var(--color-luxury-text);
  margin-bottom: 28px;
  font-weight: 400;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px clamp(20px, 3.5vw, 36px);
}

.footer-link {
  font-size: 12px;
  color: var(--color-luxury-text);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--color-luxury-line);
  letter-spacing: 0.05em;
  transition: opacity var(--transition-fast);
}

.footer-link:hover {
  opacity: 0.8;
}

/* ==========================================================================
   SECCIÓN INFERIOR ESTADO 2 (EDITORIAL + FORMULARIO / PÁGINA 2 DEL MOCKUP)
   ========================================================================== */
.editorial-bottom-section {
  display: none;
  width: 100%;
  background-color: var(--color-charcoal);
  padding: clamp(80px, 11vh, 130px) clamp(24px, 5vw, 64px) clamp(56px, 7vh, 84px);
  flex-direction: column;
  align-items: center;
  content-visibility: auto;
  contain-intrinsic-size: auto 800px;
}

#sagasta-app.is-open .editorial-bottom-section {
  display: flex;
}

/* Contenedor en 2 columnas: Proporción balanceada y espaciosa */
.two-columns-container {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 5.5vw, 72px);
  margin-bottom: clamp(64px, 9vh, 96px);
  align-items: start;
}

/* Columna Izquierda: Sagasta Members Club */
.members-club-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(28px, 4vw, 48px) 20px;
}

.members-club-heading {
  margin-bottom: 22px;
}

.members-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 26px);
  letter-spacing: 0.16em;
  font-weight: 700;
  line-height: 1.2;
}

.members-subtitle {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 500;
  color: var(--color-luxury-text);
  margin-top: 6px;
  display: block;
}

.members-description {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--color-luxury-text);
  font-weight: 400;
  max-width: 320px;
  margin-bottom: 32px;
}

.coming-soon-btn {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 14px 0;
  border-top: 1px solid var(--color-luxury-line);
  border-bottom: 1px solid var(--color-luxury-line);
  border-left: none;
  border-right: none;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-luxury-text);
  background: transparent;
  font-weight: 500;
  text-align: center;
  user-select: none;
  cursor: default;
}

/* Columna Derecha: Tarjeta de Contacto */
.contact-card {
  border: 1px solid var(--color-luxury-line);
  padding: clamp(36px, 4vw, 48px) clamp(24px, 3.5vw, 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: transparent;
}

.contact-heading {
  text-align: center;
  margin-bottom: 28px;
}

.contact-title {
  font-family: var(--font-display);
  font-size: clamp(19px, 1.8vw, 22px);
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--color-luxury-text);
}

.contact-subtitle {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--color-luxury-text);
  margin-top: 6px;
  display: block;
}

/* Formulario */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.form-group {
  position: relative;
  width: 100%;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-input,
.form-select {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-luxury-line);
  color: var(--color-luxury-text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  padding: 10px 0;
  border-radius: 0;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input::placeholder {
  color: var(--color-luxury-text);
  opacity: 0.85;
  font-weight: 400;
  font-size: 13px;
}

.form-input:focus,
.form-select:focus {
  border-bottom-color: var(--color-luxury-line);
}

/* Validación moderna interactiva: :user-invalid y :user-valid (Baseline Widely Available) */
.form-input:user-invalid,
.form-select:user-invalid {
  border-bottom-color: #d97878;
}

.form-input:user-valid {
  border-bottom-color: var(--color-luxury-line);
}

.form-input:focus-visible,
.form-select:focus-visible {
  border-bottom-color: #ffffff;
  outline: none;
  box-shadow: 0 1px 0 0 #ffffff;
}

/* Selector estilizado */
.select-wrapper {
  position: relative;
  width: 100%;
}

.form-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 24px;
  background-color: transparent;
}

.form-select option {
  background-color: var(--color-charcoal-dark);
  color: var(--color-luxury-text);
  padding: 10px;
  font-size: 13px;
}

.select-arrow {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 10px;
  height: 6px;
  fill: none;
  stroke: var(--color-luxury-line);
  stroke-width: 1.5;
  transition: stroke var(--transition-fast);
}

.form-select:focus + .select-arrow {
  stroke: var(--color-luxury-line);
}

/* Botón de Enviar */
.submit-btn-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.submit-btn {
  background: transparent;
  border: 1px solid var(--color-luxury-line);
  color: var(--color-luxury-text);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 500;
  text-transform: uppercase;
  padding: 13px 48px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.submit-btn:hover:not(:disabled) {
  background: var(--color-luxury-line);
  color: var(--color-charcoal);
  border-color: var(--color-luxury-line);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Mensajes de estado del formulario */
.form-status {
  display: none;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  margin-top: 12px;
}

.form-status.error {
  color: #ff8a80;
}

.form-success-container {
  text-align: center;
  padding: 28px 16px;
}

.success-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
  color: var(--color-white);
}

.success-desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--color-luxury-text);
  font-weight: 400;
}

/* Pie en Estado 2 */
.editorial-footer {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

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

@media (max-width: 860px) {
  .two-columns-container {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .members-club-box {
    padding: 16px 0;
  }

  .contact-card {
    padding: 36px 24px;
  }

  .form-group-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .partners-grid {
    gap: 48px;
  }
}

@media (max-width: 480px) {
  .site-header {
    height: 64px;
    padding: 0 20px;
  }

  .hero-logo-img {
    max-width: 240px;
  }

  .hero-state-editorial {
    padding: 80px 20px 40px;
  }

  .editorial-logo-img {
    max-width: 136px;
  }

  .submit-btn {
    width: 100%;
  }

  .footer-links {
    flex-direction: column;
    gap: 12px;
  }
}

/* ==========================================================================
   MODERN WEB GUIDANCE: ACCESIBILIDAD, FOCO, SCROLLBAR Y REDUCED MOTION
   ========================================================================== */

/* Anillo de foco accesible, nítido y refinado para navegación por teclado */
:focus-visible {
  outline: 2px solid var(--color-luxury-line);
  outline-offset: 3px;
}

.lang-btn:focus-visible,
.menu-toggle-btn:focus-visible,
.submit-btn:focus-visible,
.editorial-scroll-chevron:focus-visible {
  outline: 2px solid var(--color-luxury-line);
  outline-offset: 4px;
}

/* Respeto estricto a las preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Scrollbar moderna y discreta */
@supports (scrollbar-color: auto) {
  html {
    scrollbar-color: rgba(234, 231, 228, 0.3) var(--color-charcoal-dark);
    scrollbar-width: thin;
  }
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-charcoal-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(234, 231, 228, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(234, 231, 228, 0.45);
}
