/* SAGATEC Instalaciones — hoja de estilos (v3)
   Basada en las maquetas de "SAGATEC_imagenes_web": blanco, azul marino corporativo y fotografía. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2-variations"), url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}

:root {
  --navy: #0A2463;          /* azul marino corporativo */
  --navy-2: #0D2F80;
  --navy-deep: #061740;
  --blue: #2563EB;          /* acento */
  --blue-soft: #EAF0FC;
  --bg: #FFFFFF;
  --bg-alt: #F4F7FC;
  --surface: #FFFFFF;
  --ink: #0B1633;
  --ink-soft: #4F5B76;
  --line: #E2E8F2;
  --shadow: 0 12px 30px -14px rgba(10, 36, 99, .25);
  --shadow-lg: 0 26px 50px -22px rgba(10, 36, 99, .38);
  --radius: 14px;
  --f: "Archivo", "Segoe UI", Arial, sans-serif;
  --step-3: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  --step-4: clamp(1.9rem, 1.1rem + 2.7vw, 3.2rem);
  --wrap: 76rem;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 1rem; line-height: 1.65; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #F2B200; outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.12; text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 60; background: #F2B200; color: #111; padding: .5rem 1rem; }

/* Títulos de sección con raya debajo */
.title { font-size: var(--step-3); font-weight: 800; color: var(--navy); letter-spacing: -.01em; }
.title::after { content: ""; display: block; width: 64px; height: 4px; border-radius: 2px; background: var(--navy); margin-top: .9rem; }
.center { text-align: center; }
.center .title::after { margin-inline: auto; }
.section-head { margin-bottom: clamp(2rem, 4vw, 2.8rem); display: grid; gap: .9rem; }
.section-head p { color: var(--ink-soft); font-size: 1.12rem; max-width: 44rem; }
.center.section-head p { margin-inline: auto; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; font-family: var(--f); font-weight: 650; font-size: 1rem; text-decoration: none; padding: .9rem 1.5rem; border-radius: 9px; border: 2px solid transparent; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.btn:hover svg { transform: translateX(3px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-outline { border-color: var(--navy); color: var(--navy); background: #fff; }
.btn-outline:hover { background: var(--navy); color: #fff; }

/* ---------- Cabecera ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 80px; }
.brand { width: 178px; flex-shrink: 0; display: block; }
.brand img { width: 100%; }
.brand .logo-dark { display: none; }
.nav { display: flex; align-items: center; gap: 1.7rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .96rem; position: relative; padding-block: .3rem; }
.nav > a:not(.wa):not(.call)::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 2px; background: var(--navy); transition: right .25s; }
.nav > a:not(.wa):not(.call):hover::after { right: 0; }
.nav .wa, .nav .call { display: inline-flex; align-items: center; gap: .45rem; color: #fff; padding: .62rem 1rem; border-radius: 9px; font-size: .92rem; }
.nav .wa { background: #25D366; margin-right: -.9rem; }
.nav .wa:hover { background: #1EBE5A; }
.nav .wa svg { width: 18px; height: 18px; fill: currentColor; }
.nav .call { background: var(--navy); }
.nav .call:hover { background: var(--navy-2); }
.nav .call svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: .5rem .85rem; font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 1080px) and (min-width: 881px) { .nav { gap: 1.2rem; } .nav .wa span { display: none; } .nav .wa { padding: .62rem; } }
@media (max-width: 880px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: #fff; box-shadow: var(--shadow); padding: .5rem var(--gutter) 1.2rem; }
  .nav.open { display: flex; }
  .nav > a { padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .nav .wa, .nav .call { justify-content: center; margin: .9rem 0 0; border-bottom: 0; padding: .8rem; }
  .nav .wa + .call { margin-top: .6rem; }
  .brand { width: 145px; }
}

/* ---------- Portada ---------- */
.hero { position: relative; background: linear-gradient(180deg, #fff 0%, var(--bg-alt) 100%); overflow: hidden; padding: 0; }
.hero-media { position: absolute; top: 0; right: 0; bottom: 0; width: 52%; clip-path: polygon(20% 0, 100% 0, 100% 100%, 0 100%); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.35), transparent 35%); z-index: 1; }
.hero-line { position: absolute; top: 0; bottom: 0; right: 0; width: 52%; transform: translateX(-16px); background: var(--navy); clip-path: polygon(20% 0, calc(20% + 6px) 0, 6px 100%, 0 100%); z-index: 2; }
.hero .wrap { position: relative; z-index: 3; padding-block: clamp(3rem, 7vw, 6rem) clamp(7.5rem, 11vw, 9.5rem); }
.hero-text { max-width: min(38rem, calc(44vw - max(var(--gutter), (100vw - var(--wrap)) / 2 + var(--gutter)))); container-type: inline-size; }
.hero-text h1 { font-size: min(3.2rem, 10.4cqi); }
@media (max-width: 900px) { .hero-text { max-width: none; } .hero-text h1 { font-size: min(var(--step-4), 10.4cqi); } }
.hero h1 { font-size: var(--step-4); font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.hero h1::after { content: ""; display: block; width: 90px; height: 5px; border-radius: 3px; background: var(--navy); margin-top: 1.3rem; }
.hero .sub { margin-top: 1.3rem; font-size: 1.25rem; font-weight: 600; color: var(--ink); max-width: 30ch; }
.hero .lead { margin-top: .8rem; font-size: 1.08rem; color: var(--ink-soft); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }
@media (max-width: 900px) {
  .hero-media { position: relative; width: 100%; height: 280px; clip-path: polygon(0 12%, 100% 0, 100% 100%, 0 100%); order: 2; }
  .hero-media::before { display: none; }
  .hero-line { display: none; }
  .hero { display: flex; flex-direction: column; }
  .hero .wrap { padding-bottom: 2.2rem; }
}

/* Barra de iconos de servicios bajo la portada */
.quick { position: relative; z-index: 5; margin-top: -4.5rem; }
.quick ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .9rem; }
.quick a { display: grid; justify-items: center; gap: .6rem; text-align: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem .7rem 1.2rem; text-decoration: none; color: var(--ink); font-weight: 650; font-size: .93rem; line-height: 1.25; height: 100%; transition: transform .2s, box-shadow .2s; }
.quick a:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--navy); }
.quick svg { width: 36px; height: 36px; stroke: var(--navy); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 1080px) { .quick ul { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .quick { margin-top: -1.5rem; } }
@media (max-width: 560px) { .quick ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Secciones ---------- */
section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.alt { background: var(--bg-alt); }

/* Servicios con foto */
.services { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.4rem; }
.service { grid-column: span 4; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; transition: transform .25s, box-shadow .25s; }
.service:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.service .ph { aspect-ratio: 16 / 10; overflow: hidden; }
.service .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.service:hover .ph img { transform: scale(1.05); }
.service .body { padding: 1.2rem 1.3rem 1.4rem; display: grid; gap: .55rem; }
.service h3 { display: flex; align-items: center; gap: .7rem; font-size: 1.12rem; font-weight: 750; color: var(--navy); }
.service h3 svg { flex: 0 0 30px; width: 30px; height: 30px; stroke: var(--navy); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.service p { color: var(--ink-soft); font-size: .95rem; }
@media (max-width: 1000px) { .service { grid-column: span 6; } }
@media (max-width: 600px) { .service { grid-column: 1 / -1; } }

/* Tipos de trabajo */
.works { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; }
.work { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3.2; box-shadow: var(--shadow); isolation: isolate; }
.work img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .5s; }
.work:hover img { transform: scale(1.05); }
.work::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,23,64,0) 20%, rgba(6,23,64,.55) 50%, rgba(6,23,64,.95) 100%); z-index: -1; }
.work .txt { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.3rem 1.4rem; color: #fff; }
.work .tag { display: inline-block; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .3rem .7rem; border-radius: 6px; margin-bottom: .6rem; }
.work h3 { font-size: 1.25rem; font-weight: 750; }
.work p { color: #D7DFF3; font-size: .93rem; margin-top: .3rem; }
@media (max-width: 900px) { .works { grid-template-columns: 1fr; } .work { aspect-ratio: 16 / 9; } }

/* Sobre nosotros */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.about-text { display: grid; gap: 1rem; }
.about-text p { color: var(--ink-soft); }
.values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1rem; }
.value { display: grid; justify-items: center; text-align: center; gap: .5rem; padding: .4rem .8rem; font-weight: 700; font-size: .95rem; color: var(--navy); line-height: 1.25; }
.value + .value { border-left: 1px solid var(--line); }
.value svg { width: 38px; height: 38px; stroke: var(--navy); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.about-text .btn { justify-self: start; margin-top: 1rem; }
.about-photo { position: relative; aspect-ratio: 5 / 4; }
.about-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%, 0 30%); box-shadow: var(--shadow-lg); }
.about-photo::before { content: ""; position: absolute; left: -14px; bottom: -14px; width: 40%; height: 40%; border-radius: 20px; background: var(--blue-soft); z-index: -1; }
@media (max-width: 900px) { .about { grid-template-columns: 1fr; } .about-photo { order: -1; } .about-photo img { clip-path: none; } }
@media (max-width: 460px) { .values { grid-template-columns: 1fr; gap: 1rem; } .value + .value { border-left: 0; border-top: 1px solid var(--line); padding-top: 1rem; } }

/* Cómo trabajamos */
.process { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.process-photo img { border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; aspect-ratio: 4 / 3.3; object-fit: cover; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 1.1rem; align-items: start; background: #fff; border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); width: 56px; height: 56px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.35rem; }
.steps h3 { font-size: 1.1rem; font-weight: 750; color: var(--navy); margin-top: .2rem; }
.steps p { color: var(--ink-soft); font-size: .96rem; margin-top: .15rem; }
@media (max-width: 900px) { .process { grid-template-columns: 1fr; } }

/* ---------- Contacto ---------- */
.contact { position: relative; overflow: hidden; background: var(--bg-alt); }
.contact-bg { position: absolute; top: 0; right: 0; bottom: 0; width: 55%; }
.contact-bg img { width: 100%; height: 100%; object-fit: cover; }
.contact-bg::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg-alt) 0%, rgba(244,247,252,.55) 40%, rgba(244,247,252,.15) 100%); }
.contact .wrap { position: relative; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 900px) { .contact .wrap { grid-template-columns: 1fr; } .contact-bg { display: none; } }
.contact-list { list-style: none; margin: 1.8rem 0 0; padding: 0; display: grid; gap: 1.1rem; }
.contact-list li { display: flex; gap: .9rem; align-items: center; font-size: 1.08rem; font-weight: 650; }
.contact-list .ico { flex: 0 0 44px; height: 44px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; }
.contact-list .ico svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact-list a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.contact-list a:hover { color: var(--blue); }
.contact-list small { display: block; font-weight: 500; font-size: .88rem; }

.form { background: #fff; box-shadow: var(--shadow-lg); padding: clamp(1.4rem, 3vw, 2.3rem); border-radius: 18px; display: grid; gap: 1rem; }
.form h3 { font-size: 1.55rem; font-weight: 800; color: var(--navy); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }
.field { display: grid; gap: .3rem; min-width: 0; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field textarea, .field select { font: inherit; color: var(--ink); background: #fff; border: 1px solid #CBD4E3; border-radius: 8px; padding: .72rem .85rem; width: 100%; transition: border-color .2s, box-shadow .2s; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(10,36,99,.15); }
.field textarea { min-height: 120px; resize: vertical; }
.layer1 { font-size: .79rem; color: var(--ink-soft); line-height: 1.5; background: var(--bg-alt); border-radius: 8px; padding: .8rem .95rem; }
.layer1 strong { color: var(--ink); }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: .6rem; align-items: start; font-size: .9rem; }
.check input { width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--navy); }
.form .btn { width: 100%; }
.form-msg { font-size: .92rem; }
.form-msg.err { color: #B42318; }
.form-msg.ok { color: #067647; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.req { color: #B42318; }

/* ---------- Pie ---------- */
.site-footer { background: var(--navy-deep); color: #C6D0E8; font-size: .93rem; padding-top: 3.5rem; }
.foot-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1.2fr) minmax(0, 1.1fr); gap: 2rem; padding-bottom: 2.6rem; }
.foot-top > div + div { border-left: 1px solid rgba(255,255,255,.12); padding-left: 2rem; }
@media (max-width: 960px) { .foot-top { grid-template-columns: 1fr 1fr; } .foot-top > div + div { border-left: 0; padding-left: 0; } }
@media (max-width: 560px) { .foot-top { grid-template-columns: 1fr; } }
.site-footer img { width: 180px; margin-bottom: 1.1rem; }
.site-footer h4 { font-size: 1rem; color: #fff; margin: 0 0 1rem; font-weight: 700; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.site-footer li { display: flex; gap: .6rem; align-items: flex-start; }
.site-footer li svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: .2rem; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.site-footer a { color: #E6ECF9; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-block: 1.3rem; display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; justify-content: space-between; align-items: center; font-size: .84rem; color: #9FB0D6; }
.foot-bottom nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }

/* Botón volver arriba */
.to-top { position: fixed; right: 18px; bottom: 18px; width: 46px; height: 46px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .25s, transform .25s; z-index: 30; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Aparición al hacer scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Páginas legales ---------- */
.legal-hero { background: linear-gradient(115deg, var(--navy-deep) 0%, var(--navy) 60%, var(--navy-2) 100%); color: #EEF2FA; padding-block: clamp(2.8rem, 6vw, 4.5rem); }
.legal-hero .label { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #B9C7EA; }
.legal-hero h1 { font-size: var(--step-3); font-weight: 800; margin-top: .6rem; }
.legal-hero p { color: #D5DEF5; margin-top: .6rem; }
.legal { padding-block: clamp(2.5rem, 6vw, 4rem); }
.legal .wrap { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 46rem); gap: clamp(1.5rem, 5vw, 4rem); }
@media (max-width: 860px) { .legal .wrap { grid-template-columns: 1fr; } .legal aside { display: none; } }
.legal aside nav { position: sticky; top: 100px; display: grid; gap: .3rem; font-size: .92rem; background: var(--bg-alt); border-radius: var(--radius); padding: 1rem; }
.legal aside nav a { color: var(--ink-soft); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; }
.legal aside nav a:hover { color: var(--navy); }
.legal aside nav a[aria-current="page"] { color: #fff; background: var(--navy); font-weight: 600; }
.legal article { min-width: 0; }
.legal article h2 { font-size: 1.5rem; font-weight: 750; color: var(--navy); margin: 2.4rem 0 .8rem; }
.legal article h2:first-child { margin-top: 0; }
.legal article h3 { font-size: 1.1rem; font-weight: 700; margin: 1.6rem 0 .5rem; }
.legal article p, .legal article li { max-width: 68ch; }
.legal article p + p { margin-top: .8rem; }
.legal article ul { padding-left: 1.2rem; display: grid; gap: .4rem; margin: .6rem 0; }
.data-table { width: 100%; border-collapse: collapse; margin: .8rem 0 1rem; font-size: .95rem; }
.data-table th, .data-table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { font-weight: 600; color: var(--ink-soft); width: 38%; }
.table-scroll { overflow-x: auto; }
.note { background: var(--bg-alt); border-left: 4px solid var(--navy); padding: 1rem 1.2rem; margin: 1rem 0; border-radius: 8px; }
.pending { background: #FFF3C4; color: #5A4300; padding: 0 .3rem; border-radius: 2px; }
.updated { font-size: .82rem; color: var(--ink-soft); margin-top: 2.4rem; }
