/* ===========================================================================
   IMD Industrial · armazón
   Lo que se repite en todas las páginas: barra de contacto, encabezado, menú
   móvil, pie, y las capas flotantes (modal de cotización, lightbox, aviso).
   =========================================================================== */

/* ------------------------------------------------------- Barra de contacto */
.topbar { background: var(--navy); color: var(--on-navy-soft); font-size: .8125rem; }
.topbar__in { display: flex; align-items: center; gap: 26px; min-height: 42px; }
.topbar__in > * { white-space: nowrap; }
.topbar a { color: var(--on-navy-soft); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; transition: color 160ms ease; }
.topbar a:hover { color: var(--white); }
.topbar svg { width: 15px; height: 15px; flex: none; color: var(--celeste); }
.topbar__end { margin-left: auto; }
.topbar__wa { font-weight: 700; color: var(--white); }

/* ------------------------------------------------------------- Encabezado */
.hdr {
  position: sticky; top: 0; z-index: 40; background: var(--white);
  border-bottom: 1px solid var(--grey-2); transition: box-shadow 220ms ease;
}
.hdr.is-stuck { box-shadow: var(--shadow-1); }
.hdr__in { display: flex; align-items: center; gap: 28px; min-height: 94px; }
.hdr__logo { flex: none; }
.hdr__logo img { height: 58px; width: auto; }   /* logo más grande (pedido del cliente) */
.hdr__nav { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.hdr__link {
  position: relative; display: inline-flex; align-items: center; height: 44px; padding: 0 14px;
  font-weight: 600; font-size: 1rem; color: var(--navy); text-decoration: none;
  border-radius: var(--radius-sm); transition: color 160ms ease;
}
.hdr__link::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px;
  background: var(--blue); transform: scaleX(0); transform-origin: left;
  transition: transform 240ms var(--ease-out);
}
.hdr__link:hover { color: var(--blue); }
.hdr__link:hover::after, .hdr__link[aria-current="page"]::after { transform: scaleX(1); }
.hdr__link[aria-current="page"] { color: var(--blue); }
/* Botón "Productos" que abre el mega menú */
.hdr__mega { border: 0; background: none; cursor: pointer; gap: 4px; font-family: inherit; }
.hdr__mega svg { width: 16px; height: 16px; transition: transform 200ms var(--ease-out); }
.hdr__mega[aria-expanded="true"] { color: var(--blue); }
.hdr__mega[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ------------------------------------------------ Mega menú de productos */
.mega {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 45;
  background: var(--white); border-top: 1px solid var(--grey-2); box-shadow: var(--shadow-2);
  max-height: calc(100vh - var(--chrome)); overflow-y: auto; overscroll-behavior: contain;
}
.mega__in { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 340px; padding-inline: 0; }
.mega__cats { list-style: none; margin: 0; padding: 12px 0; background: var(--navy); }
.mega__cat, .mega__all {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) 16px; gap: 12px; align-items: center;
  width: 100%; padding: 14px 20px; border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--on-navy-soft); font: inherit; font-size: .9375rem; font-weight: 600; text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}
.mega__ico svg, .mega__all svg { width: 24px; height: 24px; color: var(--celeste); }
.mega__cat > svg { width: 16px; height: 16px; opacity: .6; }
.mega__cat[aria-selected="true"], .mega__cat:hover { background: var(--blue); color: var(--white); }
.mega__cat[aria-selected="true"] .mega__ico svg { color: var(--white); }
.mega__all { grid-template-columns: 26px minmax(0, 1fr); margin-top: 8px; border-top: 1px solid rgba(255, 255, 255, .14); color: var(--white); }
.mega__all:hover { background: rgba(255, 255, 255, .08); }
.mega__all small, .mega__head small { font-weight: 500; opacity: .7; }
.mega__panel { padding: 24px 32px 32px; }
.mega__head { display: inline-flex; align-items: center; gap: 8px; font-size: 1.125rem; font-weight: 800; color: var(--navy); text-decoration: none; }
.mega__head svg { width: 18px; height: 18px; color: var(--blue); }
.mega__head:hover { color: var(--blue); }
.mega__cols { margin-top: 18px; columns: 3 220px; column-gap: 32px; }
.mega__col { break-inside: avoid; margin-bottom: 22px; }
.mega__sub { display: block; font-weight: 700; color: var(--blue); text-decoration: none; font-size: .9375rem; margin-bottom: 8px; }
.mega__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mega__col li a { display: block; padding: 4px 0; color: var(--ink-soft); text-decoration: none; font-size: .875rem; }
.mega__sub:hover, .mega__col li a:hover { color: var(--blue); text-decoration: underline; }

.hdr__tools { display: flex; align-items: center; gap: 6px; flex: none; }
.hdr__cta { margin-left: 6px; }
.hdr__burger { display: none; }

.iconbtn {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--navy);
  display: grid; place-items: center; cursor: pointer; text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn:hover { background: var(--grey); color: var(--blue); }
.iconbtn:active { transform: scale(.94); }

/* ------------------------------------------------------------- Menú móvil */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(10, 46, 86, .55); transition: opacity 280ms var(--ease-out); }
.scrim[hidden] { display: block !important; opacity: 0; pointer-events: none; visibility: hidden; }

.mnav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 90; width: min(360px, 88vw);
  background: var(--white); color: var(--navy); display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 28px;
  box-shadow: var(--shadow-2); transition: transform 380ms var(--ease-drawer), visibility 0s;
}
.mnav[hidden] { display: flex !important; transform: translateX(-100%); visibility: hidden; transition: transform 280ms var(--ease-drawer), visibility 0s 280ms; }
.mnav__head { display: flex; justify-content: space-between; align-items: center; }
.mnav__head img { height: 44px; width: auto; }
.mnav__links { display: grid; margin-top: 26px; }
.mnav__links > a { padding: 14px 0; font-size: 1.1875rem; font-weight: 700; text-decoration: none; color: var(--navy); border-bottom: 1px solid var(--grey-2); }
.mnav__links > a[aria-current="page"] { color: var(--blue); }
.mnav__sub { padding: 6px 0 14px; border-bottom: 1px solid var(--grey-2); display: grid; }
.mnav__sub a { padding: 9px 0 9px 14px; font-size: .9375rem; font-weight: 500; color: var(--ink-soft); text-decoration: none; border-left: 2px solid var(--grey-2); }
.mnav__sub a:hover { color: var(--blue); border-left-color: var(--blue); }
.mnav__foot { margin-top: auto; display: grid; gap: 8px; color: var(--ink-soft); font-size: .9375rem; padding-top: 24px; }
.mnav__foot a { color: var(--ink-soft); }

/* ------------------------------------------------- Modal (panel) de cotización */
.modal {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90; width: min(520px, 100vw);
  background: var(--white); box-shadow: var(--shadow-2); display: flex; flex-direction: column;
  transition: transform 420ms var(--ease-drawer), visibility 0s;
}
.modal[hidden] { display: flex !important; transform: translateX(100%); visibility: hidden; transition: transform 300ms var(--ease-drawer), visibility 0s 300ms; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 16px 18px 28px; background: var(--grey); border-bottom: 1px solid var(--grey-2); }
.modal__head h2 { font-size: 1.1875rem; font-weight: 700; color: var(--navy); }
.modal__body { flex: 1; overflow: auto; padding: 24px 28px 32px; overscroll-behavior: contain; }
.modal__ctx { background: var(--blue-soft); border-radius: var(--radius-sm); padding: 14px 16px; font-size: .9375rem; color: var(--navy); margin-bottom: 20px; }
.modal__ctx b { display: block; font-weight: 700; }
.modal__ctx small { color: var(--ink-soft); }

.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form__full { grid-column: 1 / -1; }
.form .error:empty { display: none; }
.form textarea.input { resize: vertical; min-height: 96px; }
.form__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.form__actions .btn { padding: 0 .8em; }
.form__actions--one { grid-template-columns: 1fr; }
.form__legal { margin-top: 14px; font-size: .8125rem; color: var(--ink-soft); line-height: 1.5; }
.form .hint { font-size: .8125rem; color: var(--ink-soft); }
.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.choice legend { font-weight: 600; font-size: .9375rem; color: var(--navy); margin-bottom: 8px; padding: 0; }
.choice label, .check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .9375rem; color: var(--navy); cursor: pointer; }
.choice input, .check input { width: 20px; height: 20px; accent-color: var(--blue); }

/* Redes sociales */
.social { list-style: none; margin: 20px 0 0; padding: 0; display: flex; gap: 8px; }
.social a { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: var(--white); }
.social a:hover { background: var(--blue); text-decoration: none; }
.social svg { width: 20px; height: 20px; }

.btn.is-loading { position: relative; pointer-events: none; }
.btn.is-loading .btn__label { opacity: 0; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #FFF;
  animation: spin 620ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.done { padding: 40px 0; display: grid; gap: 14px; justify-items: start; }
.done svg { width: 56px; height: 56px; }
.done p { color: var(--ink-soft); }

/* ---------------------------------------------------------------- Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(6, 20, 40, .92); display: grid; place-items: center; padding: 24px; transition: opacity 240ms var(--ease-out); }
.lightbox[hidden] { display: grid !important; opacity: 0; pointer-events: none; visibility: hidden; }
.lightbox img { max-width: min(1100px, 92vw); max-height: 84vh; width: auto; border-radius: var(--radius); }
.lightbox__x { position: absolute; top: 20px; right: 20px; color: var(--white); background: rgba(255, 255, 255, .14); }
.lightbox__x:hover { background: rgba(255, 255, 255, .26); color: var(--white); }

/* ------------------------------------------------------------------- Aviso */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 0); background: var(--navy); color: var(--white);
  padding: 14px 18px; border-radius: var(--radius); box-shadow: var(--shadow-2);
  font-weight: 500; max-width: min(520px, calc(100vw - 32px));
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out);
}
.toast[hidden] { display: block !important; opacity: 0; transform: translate(-50%, 16px); pointer-events: none; visibility: hidden; }

/* -------------------------------------------------------------------- Pie */
.foot { background: var(--navy); color: var(--on-navy-soft); padding-block: clamp(48px, 6vw, 76px) 28px; }
.foot__top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: clamp(32px, 4vw, 64px); }
.foot__brand img { width: 260px; height: auto; max-width: 100%; }   /* logo oficial (blanco, con lema) */
.foot__brand p { margin-top: 18px; max-width: 36ch; line-height: 1.6; font-size: .9375rem; }
.foot__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot h3 { color: var(--white); font-size: .9375rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 16px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .9375rem; }
.foot a { color: var(--on-navy-soft); text-decoration: none; transition: color 150ms ease; }
.foot a:hover { color: var(--white); text-decoration: underline; }
.foot__bottom { margin-top: clamp(36px, 4vw, 56px); padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .8438rem; }

/* ------------------------------------------------------------- Responsive */
/* La barra de contacto completa solo entra en pantallas anchas: se ocultan
   primero el horario y luego la dirección (siguen en el pie y en Contacto);
   como respaldo, la barra se desplaza en vez de ensanchar la página. */
@media (max-width: 1440px) {
  .topbar__in { overflow-x: auto; scrollbar-width: none; }
  .topbar__in::-webkit-scrollbar { display: none; }
  .topbar__end { display: none; }
  .topbar__wa { margin-left: auto; }
}
@media (max-width: 1280px) {
  .hdr__in { gap: 16px; }
  .hdr__link { padding: 0 10px; }
  .hdr__tools .iconbtn { display: none; }     /* correo y WhatsApp siguen en la barra superior */
}
@media (max-width: 1180px) {
  .topbar__addr { display: none; }
}
@media (max-width: 1024px) {
  .hdr__nav, .mega { display: none !important; }
  .hdr__burger { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--navy); cursor: pointer; margin-left: -8px; }
  .hdr__burger svg { width: 26px; height: 26px; }
  .hdr__in { min-height: 76px; gap: 12px; }
  .hdr__logo { margin-right: auto; }
  .hdr__logo img { height: 46px; }
  .foot__top { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar__in { gap: 14px; }
  .hdr__cta { display: none; }
  .form__grid, .form__actions { grid-template-columns: 1fr; }
  .foot__cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) { .foot__cols { grid-template-columns: 1fr; } }

/* ----------------------------------------- Lista de cotización (carrito) */
.cartbtn { position: relative; }
.cartbtn__n {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--blue); color: var(--white);
  font-size: .6875rem; font-weight: 700; line-height: 18px; text-align: center;
}
.cartbtn__n[hidden] { display: none; }
.hdr__tools .cartbtn { display: grid !important; }   /* siempre visible, también en pantallas chicas */

.cart { display: flex; flex-direction: column; }
.cart__empty { color: var(--ink-soft); line-height: 1.6; padding: 24px 4px; }
.cart__list { display: grid; gap: 12px; }
.citem {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: start;
  padding: 14px 14px 16px; border: 1px solid var(--grey-2); border-radius: var(--radius); background: var(--white);
}
.citem__t b { display: block; font-size: .9375rem; line-height: 1.35; color: var(--navy); }
.citem__t small { color: var(--ink-soft); }
.citem__rm { width: 36px; height: 36px; margin: -6px -6px 0 0; }
.citem__rm svg { width: 18px; height: 18px; }
.citem__q { grid-column: 1 / -1; display: grid; gap: 4px; font-size: .8125rem; font-weight: 600; color: var(--navy); }
.cart__foot { padding: 16px 28px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--grey-2); background: var(--white); display: grid; gap: 12px; }
.cart__aux { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .9375rem; }
.cart__clear { border: 0; background: none; padding: 8px 0; color: var(--danger); font: inherit; font-weight: 600; cursor: pointer; }
.cart__clear[hidden] { display: none; }

/* Formulario: trampa para bots (invisible para personas), consentimiento y envío */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check--top { align-items: flex-start; padding-block: 6px; line-height: 1.4; }
.check--top input { margin-top: 2px; flex: none; }
.form__fail { margin-top: 12px; font-weight: 600; }
.qok { display: grid; gap: 14px; justify-items: start; padding: 8px 0 4px; outline: none; }
.qok[hidden] { display: none; }
.qok__ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--wa); color: var(--wa-ink); }
.qok__ico svg { width: 30px; height: 30px; }
.qok h3 { font-size: 1.375rem; color: var(--navy); }
.qok__code { font-size: 1.125rem; color: var(--navy); }
.qok__code b { letter-spacing: .04em; background: var(--blue-soft); padding: 4px 10px; border-radius: var(--radius-sm); }
.qok .btn { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .modal[hidden], .mnav[hidden], .scrim[hidden], .lightbox[hidden], .toast[hidden] { display: none !important; }
}
