/* Calias · Grilla constructiva
   Estructura negra, celdas hueso, una sola celda naranja activa por pantalla. */

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

:root {
  --ink: #0B0B0B;
  --orange: #FC5409;
  --bone: #EAECEB;
  --bone-2: #DEE1E0;           /* celda en reposo al pasar el puntero */
  --ink-soft: #3A3A37;         /* texto secundario sobre hueso: 10.6:1 */

  --line: clamp(4px, 0.42vw, 7px);   /* espesor de la estructura */
  --pad: clamp(16px, 1.9vw, 30px);   /* aire interior de una celda */

  --f: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --t-display: clamp(2rem, 1.1rem + 3.3vw, 4.6rem);
  --t-h2: clamp(1.7rem, 1.1rem + 1.9vw, 3rem);
  --t-h3: clamp(1.05rem, 0.9rem + 0.5vw, 1.4rem);
  --t-body: clamp(1rem, 0.96rem + 0.18vw, 1.125rem);
  --t-small: 0.875rem;
  --t-label: 0.78rem;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 0; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font-family: var(--f);
  font-size: var(--t-body);
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--orange); color: var(--ink); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }
.cell--orange :focus-visible, .cell--orange:focus-visible, .is-lit:focus-visible { outline-color: var(--ink); }
html { scrollbar-color: var(--ink) var(--bone); }

.skip {
  position: absolute; left: 12px; top: -100px; z-index: 50;
  background: var(--orange); color: var(--ink); padding: 12px 16px; font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Retícula ---------- */
.grid {
  display: grid;
  gap: var(--line);
  padding: 0 var(--line) var(--line);
  padding-left: max(var(--line), env(safe-area-inset-left, 0px));
  padding-right: max(var(--line), env(safe-area-inset-right, 0px));
  grid-template-columns: repeat(12, minmax(0, 1fr));
  max-width: 1920px;
  margin: 0 auto;
}
.grid--top { padding-top: var(--line); }
.cell {
  background: var(--bone);
  min-width: 0;
  padding: var(--pad);
  position: relative;
}
.cell--ink { background: var(--ink); color: var(--bone); }
.cell--orange { background: var(--orange); }
.cell--flush { padding: 0; overflow: hidden; }

/* tipografía de la marca */
.display, h1, h2 {
  font-stretch: 125%;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.98;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--t-display); }
h2 { font-size: var(--t-h2); }
h3 {
  font-size: var(--t-h3);
  font-stretch: 112%;
  font-weight: 750;
  text-transform: uppercase;
  line-height: 1.12;
  letter-spacing: 0;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; max-width: 62ch; }
.lead { font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.3rem); line-height: 1.45; max-width: 46ch; }
.label {
  font-size: var(--t-label); font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase;
  font-stretch: 105%;
}
.muted { color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.between { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }

/* ---------- Cabecera ---------- */
.site-head { position: relative; z-index: 5; }
.site-head .grid { grid-auto-rows: minmax(64px, auto); }
.brand { grid-column: span 3; display: flex; align-items: center; padding-block: 14px; }
.brand img { width: min(100%, 230px); height: auto; }
.nav { display: contents; }
.nav a, .lang a {
  display: flex; align-items: center; justify-content: center;
  background: var(--bone); text-decoration: none;
  font-size: 0.82rem; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; font-stretch: 108%;
  min-height: 64px; padding: 0 12px; text-align: center;
  transition: background-color .25s var(--ease);
}
.nav a { grid-column: span 2; }
.lang { grid-column: span 1; display: flex; }
.lang a { flex: 1; }
.nav a:hover, .lang a:hover { background: var(--bone-2); }
.nav a span { background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .35s var(--ease); padding-bottom: 2px; }
.nav a:hover span { background-size: 100% 2px; }
.menu-btn { display: none; }

/* ---------- Primera pantalla ---------- */
.hero { grid-template-rows: auto; }
.hero__title { grid-column: 1 / 8; grid-row: 1 / 3; min-height: clamp(360px, 46vh, 520px); }
.hero__photo { grid-column: 8 / 13; grid-row: 1 / 3; }
.hero__mail { grid-column: 1 / 5; grid-row: 3 / 5; }
.svc-cell { grid-row: 3; grid-column: span 2; }
.svc-cell--wide { grid-row: 4; grid-column: 5 / 9; }
.hero__impianti { grid-row: 4; grid-column: 9 / 13; display: flex; align-items: center; }

.photo { position: relative; height: 100%; min-height: 260px; overflow: hidden; background: var(--bone-2); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.photo:hover img { transform: scale(1.025); }

/* celda de contacto */
.mail { display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; }
.mail__link {
  text-decoration: none; display: block;
  font-stretch: 112%; font-weight: 800; line-height: 1.02;
  font-size: clamp(1.45rem, 0.8rem + 1.9vw, 2.6rem);
  overflow-wrap: anywhere;
}
.mail__link .arrow { display: inline-block; transition: transform .35s var(--ease); }
.mail__link:hover .arrow { transform: translateX(8px); }
.mail__row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.btn {
  appearance: none; border: 2px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-stretch: 105%;
  min-height: 44px; padding: 0 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background-color .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--orange); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--solid { background: var(--ink); color: var(--bone); }
.btn--solid:hover { background: var(--ink); color: var(--orange); }
.copied { font-size: var(--t-small); font-weight: 600; min-height: 1.5em; }

/* celdas de servicio en la portada */
.svc-cell {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 1.2rem;
  text-decoration: none; min-height: 168px;
  transition: background-color .3s var(--ease);
}
.svc-cell--wide { flex-direction: row; align-items: center; justify-content: flex-start; min-height: 0; }
.picto { width: clamp(40px, 3.6vw, 58px); height: auto; aspect-ratio: 1; flex: none; }
.svc-cell .picto { transition: transform .45s var(--ease); }
.svc-cell:hover .picto { transform: translateY(-3px); }
.svc-cell span { font-size: 0.86rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-stretch: 108%; line-height: 1.2; }

/* el naranja migra: una sola celda encendida a la vez */
.is-lit { background: var(--orange) !important; }
[data-lit-scope]:has(.is-lit) .cell--orange[data-lit-home] { background: var(--bone); }

/* ---------- Secciones ---------- */
main > section { scroll-margin-top: 0; }
.sec-head { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: var(--line); background: var(--ink); padding: 0; }
.sec-head > * { background: var(--bone); padding: var(--pad); }
.sec-head h2 { grid-column: 1 / 8; }
.sec-head p { grid-column: 8 / 13; max-width: none; display: flex; align-items: flex-end; }

/* servicios */
.svc { grid-column: span 4; display: flex; flex-direction: column; gap: 1.4rem; min-height: 360px; transition: background-color .3s var(--ease); }
.svc:nth-of-type(4), .svc:nth-of-type(5) { grid-column: span 6; }
.svc ul { list-style: none; margin: auto 0 0; padding: 0; display: grid; gap: 0; border-top: 2px solid var(--ink); }
.svc li { padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); font-size: 0.98rem; }
.svc li:last-child { border-bottom: 0; }
.svc__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.svc:target, .svc.is-lit { background: var(--orange); }
.svc:target li, .svc.is-lit li { border-color: color-mix(in srgb, var(--ink) 45%, transparent); }

/* obra */
.obra__drawing { grid-column: 1 / 9; grid-row: span 3; background: var(--bone); padding: clamp(12px,1.4vw,24px); }
.obra__drawing svg { width: 100%; height: auto; }
.fact { grid-column: 9 / 13; display: flex; flex-direction: column; gap: .6rem; }
.fact--wide { grid-column: 9 / 13; }
.fact p { font-weight: 650; font-stretch: 106%; font-size: 1.05rem; line-height: 1.3; }

/* clientes */
.client { grid-column: span 4; min-height: clamp(110px, 12vw, 170px); display: flex; align-items: flex-end; }
.client span { font-stretch: 125%; font-weight: 800; text-transform: uppercase; font-size: clamp(1.2rem, 0.8rem + 1.3vw, 2.1rem); line-height: 1; }
.empresa { grid-column: 1 / 8; }
.empresa__photo { grid-column: 8 / 13; min-height: 300px; }

/* cierre */
.close__title { grid-column: 1 / 6; min-height: clamp(300px, 38vh, 440px); }
.close__mail { grid-column: 6 / 13; }

/* pie */
.foot { padding-bottom: max(var(--line), env(safe-area-inset-bottom, 0px)); }
.foot .cell { font-size: var(--t-small); }
.foot__brand { grid-column: 1 / 4; display: flex; align-items: center; }
.foot__brand img { width: 150px; }
.foot__info { grid-column: 4 / 9; display: flex; flex-direction: column; gap: .35rem; justify-content: center; }
.foot__links { grid-column: 9 / 13; display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; }
.foot a { text-underline-offset: 3px; }
.foot__links a { min-height: 44px; display: inline-flex; align-items: center; }
.credits { grid-column: 1 / -1; font-size: 0.75rem; color: var(--ink-soft); }
.credits a { color: inherit; }

/* ---------- Movimiento ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-enter] .cell { animation: cell-in .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
  .js [data-enter] .cell--orange[data-lit-home] { animation-name: cell-in-orange; }
}
@keyframes cell-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes cell-in-orange { 0% { clip-path: inset(0 0 100% 0); background: var(--bone); } 60% { clip-path: inset(0 0 0 0); background: var(--bone); } 100% { background: var(--orange); } }
@media (prefers-reduced-motion: reduce) { * { transition-duration: 0s !important; animation: none !important; } }

/* ---------- Pantallas medianas ---------- */
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .brand { grid-column: span 2; }
  .nav a { grid-column: span 1; font-size: 0.74rem; letter-spacing: .06em; }
  .lang { grid-column: span 6; } .lang a { min-height: 44px; }
  .hero__title { grid-column: 1 / -1; grid-row: auto; min-height: 0; }
  .hero__photo { grid-column: 1 / 4; grid-row: auto; min-height: 320px; }
  .hero__mail { grid-column: 4 / 7; grid-row: auto; }
  .svc-cell { grid-row: auto; grid-column: span 2; }
  .svc-cell--wide { grid-row: auto; grid-column: span 3; }
  .hero__impianti { grid-row: auto; grid-column: span 3; }
  .sec-head { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .sec-head h2, .sec-head p { grid-column: 1 / -1; }
  .svc, .svc:nth-of-type(4), .svc:nth-of-type(5) { grid-column: span 3; min-height: 320px; }
  .svc:nth-of-type(5) { grid-column: 1 / -1; }
  .obra__drawing { grid-column: 1 / -1; grid-row: auto; }
  .fact { grid-column: span 3; } .fact--wide { grid-column: 1 / -1; }
  .client { grid-column: span 2; }
  .empresa, .empresa__photo { grid-column: 1 / -1; }
  .close__title, .close__mail { grid-column: 1 / -1; min-height: 0; }
  .foot__brand { grid-column: 1 / 3; } .foot__info { grid-column: 3 / 7; } .foot__links { grid-column: 1 / -1; }
}

/* ---------- Teléfono ---------- */
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-head .grid { grid-template-columns: minmax(0, 1fr) 64px 104px; }
  .brand { grid-column: 1 / 2; grid-row: 1; }
  .site-head .lang { grid-column: 2 / 3; grid-row: 1; }
  .site-head .lang a { min-height: 64px; padding: 0; }
  .menu-btn {
    display: flex; grid-column: 3 / 4; grid-row: 1; align-items: center; justify-content: center; gap: 10px;
    background: var(--bone); border: 0; font: inherit; font-size: .82rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; cursor: pointer; min-height: 64px;
  }
  .menu-btn[aria-expanded="true"] { background: var(--orange); }
  .nav { display: none; }
  .nav.is-open { display: contents; }
  .nav a { grid-column: 1 / -1; min-height: 56px; font-size: .85rem; justify-content: flex-start; padding: 0 16px; }
  .hero__photo, .hero__mail { grid-column: 1 / -1; }
  .hero__photo { min-height: 240px; }
  .svc-cell { grid-column: span 1; min-height: 140px; padding: 16px; }
  .svc-cell--wide, .hero__impianti { grid-column: 1 / -1; }
  .sec-head { grid-template-columns: 1fr; }
  .svc, .svc:nth-of-type(4), .svc:nth-of-type(5) { grid-column: 1 / -1; min-height: 0; }
  .fact, .fact--wide { grid-column: 1 / -1; }
  .client { grid-column: span 1; min-height: 92px; padding: 16px; }
  .client span { font-size: clamp(1rem, 4.6vw, 1.3rem); overflow-wrap: anywhere; }
  .client:has(+ .empresa) { grid-column: 1 / -1; }
  .foot__brand, .foot__info, .foot__links { grid-column: 1 / -1; }
}

@media (max-width: 400px) {
  .svc-cell span { font-size: 0.74rem; letter-spacing: 0.03em; hyphens: auto; }
  h1 { font-size: min(2rem, 8.1vw); }
  h2 { font-size: min(1.7rem, 6.6vw); }
}

/* foco de teclado visible también cuando la celda toma el naranja */
.svc-cell:focus-visible, .svc:focus-within, .mail__link:focus-visible { outline: 4px solid var(--ink); outline-offset: -4px; }

/* ---------- Fotos de obra que van pasando ---------- */
.slides .slide { opacity: 0; transition: opacity 1.2s var(--ease), transform .7s var(--ease); }
.slides .slide.is-on { opacity: 1; }
.slides--cut .slide { transition: none !important; }
.slides__toggle {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  width: 48px; height: 48px; border: 0; padding: 0; cursor: pointer;
  background: var(--ink); color: var(--bone);
  display: grid; place-items: center;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.slides__toggle:hover { color: var(--orange); }
.slides__toggle svg { width: 16px; height: 16px; fill: currentColor; }
.slides__toggle .i-play { display: none; }
.slides__toggle[aria-pressed="true"] .i-play { display: inline; }
.slides__toggle[aria-pressed="true"] .i-pause { display: none; }
.slides__toggle:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }

/* foto dentro de cada servicio */
.svc__photo { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bone-2); margin-inline: calc(var(--pad) * -1); }
.svc__photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.svc:hover .svc__photo img { transform: scale(1.025); }
.svc ul { margin-top: 0; }

/* esquema de obra */
.obra__drawing { display: flex; flex-direction: column; gap: 1rem; }
.obra__drawing img { width: 100%; height: auto; }

/* ---------- Obras e instalaciones ---------- */
.esquema { grid-column: span 6; display: flex; flex-direction: column; gap: 1rem; }
.esquema img { width: 100%; height: auto; margin-top: auto; }
.obras__carrusel { grid-column: 1 / -1; }
.obras__carrusel .photo { height: clamp(300px, 46vw, 760px); }
.slides__bar { position: absolute; left: 0; bottom: 0; z-index: 2; display: flex; align-items: stretch; background: var(--ink); color: var(--bone); }
.slides__bar .slides__toggle { position: static; }
.slides__btn {
  width: 48px; height: 48px; border: 0; padding: 0; cursor: pointer; background: var(--ink); color: var(--bone);
  display: grid; place-items: center; transition: color .2s var(--ease);
}
.slides__btn:hover { color: var(--orange); }
.slides__btn:active, .slides__toggle:active { transform: scale(.94); }
.slides__btn svg { width: 16px; height: 16px; }
.slides__btn:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }
.slides__count { display: flex; align-items: center; padding: 0 16px 0 8px; font-size: .8rem; font-weight: 650; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
@media (max-width: 1080px) {
  .esquema { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .obras__carrusel .photo { height: 72vw; }
}
