/* =====================================================
   GAMACO Automación — estilos
   Cómo está organizado este archivo:
   1. Variables (colores y medidas) — lo primero que conviene tocar
   2. Base y utilidades
   3. Cabecera / menú
   4. Hero
   5. Secciones (tarjetas, beneficios, pasos, galería, contacto)
   6. Animación de la línea de envasado (SVG)
   7. Pantallas chicas (celular)
   ===================================================== */

/* ---------- 1. VARIABLES ---------- */
:root {
  --ink:    #0e1a22;   /* fondo oscuro / texto principal */
  --ink-2:  #162631;
  --line:   #2a4050;
  --green:  #3fb425;   /* verde de marca (tomado del logo) */
  --blue:   #2f7df6;   /* azul de marca (ajustar al logo real) */
  --paper:  #f4f6f8;
  --white:  #ffffff;
  --muted:  #5d7282;
  --radius: 14px;
  --max:    1120px;    /* ancho máximo del contenido */
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { width: min(var(--max), 100% - 40px); margin-inline: auto; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 800; max-width: 22ch; }
h3 { font-size: 1.2rem; font-weight: 700; }

.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700;
  color: var(--green); margin: 0 0 .9rem;
}
.eyebrow--dark { color: var(--blue); }
.lead { font-size: clamp(1.05rem, 2vw, 1.3rem); color: #c7d5df; max-width: 56ch; }
.sub  { color: var(--muted); max-width: 62ch; font-size: 1.05rem; }
.sec--dark .sub { color: #aebfcb; }

.btn {
  display: inline-block; padding: .9rem 1.5rem; border-radius: 999px;
  background: var(--green); color: #07140a; font-weight: 700; text-decoration: none;
  border: 2px solid var(--green); transition: transform .15s, background .15s;
  cursor: pointer; font-size: 1rem;
}
.btn:hover { transform: translateY(-2px); background: #4cc05c; }
.btn--ghost { background: transparent; color: var(--white); border-color: #4a6678; }
.btn--ghost:hover { background: rgba(255,255,255,.08); }
.btn--small { padding: .5rem 1.1rem; font-size: .92rem; }
.btn--wa { background: #25d366; border-color: #25d366; width: 100%; }

/* ---------- 3. CABECERA ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 26, 34, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__in { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 58px; width: auto; }
.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav a { color: #d5e0e8; text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--white); }
.nav .btn { color: #07140a; }
.burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.burger span { display: block; width: 24px; height: 2px; background: var(--white); margin: 5px 0; transition: .2s; }

/* ---------- 4. HERO ---------- */
.hero {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(47,125,246,.22), transparent 60%),
    radial-gradient(700px 360px at 0% 100%, rgba(63,174,79,.16), transparent 60%),
    var(--ink);
  color: var(--white);
  padding: clamp(40px, 6vw, 72px) 0 0;
  overflow: hidden;
}
.hero h1 { max-width: 14ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.line { width: 100%; height: auto; margin-top: clamp(16px, 3vw, 32px); }
.tag { font: 700 11px "Segoe UI", sans-serif; letter-spacing: .2em; fill: #8fa6b6; }

/* ---------- 5. SECCIONES ---------- */
.sec { padding: clamp(60px, 9vw, 110px) 0; }
.sec--dark  { background: var(--ink); color: var(--white); }
.sec--paper { background: var(--paper); }
.sec h2 + .sub { margin-top: .4rem; }

/* tarjetas de máquinas */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 2.4rem; }
.card {
  background: var(--white); border: 1px solid #e1e8ed; border-radius: var(--radius);
  padding: 1.6rem; display: flex; flex-direction: column; gap: .4rem;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(14,26,34,.12); border-color: var(--blue); }
.card__n { font-weight: 800; color: var(--green); font-size: .9rem; letter-spacing: .1em; }
.card p { color: var(--muted); margin: 0 0 .6rem; flex: 1; }
.card__link { color: var(--blue); font-weight: 700; text-decoration: none; }
.card__link:hover { text-decoration: underline; }

/* beneficios */
.benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 2.4rem; }
.benefit { border-top: 3px solid var(--green); padding-top: 1rem; }
.benefit p { color: #aebfcb; margin: 0; }

/* pasos */
.steps { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; padding: 0; margin: 2.4rem 0 0; }
.steps li { counter-increment: s; position: relative; padding-top: 3.2rem; }
.steps li::before {
  content: counter(s); position: absolute; top: 0; left: 0;
  width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--white); font-weight: 800;
}
.steps li::after { content: ""; position: absolute; top: 1.2rem; left: 2.8rem; right: -18px; height: 2px; background: #d6dee4; }
.steps li:last-child::after { display: none; }
.steps b { display: block; font-size: 1.1rem; margin-bottom: .25rem; }
.steps span { color: var(--muted); font-size: .96rem; }

/* galería (lugares reservados para fotos) */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 2rem 0 1.4rem; }
.vid {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: .25rem;
  aspect-ratio: 4 / 3; padding: 1.2rem; border-radius: var(--radius); text-decoration: none; color: var(--white);
  background: linear-gradient(135deg, var(--ink) 0%, #16303f 100%); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.vid:hover, .vid:focus-visible { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(14,26,34,.25); }
.vid strong { font-size: 1.1rem; }
.vid span { color: #b9c9d4; font-size: .92rem; }
.vid .vid__tag { color: var(--green); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.vid .vid__play {
  position: absolute; top: 1.1rem; right: 1.1rem; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; background: var(--green); color: #fff;
}
.vid:hover .vid__play { background: var(--blue); }
.ph {
  display: grid; place-items: center; text-align: center; padding: 1rem;
  background: repeating-linear-gradient(45deg, #e6ecf0, #e6ecf0 12px, #eef2f5 12px, #eef2f5 24px);
  color: #7d909d; font-weight: 600; border: 2px dashed #c3d0d9;
}

/* contacto */
.contact > * { min-width: 0; }
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 6vw, 72px); align-items: start; }
.info { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .7rem; }
.info b { display: inline-block; min-width: 7.5rem; color: #8fa6b6; font-weight: 600; }
.info a { color: var(--white); }
.form { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; display: grid; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-size: .9rem; color: #c3d2dd; font-weight: 600; }
.form input, .form select {
  font: inherit; padding: .75rem .9rem; border-radius: 10px; border: 1px solid #36505f;
  background: #0e1a22; color: var(--white);
}
.form input:focus, .form select:focus { outline: 2px solid var(--blue); border-color: transparent; }
.form__note { margin: 0; font-size: .88rem; color: #f2b66b; min-height: 1.2em; }

.foot { background: #09131a; color: #8fa6b6; padding: 1.4rem 0; font-size: .9rem; }
.foot__in { display: flex; flex-wrap: wrap; gap: .6rem 2rem; justify-content: space-between; }

.wa-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: #25d366; color: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.3); transition: transform .15s;
}
.wa-float:hover { transform: scale(1.08); }

/* aparición suave al hacer scroll (la clase .in la agrega main.js) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- 6. ANIMACIÓN DE LA LÍNEA ----------
   Idea: 5 bidones recorren la cinta en 10 segundos (uno cada 2 s).
   Cada bidón se llena al pasar por el llenado y se tapa en el tapado.
   Los equipos "pulsan" cada 2 s, sincronizados con el paso de los bidones.
   Para acelerar o frenar todo: cambiar la duración de .can (10s) y las de abajo en proporción.  */
.belt { stroke: #4b6678; stroke-width: 2; stroke-dasharray: 12 13; animation: belt .25s linear infinite; }
@keyframes belt { to { stroke-dashoffset: -25; } }

.can { animation: travel 10s linear infinite; animation-delay: calc(var(--i) * -2s); }
@keyframes travel {
  0%    { transform: translateX(-60px);  opacity: 1; }
  81%   { opacity: 1; }
  82.5% { transform: translateX(765px);  opacity: 0; }   /* lo agarra el paletizador */
  100%  { transform: translateX(940px);  opacity: 0; }
}

.liquid { transform-box: fill-box; transform-origin: bottom; animation: fill 10s linear infinite; animation-delay: calc(var(--i) * -2s); }
@keyframes fill { 0%, 32% { transform: scaleY(0); } 36%, 100% { transform: scaleY(1); } }

.cap { animation: capon 10s linear infinite; animation-delay: calc(var(--i) * -2s); }
@keyframes capon { 0%, 54% { opacity: 0; } 57%, 100% { opacity: 1; } }

.stream { animation: pour 2s linear infinite; transform-box: fill-box; transform-origin: top; }
@keyframes pour { 0%, 52% { opacity: 0; } 55%, 82% { opacity: 1; } 85%, 100% { opacity: 0; } }

.caphead { animation: press 2s ease-in-out infinite; }
@keyframes press { 0%, 62% { transform: translateY(0); } 78% { transform: translateY(16px); } 92%, 100% { transform: translateY(0); } }

.carriage { animation: gantry 2s ease-in-out infinite; }
@keyframes gantry { 0%, 26% { transform: translateX(0); } 50%, 78% { transform: translateX(87px); } 98%, 100% { transform: translateX(0); } }

.rod  { transform-box: fill-box; transform-origin: top; animation: rod 2s ease-in-out infinite; }
@keyframes rod  { 0%, 4% { transform: scaleY(.3); } 8%, 14% { transform: scaleY(1); } 26%, 54% { transform: scaleY(.3); } 60%, 68% { transform: scaleY(1); } 78%, 100% { transform: scaleY(.3); } }
.grip { animation: grip 2s ease-in-out infinite; }
@keyframes grip { 0%, 4% { transform: translateY(-49px); } 8%, 14% { transform: translateY(0); } 26%, 54% { transform: translateY(-49px); } 60%, 68% { transform: translateY(0); } 78%, 100% { transform: translateY(-49px); } }

/* cajas del pallet: aparecen una a una, cada 2 s, y se reinician cada 10 s */
.box { fill: #c99a5b; stroke: #8a6334; stroke-width: 1.5; opacity: 0; animation-duration: 10s; animation-iteration-count: infinite; animation-timing-function: step-end; }
.b0 { animation-name: box0; } .b1 { animation-name: box1; } .b2 { animation-name: box2; } .b3 { animation-name: box3; } .b4 { animation-name: box4; }
@keyframes box0 { 0%, 12% { opacity: 0; } 13%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes box1 { 0%, 32% { opacity: 0; } 33%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes box2 { 0%, 52% { opacity: 0; } 53%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes box3 { 0%, 72% { opacity: 0; } 73%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes box4 { 0%, 92% { opacity: 0; } 93%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }

/* Si la persona pidió "reducir movimiento" en su dispositivo, congelamos todo */
@media (prefers-reduced-motion: reduce) {
  .line *, .reveal { animation-play-state: paused !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- 7. CELULAR / TABLET ---------- */
@media (max-width: 960px) {
  .cards, .benefits { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; gap: 1.4rem; }
  .steps li { padding: 0 0 0 3.4rem; }
  .steps li::after { display: none; }
  .contact { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .burger { display: block; }
  .nav {
    position: absolute; top: 76px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    gap: 0; background: var(--ink); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; transition: max-height .25s;
  }
  .nav.open { max-height: 320px; }
  .nav a { padding: 1rem 20px; border-top: 1px solid var(--line); }
  .nav .btn { margin: 12px 20px; text-align: center; }
  .cards, .benefits, .gallery { grid-template-columns: 1fr; }
  .line { margin-inline: -10px; width: calc(100% + 20px); max-width: none; }
}
