/* IMAC · Un solo motivo: la barra inclinada del logotipo.
   Paleta tomada del logotipo (Galería\IMAC Logo.jpg): rojo = calor, gris acero y gris claro = confort. */
:root {
  --rojo: #D93830;
  --rojo-hondo: #B42A23;
  --acero: #6C6D71;
  --niebla: #D0D1D3;
  --tinta: #0A0A0A;
  --tinta-2: #2B2B2D;
  --papel: #F4F4F2;
  --papel-2: #E8E8E5;
  --blanco: #FFFFFF;

  --f-titulo: "Archivo", "Arial Black", sans-serif;
  --f-texto: "Inter", system-ui, sans-serif;

  /* Escala: cinco tamaños */
  --s-display: clamp(64px, 6.6vw, 112px);
  --s-h2: clamp(40px, 4.2vw, 68px);
  --s-h3: 19px;
  --s-body: 17px;

  --m: clamp(16px, 3vw, 48px);        /* margen exterior único */
  --gap-section: clamp(120px, 14vw, 200px);
  --slant: -22deg;                    /* ángulo de las barras del logotipo */
  --slant-photo: -9deg;               /* las fotos se inclinan menos para que se lean completas */
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 var(--s-body)/1.55 var(--f-texto);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, .step-title {
  font-family: var(--f-titulo);
  font-weight: 850;
  font-stretch: 106%;
  letter-spacing: -0.035em;
  line-height: .95;
  text-wrap: balance;
}
h3 { font: 700 var(--s-h3)/1.25 var(--f-texto); letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--rojo); outline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--tinta); color: var(--blanco); padding: 10px 14px; }
.skip:focus { left: 8px; }

/* Botón con la forma de la barra del logotipo */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 0 38px;
  font: 600 17px/1 var(--f-texto);
  text-decoration: none; border: 0; cursor: pointer;
  transition: transform .25s var(--ease), background-color .25s;
}
.btn-slant { clip-path: polygon(22px 0, 100% 0, calc(100% - 22px) 100%, 0 100%); }
.btn-red { background: var(--rojo); color: var(--blanco); }
.btn-red:hover { background: var(--rojo-hondo); }
.btn-ink { background: var(--tinta); color: var(--blanco); }
.btn-ink:hover { background: var(--tinta-2); }
.btn:hover { transform: translateX(4px); }
.btn:active { transform: translateX(2px) scale(.98); }
.btn-small { min-height: 44px; padding: 0 30px; font-size: 15px; }

/* Encabezado: logotipo, tres enlaces y una acción */
.top {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: 36px;
  height: 76px; padding: 0 var(--m);
  background: var(--papel);
  transition: background-color .3s;
}
.brand img { width: 164px; }
.nav { display: flex; gap: 30px; margin-left: auto; }
.nav a { font-size: 15px; font-weight: 500; text-decoration: none; position: relative; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 3px;
  background: var(--rojo); transform: scaleX(0) skewX(var(--slant)); transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav a:hover::after { transform: scaleX(1) skewX(var(--slant)); }
.top-cta { min-height: 46px; padding: 0 30px; font-size: 15px; }

/* ---------- Portada ---------- */
.hero { position: relative; height: 200vh; }
.hero-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--papel); }

/* La barra del logotipo a escala gigante: entra por la derecha y la cortan los bordes de la pantalla */
.motif {
  position: absolute; top: -12vh; left: 34vw;
  width: 97vw; height: 124vh;
  background: var(--motif, var(--rojo));
  transform: skewX(var(--slant)); transform-origin: 0 100%;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

.hero-copy {
  position: absolute; z-index: 3;
  left: var(--m); top: 50%;
  width: min(38vw, 600px);
  transform: translateY(-50%);
}
.hero-copy h1 { font-size: var(--s-display); margin-bottom: 36px; }
.step-title { font-size: var(--s-display); margin-bottom: 32px; }
.lede { font-size: 19px; line-height: 1.5; max-width: 30em; margin-bottom: 36px; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; }
.tel { font-weight: 600; font-size: 17px; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.tel:hover { color: var(--rojo); }
.hero-step { display: none; }
.hero-step .lede:last-child { margin-bottom: 0; }

/* ---------- Servicios ---------- */
.services { padding: var(--gap-section) var(--m) 0; }
.services h2 { font-size: var(--s-h2); margin-bottom: 48px; }
.service-list {
  list-style: none; margin: 72px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px var(--m);
}
.service-list li { position: relative; padding-left: 34px; }
/* Viñeta: la barra del logotipo a tamaño de texto */
.service-list li::before {
  content: ""; position: absolute; left: 4px; top: 3px;
  width: 12px; height: 22px; background: var(--rojo); transform: skewX(var(--slant));
}
.service-list h3 { margin-bottom: 8px; }
.service-list p { max-width: 30em; }

/* ---------- Trabajos ---------- */
.work { padding: var(--gap-section) var(--m) 0; }
.work-head { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 20px; align-items: end; margin-bottom: 56px; }
.work-head h2 { grid-column: 1 / 7; font-size: var(--s-h2); }
.work-head p { grid-column: 8 / 13; font-size: 19px; }
/* Tres filas; en cada una las fotos miden lo mismo de alto */
.work-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 48px 20px; }
/* La inclinación saca las esquinas de las fotos; este margen interior las regresa dentro de los márgenes de la página */
.work-grid { padding-inline: clamp(24px, 2.7vw, 43px); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s8 { grid-column: span 8; }
.tile { margin: 0; min-width: 0; }
.frame { overflow: hidden; transform: skewX(var(--slant-photo)); }
.row-a .frame { height: clamp(300px, 34vw, 540px); }
.row-b .frame { height: clamp(280px, 30vw, 480px); }
.row-c .frame { height: clamp(240px, 24vw, 400px); }
.frame img {
  width: 100%; height: 100%; object-fit: cover;
  transform: skewX(calc(var(--slant-photo) * -1)) scale(1.2);
  transition: transform .9s var(--ease);
}
.tile:hover .frame img { transform: skewX(calc(var(--slant-photo) * -1)) scale(1.27); }
.tile figcaption {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 14px; font-size: 15px;
}
.tile figcaption span:last-child { color: var(--acero); white-space: nowrap; }
/* ---------- Proceso: la foto del técnico de IMAC es el fondo de la sección ---------- */
.process { margin-top: var(--gap-section); background: var(--blanco); }
.process-photo { position: relative; overflow: hidden; }
.process-photo img { width: 100%; aspect-ratio: 1776 / 652; min-height: 520px; object-fit: cover; object-position: 50% 30%; }
/* El encabezado se apoya en la pared blanca de la foto, a la izquierda del técnico */
.process-head { position: absolute; left: var(--m); top: 18%; width: min(30%, 420px); }
.process-head h2 { font-size: var(--s-h2); margin-bottom: 20px; }
.process-body { padding: 96px var(--m) 140px; }
.process-head p, .lede { font-size: 19px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.steps h3 { margin-bottom: 8px; }
.steps p { max-width: 24em; }

/* ---------- Calculadora ---------- */
.calc {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 20px;
  min-height: 92svh; padding: 0 var(--m);
  background: var(--papel-2);
}
.calc-photo { grid-column: 1 / 8; position: relative; min-height: 92svh; }
/* Campo de color con la forma del motivo: la foto se abre encima */
.calc-photo::before {
  content: "; position: absolute; left: calc(var(--m) * -1 - 40px); bottom: -14%;
  width: 118%; height: 128%; background: var(--niebla);
  clip-path: polygon(0 0, 100% 0, calc(100% - 15%) 100%, 0 100%);
}
.calc-photo img {
  position: absolute; left: calc(var(--m) * -1 - 40px); bottom: -14%;
  width: 118%; height: 128%; object-fit: cover; object-position: 50% 40%;
  clip-path: polygon(0 0, 100% 0, calc(100% - 15%) 100%, 0 100%);
}
.calc-box { grid-column: 8 / 13; align-self: center; padding: 96px 0; }
.calc-box h2 { font-size: var(--s-h2); margin-bottom: 20px; }
.calc-box > p { margin-bottom: 32px; }
#calc-wa { margin-top: 32px; }
.field-label { display: block; font-weight: 600; margin-bottom: 12px; }
.field-label output { font-weight: 700; }
fieldset { border: 0; margin: 28px 0 0; padding: 0; min-width: 0; }
input[type="range"] { width: 100%; accent-color: var(--rojo); height: 32px; margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  background: var(--blanco); font-size: 15px; font-weight: 500;
  transition: background-color .2s, color .2s;
}
.seg label:hover span { background: var(--niebla); }
.seg input:checked + span { background: var(--tinta); color: var(--blanco); }
.seg input:focus-visible + span { outline: 3px solid var(--rojo); outline-offset: 2px; }
.result { margin: 0 0 8px; }
.result-big, .field-label output { font-variant-numeric: tabular-nums; }
.result-big { font-family: var(--f-titulo); font-weight: 850; font-stretch: 106%; font-size: var(--s-h2); letter-spacing: -0.03em; line-height: 1; }
.result-small { margin-top: 10px; }

/* ---------- Orden de servicio (cupón) ---------- */
.order { padding: var(--gap-section) var(--m) 140px; }
.ticket {
  position: relative;
  display: grid; grid-template-columns: 46fr 54fr;
  width: min(100%, 1180px); margin: 0 auto; min-height: 480px;
  background: var(--tinta); color: var(--blanco);
}
/* Muescas del cupón, del color del fondo */
.ticket::before, .ticket::after {
  content: ""; position: absolute; left: 46%; width: 30px; height: 30px; margin-left: -15px;
  background: var(--papel); border-radius: 50%;
}
.ticket::before { top: -15px; }
.ticket::after { bottom: -15px; }
.ticket-left { padding: 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.ticket-left h2 { font-size: var(--s-h2); }
.ticket-left p { max-width: 24em; color: var(--niebla); }
.ticket-right {
  padding: 52px; display: flex; flex-direction: column; gap: 10px; justify-content: center;
  border-left: 5px dotted var(--papel);   /* perforación */
}
.ticket input, .ticket select {
  width: 100%; height: 54px; padding: 0 18px; border: 0; border-radius: 0;
  background: var(--tinta-2); color: var(--blanco);
  font: 400 17px/1 var(--f-texto);
  appearance: none;
}
.ticket select {
  color: var(--niebla); padding-right: 48px; cursor: pointer;
  background: var(--tinta-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23D0D1D3' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 18px center;
}
.ticket select:valid { color: var(--blanco); }
.ticket input::placeholder { color: #B7B8BB; }
.ticket input:focus-visible, .ticket select:focus-visible { outline: 3px solid var(--rojo); outline-offset: 0; }
.submit {
  height: 58px; margin-top: 8px; border: 0; cursor: pointer;
  background: var(--rojo); color: var(--blanco); font: 600 17px/1 var(--f-texto);
  transition: background-color .2s, transform .2s var(--ease);
}
.submit:hover { background: var(--rojo-hondo); }
.submit:active { transform: scale(.99); }

/* ---------- Pie: el motivo construido en grande ---------- */
.foot { padding: 0 var(--m) 40px; }
.foot-mark { display: block; width: 100%; height: 30svh; margin-bottom: 72px; }
.foot-cols { display: grid; grid-template-columns: repeat(12, 1fr); gap: 32px 20px; margin-bottom: 64px; }
.foot-links { grid-column: 1 / 8; display: grid; grid-template-columns: repeat(2, max-content); gap: 12px 64px; }
.foot-links a, .foot-contact a { text-decoration: none; font-size: 17px; }
.foot-links a:hover, .foot-contact a:hover { color: var(--rojo); }
.foot-contact { grid-column: 9 / 13; display: flex; flex-direction: column; gap: 12px; }
.foot-last { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--acero); font-size: 15px; }

/* WhatsApp flotante */
.wa {
  position: fixed; right: var(--m); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  display: grid; place-items: center; width: 58px; height: 58px;
  /* Los colores los pone ui.js según el fondo que tiene debajo, siempre con la paleta de las barras */
  background: var(--wa-bg, var(--rojo)); color: var(--wa-fg, var(--blanco));
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  width: 70px;
  transition: background-color .35s, color .35s, transform .25s var(--ease);
}
.wa:hover { background: var(--tinta); color: var(--blanco); transform: translateY(-3px); }

/* Entradas por sección (solo con movimiento permitido; sin JS todo se ve) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0ms); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .shutter { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); transform: scale(1.12); transition: clip-path 1.1s var(--ease), transform 1.4s var(--ease); }
  .js .shutter.in { clip-path: polygon(0 0, 100% 0, calc(100% - 15%) 100%, 0 100%); transform: none; }
}

/* ---------- Tableta ---------- */
@media (max-width: 1000px) {
  .nav { display: none; }
  .top-cta { margin-left: auto; }
  .service-list { grid-template-columns: repeat(2, 1fr); }
  .calc { grid-template-columns: 1fr; }
  .calc-box { grid-column: 1; grid-row: 1; padding: 96px 0 40px; }
  .calc-photo { grid-column: 1; min-height: 60svh; }
  .calc-photo img, .calc-photo::before { left: auto; right: -10%; bottom: -10%; width: 110%; height: 118%; }
  .process-photo img { aspect-ratio: 16 / 9; min-height: 0; object-position: 50% 40%; }
  .process-head { position: static; width: auto; padding: 56px var(--m) 0; }
  .process-head p { max-width: 34em; }
  .process-body { padding-top: 56px; }

  /* Trabajos: dos columnas; las fotos anchas ocupan toda la fila */
  .work-head h2 { grid-column: 1 / 13; margin-bottom: 16px; }
  .work-head p { grid-column: 1 / 11; }
  .work-grid { grid-template-columns: 1fr 1fr; gap: 36px 14px; padding-inline: 4.2vw; }
  .s3, .s4 { grid-column: span 1; }
  .s5, .s8 { grid-column: 1 / -1; }
  .row-a .frame, .row-b .frame, .row-c .frame { height: clamp(220px, 46vw, 420px); }
  .s5 .frame, .s8 .frame { height: clamp(240px, 52vw, 460px); }
  .tile figcaption { flex-direction: column; gap: 2px; }

  /* Portada en pantallas angostas: texto arriba, la barra gigante abajo */
  .motif { left: -14vw; top: 60svh; width: 128vw; height: 60svh; transform-origin: 50% 0; }
  .hero-copy { top: calc(76px + 5svh); transform: none; width: auto; max-width: 640px; right: var(--m); }
}

/* ---------- Celular ---------- */
@media (max-width: 700px) {
  :root { --s-display: 11.5vw; --s-h2: 10vw; }
  .top { height: 64px; }
  .brand img { width: 132px; }
  .top-cta { min-height: 42px; padding: 0 24px; font-size: 15px; }

  .hero-copy h1, .step-title { margin-bottom: 18px; }
  .lede { margin-bottom: 22px; }
  .hero-actions { gap: 20px; }


  .service-list { grid-template-columns: 1fr; gap: 36px; margin-top: 64px; }


  .process-photo img { aspect-ratio: 4 / 3; object-position: 50% 30%; }
  .process-body { padding: 48px var(--m) 96px; }
  .steps { grid-template-columns: 1fr; gap: 28px; }

  .ticket { grid-template-columns: 1fr; min-height: 0; }
  .ticket::before, .ticket::after { left: auto; top: 33%; margin: 0; }
  .ticket::before { left: -15px; }
  .ticket::after { right: -15px; bottom: auto; }
  .ticket-left { padding: 36px 24px 32px; }
  .ticket-right { padding: 32px 24px 28px; border-left: 0; border-top: 5px dotted var(--papel); }

  .foot-mark { height: 22svh; margin-bottom: 48px; }
  .foot-links { grid-column: 1 / 13; gap: 12px 32px; }
  .foot-contact { grid-column: 1 / 13; }
  .wa { bottom: calc(16px + env(safe-area-inset-bottom)); width: 62px; height: 52px; }
  .foot { padding-bottom: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover, .btn:active, .wa:hover { transform: none; }
  .tile:hover .frame img { transform: skewX(calc(var(--slant-photo) * -1)) scale(1.2); }
}
