:root {
  --navy: #02264a;
  --ink: #02182f;
  --footer: #02162c;
  --red: #f60315;
  --whatsapp: #25d366;
  --hero-fade: rgba(244, 249, 253, 0.78);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Montserrat", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--footer);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font-family: inherit;
}

img {
  max-width: 100%;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 5;
  background: #fff;
  color: var(--navy);
  padding: 8px 12px;
  font-weight: 700;
}

.skip:focus {
  top: 12px;
}

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 460px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  background-color: #8ebfe0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.page-m27 .hero {
  background-image: url("../assets/m27-hero.webp?v=hires");
  background-position: right center;
}

.page-a27 .hero {
  background-image: url("../assets/a27-hero.webp?v=hires");
  background-position: center center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--hero-fade) 0%, rgba(244, 249, 253, 0.42) 24%, rgba(244, 249, 253, 0) 46%),
    linear-gradient(270deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 18%);
}

.hero-copy,
.rail {
  position: relative;
  z-index: 1;
}

.hero-copy {
  width: min(560px, 44vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(16px, 2.6vh, 40px) clamp(22px, 3.2vw, 56px) clamp(14px, 2vh, 28px);
}

.page-a27 .hero-copy {
  width: min(860px, 62vw);
}

.logo {
  display: block;
  width: min(300px, 100%);
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: clamp(10px, 1.8vh, 22px) 0 0;
  font-weight: 700;
  font-size: clamp(11px, min(1.12vw, 1.7vh), 15px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  margin: clamp(6px, 1vh, 12px) 0 0;
  font-weight: 800;
  font-size: clamp(26px, min(3.05vw, 5.2vh), 50px);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.lead {
  margin: clamp(8px, 1.2vh, 14px) 0 0;
  max-width: 38em;
  font-weight: 500;
  font-size: clamp(12.5px, min(1.02vw, 1.85vh), 15.5px);
  line-height: 1.38;
}

.accent {
  display: block;
  width: 42px;
  height: 3px;
  margin-top: clamp(10px, 1.4vh, 16px);
  background: var(--red);
}

.pillars {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.2vw, 22px) clamp(12px, 1.6vw, 26px);
  margin-top: clamp(10px, 1.8vh, 20px);
}

.pillar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 138px;
  font-size: clamp(9px, 0.7vw, 11px);
  font-weight: 800;
  letter-spacing: 0.035em;
  line-height: 1.2;
  text-transform: uppercase;
}

.page-a27 .pillar {
  width: auto;
  max-width: 168px;
  flex: 1 1 120px;
}

@media (min-width: 1100px) {
  .page-a27 .pillars {
    flex-wrap: nowrap;
  }
}

.pillar svg,
.card-icon,
.wa-badge svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pillar svg,
.pillar img {
  width: auto;
  height: 30px;
  max-width: 40px;
  object-fit: contain;
  flex: none;
}

.tagline {
  margin: clamp(12px, 2vh, 22px) 0 0;
  font-weight: 800;
  font-size: clamp(12px, min(1.02vw, 1.7vh), 15px);
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.rail {
  position: absolute;
  top: 0;
  right: 8px;
  bottom: 0;
  width: 168px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 16px 4px 20px 0;
  text-align: left;
  color: var(--ink);
}

.page-m27 .rail {
  right: 28px;
  width: 138px;
}

.page-a27 .rail {
  right: 18px;
  width: 132px;
}

.page-a27 .rail-list,
.page-a27 .rail-phrase {
  font-size: clamp(11px, 0.82vw, 13.5px);
  letter-spacing: 0.08em;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0 12px 0 8px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.lang button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 2px 0;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  opacity: 0.38;
}

.lang button.is-active {
  opacity: 1;
  box-shadow: inset 0 -2px 0 var(--red);
}

.lang button:hover,
.lang button:focus-visible {
  opacity: 1;
}

.lang-sep {
  opacity: 0.45;
  font-weight: 600;
}

.rail-copy {
  margin-top: clamp(84px, 14vh, 130px);
}

.rail-list,
.rail-phrase {
  margin: 0;
  font-weight: 800;
  font-size: clamp(12px, min(1.02vw, 1.7vh), 16px);
  line-height: 1.45;
  letter-spacing: 0.145em;
  text-transform: uppercase;
}

.rail-rule {
  display: block;
  width: 38px;
  height: 3px;
  margin: 10px 0;
  background: var(--red);
}

.services {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-template-rows: minmax(clamp(96px, calc(28vh - 120px), 160px), 1fr) auto auto;
  column-gap: 3px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 6%, rgba(255, 255, 255, 0.82) 46%, rgba(255, 255, 255, 0.82) 54%, rgba(255, 255, 255, 0) 94%);
}

.card {
  position: relative;
  isolation: isolate;
  min-height: clamp(210px, 28vh, 280px);
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  row-gap: 0;
  justify-items: center;
  padding: 14px 12px 16px;
  color: #fff;
  text-align: center;
  background-color: var(--navy);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    to top,
    rgba(2, 22, 48, 0.94) 0%,
    rgba(2, 32, 64, 0.55) 34%,
    rgba(2, 38, 74, 0.12) 62%,
    rgba(2, 38, 74, 0) 82%
  );
}

.card-icon,
.card h2,
.card p,
.card-body {
  position: relative;
  z-index: 1;
}

.card h2 {
  grid-row: 2;
}

.card > p,
.card-body {
  grid-row: 3;
}

.card-body {
  width: 100%;
}

.card .card-sub {
  min-height: 0;
  margin-bottom: 5px;
  font-size: clamp(11.5px, 0.8vw, 13.5px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.card .card-note {
  min-height: 0;
  font-size: clamp(9.5px, 0.6vw, 11px);
  line-height: 1.35;
}

.card-icon {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 34%;
  width: auto;
  height: clamp(42px, 5vh, 58px);
  max-width: 72%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.65));
}

.card.seguridad .card-icon {
  height: clamp(46px, 5.2vh, 62px);
  max-width: 86%;
}

.card h2 {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 2.45em;
  margin: 0 0 18px;
  font-size: clamp(12px, 0.82vw, 14px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.card h2::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  width: 38px;
  height: 3px;
  transform: translateX(-50%);
  background: var(--red);
}

.card p {
  margin: 0;
  width: 100%;
  min-height: calc(1.35em * 2);
  font-size: clamp(11px, 0.72vw, 13px);
  font-weight: 400;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.page-m27 .card p {
  min-height: calc(1.35em * 3);
}

.card.limpieza { background-image: url("../assets/m27-limpieza.jpg?v=cards"); }
.card.conserjeria { background-image: url("../assets/m27-conserjeria.jpg?v=cards"); }
.card.jardineria { background-image: url("../assets/m27-jardineria.jpg?v=cards"); }
.card.piscinas { background-image: url("../assets/m27-piscinas.jpg?v=cards"); }
.card.mantenimiento { background-image: url("../assets/m27-mantenimiento.jpg?v=cards"); }
.card.obras { background-image: url("../assets/m27-obras.jpg?v=cards"); }
.card.seguridad { background-image: url("../assets/m27-seguridad.jpg?v=cards"); }
.card.diligence { background-image: url("../assets/a27-due-diligence.jpg?v=cards"); }
.card.inversion { background-image: url("../assets/a27-inversion.jpg?v=cards"); }
.card.monitoring { background-image: url("../assets/a27-monitoring.jpg?v=cards"); }
.card.asset { background-image: url("../assets/a27-asset.jpg?v=cards"); }
.card.key { background-image: url("../assets/a27-key.jpg?v=keylogo"); background-position: 70% 42%; }
.card.expansion { background-image: url("../assets/a27-expansion.jpg?v=cards"); background-position: center top; }

.site-footer {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 8px 260px;
  background: var(--footer);
  color: #fff;
}

.topnav {
  position: absolute;
  z-index: 3;
  top: clamp(12px, 2.2vh, 22px);
  right: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(2, 22, 44, 0.22);
}

.nav-tab,
.wa {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.nav-tab {
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 20px;
  color: var(--navy);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(2, 38, 74, 0.16);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-mark {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.nav-mark b {
  color: var(--red);
  font-weight: 800;
}

.nav-tab:hover {
  box-shadow: inset 0 0 0 1.5px var(--navy), 0 6px 14px rgba(2, 22, 44, 0.18);
}

.nav-tab.is-current {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 4px 12px rgba(2, 22, 44, 0.3);
  cursor: default;
}

.wa {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 8px;
  height: 48px;
  gap: 9px;
  padding: 4px 20px 4px 5px;
  color: #fff;
  background: var(--whatsapp);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.wa-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
  flex: none;
}

.wa-badge svg {
  width: 22px;
  height: 22px;
  stroke: none;
  fill: #fff;
}

.footer-slogan {
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: clamp(11px, 1vw, 15px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.wa:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
}

.scroll-top {
  display: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  .footer-slogan {
    letter-spacing: 0.08em;
  }
}

@media (max-width: 960px) {
  .hero {
    flex-direction: column;
    min-height: 0;
    background-position: center top;
  }

  .hero::before {
    background: linear-gradient(180deg, rgba(248, 251, 254, 0.9) 0%, rgba(248, 251, 254, 0.8) 55%, rgba(248, 251, 254, 0.72) 100%);
  }

  .hero-copy,
  .page-a27 .hero-copy,
  .rail {
    width: 100%;
  }

  .rail,
  .page-m27 .rail,
  .page-a27 .rail {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    text-align: left;
    padding: 8px 22px 22px;
  }

  .page-m27 .hero,
  .page-a27 .hero {
    background-position: right center;
  }

  .hero-copy {
    align-items: center;
    text-align: center;
  }

  .pillars {
    justify-content: center;
  }

  .rail,
  .page-m27 .rail,
  .page-a27 .rail {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .rail-rule {
    margin: 10px auto;
  }

  .rail-copy {
    margin-top: 0;
  }

  .pillar,
  .page-a27 .pillar {
    flex: 1 1 calc(50% - 12px);
    flex-direction: column;
    align-items: center;
    width: calc(50% - 12px);
    max-width: none;
    text-align: center;
  }

  .topnav {
    position: relative;
    top: auto;
    right: auto;
    order: -1;
    flex-wrap: wrap;
    justify-content: center;
    margin: 12px 12px 0;
    border-radius: 26px;
  }

  .services {
    grid-auto-flow: row;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    row-gap: 3px;
  }

  .card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    grid-row: auto;
    min-height: 230px;
  }

  .card h2 {
    font-size: 15px;
  }

  .card p {
    font-size: 13px;
  }

  .site-footer {
    text-align: center;
    padding: 16px 16px 84px;
  }

  .wa {
    left: 16px;
    right: auto;
    bottom: 16px;
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .wa-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .wa-badge {
    width: 100%;
    height: 100%;
    background: transparent;
  }

  .wa-badge svg {
    width: 30px;
    height: 30px;
  }

  .scroll-top {
    display: grid;
    place-items: center;
    position: fixed;
    z-index: 20;
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--navy);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, filter 0.15s ease;
  }

  .scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .scroll-top svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .scroll-top:hover {
    filter: brightness(1.08);
  }
}

@media (max-width: 640px) {
  .services {
    grid-template-columns: 1fr;
  }

  .pillar,
  .page-a27 .pillar {
    width: calc(50% - 12px);
  }

  .hero h1 {
    font-size: 32px;
    white-space: normal;
  }

  .nav-tab {
    flex: 1 1 calc(50% - 4px);
    gap: 7px;
    padding: 0 10px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
  }

  .nav-mark {
    font-size: 16px;
  }

  .topnav .lang {
    flex: 1 1 100%;
    justify-content: center;
    padding: 2px 0;
  }
}

@media (max-height: 760px) and (min-width: 961px) {
  .logo {
    width: min(240px, 100%);
  }

  .hero-copy {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .rail {
    padding-bottom: 16px;
  }
}
