/* ============================================================
   LAYOUT — Navigation, Splash, Sections, Footer
   ============================================================ */

/* ── Navigation / Glassmorphism Header ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  transition: background var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.nav--scrolled {
  background: rgba(253,252,250,0.95);
  box-shadow: var(--shadow-md);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  color: var(--color-hunter);
  letter-spacing: var(--ls-tight);
}

.nav__logo-img {
  width: auto;
  height: 40px; /* mobile-first; bumped up on wider screens */
  object-fit: contain;
}

@media (min-width: 769px) {
  .nav__logo-img {
    height: 56px;
  }
}

/* Desktop: nav__links sits in the viewport top-right, visually inside the
   glassmorphism bar. position:fixed here (instead of being a flex child of
   .nav__inner) is required because the element now lives outside <header>
   to avoid the iOS Safari backdrop-filter containing-block bug on mobile. */
.nav__links {
  position: fixed;
  top: 0;
  right: 0;
  height: 72px;                              /* px fallback */
  height: var(--nav-height);
  padding-right: clamp(1.25rem, 4vw, 3rem); /* matches nav__inner gutter */
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  z-index: var(--z-sticky);                 /* same layer as nav bar */
}

.nav__link {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-slate);
  position: relative;
  padding-block: var(--space-2xs);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-hunter);
  transition: width var(--duration-normal) var(--ease-out);
}

.nav__link:hover::after,
.nav__link--active::after {
  width: 100%;
}

.nav__link:hover {
  color: var(--color-hunter);
}

.nav__cta {
  margin-left: var(--space-md);
}

/* Mobile Menu Toggle — 44×44 minimum per Apple HIG */
.nav__toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-charcoal);
  transition: all var(--duration-normal) var(--ease-out);
  transform-origin: center;
}

.nav__toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Subpage <main> ──
   Pushes content below the fixed nav on /about, /services, /gallery, /contact.
   Home (/) doesn't use this because its splash section has its own nav-height padding. */
.page--subpage {
  padding-top: var(--nav-height);
}

/* ══════════════════════════════════════════════
   SPLASH — Full-viewport, centered
   ══════════════════════════════════════════════ */

.splash {
  background-color: #355E3B;                /* hex fallback for old Safari */
  background-color: var(--color-hunter);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  width: 100%;
  padding: var(--nav-height) var(--gutter) var(--space-3xl);
}

.splash__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  width: 100%;
  max-width: 720px;
}

.splash__logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.3));
}

.splash__eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-ultra);
  text-transform: uppercase;
  color: var(--color-sage-muted);
}

.splash__title {
  font-family: var(--font-display);
  font-size: var(--fs-splash);
  font-weight: var(--fw-semibold);
  line-height: 1.05;
  color: var(--color-white);
  letter-spacing: var(--ls-tight);
}

.splash__subtitle {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: var(--fw-light);
  line-height: var(--lh-relaxed);
  color: rgba(255,255,255,0.85);
  max-width: 48ch;
}

.splash__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding-bottom: var(--space-3xl);
}

/* ── Button colours — gold on green, hex fallbacks before every var() ── */
.splash .btn--primary {
  background: #C4A35A;
  background: var(--color-accent-gold);
  color: #1C1C1E;
  color: var(--color-charcoal);
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.splash .btn--primary:hover {
  background: #B87333;
  background: var(--color-accent-copper);
  color: #ffffff;
  color: var(--color-white);
}
.splash .btn--ghost {
  border-color: rgba(196,163,90,0.8);
  color: #C4A35A;
  color: var(--color-accent-gold);
}
.splash .btn--ghost:hover {
  background: rgba(196,163,90,0.15);
  border-color: #C4A35A;
  border-color: var(--color-accent-gold);
}

/* ── About Section ── */
.about {
  background-color: var(--color-white);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.about__image {
  position: relative;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  background-color: var(--color-sand-light);
}

.about__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about__image::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(53,94,59,0.1);
  border-radius: var(--border-radius-md);
  pointer-events: none;
}

.about__stat-bar {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-sand-light);
}

.about__stat {
  text-align: center;
}

.about__stat-number {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--color-hunter);
  line-height: 1;
}

.about__stat-label {
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-slate-muted);
  margin-top: var(--space-2xs);
}

/* Language Toggle */
.lang-toggle {
  display: inline-flex;
  background: var(--color-sand-light);
  border-radius: var(--border-radius-full);
  padding: 3px;
  margin-bottom: var(--space-lg);
}

.lang-toggle__btn {
  padding: var(--space-2xs) var(--space-md);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  border-radius: var(--border-radius-full);
  transition: all var(--duration-normal) var(--ease-out);
  color: var(--color-slate-muted);
}

.lang-toggle__btn.active {
  background: var(--color-white);
  color: var(--color-hunter);
  box-shadow: var(--shadow-xs);
}

/* ── Services Section ── */
.services {
  background-color: var(--color-off-white);
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.service-card {
  background: var(--color-white);
  border: 1px solid rgba(53,94,59,0.08);
  border-radius: var(--border-radius-md);
  padding: var(--space-xl) var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-hunter);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-slow) var(--ease-out);
}

.service-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: transparent;
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-sand-light);
  border-radius: var(--border-radius-md);
  margin-bottom: var(--space-md);
  color: var(--color-hunter);
  transition: background var(--duration-normal) var(--ease-out);
}

.service-card:hover .service-card__icon {
  background: var(--color-hunter);
  color: var(--color-white);
}

.service-card__icon svg {
  width: 24px;
  height: 24px;
}

.service-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  color: var(--color-charcoal);
  margin-bottom: var(--space-xs);
}

.service-card__desc {
  font-size: var(--fs-small);
  color: var(--color-slate-light);
  line-height: var(--lh-relaxed);
  margin-bottom: 0;
}

/* ── Gallery Section ── */
.gallery {
  background-color: var(--color-white);
}

.gallery__masonry {
  columns: 3;
  column-gap: var(--space-md);
  margin-top: var(--space-2xl);
}

.gallery__item {
  break-inside: avoid;
  margin-bottom: var(--space-md);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.gallery__item img {
  width: 100%;
  display: block;
  transition: transform var(--duration-slow) var(--ease-out);
}

.gallery__item:hover img {
  transform: scale(1.04);
}

.gallery__item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(27,58,32,0.7) 0%, transparent 50%);
  display: flex;
  align-items: flex-end;
  padding: var(--space-lg);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.gallery__item:hover .gallery__item-overlay {
  opacity: 1;
}

.gallery__item-title {
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  color: var(--color-white);
  font-weight: var(--fw-semibold);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
  backdrop-filter: blur(8px);
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-xl);
  transform: scale(0.92);
  transition: transform var(--duration-slow) var(--ease-spring);
}

.lightbox.active .lightbox__img {
  transform: scale(1);
}

.lightbox__close {
  position: absolute;
  top: var(--space-xl);
  right: var(--space-xl);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: var(--border-radius-full);
  border: 1px solid rgba(255,255,255,0.2);
  transition: all var(--duration-normal) var(--ease-out);
}

.lightbox__close:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
}

/* ── Estimate Form Section ── */
.estimate {
  background: linear-gradient(
    180deg,
    var(--color-off-white) 0%,
    var(--color-sand-light) 100%
  );
}

.estimate__wrapper {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--space-3xl);
  align-items: start;
}

.estimate__info h2 {
  margin-bottom: var(--space-md);
}

.estimate__trust {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
}

.estimate__trust-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.estimate__trust-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--color-hunter);
  margin-top: 2px;
}

.estimate__trust-text {
  font-size: var(--fs-small);
  color: var(--color-slate-light);
  line-height: var(--lh-normal);
}

.estimate__trust-text strong {
  color: var(--color-charcoal);
}

.estimate__form {
  background: var(--color-white);
  border-radius: var(--border-radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(53,94,59,0.06);
}

/* Floating Labels */
.form-group {
  position: relative;
  margin-bottom: var(--space-lg);
}

.form-group__input,
.form-group__select {
  width: 100%;
  padding: var(--space-md) var(--space-md) var(--space-xs);
  font-size: var(--fs-body);
  border: 1.5px solid var(--color-sand);
  border-radius: var(--border-radius);
  background: var(--color-off-white);
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
  appearance: none;
}

.form-group__input:focus,
.form-group__select:focus {
  border-color: var(--color-hunter);
  box-shadow: 0 0 0 3px rgba(53,94,59,0.1);
  background: var(--color-white);
}

.form-group__label {
  position: absolute;
  top: 50%;
  left: var(--space-md);
  transform: translateY(-50%);
  font-size: var(--fs-body);
  color: var(--color-slate-muted);
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-out);
  background: transparent;
}

.form-group__input:focus ~ .form-group__label,
.form-group__input:not(:placeholder-shown) ~ .form-group__label,
.form-group__select:focus ~ .form-group__label,
.form-group__select:valid ~ .form-group__label {
  top: 6px;
  transform: translateY(0);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--color-hunter);
  letter-spacing: var(--ls-wide);
}

.form-group__select {
  padding-right: var(--space-2xl);
  cursor: pointer;
}

.form-group__select-arrow {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-slate-muted);
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form__submit {
  width: 100%;
  margin-top: var(--space-xs);
}

.form__success {
  display: none;
  text-align: center;
  padding: var(--space-2xl);
}

.form__success.active {
  display: block;
}

.form__success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  color: var(--color-success);
}

.form__error {
  font-size: var(--fs-caption);
  color: var(--color-error);
  margin-top: var(--space-2xs);
  display: none;
}

.form-group--error .form__error { display: block; }
.form-group--error .form-group__input,
.form-group--error .form-group__select {
  border-color: var(--color-error);
}

/* ── Footer ── */
.footer {
  background-color: var(--color-charcoal);
  color: rgba(255,255,255,0.7);
  padding-block: var(--space-3xl) var(--space-xl);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: var(--fw-bold);
  color: var(--color-white);
  margin-bottom: var(--space-md);
}

.footer__logo-img {
  width: auto;
  height: 36px;
  object-fit: contain;
}

.footer__desc {
  font-size: var(--fs-small);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-lg);
  max-width: 36ch;
}

.footer__social {
  display: flex;
  gap: var(--space-sm);
}

.footer__social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-full);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  transition: all var(--duration-normal) var(--ease-out);
}

.footer__social-link:hover {
  background: var(--color-hunter);
  border-color: var(--color-hunter);
  color: var(--color-white);
}

.footer__heading {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-white);
  margin-bottom: var(--space-lg);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer__link {
  font-size: var(--fs-small);
  color: rgba(255,255,255,0.6);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer__link:hover {
  color: var(--color-white);
}

.footer__bilingual {
  font-size: var(--fs-caption);
  color: rgba(255,255,255,0.4);
  font-style: italic;
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-xl);
  font-size: var(--fs-caption);
  color: rgba(255,255,255,0.4);
}

.footer__bottom a {
  color: rgba(255,255,255,0.5);
}

.footer__bottom a:hover {
  color: var(--color-white);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .about__grid { grid-template-columns: 1fr; gap: var(--space-2xl); }
  .estimate__wrapper { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .gallery__masonry { columns: 2; }
}

@media (max-width: 768px) {
  /* ── Mobile nav menu ──
     #navLinks lives OUTSIDE <header> in the HTML so iOS Safari's
     backdrop-filter does not claim it as a fixed-position containing block.
     z-index 999 puts it above everything on the page.              */
  .nav__links {
    display: none;
    position: fixed;
    top: 0;                     /* full-screen overlay — covers header too */
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;               /* reset desktop 72px so top+bottom fills viewport */
    padding-right: 0;           /* reset desktop gutter */
    background: #FDFCFA;        /* solid cream — never transparent */
    z-index: 999;
    flex-direction: column;
    align-items: center;
    justify-content: center;    /* vertically center links in the viewport */
    padding-top: calc(var(--nav-height) + 1rem); /* clear the X-close button up top */
    padding-bottom: 2rem;
    gap: var(--space-xl);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav__links.active {
    display: flex;
  }

  /* Readable nav links on the cream menu */
  .nav__links .nav__link {
    font-size: 1.15rem;
    color: #3A3A3C;
    color: var(--color-slate);
    padding: 0.5rem 1rem;
  }

  .nav__links .nav__cta {
    margin-left: 0;
    margin-top: var(--space-sm);
    background: #355E3B;        /* hunter green — explicit hex */
    color: #ffffff;
  }

  .nav__toggle {
    display: flex;
    z-index: 1000;              /* above the overlay so it stays tappable */
  }

  .nav__cta {
    margin-left: 0;
  }

  /* ── Mobile splash ──
     Use justify-content: flex-start so content can never scroll behind the
     fixed nav. Content is vertically centred via margin: auto on the child. */
  .splash {
    min-height: 100vh;          /* fallback for iOS < 15.4 */
    min-height: 100svh;         /* iOS 15.4+ — excludes browser chrome */
    justify-content: flex-start;
    align-items: center;
    padding-top: 0;             /* managed by splash__content margin */
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-bottom: 0;
    background-color: #355E3B; /* explicit hex — belt + suspenders */
  }

  .splash__content {
    gap: var(--space-md);
    margin-top: auto;
    margin-bottom: auto;
    /* Keep the content from ever hiding behind the fixed nav */
    padding-top: calc(72px + 1.5rem);
    padding-top: calc(var(--nav-height) + 1.5rem);
    padding-bottom: 2rem;
    align-items: center;
    width: 100%;
  }

  .splash__logo {
    width: 90px;
    height: 90px;
  }

  .splash__title {
    font-size: clamp(2.2rem, 9vw, 3.5rem);
  }

  .splash__subtitle {
    font-size: 0.95rem;
  }

  .splash__actions {
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding-bottom: 0;
  }

  /* Ensure both splash buttons are always visible and correctly coloured */
  .splash .btn--large {
    width: 100%;
    max-width: 320px;
    padding: var(--space-sm) var(--space-xl);
  }

  .splash .btn--primary {
    background: #C4A35A;        /* gold — explicit hex override */
    color: #1C1C1E;
    border-color: transparent;
  }

  .splash .btn--ghost {
    border: 1.5px solid rgba(196,163,90,0.85);
    color: #C4A35A;
  }

  .services__grid {
    grid-template-columns: 1fr;
  }

  .gallery__masonry {
    columns: 1;
  }

  .form__row {
    grid-template-columns: 1fr;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .footer__bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .about__stat-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ── Utility Classes ── */
.lang-hidden { display: none; }
.footer-contacto { margin-top: var(--space-lg); }
