/* ==========================================================================
   IBRAVA · CABECERA + HERO "EDITORIAL IZQUIERDA · CASA NOCHE"
   Reutiliza los tokens y fuentes locales existentes de ibrava.es:
   --brand-ink (#22394A), --brand-paper (#F7F5EF), --brand-surface (#EAE8DF),
   --brand-muted (#626B70), --brand-line (#DCD8CB), Manrope, Bodoni Moda
   ========================================================================== */

:root {
  --ib-ink-deep: #152631;
  --ib-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Cabecera por defecto: sólida Caliza para páginas interiores --- */
.ib-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 74px;
  display: flex;
  align-items: center;
  background-color: rgba(247, 245, 239, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--brand-line, #DCD8CB);
  transition:
    height 340ms var(--ib-ease),
    background-color 300ms ease,
    border-color 300ms ease,
    box-shadow 300ms ease;
}

/* Solo en portada (body.owner-home) flota transparente sobre el hero */
body.owner-home .ib-header {
  position: fixed;
  height: 92px;
  background-color: rgba(247, 245, 239, 0);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
  box-shadow: none;
}

body.owner-home .ib-header.is-pinned {
  height: 74px;
  background-color: rgba(247, 245, 239, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--brand-line, #DCD8CB);
  box-shadow: 0 6px 24px rgba(20, 36, 46, 0.06);
}

.ib-header-in {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(22px, 5vw, 68px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Marca a la izquierda */
.ib-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  padding: 4px 0;
}

.ib-brand-mark {
  display: block;
  width: 132px;
  height: auto;
  transition: width 320ms var(--ib-ease), height 320ms var(--ib-ease);
}

body.owner-home .ib-header:not(.is-pinned) .ib-brand-mark {
  width: 144px;
  height: auto;
}

.ib-brand-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: url(#ibrava-palette-ink);
  transition: filter 260ms ease;
}

body.owner-home .ib-header:not(.is-pinned) .ib-brand-img {
  filter: url(#ibrava-logo-caliza);
}

.ib-brand-sub {
  margin-top: 5px;
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 7.2px;
  font-weight: 500;
  letter-spacing: 0.21em;
  text-transform: uppercase;
  color: rgba(34, 57, 74, 0.72);
  white-space: nowrap;
  transition: color 280ms ease, margin-top 280ms ease;
}

body.owner-home .ib-header:not(.is-pinned) .ib-brand-sub {
  margin-top: 6px;
  color: rgba(247, 245, 239, 0.84);
}

/* Navegación + idioma a la derecha */
.ib-header-right {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 26px);
}

.ib-nav {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.8vw, 38px);
}

.ib-nav-link {
  position: relative;
  display: inline-block;
  padding: 6px 0;
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--brand-ink, #22394A);
  white-space: nowrap;
  transition: color 240ms ease, opacity 200ms ease, border-color 240ms ease;
}

body.owner-home .ib-header:not(.is-pinned) .ib-nav-link {
  color: rgba(255, 255, 255, 0.94);
}

.ib-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0.7;
  transition: transform 280ms var(--ib-ease);
}

.ib-nav-link:hover::after {
  transform: scaleX(1);
}

.ib-nav-link:hover {
  opacity: 0.82;
}

/* Contacto discreto con línea fina (sin botón píldora) */
.ib-nav-link--contact {
  border-bottom: 1px solid rgba(34, 57, 74, 0.42);
  padding-bottom: 4px;
}

body.owner-home .ib-header:not(.is-pinned) .ib-nav-link--contact {
  border-bottom-color: rgba(255, 255, 255, 0.56);
}

.ib-nav-link--contact::after {
  display: none;
}

/* Selector de idioma discreto */
.ib-lang {
  position: relative;
  padding-left: 16px;
  border-left: 1px solid var(--brand-line, #DCD8CB);
  transition: border-color 260ms ease;
}

body.owner-home .ib-header:not(.is-pinned) .ib-lang {
  border-left-color: rgba(255, 255, 255, 0.28);
}

.ib-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-muted, #626B70);
  cursor: pointer;
  transition: color 240ms ease, opacity 200ms ease;
}

body.owner-home .ib-header:not(.is-pinned) .ib-lang-trigger {
  color: rgba(255, 255, 255, 0.88);
}

.ib-lang-trigger:hover {
  opacity: 0.72;
}

.ib-lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 148px;
  background: rgba(247, 245, 239, 0.98);
  border: 1px solid var(--brand-line, #DCD8CB);
  box-shadow: 0 18px 42px rgba(18, 34, 44, 0.18);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.ib-lang.is-open .ib-lang-menu {
  display: flex;
}

.ib-lang-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  color: var(--brand-ink, #22394A);
  text-decoration: none;
  font-size: 12.5px;
  transition: background-color 160ms ease;
}

.ib-lang-opt:hover {
  background-color: var(--brand-surface, #EAE8DF);
}

.ib-lang-opt.is-active {
  font-weight: 600;
  background-color: rgba(34, 57, 74, 0.06);
}

.ib-lang-opt span:last-child {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--brand-muted, #626B70);
}

/* Botón menú móvil y drawer */
.ib-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--brand-ink, #22394A);
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

body.owner-home .ib-header:not(.is-pinned) .ib-menu-btn {
  color: #FFFFFF;
}

.ib-drawer {
  position: fixed;
  inset: 0;
  z-index: 55;
  background-color: var(--brand-ink, #22394A);
  color: var(--brand-paper, #F7F5EF);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 26px 38px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ib-ease);
}

.ib-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ib-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ib-drawer-logo {
  height: auto;
  width: auto;
  filter: url(#ibrava-logo-caliza);
}

.ib-drawer-close {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--brand-paper, #F7F5EF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ib-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: auto 0;
  padding: 24px 0;
}

.ib-drawer-nav a {
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--brand-paper, #F7F5EF);
  opacity: 0.92;
}

.ib-drawer-foot {
  border-top: 1px solid rgba(247, 245, 239, 0.16);
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: rgba(247, 245, 239, 0.72);
}

.ib-drawer-langs {
  display: flex;
  gap: 14px;
  font-size: 12px;
  letter-spacing: 0.14em;
}

.ib-drawer-langs a {
  color: rgba(247, 245, 239, 0.65);
  text-decoration: none;
}

.ib-drawer-langs a[aria-current="true"] {
  color: var(--brand-paper, #F7F5EF);
  border-bottom: 1px solid var(--brand-paper, #F7F5EF);
  padding-bottom: 2px;
}

/* ==========================================================================
   HERO EDITORIAL IZQUIERDA (100SVH · VELADURA ASIMÉTRICA · CASA NOCHE)
   ========================================================================== */
.ib-hero {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 620px;
  max-height: 1060px;
  background-color: var(--ib-ink-deep);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.ib-hero-media {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ib-hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
  display: block;
}

/* Veladura superior: contraste de la cabecera sin oscurecer el cielo central */
.ib-scrim-top {
  position: absolute;
  inset: 0 0 auto 0;
  height: 195px;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(14, 27, 36, 0.66) 0%,
    rgba(14, 27, 36, 0.24) 54%,
    rgba(14, 27, 36, 0) 100%
  );
  pointer-events: none;
}

/* Veladura asimétrica inferior izquierda + fundido sin corte hacia #22394A */
.ib-scrim-corner {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(0deg, #22394a, rgba(34, 57, 74, .30) 20%, transparent 38%),
    linear-gradient(24deg, rgba(16, 30, 39, .84), rgba(16, 30, 39, .48) 32%,
      rgba(16, 30, 39, .08) 58%, transparent 76%);
  pointer-events: none;
}

.ib-hero-content {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(22px, 5vw, 68px) clamp(56px, 8.2vh, 90px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.ib-hero-copy {
  max-width: 560px;
  text-align: left;
}

.ib-hero-kicker {
  margin: 0 0 16px;
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(247, 245, 239, 0.82);
}

.ib-hero-title {
  margin: 0;
  font-family: 'Bodoni Moda', 'Didot', 'Bodoni MT', Georgia, serif;
  font-weight: 400;
  font-size: clamp(36px, 4.1vw, 58px);
  line-height: 1.07;
  letter-spacing: -0.01em;
  color: var(--brand-paper, #F7F5EF);
  text-shadow: 0 2px 24px rgba(14, 27, 36, 0.26);
  text-wrap: balance;
}

.ib-hero-sub {
  margin: 18px 0 0;
  font-family: 'Manrope', Arial, sans-serif;
  font-size: clamp(15px, 1.25vw, 17px);
  font-weight: 400;
  line-height: 1.65;
  color: rgba(247, 245, 239, 0.9);
  max-width: 44ch;
}

.ib-hero-actions {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.ib-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 32px;
  border-radius: 0;
  background-color: var(--brand-paper, #F7F5EF);
  border: 1px solid var(--brand-paper, #F7F5EF);
  color: var(--brand-ink, #22394A);
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 220ms ease, border-color 220ms ease, transform 220ms var(--ib-ease);
}

.ib-btn-primary:hover {
  background-color: #FFFFFF;
  border-color: #FFFFFF;
  transform: translateY(-1px);
}

.ib-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 6px;
  border-bottom: 1px solid rgba(247, 245, 239, 0.56);
  color: var(--brand-paper, #F7F5EF);
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 200ms ease, opacity 200ms ease;
}

.ib-btn-secondary:hover {
  border-color: #FFFFFF;
  opacity: 0.92;
}

.ib-hero-note {
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(247, 245, 239, 0.56);
  white-space: nowrap;
  padding-bottom: 4px;
}

/* Accesibilidad */
.ib-header :focus-visible,
.ib-hero :focus-visible,
.ib-drawer :focus-visible {
  outline: 2px solid var(--brand-paper, #F7F5EF);
  outline-offset: 3px;
}

.ib-header.is-pinned :focus-visible,
body:not(.owner-home) .ib-header :focus-visible {
  outline-color: var(--brand-ink, #22394A);
}

/* ==========================================================================
   RESPONSIVE (TABLET Y MÓVIL 390PX)
   ========================================================================== */
@media (max-width: 1060px) {
  body.owner-home .ib-header,
  .ib-header {
    height: 74px;
  }

  .ib-nav {
    display: none;
  }

  .ib-lang {
    border-left: 0;
    padding-left: 0;
  }

  .ib-menu-btn {
    display: inline-flex;
  }

  body.owner-home .ib-header:not(.is-pinned) .ib-brand-mark {
    width: 128px;
    height: auto;
  }
}

@media (max-width: 640px) {
  .ib-brand-sub,
  .ib-hero-note {
    display: none;
  }

  .ib-hero {
    min-height: 600px;
  }

  /* Encuadre vertical optimizado para Casa Noche: fachada y arcos arriba, piscina oscura abajo */
  .ib-hero-photo {
    object-position: 54% 44%;
  }

  /* En móvil reforzamos la base oscura inferior para contraste AAA sobre el reflejo del agua */
  .ib-scrim-corner {
    background: linear-gradient(
      0deg,
      rgba(34, 57, 74, 0.96) 0%,
      rgba(16, 30, 39, 0.80) 40%,
      rgba(16, 30, 39, 0.34) 64%,
      rgba(16, 30, 39, 0) 80%
    );
  }

  .ib-hero-content {
    padding: 0 22px 46px;
  }

  .ib-hero-kicker {
    font-size: 9.8px;
    letter-spacing: 0.14em;
    margin-bottom: 12px;
  }

  .ib-hero-title {
    font-size: 34px;
    line-height: 1.08;
  }

  .ib-hero-sub {
    font-size: 14.5px;
    margin-top: 14px;
  }

  .ib-hero-actions {
    margin-top: 24px;
    gap: 18px;
  }

  .ib-btn-primary {
    height: 48px;
    padding: 0 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ib-header,
  .ib-brand-mark,
  .ib-nav-link::after,
  .ib-btn-primary,
  .ib-drawer {
    transition-duration: 0.01ms !important;
  }
}

/* The existing SVG includes padding around its wordmark. */
.ib-brand-mark { position: relative; overflow: hidden; aspect-ratio: 1100 / 205; }
.ib-brand-mark :is(.ib-brand-img, .ib-drawer-logo) {
  position: absolute;
  width: 197.5%;
  height: auto;
  max-width: none;
  left: -46.8%;
  top: 0;
  transform: translateY(-30%);
}
.ib-drawer {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  overflow: auto;
  opacity: 1;
  pointer-events: auto;
}
.ib-drawer:not([open]) { display: none; }
.ib-drawer-open { overflow: hidden; }
.ib-hero { height: auto; min-height: max(540px, 100svh); max-height: none; isolation: isolate; }
.owner-home .agency-editorial { background: #22394a; }
.owner-home .ib-header.is-pinned, .ib-btn-primary { background-color: #f7f5ef; }
@media (max-width: 640px) {
  .ib-hero-kicker { white-space: nowrap; letter-spacing: .11em; }
  .ib-scrim-corner { background: linear-gradient(0deg,#22394a,rgba(16,30,39,.88) 45%,rgba(16,30,39,.32) 72%,transparent); }
}
