/* =========================================================
   Grup Ditecsa — Estilos base compartidos
   Fondo único gris corporativo #5B5B51 (decisión del proyecto).
   ========================================================= */

/* ---------- Tipografías (alojadas en el propio sitio: assets/fonts, licencia SIL OFL 1.1) ----------
   Antes se cargaban de Google Fonts; se alojan aquí para no enviar la IP de los visitantes a Google. */
/* latin-ext */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(../assets/fonts/opensans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(../assets/fonts/opensans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(../assets/fonts/opensans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(../assets/fonts/opensans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(../assets/fonts/opensans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(../assets/fonts/opensans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Viga';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/viga-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Viga';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/viga-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colores corporativos */
  --gray: #5B5B51;          /* C0 M0 Y0 K80 */
  --red: #E8424B;           /* C0 M87 Y67 K0 */
  --blue: #A5CDEE;          /* C16 M4 Y0 K0 */
  --yellow: #FCC934;        /* C0 M9 Y34 K0 */

  /* Derivados para texto y superficies sobre el gris */
  --surface: #65655B;
  --ink: #F2EFEA;
  --ink-2: #E2DED8;
  --ink-3: #D6D2CB;
  --red-soft: #FF8A90;       /* rojo legible en titulares sobre gris */
  --dark: #0B0A09;
  --line: rgba(242, 239, 234, .12);
  --line-soft: rgba(242, 239, 234, .08);
  --glass: rgba(91, 91, 81, .6);

  /* Tipografía */
  --font-display: 'Viga', 'Arial Narrow', Arial, sans-serif;
  --font-text: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  /* Espaciado: una sola escala para que todo respire igual */
  --s-1: 8px;
  --s-2: 12px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --s-6: 48px;
  --s-7: 64px;
  --s-8: 96px;
  --gutter: clamp(20px, 4vw, 40px);
  --section-y: clamp(88px, 11vw, 160px);
  --container: 1360px;
  --radius: 6px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 86px;

  color-scheme: dark;
}

/* ---------- Reset mínimo ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
body {
  margin: 0;
  background: var(--gray);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input { font: inherit; color: inherit; }
a { color: var(--yellow); }
a:hover { color: #FFFFFF; }
::selection { background: var(--red); color: #FFFFFF; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

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

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--ink); color: var(--dark); padding: var(--s-2) var(--s-4);
  border-radius: 9999px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--s-2); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end;
  gap: var(--s-4); margin-bottom: var(--s-6);
}
.rule-top { border-top: 1px solid var(--line-soft); }

/* ---------- Tipografía ---------- */
.h2 {
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(40px, 5.6vw, 88px); line-height: .96; letter-spacing: -1px;
  text-transform: uppercase;
}
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--ink-2);
}
.muted { color: var(--ink-2); }
.c-red { color: var(--red); }
.c-red-soft { color: var(--red-soft); }
.c-yellow { color: var(--yellow); }
.c-blue { color: var(--blue); }
.c-soft { color: var(--ink-2); }

/* Texto que se amplía y destaca al pasar el ratón */
.hv {
  display: inline-block; position: relative; transform-origin: left center;
  transition: transform .45s var(--ease), color .3s, text-shadow .45s;
}
.hv-c { transform-origin: center; }
@media (hover: hover) {
  .hv:hover { transform: scale(1.06); color: #FFFFFF; text-shadow: 0 0 28px rgba(252, 201, 52, .45); z-index: 5; }
}

/* ---------- Cabecera ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: rgba(91, 91, 81, .62);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding-block: var(--s-2);
}
.brand { display: block; padding-block: var(--s-1); flex: 0 0 auto; }
.brand img { height: 46px; width: auto; }

.nav-only-mobile { display: none; }
.main-nav ul { display: flex; flex-wrap: wrap; gap: var(--s-5); margin: 0; padding: 0; list-style: none; }
.nav-link {
  position: relative; display: inline-block; padding: 14px 2px;
  color: #ECE8E2; text-decoration: none;
  font-size: 12px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  transition: color .3s, transform .4s var(--ease);
}
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 8px; height: 1px; background: var(--red);
  transform: scaleX(0); transform-origin: right; transition: transform .4s;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: #FFFFFF; }
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
@media (hover: hover) { .nav-link:hover { transform: scale(1.1); } }
/* Pantallas medianas: menú (5 enlaces) y botones («Presupuesto», «Contacto») más compactos para que quepan en una línea */
@media (min-width: 1261px) and (max-width: 1440px) {
  .header-inner { gap: var(--s-3); }
  .main-nav ul { gap: var(--s-3); }
  .nav-link { letter-spacing: 1px; }
  .site-header .header-tools { gap: var(--s-2); }
  .header-tools .pill-sm { padding: 0 16px; letter-spacing: 1px; }
}

.header-tools { display: flex; align-items: center; gap: var(--s-3); }
.lang-switch { display: flex; gap: 2px; }
.lang-btn {
  border: 0; background: none; cursor: pointer; padding: 12px 5px;
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--ink-3);
  transition: color .3s, transform .3s var(--ease);
}
.lang-btn[aria-pressed="true"] { color: #FFFFFF; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 6px; }
.lang-btn:hover { color: #FFFFFF; transform: scale(1.2); }

.menu-toggle {
  display: none; align-items: center; gap: var(--s-1);
  min-height: 44px; padding: 0 var(--s-3); border-radius: 9999px;
  border: 1px solid rgba(242, 239, 234, .35); background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
}
.menu-toggle .bars { width: 16px; height: 10px; position: relative; }
.menu-toggle .bars::before, .menu-toggle .bars::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor; transition: transform .3s;
}
.menu-toggle .bars::before { top: 0; }
.menu-toggle .bars::after { bottom: 0; }
.menu-toggle[aria-expanded="true"] .bars::before { transform: translateY(4px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .bars::after { transform: translateY(-4px) rotate(-45deg); }

.readbar {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--red); transform-origin: 0 50%; transform: scaleX(0);
}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes grow-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    .readbar { animation: grow-progress auto linear; animation-timeline: scroll(root); }
  }
}

@media (max-width: 1260px) {
  .menu-toggle { display: inline-flex; }
  .header-inner { flex-wrap: wrap; }
  .main-nav { order: 3; flex-basis: 100%; display: none; padding-bottom: var(--s-3); }
  .site-header.menu-open .main-nav { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .nav-link { display: block; padding: 14px 0; border-top: 1px solid var(--line-soft); }
  .nav-only-mobile { display: list-item; }
  .site-header .header-contact, .site-header .header-budget { display: none; }
}
@media (max-width: 480px) {
  .brand img { height: 36px; }
  .header-inner { gap: var(--s-2); }
  .header-tools { gap: var(--s-1); }
  .menu-toggle { width: 44px; padding: 0; justify-content: center; }
  .menu-toggle .menu-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Botones ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 52px; padding: 0 28px; border-radius: 9999px; cursor: pointer;
  font-family: var(--font-text); font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; text-decoration: none; white-space: nowrap;
  transition: transform .4s var(--ease), background .3s, color .3s, border-color .3s, box-shadow .4s;
}
.pill-sm { min-height: 44px; padding: 0 20px; font-size: 12px; }
.pill:hover { transform: scale(1.06); }
.pill-light { background: var(--ink); color: var(--dark); border: 1px solid var(--ink); }
.pill-light:hover { background: var(--red); border-color: var(--red); color: #FFFFFF; box-shadow: 0 18px 40px -16px rgba(232, 66, 75, .9); }
.pill-line { background: rgba(91, 91, 81, .3); color: var(--ink); border: 1px solid rgba(242, 239, 234, .4); }
.pill-line:hover { border-color: var(--yellow); color: var(--yellow); }
/* Rojo corporativo algo más oscuro para que el texto blanco pequeño se lea bien (contraste 4,8:1) */
.pill-red { background: #D6333C; color: #FFFFFF; border: 1px solid #D6333C; }
.pill-red:hover { background: var(--ink); border-color: var(--ink); color: var(--dark); box-shadow: 0 18px 40px -16px rgba(232, 66, 75, .9); }
.pill .ar { transition: transform .35s; }
.pill:hover .ar { transform: translateX(5px); }

.tag {
  display: inline-block; border: 1px solid rgba(242, 239, 234, .35); background: rgba(91, 91, 81, .35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-radius: 9999px; padding: var(--s-1) var(--s-3);
  font-size: 12px; font-weight: 600; letter-spacing: 1px; color: #FFFFFF;
  transition: transform .35s var(--ease), background .3s, color .3s;
}
.tag:hover { transform: scale(1.1); background: var(--ink); color: var(--dark); }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--s-1); margin: 0; padding: 0; list-style: none; }

/* ---------- Marquesinas ---------- */
.marquee { overflow: hidden; }
.marquee-track { display: flex; width: max-content; align-items: center; }
.fade-x {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
@keyframes marq { to { transform: translateX(-50%); } }
@keyframes marq-rev { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.anim .marquee-track { animation: marq var(--marquee-speed, 38s) linear infinite; }
.anim .marquee-track.rev { animation-name: marq-rev; }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ---------- Animaciones de entrada (solo con JS y sin "reducir movimiento") ---------- */
.anim [data-reveal] .rv,
.anim .rv[data-reveal] {
  opacity: 0; transform: translateY(60px);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
}
.anim [data-reveal].is-in .rv,
.anim .rv[data-reveal].is-in { opacity: 1; transform: none; }
.anim .d1 { transition-delay: .12s; }
.anim .d2 { transition-delay: .24s; }
.anim .d3 { transition-delay: .36s; }

@keyframes fadeup { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes lineup { from { transform: translateY(110%); } to { transform: none; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(3.6); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flow { to { stroke-dashoffset: -40; } }

.mask { display: block; overflow: hidden; padding-bottom: .05em; }
.mask > span { display: block; }
.anim .mask > span { animation: lineup 1.1s var(--ease) both; }
.anim .fu { animation: fadeup 1s var(--ease) both; }

.anim .pulse { transform-origin: center; transform-box: fill-box; animation: pulse 2.2s ease-out infinite; }
.anim .spin { animation: spin 22s linear infinite; transform-origin: center; }
.anim .flow { stroke-dasharray: 5 15; animation: flow 1.2s linear infinite; }

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--line-soft); }
.footer-top {
  display: flex; flex-wrap: wrap; gap: var(--s-6); align-items: center; justify-content: space-between;
  padding-block: var(--s-7) var(--s-6);
}
.footer-brand-main { height: 42px; width: auto; }
.footer-info { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.footer-info a { color: var(--ink); text-decoration: none; }
.footer-info a:hover { color: var(--yellow); }
/* Redes sociales */
.footer-social { display: flex; gap: var(--s-1); margin: 0; padding: 0; list-style: none; }
.footer-social a {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--ink);
  transition: color .3s, background .3s, border-color .3s, transform .4s var(--ease);
}
.footer-social a:hover, .footer-social a:focus-visible { color: var(--dark); background: var(--yellow); border-color: var(--yellow); transform: translateY(-3px); }
.footer-social svg { display: block; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4);
  padding-block: var(--s-4) var(--s-5); border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--ink-3);
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s-4); margin: 0; padding: 0; list-style: none; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: #FFFFFF; }
/* «Configurar cookies» (lo añade js/consentiment.js): botón con aspecto de enlace */
.ck-open { padding: 0; border: 0; background: none; color: var(--ink-2); text-decoration: underline; cursor: pointer; }
.ck-open:hover { color: #FFFFFF; }

/* ---------- Aviso de cookies (js/consentiment.js) ---------- */
.ck {
  position: fixed; left: var(--gutter); bottom: var(--gutter); z-index: 60;
  width: min(440px, calc(100% - 2 * var(--gutter)));
  display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-4); border-radius: var(--radius);
  background: var(--dark); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8);
  animation: fadeup .6s var(--ease) both;
}
.ck[hidden] { display: none; }
.ck-copy { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.ck-more { color: var(--yellow); }
.ck-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ck-btn { flex: 1 1 140px; cursor: pointer; }

/* ---------- Reducir movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Filtros en pastilla (Noticias y Proyectos de la Home) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.chip {
  min-height: 44px; padding: 0 20px; border-radius: 9999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  background: transparent; color: var(--ink); border: 1px solid rgba(242,239,234,.25);
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  transition: background .3s, color .3s, border-color .3s, transform .3s var(--ease);
}
.chip:hover { transform: scale(1.06); border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--dark); border-color: var(--ink); }
.chip-count { opacity: .6; }
.chip-esp { --esp: var(--ink); }
.chip-esp[data-esp="enginyeria"] { --esp: #E8424B; }
.chip-esp[data-esp="instal-lacions"] { --esp: #A5CDEE; }
.chip-esp[data-esp="energia"] { --esp: #FCC934; }
.chip-esp[data-esp="manteniment"] { --esp: #F2EFEA; }
.chip-esp[data-esp]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--esp); }
.chip-esp[aria-pressed="true"] { background: var(--esp); border-color: var(--esp); color: var(--dark); }
.chip-esp[aria-pressed="true"]::before { background: var(--dark); }

/* ---------- Cinta de textos con triángulo (Home: las cuatro áreas; Instalaciones: servicios) ---------- */
.ticker { border-block: 1px solid var(--line-soft); padding-block: 20px; --marquee-speed: 30s; }
.ticker .marquee-track {
  gap: var(--s-6); margin: 0; padding: 0; list-style: none;
  font-family: var(--font-display); font-size: 16px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--ink-2); white-space: nowrap;
}
.ticker li { display: flex; align-items: center; gap: var(--s-6); }
.ticker .tri { font-size: 12px; }
/* Color de cada área: texto y triángulo (en Ingeniería, el texto en rojo claro para que se lea sobre el gris) */
.tk-energia { color: var(--yellow); }
.tk-instal-lacions { color: var(--blue); }
.tk-enginyeria { color: var(--red-soft); }
.tk-enginyeria .tri { color: var(--red); }
.tk-manteniment { color: #F2EFEA; }
