/* ==========================================================================
   Sections — in page order
   Hero · Clientes · Nosotros · Servicios · Productos · Alianza · Contacto
   ========================================================================== */

/* ---------- Hero ---------- */

.hero { position: relative; padding-top: calc(env(safe-area-inset-top, 0px) + 120px); overflow: hidden; }

.hero-media { position: absolute; inset: 0 0 auto 0; z-index: 0; height: min(92vw, 820px); overflow: hidden; }
.hero-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.04);   /* hero.js adds the parallax offset to this */
}
.hero-media::after {  /* the video dissolves into the page background */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(var(--bg-rgb), 0) 0%, rgba(var(--bg-rgb), 0) 38%, rgba(var(--bg-rgb), .72) 62%, rgba(var(--bg-rgb), 1) 86%, rgba(var(--bg-rgb), 1) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding-top: clamp(160px, 30vw, 370px);
  padding-bottom: 40px;
  text-align: center;
}
.hero h1 { max-width: 17ch; font-size: clamp(36px, 5.6vw, 76px); font-weight: 300; line-height: 1.02; letter-spacing: -.04em; }
.hero h1 b { font-weight: 900; letter-spacing: -.05em; }
.hero-tagline { font: 800 clamp(15px, 1.4vw, 18px)/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.hero-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }

/* ---------- Clientes (logo marquee) ---------- */

.clients { padding-block: 36px 24px; scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 84px); }
.clients-label { margin-bottom: 22px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }

.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track { display: flex; align-items: center; gap: 64px; width: max-content; animation: marquee 60s linear infinite; }
.marquee-track img { display: block; flex: none; max-width: none; opacity: .78; filter: var(--client-logo-filter); }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }   /* marquee.js duplicates the logos, so -50% loops seamlessly */

@media (max-width: 600px) { .marquee-track { zoom: .75; } }

/* ---------- Nosotros ---------- */

.about { display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: clamp(32px, 5vw, 72px); }

.about-photo { position: relative; aspect-ratio: 4 / 3.4; overflow: hidden; border-radius: var(--r-lg); }
.about-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.about-mark { position: absolute; left: 18px; bottom: 16px; width: 44px; fill: #FFFFFF; filter: drop-shadow(0 1px 8px rgba(0, 0, 0, .4)); }

.about-copy { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.mission-vision { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.mv-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: var(--r-md); background: var(--surface); }
.mv-card h3 { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.mv-card p { font-size: 16px; color: var(--ink); }

.values { display: grid; gap: 22px; margin-top: clamp(48px, 6vw, 80px); padding-top: 28px; border-top: 1px solid var(--line); }
.values-title { padding-top: 4px; font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.values-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.values-grid li { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 0 20px; border-left: 1px solid var(--line); }
.values-grid li:first-child { padding-left: 0; border-left: 0; }
.values-grid p { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.value-name { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.value-name::before {  /* carbide button */
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--carbide);
  box-shadow: 0 0 0 1.5px rgba(104, 42, 3, .55), 0 2px 4px rgba(70, 25, 0, .35);
}

@media (max-width: 1100px) {
  .values-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 28px; }
  .values-grid li:nth-child(3n+1) { padding-left: 0; border-left: 0; }
}
@media (max-width: 900px) {
  .about, .mission-vision { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .values-grid { grid-template-columns: 1fr; row-gap: 0; }
  .values-grid li,
  .values-grid li:nth-child(3n+1) { flex-direction: row; align-items: flex-start; gap: 16px; padding: 16px 0; border-left: 0; border-top: 1px solid var(--line); }
  .values-grid li:first-child { padding-top: 0; border-top: 0; }
  .value-name { flex: 0 0 150px; padding-top: 1px; font-size: 17px; }
}

/* ---------- Servicios (drill-bit dial) ----------
   services.js builds the dial from the .svc-list items and draws the bit face. */

.services .section-head { margin-bottom: 40px; }

.cycle { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px); }
html:not(.js) .cycle { display: none; }          /* without script, the plain list below is shown instead */
.js .svc-list { display: none; }

.svc-list { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.svc-list h3 { font-size: 20px; }
.svc-list p { color: var(--ink-2); }

.dial { position: relative; width: 100%; min-height: 300px; }
.dial-face { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial-arc { transition: stroke-dashoffset .5s var(--ease-out); }
.dial.is-running .dial-arc { transition: none; }
.dial-nodes { position: absolute; inset: 0; }

.node {   /* carbide button, size set by services.js through --n */
  position: absolute;
  width: var(--n, 52px);
  height: var(--n, 52px);
  margin: calc(var(--n, 52px) / -2) 0 0 calc(var(--n, 52px) / -2);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--carbide);
  box-shadow: 0 0 0 3px rgba(104, 42, 3, .62), 0 0 0 4.5px rgba(255, 196, 130, .35), inset 0 -5px 9px rgba(0, 0, 0, .30), inset 0 3px 4px rgba(255, 255, 255, .8), 0 6px 12px rgba(70, 25, 0, .45);
  transition: transform .35s var(--ease-out), box-shadow .35s ease;
}
.node:hover { transform: scale(1.06); }
.node[aria-selected="true"] {
  transform: scale(1.14);
  box-shadow: 0 0 0 3px rgba(104, 42, 3, .62), 0 0 0 6px var(--red), 0 0 22px 4px rgba(225, 8, 30, .45), inset 0 -5px 9px rgba(0, 0, 0, .30), inset 0 3px 4px rgba(255, 255, 255, .8), 0 8px 16px rgba(70, 25, 0, .45);
}

/* AP's service icons, used as masks so they render in white on the button */
.node-icon {
  display: block;
  width: 66%;
  height: 66%;
  margin: auto;
  background: #FFFFFF;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  filter: drop-shadow(0 0 .4px #FFFFFF) drop-shadow(0 1px 1.5px rgba(80, 30, 0, .6));
}
.node-icon--seleccion    { --icon: url("../img/icons/seleccion.png"); }
.node-icon--almacenes    { --icon: url("../img/icons/almacenes.png"); }
.node-icon--capacitacion { --icon: url("../img/icons/capacitacion.png"); }
.node-icon--reparacion   { --icon: url("../img/icons/reparacion.png"); }
.node-icon--rectificado  { --icon: url("../img/icons/rectificado.png"); width: 76%; height: 76%; }

.node-label {   /* position set by services.js on wide screens */
  position: absolute;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: 700 15px/1.25 var(--font);
  color: var(--ink-2);
  transition: color .25s;
}
.node-label:hover,
.node-label.is-active { color: var(--ink); }
.dial.is-compact .node-label { display: none; }

.dial-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--hub, 120px);
  height: var(--hub, 120px);
  padding: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.dial-hub svg { width: 62%; height: auto; fill: var(--red); filter: drop-shadow(0 1px 1px rgba(255, 255, 255, .4)); }

.svc-detail { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); }

.svc-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity .6s ease, transform 1.4s ease;
}
.svc-photo.is-active { opacity: 1; transform: scale(1); }
/* framing per photo: keep the subject above the glass panel */
.svc-photo--capacitacion { object-position: 50% 100%; top: -24%; height: 124%; }
.svc-photo--reparacion   { object-position: 50% 100%; top: -42%; height: 142%; }
.svc-photo--rectificado  { object-position: 78% 100%; top: -38%; height: 138%; }

.svc-panel { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; padding: 22px 22px 16px; border-radius: 22px; }
.svc-panel > * { transition: opacity .25s ease, transform .25s ease; }
.svc-panel.is-swapping > :not(.svc-nav) { opacity: 0; transform: translateY(6px); }
.svc-panel h3 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 800; letter-spacing: -.02em; }
.svc-panel p { min-height: 4.8em; font-size: 16px; color: var(--ink-2); }

.svc-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.svc-count { font-size: 14px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc-arrows { display: flex; gap: 8px; }
.svc-arrows button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass-strong);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s;
}
.svc-arrows button:hover { background: var(--surface); }
.svc-arrows svg { width: 18px; height: 18px; }
.svc-prev svg { transform: scaleX(-1); }

@media (max-width: 900px) {
  .cycle { grid-template-columns: 1fr; }
  .svc-detail { aspect-ratio: auto; padding-top: min(240px, 60vw); }
  .svc-panel { position: relative; left: auto; right: auto; bottom: auto; margin: -40px 12px 12px; }
  .svc-panel p { min-height: 0; }
}

/* ---------- Productos ---------- */

.prod-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 24px 48px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.prod-head .section-head { flex: 1 1 320px; min-width: 0; }
.prod-head .title { max-width: 16ch; }
.prod-head .lead { flex: 0 1 40ch; max-width: 40ch; }

.prod-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 20px; }

.prod {
  --stageH: clamp(260px, 24vw, 320px);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: var(--stageH);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
  transition: border-color .3s ease, box-shadow .3s ease;
}
.prod:hover { border-color: rgba(130, 104, 106, .28); box-shadow: 0 18px 40px -24px rgba(40, 39, 39, .35); }

/* photo shown until (or instead of) the 3D model */
.prod-photo { position: absolute; inset: 0 0 auto 0; width: 100%; height: var(--stageH); object-fit: cover; }
.prod-photo--top { object-position: center 30%; }
.prod.has-3d .prod-photo { visibility: hidden; }

.prod-stage {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--stageH);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(90% 80% at 50% 38%, var(--stage-hi) 0%, var(--stage-lo) 100%);
  opacity: 0;
  touch-action: pan-y;   /* vertical swipes still scroll the page */
  transition: opacity .6s ease;
}
.prod.has-3d .prod-stage { opacity: 1; }
.prod-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.prod.is-grabbing .prod-stage canvas { cursor: grabbing; }

.prod-body { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; padding: 22px 24px 0; }
.prod-body h3 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }

.subfam { display: flex; flex-direction: column; margin: 16px 0 22px; padding: 0; list-style: none; }
.subfam li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; color: var(--ink-2); }
.subfam li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }

.prod-catalog {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 16px 0 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  text-decoration: none;
}
.prod-catalog svg { order: 2; width: 16px; height: 16px; transition: transform .25s ease; }
.prod-catalog:hover svg { transform: translateY(2px); }

@media (max-width: 900px) {
  .prod-grid { grid-template-columns: 1fr; }
  .prod { --stageH: min(300px, 72vw); }
}

/* ---------- Alianza JSI ---------- */

.alliance { position: relative; display: flex; align-items: flex-end; min-height: clamp(380px, 38vw, 520px); overflow: hidden; border-radius: var(--r-lg); }
.alliance > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; }
.alliance-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 520px;
  margin: clamp(14px, 2vw, 24px);
  padding: clamp(22px, 2.6vw, 32px);
  border-radius: 22px;
}
.alliance-card p { font-size: 16px; color: var(--ink-2); }

@media (max-width: 640px) {
  .alliance { flex-direction: column; align-items: stretch; min-height: 0; padding-top: 52vw; }
  .alliance > img { height: 60vw; }
  .alliance-card { max-width: none; margin: -24px 10px 10px; }
}

/* ---------- Contacto ---------- */

.contact { display: grid; grid-template-columns: 1fr 1.05fr; align-items: start; gap: clamp(28px, 5vw, 64px); }
.contact .lead { margin-top: 16px; }

.offices { display: grid; gap: 14px; margin-top: 28px; }
.office { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--r-md); }
.office h3 { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.office address { font-style: normal; color: var(--ink-2); }
.office-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 4px; }
.office-tel { padding: 6px 0; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); text-decoration: none; }
.office-tel:hover { color: var(--red); }
.office-map { padding: 8px 0 6px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; }
.office-map:hover { border-bottom-color: var(--ink); }

.form-card { padding: clamp(22px, 3vw, 36px); border-radius: var(--r-lg); background: var(--surface); }
.form-card form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--ink); }
.field .req { font-style: normal; color: var(--red); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: 500 16px/1.4 var(--font);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input,
.field select { min-height: 50px; }
.field textarea { min-height: 168px; resize: vertical; }
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 42px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382686A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
}
.field :is(input, select, textarea):hover { border-color: var(--muted); }
.field :is(input, select, textarea):focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 8, 30, .16); }
.field [aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 8, 30, .12); }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.form-note { min-height: 1.2em; font-size: 13px; color: var(--ink-2); }
.form-note a { font-weight: 700; color: var(--ink); }
.form-note.is-error { font-weight: 700; color: var(--red); }

@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
