/* =========================================================
   H2T Ingeniería y Construcción - Hoja de estilos principal
   ========================================================= */

:root {
  --verde: #8baba7;
  --petroleo: #3c575d;
  --petroleo-oscuro: #3d575d;
  --texto-destacado: #50676c;
  --texto: #666;
  --separador-menu: #76aca3;
  --fuente: "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif;
  --fuente-titulos: Georgia, "Times New Roman", serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 12px;
  line-height: 1.55;
  color: var(--texto);
  background: #f2f2f2 url("../images/fondo-h2t.webp") center top / cover no-repeat fixed;
}

img { max-width: 100%; height: auto; border: 0; vertical-align: middle; }

a { color: var(--texto-destacado); text-decoration: none; }
a:hover { color: var(--texto-destacado); }

h1, h2, h3, h4 {
  font-family: var(--fuente-titulos);
  font-weight: 700;
  color: var(--verde);
  margin: 0 0 15px;
}
h1 { font-size: 34px; line-height: 1; }
h2 { font-size: 25px; line-height: 1; }
h3 { font-size: 20px; line-height: 1.2; }
h4 { font-size: 16px; line-height: 1.3; }

p { margin: 0 0 5px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Contenedor general (diseño en caja) ---------- */
.site {
  max-width: 980px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 8px #bbb;
}

/* ---------- Cabecera ---------- */
.site-header {
  background: #fff url("../images/fondo-cabecera.webp") repeat;
  min-height: 194px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 20px;
}
.logo { display: block; padding: 35px 0 26px 30px; }
.logo img { display: block; width: 417px; }

.header-contact {
  margin: 33px 0 0;
  padding-right: 30px;
  text-align: right;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--texto-destacado);
  font-style: normal;
}

/* ---------- Navegación ---------- */
.main-nav {
  position: relative;
  background: var(--petroleo) linear-gradient(to bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 40px);
  border-top: 1px solid #fff;
  border-bottom: 1px solid #fff;
  box-shadow: 0 1px 5px -1px #f5f5f5;
}
.menu {
  list-style: none;
  margin: 0 0 0 5px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.menu li { padding: 8px 0 9px; }
.menu a {
  display: block;
  padding: 0 30px;
  font-size: 13px;
  font-weight: 700;
  line-height: 24px;
  color: #fff;
  text-transform: uppercase;
  border-right: 1px solid var(--separador-menu);
}
.menu li:last-child a { border-right: 0; }
.menu a:hover, .menu a[aria-current="page"] { color: #fff; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: 0;
  color: #fff;
  font: 700 13px/24px var(--fuente);
  text-transform: uppercase;
  cursor: pointer;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 24px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s, background-color .25s;
}
.nav-toggle-icon { position: relative; }
.nav-toggle-icon::before,
.nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }
.nav-open .nav-toggle-icon { background: transparent; }
.nav-open .nav-toggle-icon::before { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle-icon::after { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Slider de portada y cabeceras interiores ---------- */
.banner {
  position: relative;
  overflow: hidden;
  background: #fff;
}
.banner::before {
  /* sombra superior bajo el menú */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(to bottom, rgba(0,0,0,.18), rgba(0,0,0,0));
  z-index: 3;
  pointer-events: none;
}
.banner img { display: block; width: 100%; }

.slider { aspect-ratio: 980 / 415; }
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .8s ease;
}
.slide.is-active { opacity: 1; z-index: 1; }

.slider-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 38px;
  height: 38px;
  margin-top: -19px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(40, 40, 40, .75);
  cursor: pointer;
  opacity: .9;
}
.slider-arrow:hover { opacity: 1; }
.slider-arrow svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; display: block; margin: auto; }
.slider-prev { left: 15px; }
.slider-next { right: 15px; }

.slider-dots {
  position: absolute;
  left: 20px;
  bottom: 60px;
  z-index: 2;
  display: flex;
}
.slider-dots button {
  width: 13px;
  height: 13px;
  margin-left: 5px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(255,255,255,.45);
  cursor: pointer;
}
.slider-dots button[aria-current="true"] { background: #fff; }

/* ---------- Contenido ---------- */
.content { padding: 35px 20px 30px; }
.content::after { content: ""; display: table; clear: both; }

.content h1, .content h2, .content h3, .content h4 { padding-left: 30px; padding-right: 30px; }

.text p,
.content .text-block {
  padding: 0 30px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  text-align: justify;
}

.separator {
  display: block;
  padding: 0 30px;
  margin: 0 0 20px;
}
.separator img { display: block; width: 100%; height: 3px; }

.figure-full { padding: 0 30px; margin: 0 0 20px; }
.figure-full img { display: block; width: 100%; }

/* Pilares (portada) */
.pillar {
  display: flex;
  align-items: flex-start;
  margin: 0 0 28px;
  padding-left: 30px;
}
.pillar img { flex: 0 0 auto; width: 370px; margin-right: 30px; }
.pillar p {
  margin: 0 0 5px 10px;
  padding-right: 40px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  text-align: justify;
}
.motto { margin-top: 10px; }

/* Servicios */
.services {
  list-style: none;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  padding: 10px 30px 30px;
}
.service {
  display: grid;
  grid-template-columns: 210px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 61px;
}
.service img { justify-self: center; }
.service p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--texto);
}
.services-outro {
  padding: 0 30px 20px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  text-align: left;
}

/* Garantías */
.guarantees {
  display: flex;
  align-items: flex-start;
  padding-left: 30px;
}
.guarantees-images {
  flex: 0 0 340px;
  margin-right: 30px;
}
.guarantees-images img { display: block; width: 340px; margin-bottom: 18px; }
.guarantees ul {
  margin: 0;
  padding: 0 40px 0 30px;
}
.guarantees li {
  margin: 0 0 37px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  text-align: justify;
}

/* Preguntas frecuentes */
.faq h3 { margin-bottom: 12px; }
.faq p + h3 { margin-top: 10px; }

/* Galería */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 10px 10px 20px;
}
.gallery a {
  display: block;
  background: #f0f0f0;
  border: 1px solid #fff;
  overflow: hidden;
}
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: opacity .3s;
}
.gallery a:hover img { opacity: .8; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .8);
  padding: 50px 60px;
}
.lightbox.is-open { display: flex; }
.lightbox figure { margin: 0; background: #fff; padding: 10px; border-radius: 4px; max-width: 100%; max-height: 100%; display: flex; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); width: auto; display: block; object-fit: contain; }
.lightbox button {
  position: absolute;
  background: rgba(40, 40, 40, .75);
  border: 2px solid #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
}
.lightbox button svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; display: block; margin: auto; }
.lightbox-close { top: 15px; right: 15px; }
.lightbox-prev { left: 12px; top: 50%; margin-top: -19px; }
.lightbox-next { right: 12px; top: 50%; margin-top: -19px; }
.lightbox-count { position: absolute; bottom: 15px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; }

/* Contacto */
.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 0 20px;
}
.contact h1 { font-size: 18px; margin-top: 10px; }
.contact-list { list-style: none; margin: 0; padding: 0 30px; }
.contact-list li { margin: 0 0 22px; }
.contact-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--texto);
}
.contact-list a:hover { color: var(--texto-destacado); }
.contact-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--verde);
  display: flex;
  align-items: center;
  justify-content: center;
}
.contact-icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map { padding: 0 30px 0 0; }
.map iframe { display: block; width: 100%; height: 350px; border: 0; }

/* Textos legales */
.legal { padding: 0 30px 20px; font-size: 13px; line-height: 1.6; }
.legal p { margin: 0 0 15px; }
.legal ol { margin: 0; padding-left: 18px; }
.legal table { width: 100%; border-collapse: collapse; margin: 0 0 15px; }
.legal th, .legal td { border: 1px solid #e5e5e5; padding: 6px 8px; text-align: left; vertical-align: top; }
.legal th { color: #000; background: #f5f5f5; }

/* ---------- Pie de página ---------- */
.site-footer {
  background: var(--verde);
  border-top: 3px solid #cfcfcf;
  color: #fff;
}
.footer-widgets {
  display: grid;
  grid-template-columns: 620px 1fr;
  gap: 20px;
  padding: 20px 20px 25px;
}
.footer-widgets a { color: #fff; }
.footer-hours {
  margin: 0;
  padding-left: 30px;
  font-size: 18px;
  line-height: 1.55;
}
.footer-address {
  margin: 0;
  padding-right: 50px;
  font-size: 15px;
  line-height: 1.55;
  text-align: right;
  font-style: normal;
}
.copyright {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 41px;
  padding: 10px 30px;
  background: var(--petroleo-oscuro);
  box-shadow: inset 0 3px 6px -3px var(--petroleo-oscuro);
  color: #fff;
  font-size: 11px;
}
.copyright p { margin: 0; }
.copyright-links a { font-weight: 700; color: var(--texto-destacado); }
.copyright-credit { color: #fff; }

/* ---------- Botones auxiliares (página de cookies y mapa) ---------- */
.cookie-btn {
  display: inline-block;
  margin: 0 3px;
  padding: 2px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: linear-gradient(#fff, #ececec);
  color: #333;
  font: 12px/1.6 var(--fuente);
  cursor: pointer;
}
.cookie-btn:hover { color: #000; background: #fff; }

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet (≤ 979px) */
@media (max-width: 979px) {
  .site-header { padding: 0 10px; }
  .logo { padding-left: 10px; }
  .logo img { width: 340px; }
  .header-contact { padding-right: 10px; font-size: 14px; }
  .menu a { padding: 0 18px; }
  .pillar img { width: 300px; }
  .guarantees-images { flex-basis: 260px; }
  .guarantees-images img { width: 260px; }
  .footer-widgets { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

/* Móvil (≤ 767px) */
@media (max-width: 767px) {
  body { font-size: 13px; }
  h1 { font-size: 28px; }
  h2 { font-size: 21px; }
  h3 { font-size: 18px; }

  .site-header { flex-direction: column; align-items: center; min-height: 0; padding: 20px 15px; text-align: center; }
  .logo { padding: 0 0 15px; }
  .logo img { width: 300px; }
  .header-contact { margin: 0; padding: 0; text-align: center; font-size: 14px; }

  .nav-toggle { display: flex; }
  .menu { display: none; flex-direction: column; margin: 0; border-top: 1px solid var(--separador-menu); }
  .nav-open .menu { display: flex; }
  .menu li { padding: 0; border-bottom: 1px solid var(--separador-menu); }
  .menu li:last-child { border-bottom: 0; }
  .menu a { padding: 11px 20px; border-right: 0; }
  .menu a[aria-current="page"] { background: rgba(255,255,255,.08); }

  .slider-arrow { width: 32px; height: 32px; margin-top: -16px; }
  .slider-prev { left: 8px; }
  .slider-next { right: 8px; }
  .slider-dots { left: 50%; bottom: 10px; transform: translateX(-50%); }

  .content { padding: 25px 0 20px; }
  .content h1, .content h2, .content h3, .content h4 { padding-left: 15px; padding-right: 15px; }
  .text p, .content .text-block, .separator, .figure-full, .services-outro, .legal { padding-left: 15px; padding-right: 15px; }

  .pillar { flex-direction: column; padding: 0 15px; }
  .pillar img { width: 100%; max-width: 370px; margin: 0 auto 12px; }
  .pillar p { margin: 0; padding: 0; }

  .services { grid-template-columns: 1fr; padding: 10px 15px 25px; }
  .service { grid-template-columns: 80px 1fr; }

  .guarantees { flex-direction: column; padding: 0 15px; }
  .guarantees-images { flex-basis: auto; margin: 0 auto 10px; }
  .guarantees-images img { width: 100%; max-width: 340px; margin: 0 auto 15px; }
  .guarantees ul { padding: 0 0 0 20px; }
  .guarantees li { margin-bottom: 18px; }

  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px 15px 20px; }

  .contact { grid-template-columns: 1fr; }
  .contact-list { padding: 0 15px; }
  .map { padding: 0 15px; }
  .map iframe { height: 300px; }

  .footer-widgets { grid-template-columns: 1fr; padding: 20px 15px; text-align: center; }
  .footer-hours { padding: 0; font-size: 16px; }
  .footer-address { padding: 0; text-align: center; }
  .copyright { flex-direction: column; text-align: center; padding: 10px 15px; }

  .lightbox { padding: 50px 10px; }
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}

/* Móvil pequeño (≤ 479px) */
@media (max-width: 479px) {
  .logo img { width: 250px; }
  .header-contact { font-size: 13px; }
  .service p { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .slide, .gallery img, .nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { transition: none; }
}

/* ---------- Textos justificados (escritorio y móvil) ---------- */
.content p,
.content li,
.content td,
.content .text-block,
.services-outro,
.cookie-consent p,
.cookie-modal__box p {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* ---------- Consentimiento de cookies ---------- */
[hidden] { display: none !important; }
.cookie-consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: var(--petroleo-oscuro);
  color: #fff;
  box-shadow: 0 -8px 32px rgba(0,0,0,.24);
  font-family: var(--fuente);
}
.cookie-consent__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 36px;
  max-width: 1210px;
  margin: 0 auto;
  padding: 20px 28px;
}
.cookie-consent__copy { max-width: 730px; }
.cookie-consent .cookie-consent__title {
  margin: 0 0 8px;
  padding: 0;
  font: 600 18px/1.3 var(--fuente-titulos);
  color: #fff;
  text-transform: none;
}
.cookie-consent p { margin: 0; font-size: 14px; line-height: 1.55; color: #e3eceb; }
.cookie-consent a { color: #fff; text-decoration: underline; }
.cookie-consent__actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-button {
  padding: 10px 18px;
  border: 1px solid #fff;
  border-radius: 0;
  font: 600 13px/1.2 var(--fuente);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.cookie-button--choice { background: #fff; color: var(--petroleo-oscuro); }
.cookie-button--choice:hover { background: var(--verde); border-color: var(--verde); color: #fff; }
.cookie-button--secondary { background: transparent; color: #fff; }
.cookie-button--secondary:hover { background: #fff; color: var(--petroleo-oscuro); }
.cookie-button:focus-visible, .cookie-modal__close:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }

.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.55);
  font-family: var(--fuente);
}
body.cookie-modal-open { overflow: hidden; }
.cookie-modal__box {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px 22px 22px;
  background: #fff;
  color: var(--texto);
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.cookie-modal__box .cookie-modal__title {
  margin: 0 0 12px;
  padding: 0 30px 0 0;
  font: 400 22px/1.3 var(--fuente-titulos);
  color: var(--petroleo-oscuro);
  text-transform: none;
}
.cookie-modal__box p { margin: 0 0 16px; font-size: 13px; line-height: 1.6; }
.cookie-modal__close {
  position: absolute;
  top: 14px; right: 16px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--petroleo-oscuro);
  font: 700 24px/1 var(--fuente);
  cursor: pointer;
}
.cookie-option {
  display: block;
  margin: 0 0 14px;
  padding: 14px 12px;
  background: #f5f8f8;
  border: 1px solid #dfe7e6;
  cursor: pointer;
}
.cookie-option__head { display: flex; align-items: center; gap: 10px; color: #333; font-size: 13px; font-weight: 700; }
.cookie-option__head input { width: 15px; height: 15px; margin: 0; accent-color: var(--verde); }
.cookie-option__text { display: block; margin-top: 8px; font-size: 12px; line-height: 1.6; }
.cookie-modal__note { font-size: 12px; }
.cookie-modal__actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.cookie-button--primary { background: var(--petroleo-oscuro); border-color: var(--petroleo-oscuro); color: #fff; }
.cookie-button--primary:hover { background: var(--verde); border-color: var(--verde); }
.cookie-button--outline { background: #fff; border-color: var(--petroleo-oscuro); color: var(--petroleo-oscuro); }
.cookie-button--outline:hover { background: var(--petroleo-oscuro); color: #fff; }

@media (max-width: 767px) {
  .cookie-consent__inner { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .cookie-consent .cookie-consent__title { font-size: 16px; }
  .cookie-consent p { font-size: 13px; }
  .cookie-consent__actions { gap: 8px; }
  .cookie-consent__actions .cookie-button { flex: 1; padding: 10px 6px; }
  .cookie-modal__actions .cookie-button { flex: 1 1 auto; }
}

/* ---------- Mapa con consentimiento ---------- */
.map iframe:not([src]) { display: none; }
.map.is-loaded .map-placeholder { display: none; }
.map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  padding: 20px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.map-placeholder p { margin: 0 0 10px; text-align: center; }

/* ---------- Pie: enlaces legales ---------- */
.copyright { justify-content: center; }
.copyright-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 32px; margin: 0; }
.copyright-links a { color: #fff; }
.copyright-links a:hover { color: var(--verde); }

@media (max-width: 767px) {
  .map-placeholder { min-height: 300px; }
  .copyright-links { flex-direction: column; align-items: center; gap: 10px; }
}

/* ---------- Accesibilidad ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: -100px; left: 10px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--petroleo-oscuro);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* ---------- Fondo fijo solo en escritorio ---------- */
@media (max-width: 767px) {
  body { background-attachment: scroll; }
}
