/* ===================================================================
   Montalvo — Landing Page
   =================================================================== */

:root {
  --color-black: #111111;
  --color-graphite: #2b2b2d;
  --color-ink: #1c1c1c;
  --color-muted: #6f6f6f;
  --color-white: #ffffff;
  --color-line: #e4e2df;
  --overlay-dark: rgba(15, 13, 12, 0.5);
  --overlay-strong: rgba(10, 9, 8, 0.62);

  --font-heading: "Montserrat", "Georgia", serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

  --container: 1280px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* `overflow-x: hidden` on <html> forces the vertical axis into its own
     scroll container, which silently kills `scroll-behavior: smooth` and
     scrollIntoView({behavior:"smooth"}) in Chromium. `clip` prevents the
     horizontal overflow the same way without creating that container, so
     the smooth scroll keeps working. `hidden` stays first as a fallback
     for browsers too old to know `clip`. */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--color-white);
  color: var(--color-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 300;
}

p {
  margin: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 40px;
}

/* Texto disponible para Google y lectores de pantalla, pero invisible en
   pantalla. Se usa para el H1 del hero, donde la marca es una imagen.
   No se usa `display:none` porque eso lo ocultaría también a ellos. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 34px;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: -0.02em;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn-outline {
  border: 1px solid currentColor;
  color: inherit;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-solid {
  background: var(--color-black);
  color: var(--color-white);
  border: 1px solid var(--color-black);
}

.btn-solid:hover {
  background: var(--color-white);
  color: var(--color-black);
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 20;
  color: var(--color-white);
  background: transparent;
  transition: background-color 0.25s ease;

}

.site-header.scrolled {
  background: rgba(17, 17, 17, 0.9);
  backdrop-filter: blur(6px);
}

/* Offsets anchor targets so the fixed header doesn't cover the top of
   the section when the nav links (#inicio, #nosotros, etc.) jump/scroll
   to it. Value tracks the header's approximate height per breakpoint. */
#inicio,
#nosotros,
#servicios,
#contacto {
  scroll-margin-top: 96px;
}

@media (max-width: 768px) {
  #inicio,
  #nosotros,
  #servicios,
  #contacto {
    scroll-margin-top: 72px;
  }
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 40px 60px;
}

.site-header .logo {
  height: 20px;
  width: auto;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 36px;
  font-size: 18px;
  font-weight: 500;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.main-nav a {
  white-space: nowrap;
}

.main-nav a {
  opacity: 0.92;
  transition: opacity 0.2s ease;
}

.main-nav a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-cta {
  padding: 12px 28px;
  font-size: 15px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

/* makes room for the search input as it expands to the left */
.header-actions.search-open .header-cta {
  transform: translateX(-300px);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: inherit;
}

.icon-btn img {
  width: 26px;
  height: auto;
}

/* ---------- Search ---------- */

.search-widget {
  position: relative;
  flex-shrink: 0;
}

.search-form {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%) scaleX(0);
  transform-origin: right center;
  width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.search-form.open {
  transform: translateY(-50%) scaleX(1);
  opacity: 1;
  pointer-events: auto;
}

.search-input {
  width: 100%;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(10, 9, 8, 0.55);
  backdrop-filter: blur(6px);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 14px;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.search-input:focus {
  outline: none;
  background: rgba(10, 9, 8, 0.75);
}

.search-input.no-match {
  border-color: #e05252;
  animation: search-shake 0.3s ease;
}

@keyframes search-shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 9, 8, 0.35) 0%,
    rgba(10, 9, 8, 0.05) 30%,
    rgba(10, 9, 8, 0.15) 70%,
    rgba(10, 9, 8, 0.55) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  padding: clamp(120px, 16vw, 120px) 60px 56px 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  color: var(--color-white);
}

.hero-cta {
  padding: clamp(14px, 1.6vw, 20px) clamp(40px, 6vw, 110px);
  font-size: clamp(18px, 1.7vw, 25px);
}

.hero-logo {
  width: 600px;
  height: auto;
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ---------- Stat bar ---------- */

.stat-bar {
  padding: 96px 0 88px;
}

.stat-bar-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-block: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.stat-graphic {
  width: clamp(160px, 24vw, 400px);
  height: auto;
  margin-top: 20px;
}

.stat-divider {
  width: 1px;
  height: 64px;
  background: var(--color-black);
  flex-shrink: 0;
}

.stat-tagline {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 300;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--color-black);
}

/* ---------- About ---------- */

.about {
  padding-bottom: 120px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 0;
  /* combined width (736+770) over the shared height (796) from the
     original design — one ratio drives both columns so they always
     end at the exact same height, instead of each column computing
     its own aspect-ratio independently and drifting apart */
  aspect-ratio: 1506 / 796;
}

.about-photo {
  margin: 0;
  position: relative;
  height: 100%;
  overflow: hidden;
}

.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-panel {
  position: relative;
  height: 100%;
  overflow: hidden;
  color: var(--color-white);
}

.about-panel-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.35) brightness(0.85);
}

.about-panel-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(26, 25, 25, 0.72) 0%, rgba(34, 34, 34, 0.55) 55%, rgba(36, 36, 36, 0.68) 100%);
}

.about-panel-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 10% 12%;
  text-align: center;
}

.about-panel-content h2 {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 300;
  letter-spacing: -0.02em;
}

.about-panel-content p {
  font-family: var(--font-heading);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(15px, 2vw, 29px);
  line-height: 1.65;
  letter-spacing: -0.01em;
  text-align: justify;
}

/* ---------- Services ---------- */

.services {
  padding-bottom: 140px;
}

.services-title {
  max-width: var(--container);
  margin: 0 auto 40px;
  padding-left: 70px;
  padding-right: 40px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(30px, 3.4vw, 44px);
  letter-spacing: -0.02em;
  color: var(--color-black);
  text-align: center;
}

.services-grid {
  max-width: 100vw;
  padding-inline: 65px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.service-card {
  position: relative;
  margin: 0;
  aspect-ratio: 311 / 681;
  overflow: hidden;
}

.service-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.service-card:hover img {
  transform: scale(1.05);
}

.service-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 9, 8, 0) 40%,
    rgba(10, 9, 8, 0.55) 75%,
    rgba(10, 9, 8, 0.82) 100%
  );
}

.service-pill {
  width: 70%;
  margin-bottom: 40px;
  text-align: center;
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 9px 22px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------- CTA ---------- */

.cta {
  position: relative;
  overflow: hidden;
  background: var(--color-graphite);
  color: var(--color-white);
  padding: 96px 0;
  text-align: center;
}

.cta-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* La modelo está pegada al borde superior derecho de la foto. Sin este
     anclaje, `cover` usa `center` y reparte el recorte arriba y abajo:
     como el alto de la sección lo define el texto pero el ancho depende
     de la pantalla, la proporción varía y en monitores anchos el recorte
     superior le cortaba el rostro. Anclando arriba-derecha, lo que se
     recorta es siempre el fondo gris y el saco, nunca la cara. */
  object-position: right top;
}

.cta-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 17, 0.6);
}

.cta-inner {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin-inline: 100px;
  padding-inline: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.cta h2 {
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 300;
  letter-spacing: -0.02em;
}

.cta p {
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
}

.cta .btn-solid {
  background: var(--color-white);
  color: var(--color-black);
  border-color: var(--color-white);
  margin-top: 8px;
}

.cta .btn-solid:hover {
  background: transparent;
  color: var(--color-white);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--color-line);
}

.footer-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer .logo {
  height: 16px;
  width: auto;
  filter: invert(1);
}

.site-footer p {
  font-size: 14px;
  color: var(--color-muted);
}

/* ---------- Scroll animations ---------- */

/* Elements start hidden/offset; main.js adds .is-visible via
   IntersectionObserver as each one scrolls into view. */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger the 4 service cards so they don't all fade in at once. */
.service-card:nth-child(1) { --reveal-delay: 0s; }
.service-card:nth-child(2) { --reveal-delay: 0.1s; }
.service-card:nth-child(3) { --reveal-delay: 0.2s; }
.service-card:nth-child(4) { --reveal-delay: 0.3s; }

/* Respect users who've asked for less motion: show content immediately,
   no fade/slide. */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .header-inner {
    padding-inline: 32px;
  }

  .hero-content {
    padding-left: 32px;
    padding-right: 32px;
  }

  .stat-bar-inner {
    padding-inline: 32px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }

  .about-photo,
  .about-panel {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .services-title {
    padding-left: 32px;
    padding-right: 32px;
  }

  .services-grid {
    padding-inline: 32px;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .container,
  .hero-content,
  .stat-bar-inner,
  .services-title,
  .services-grid,
  .cta-inner,
  .footer-inner {
    padding-inline: 22px;
  }

  .header-inner {
    padding: 20px 22px;
  }

  .site-header .logo {
    height: 16px;
  }

  .icon-btn img {
    width: 22px;
  }

  .main-nav {
    gap: 18px;
    font-size: clamp(13px, 3.4vw, 16px);
  }

  .header-actions {
    gap: 12px;
  }

  .header-cta {
    padding: 9px 18px;
    font-size: 13px;
  }

  .header-actions.search-open .header-cta {
    transform: translateX(-220px);
  }

  .search-form {
    width: 200px;
  }

  .hero-content {
    padding-bottom: 40px;
  }

  .stat-bar {
    padding: 64px 0 56px;
  }

  .stat-bar-inner {
    flex-wrap: wrap;
    row-gap: 20px;
  }

  /* a vertical rule reads oddly once the row wraps onto separate
     lines, so drop it and let spacing carry the separation instead */
  .stat-divider {
    display: none;
  }

  .about-panel-content {
    padding: 8% 9%;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about,
  .services {
    padding-bottom: 72px;
  }

  .cta {
    padding: 64px 0;
  }

  /* En móvil la sección es más alta que ancha, así que `cover` recorta en
     horizontal. Aquí se centra a propósito: deja el fondo gris detrás del
     texto (que se lee bien) en vez de la modelo, que quedaría justo bajo
     el titular restándole contraste. */
  .cta-photo {
    object-position: center top;
  }

  .cta h2 {
    font-size: clamp(24px, 6vw, 32px);
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 16px 18px;
  }

  .hero-cta {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .stat-bar-inner {
    justify-content: flex-start;
  }

  .stat-tagline {
    font-size: clamp(22px, 6vw, 26px);
  }

  .services-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .service-pill {
    font-size: 12px;
    padding: 7px 14px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
