/* Cubiertas y Tejados Cubo Carmona — hoja de estilos
   Colores tomados del logotipo: rojo, verde y gris.
   Tipografía del sistema: carga instantánea y sin peticiones a servidores externos (RGPD).
   Si en el futuro se quiere una fuente propia, subir los .woff2 a /assets/fonts/
   y declararla aquí con @font-face (nunca enlazar a Google Fonts). */

:root {
  --ink: #1d2327;
  --steel: #56616a;
  --concrete: #eef0f0;
  --line: #d5dadc;
  --white: #ffffff;
  --red: #c8102e;
  --red-dark: #9e0c24;
  --green: #0e5b2f;
  --grey: #6d6e70;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 6px;
  --header-h: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--white); padding: .6rem 1rem; border-radius: var(--radius); }
.skip-link:focus { top: 1rem; }

.ico { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: .7rem 1.2rem; border-radius: var(--radius); border: 2px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-lg { padding: .9rem 1.5rem; font-size: 1.0625rem; }
.btn-block { width: 100%; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-dark); }
.btn-ghost { color: var(--white); border-color: rgba(255,255,255,.8); }
.btn-ghost:hover { background: var(--white); color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* Cabecera */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: 1rem; }
.brand img { height: 46px; width: auto; }
.nav ul { list-style: none; }
.nav a:not(.btn) { text-decoration: none; font-weight: 600; color: var(--ink); padding: .4rem .2rem; }
.nav a:not(.btn):hover { color: var(--red); }
.site-header a.lang-switch { font-size: .95rem; color: var(--steel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: .35rem .7rem; }
.site-header a.lang-switch:hover { border-color: var(--ink); color: var(--ink); }
.site-header a.lang-switch { text-decoration: none; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.btn-ghost-dark { color: var(--ink); border-color: var(--ink); }
.btn-ghost-dark:hover { background: var(--ink); color: var(--white); }

.nav-toggle { display: none; background: none; border: 0; padding: .6rem; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 26px; height: 3px; background: var(--ink); border-radius: 2px; position: relative; content: "";
}
.nav-toggle-bars::before { position: absolute; top: -8px; }
.nav-toggle-bars::after { position: absolute; top: 8px; }

@media (min-width: 960px) {
  .nav { display: flex; align-items: center; gap: 1.75rem; }
  .nav ul { display: flex; gap: 1.25rem; }
}
@media (max-width: 959px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--white); border-bottom: 1px solid var(--line);
    padding: .5rem var(--gutter) 1.25rem;
  }
  .nav.is-open { display: block; }
  .nav li a { display: block; padding: .75rem 0 !important; border-bottom: 1px solid var(--concrete); }
  .nav a.lang-switch { display: inline-block; margin-top: 1rem; }
  .nav-call { margin-top: 1rem; width: 100%; }
}

/* Portada */
.hero { position: relative; color: var(--white); background: var(--ink); isolation: isolate; overflow: hidden; }
.hero-media, .hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-media img { object-fit: cover; object-position: 50% 40%; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(17,22,25,.88) 0%, rgba(17,22,25,.7) 45%, rgba(17,22,25,.25) 100%);
}
.hero-content { position: relative; z-index: 2; padding-top: clamp(3.5rem, 10vw, 7rem); padding-bottom: clamp(5rem, 12vw, 9rem); }
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.9rem); font-weight: 800; letter-spacing: -0.025em; max-width: 17ch; margin-bottom: .45em; }
.hero-lead { font-size: clamp(1.075rem, 1.7vw, 1.25rem); max-width: 40rem; color: #e6eaeb; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.75rem 0 2rem; }
.hero-facts { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-weight: 600; color: #e6eaeb; }
.hero-facts li { display: flex; align-items: center; gap: .5rem; }
.hero-facts li::before { content: ""; width: .55rem; height: .55rem; background: var(--red); transform: rotate(45deg); flex: none; }

/* Silueta de tejados (motivo del logotipo) */
.roofline { position: absolute; z-index: 3; left: 0; right: 0; bottom: -1px; width: 100%; height: clamp(44px, 7vw, 110px); display: block; }
.roofline polyline { fill: none; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rl-green { stroke: var(--green); }
.rl-red { stroke: var(--red); }
.rl-grey { stroke: var(--grey); }

/* Secciones */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-grey { background: var(--concrete); }
.section-ink { background: var(--ink); color: var(--white); }
.section-head { max-width: 44rem; margin-bottom: clamp(2rem, 5vw, 3rem); }
.section-head p { color: var(--steel); font-size: 1.125rem; }

/* Servicios: filas alternas foto / texto */
.service { display: grid; gap: 1.5rem; align-items: center; }
.service + .service { margin-top: clamp(2.5rem, 6vw, 4.5rem); }
.service-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.service-body h3 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); font-weight: 800; }
.service-body > p { color: var(--steel); }
@media (min-width: 900px) {
  .service { grid-template-columns: 1.1fr 1fr; gap: 3.5rem; }
  .service-flip .service-media { order: 2; }
}
.checks { list-style: none; display: grid; gap: .45rem; }
.checks li { position: relative; padding-left: 1.75rem; }
.checks li::before {
  content: ""; position: absolute; left: .15rem; top: .5em; width: .75rem; height: .4rem;
  border-left: 3px solid var(--green); border-bottom: 3px solid var(--green); transform: rotate(-45deg);
}

/* Tipos de cliente: un color del logotipo para cada uno */
.audiences { display: grid; gap: 1.25rem; }
@media (min-width: 800px) { .audiences { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
.audience { background: var(--white); padding: 1.5rem 1.5rem 1.25rem; border-top: 5px solid; border-radius: 0 0 var(--radius) var(--radius); }
.audience p { color: var(--steel); margin: 0; }
.audience-green { border-color: var(--green); }
.audience-red { border-color: var(--red); }
.audience-grey { border-color: var(--grey); }

/* Galería de trabajos */
.gallery { list-style: none; display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) {
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
  /* 10 trabajos: la primera y la última foto ocupan dos columnas para cerrar la cuadrícula sin huecos */
  .gallery > li:first-child, .gallery > li:last-child { grid-column: span 2; }
  .gallery > li:first-child .gallery-open img, .gallery > li:last-child .gallery-open img { aspect-ratio: 8 / 3; }
}
.gallery figure { margin: 0; background: var(--concrete); border-radius: var(--radius); overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.gallery-open { display: block; width: 100%; padding: 0; border: 0; background: var(--ink); cursor: zoom-in; overflow: hidden; }
.gallery-open { flex: none; }
.gallery-open img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease, opacity .35s ease; }
.gallery-open:hover img { transform: scale(1.04); opacity: .92; }
.gallery figcaption { padding: 1rem 1.15rem 1.25rem; color: var(--steel); font-size: .975rem; line-height: 1.5; }
.gallery figcaption strong { display: block; color: var(--ink); font-size: 1.075rem; margin: .35rem 0 .2rem; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--green); background: #e3efe7; padding: .15rem .55rem; border-radius: 99px; }

/* Empresa */
.about { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .about { grid-template-columns: 1.4fr 1fr; gap: 4rem; } }
.about-text p { font-size: 1.125rem; color: var(--steel); max-width: 38rem; }
.facts { margin: 0; display: grid; gap: 1rem; }
.facts div { border-left: 4px solid var(--red); padding: .25rem 0 .25rem 1rem; }
.facts dt { color: var(--steel); font-size: .95rem; }
.facts dd { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -0.02em; }

/* Zona */
.zone { display: grid; gap: 2rem; }
@media (min-width: 900px) { .zone { grid-template-columns: 1fr 2fr; gap: 3rem; } }
.zone > div > p { color: var(--steel); }
.zone-lists { display: grid; gap: 1.5rem; }
@media (min-width: 700px) { .zone-lists { grid-template-columns: repeat(3, 1fr); } }
.zone-lists h3 { font-size: 1.1rem; }
.zone-lists p { color: var(--steel); font-size: 1rem; margin: 0; }

/* Preguntas frecuentes */
.faq { max-width: 52rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 1.1rem 2.5rem 1.1rem 0; font-weight: 700; font-size: 1.1rem; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: .5rem; top: 50%; width: .65rem; height: .65rem; margin-top: -.45rem;
  border-right: 3px solid var(--red); border-bottom: 3px solid var(--red); transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -.1rem; }
.faq details p { color: var(--steel); padding-right: 2.5rem; }

/* Contacto */
.contact { display: grid; gap: 2.5rem; }
@media (min-width: 960px) { .contact { grid-template-columns: 1fr 1.25fr; gap: 4rem; align-items: start; } }
.contact-info > p { color: #c9d0d3; font-size: 1.125rem; }
.channels { list-style: none; display: grid; gap: .75rem; margin: 1.75rem 0; }
.channels a {
  display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--white);
  padding: .85rem 1rem; border: 1px solid #3a444a; border-radius: var(--radius); transition: border-color .15s, background-color .15s;
}
.channels a:hover { border-color: var(--white); background: #262e33; }
.channels .ico { width: 1.5rem; height: 1.5rem; color: #ff6b7f; }
.channels span { display: flex; flex-direction: column; line-height: 1.3; color: #c9d0d3; font-size: .95rem; }
.channels strong { color: var(--white); font-size: 1.1rem; }
.hours { color: #c9d0d3; }

.quote-form { background: var(--white); color: var(--ink); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2.25rem); }
.quote-form h3 { font-size: 1.35rem; margin-bottom: 1.25rem; }
.field { margin-bottom: 1rem; }
.field-row { display: grid; gap: 0 1rem; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; align-items: end; } }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .975rem; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--white);
  border: 1.5px solid #b7bfc3; border-radius: var(--radius); padding: .7rem .8rem;
}
.field textarea { resize: vertical; min-height: 7.5rem; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(200,16,46,.25); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); }
.field ::placeholder { color: #8a949a; }
.hp { position: absolute !important; left: -9999px; }
.field-check { display: flex; gap: .6rem; align-items: flex-start; margin: 1.25rem 0 .75rem; }
.field-check input { width: 1.2rem; height: 1.2rem; margin-top: .2rem; accent-color: var(--red); flex: none; }
.legal-layer { font-size: .8rem; line-height: 1.5; color: var(--steel); margin-bottom: 1.25rem; }
.form-status { margin: 1rem 0 0; font-weight: 600; min-height: 1.5em; }
.form-status.is-ok { color: var(--green); }
.form-status.is-error { color: var(--red); }
.form-photos { margin: .75rem 0 0; padding: .85rem 1rem; background: #e3efe7; border-left: 4px solid var(--green); border-radius: var(--radius); font-size: .975rem; }
.form-photos a { color: var(--green); font-weight: 700; }
.field .optional { font-weight: 400; color: var(--steel); }

/* Pie */
.site-footer { background: #151a1d; color: #c9d0d3; padding-top: 3.5rem; font-size: .975rem; }
.footer-inner { display: grid; gap: 2rem; padding-bottom: 2.5rem; }
@media (min-width: 800px) { .footer-inner { grid-template-columns: 2fr 1fr 1fr; gap: 3rem; } }
.footer-brand img { background: var(--white); padding: .5rem .75rem; border-radius: var(--radius); margin-bottom: 1rem; width: 180px; height: auto; }
.footer-brand p { max-width: 26rem; }
.footer-title { font-size: 1rem; font-weight: 700; color: var(--white); margin-bottom: .75rem; }
.site-footer a { color: #e6eaeb; text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.footer-links { list-style: none; display: grid; gap: .35rem; }
.footer-legal { border-top: 1px solid #2c353a; padding-block: 1.25rem; display: flex; flex-wrap: wrap; gap: .75rem 2rem; justify-content: space-between; font-size: .9rem; }
.footer-legal p { margin: 0; }
.footer-legal ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

/* Barra de contacto fija en móvil */
.mobile-bar { display: none; }
@media (max-width: 759px) {
  body { padding-bottom: 4rem; }
  .mobile-bar {
    display: grid; grid-template-columns: 1fr 1.6fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--white); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-bar a { display: grid; place-items: center; min-height: 3.5rem; font-weight: 700; text-decoration: none; color: var(--ink); }
  .mobile-bar a + a { border-left: 1px solid var(--line); }
  .mobile-bar .mobile-bar-main { background: var(--red); color: var(--white); }
}

/* Visor de fotos */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1200px); max-height: 92vh; color: var(--white); }
.lightbox::backdrop { background: rgba(10,13,15,.9); }
.lightbox img { max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: var(--radius); }
.lightbox-caption { text-align: center; margin: .75rem 0; }
.lightbox-close { display: block; margin: 0 auto; font: inherit; font-weight: 700; background: var(--white); color: var(--ink); border: 0; border-radius: var(--radius); padding: .6rem 1.4rem; cursor: pointer; }

/* Páginas legales */
.legal { max-width: 48rem; padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.legal h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; }
.legal h2 { font-size: 1.35rem; margin-top: 2rem; }
.legal p, .legal li { color: #3a444a; }
.legal ul { padding-left: 1.25rem; margin-bottom: 1em; }
.legal table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .95rem; }
.legal th, .legal td { text-align: left; border-bottom: 1px solid var(--line); padding: .6rem .5rem; vertical-align: top; }
.legal .updated { color: var(--steel); font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Cabecera y pie reducidos de las páginas legales */
.header-actions .btn { white-space: nowrap; }
.site-footer-slim { padding-top: 0; }
@media (max-width: 479px) {
  .header-actions .btn { display: none; }
}
