/* ─────────────────────────────────────────────────────────────────
   IMMAC — TERRASIL · ESTABILIZACIÓN DE SUELOS (inicio, entre Mezclas y Por qué)
   Arriba: texto + comparador de fotos reales ("Sin tratar" / "Con Terrasil").
   Abajo: la aplicación en obra en 4 pasos con foto.
   Lógica: js/terrasil.js
───────────────────────────────────────────────────────────────── */
.ts {
  --ts-bg: #F4F6F8;
  --ts-ink: #0E1318;
  --ts-txt: #4A5562;
  --ts-blue: #0A5F9A;
  --ts-lime: #B6CD20;
  --ts-fade: 240px;
  --ts-gutter: clamp(16px, 5vw, 48px);
  --ts-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 15;
  isolation: isolate;
  /* sube sobre el final de Mezclas y aparece con un fundido, sin corte */
  margin-top: calc(-1 * var(--ts-fade));
  padding: calc(var(--ts-fade) + 40px) 0 clamp(72px, 9vw, 120px);
  background: linear-gradient(180deg, rgba(244, 246, 248, 0) 0, var(--ts-bg) var(--ts-fade));
  color: var(--ts-ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-x: clip;
}
/* Halo de luz suave (azul arriba, lima abajo) */
.ts::before {
  content: '';
  position: absolute;
  inset: var(--ts-fade) 0 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55% 40% at 78% 8%, rgba(63, 180, 230, 0.13), transparent 70%),
    radial-gradient(40% 35% at 6% 78%, rgba(182, 205, 32, 0.10), transparent 70%);
  /* se apaga antes del borde para unirse sin línea con "Por qué" */
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
  mask-image: linear-gradient(180deg, #000 70%, transparent);
}
/* "Por qué" ya no se monta sobre Mezclas: ahora va después de Terrasil */
#terrasil + .pq { margin-top: -2px; /* tapa la rendija de medio píxel entre secciones */ padding-top: clamp(40px, 6vw, 72px); background: var(--pq-bg); }

.ts-wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--ts-gutter); }

.ts-k {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ts-blue);
}
.ts-k::before { content: ''; width: 22px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #3FB4E6, var(--ts-lime)); }
.ts-title {
  margin: 16px 0 18px;
  font-size: clamp(34px, 4.6vw, 64px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.ts-title span { color: var(--ts-blue); }
.ts-lead { max-width: 52ch; font-size: 18px; line-height: 1.6; color: var(--ts-txt); }

/* ── Parte 1: texto + corte de suelo ── */
.ts-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(40px, 6vw, 80px); align-items: center; }
.ts-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin: 34px 0 0; padding: 0; }
.ts-list li { padding-top: 14px; border-top: 1px solid rgba(14, 19, 24, 0.1); }
.ts-list b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.ts-list span { display: block; margin-top: 4px; font-size: 14.5px; line-height: 1.5; color: var(--ts-txt); }
.ts-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  padding: 16px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--ts-ink);
  text-decoration: none;
  box-shadow: 0 14px 30px -16px rgba(10, 40, 70, 0.6);
  transition: background 0.3s ease, transform 0.4s var(--ts-ease);
}
.ts-cta svg { transition: transform 0.4s var(--ts-ease); }
@media (hover: hover) and (pointer: fine) {
  .ts-cta:hover { background: var(--ts-blue); }
  .ts-cta:hover svg { transform: translateX(3px); }
}
.ts-cta:active { transform: scale(0.98); }

/* Comparador antes / después con fotos reales: se arrastra la línea */
.ts-cmp {
  --pos: 50%;
  position: relative;
  margin: 0;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 1226 / 900;
  border-radius: 28px;
  background: #2A2520;
  box-shadow: 0 0 0 1px rgba(14, 19, 24, 0.06), 0 40px 80px -46px rgba(10, 40, 70, 0.55);
  touch-action: pan-y;
  user-select: none;
}
.ts-cmp__img { position: absolute; inset: 0; }
.ts-cmp__img img { -webkit-user-drag: none; user-drag: none; pointer-events: none; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.ts-cmp__img--before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ts-cmp::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(5, 12, 21, 0.35), rgba(5, 12, 21, 0) 22%, rgba(5, 12, 21, 0) 58%, rgba(5, 12, 21, 0.78)); }
.ts-cmp__tag {
  position: absolute;
  top: 18px;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(14, 18, 24, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: opacity 0.3s ease;
}
.ts-cmp__tag--l { left: 18px; }
.ts-cmp__tag--r { right: 18px; color: #0E1318; background: rgba(182, 205, 32, 0.92); box-shadow: none; }
.ts-cmp__line { position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 2; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); pointer-events: none; }
.ts-cmp__line i { position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; display: grid; place-items: center; color: #0E1318; background: #fff; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.5); transition: transform 0.3s var(--ts-ease); }
.ts-cmp.is-drag .ts-cmp__line i { transform: scale(1.1); }
/* el arrastre lo maneja js/terrasil.js; el control de rango queda para el teclado y lectores de pantalla */
.ts-cmp { cursor: ew-resize; }
.ts-cmp__range { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.ts-cmp:focus-within .ts-cmp__line i { box-shadow: 0 0 0 3px var(--ts-blue), 0 10px 24px -8px rgba(0, 0, 0, 0.5); }
.ts-cmp__cap { position: absolute; left: 20px; right: 20px; bottom: 34px; z-index: 2; max-width: 440px; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.92); pointer-events: none; }
.ts-cmp__cap b { display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ts-lime); }
.ts-cmp__credit { position: absolute; right: 14px; bottom: 10px; z-index: 4; font-size: 10.5px; color: rgba(255, 255, 255, 0.75); }
.ts-cmp__credit a { color: inherit; }

/* ── Parte 2: aplicación en obra ── */
.ts-steps-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: end; margin: clamp(80px, 10vw, 128px) 0 36px; }
.ts-steps-head h3 { font-size: clamp(26px, 2.8vw, 38px); font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; margin-top: 14px; }
.ts-steps-head p { font-size: 16px; line-height: 1.6; color: var(--ts-txt); max-width: 50ch; justify-self: end; }
.ts-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; counter-reset: ts; }
.ts-step {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(14, 19, 24, 0.06), 0 30px 60px -44px rgba(10, 40, 70, 0.45);
  transition: transform 0.5s var(--ts-ease), box-shadow 0.5s var(--ts-ease);
}
.ts-step__im { aspect-ratio: 4 / 3; overflow: hidden; background: #E3E8EE; }
.ts-step__im img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ts-ease); }
.ts-step__bd { padding: 18px 20px 22px; }
.ts-step__n { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; color: var(--ts-blue); }
.ts-step h4 { margin: 6px 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.ts-step p { font-size: 14px; line-height: 1.5; color: var(--ts-txt); }
@media (hover: hover) and (pointer: fine) {
  .ts-step:hover { transform: translateY(-5px); box-shadow: 0 0 0 1px rgba(14, 19, 24, 0.06), 0 40px 70px -40px rgba(10, 40, 70, 0.5); }
  .ts-step:hover img { transform: scale(1.06); }
}
.ts-uses { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 32px 0 0; padding: 0; }
.ts-uses li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; color: #22303D; }
.ts-uses li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ts-lime); box-shadow: 0 0 0 4px rgba(182, 205, 32, 0.2); }

/* Entrada suave al aparecer */
.ts [data-ts-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ts-ease), transform 0.9s var(--ts-ease); transition-delay: var(--d, 0s); }
.ts [data-ts-reveal].is-in { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .ts-top, .ts-steps-head { grid-template-columns: 1fr; }
  .ts-steps-head { gap: 14px; }
  .ts-steps-head p { justify-self: start; }
  .ts-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .ts-list { grid-template-columns: 1fr; gap: 14px; }
  .ts-steps { display: flex; gap: 12px; margin: 0 calc(-1 * var(--ts-gutter)); padding: 0 var(--ts-gutter) 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .ts-steps::-webkit-scrollbar { display: none; }
  .ts-step { flex: 0 0 78%; scroll-snap-align: start; }
  .ts-cmp { aspect-ratio: 4 / 4.4; border-radius: 22px; }
  .ts-cmp__tag { top: 12px; }
  .ts-cmp__tag--l { left: 12px; }
  .ts-cmp__tag--r { right: 12px; }
  .ts-cmp__cap { left: 14px; right: 14px; bottom: 30px; font-size: 13px; }
  .ts-cta { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ts-cmp__line i { transition: none; }
  .ts [data-ts-reveal] { opacity: 1; transform: none; transition: none; }
}
