/* Hialsa v3 — estilo corporativo con carrusel (inspirado en plasticosfenix.pe).
   Paleta y contrastes: docs/paleta.md; desviaciones en docs/v3/implementacion.md */

:root {
  --color-primary: #0c4b86;
  --color-secondary: #0e79b6;
  --color-navy: #22274c;
  --color-accent: #0e79b6;

  --color-bg: #ffffff;
  --color-bg-soft: #eaf6fa;
  --color-text: #161211;
  --color-text-muted: #6e6c6d;
  --color-border: #d7e3ec;

  --color-whatsapp: #25d366;
  --color-whatsapp-text: #161211;

  --gradient-brand: linear-gradient(135deg, #0c4b86, #0e79b6);

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --container: 1140px;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(12, 75, 134, 0.12);
  --topbar-h: 40px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
img, svg, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--color-primary); }
a:hover { color: var(--color-secondary); }
ul { list-style: none; padding: 0; }
button, input, textarea { font: inherit; color: inherit; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.15rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--color-primary); color: #fff; padding: 0.6rem 1rem;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 2px; }

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.3rem; border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-secondary); color: #fff; }
.btn-ghost { background: transparent; color: var(--color-primary); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-white { background: #fff; color: var(--color-primary); }
.btn-white:hover { background: var(--color-bg-soft); color: var(--color-primary); }
.btn-wa { background: var(--color-whatsapp); color: var(--color-whatsapp-text); }
.btn-wa:hover { background: #1eb955; color: var(--color-whatsapp-text); }
.btn-lg { padding: 0.9rem 1.7rem; font-size: 1.05rem; }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.88rem; }

/* ---------- topbar + header ---------- */
.topbar {
  background: var(--color-navy); color: #eaf6fa; font-size: 0.82rem;
}
.topbar-inner {
  min-height: var(--topbar-h); display: flex; flex-wrap: wrap; gap: 0.25rem 1rem;
  align-items: center; justify-content: center; text-align: center; padding: 0.35rem 0;
}
.topbar ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.2rem; }
.topbar li { display: inline-flex; align-items: center; gap: 0.4rem; }
.topbar ul:first-child { display: none; } /* dirección: solo en escritorio */
.topbar a { color: #eaf6fa; text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: underline; }

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  min-height: var(--header-h); display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
}
.brand img { height: 48px; width: auto; border-radius: 6px; background: var(--color-text); }
.nav-toggle {
  background: none; border: 0; padding: 0.4rem; cursor: pointer; color: var(--color-primary);
}
.site-nav { display: none; }
.site-nav.is-open {
  display: block; position: absolute; left: 0; right: 0; top: 100%;
  background: var(--color-bg); border-bottom: 1px solid var(--color-border);
  padding: 1rem; box-shadow: var(--shadow);
}
.site-nav > ul { display: flex; flex-direction: column; gap: 0.4rem; }
.site-nav a { color: var(--color-text); text-decoration: none; font-weight: 600; }
.site-nav a:hover { color: var(--color-primary); }

/* menú "Productos" con submenú */
.has-sub { position: relative; }
.sub-toggle {
  background: none; border: 0; cursor: pointer; font-weight: 600; color: var(--color-text);
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0;
}
.sub-toggle::after { content: '▾'; font-size: 0.75em; }
.sub-menu {
  display: none; background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.5rem;
  min-width: 240px;
}
.sub-menu a { display: block; padding: 0.5rem 0.7rem; border-radius: 6px; font-size: 0.95rem; }
.sub-menu a:hover { background: var(--color-bg-soft); }
.has-sub.is-open .sub-menu { display: block; }
.header-wa { display: none; }

/* ---------- carrusel ---------- */
.carousel {
  position: relative; overflow: hidden;
  background: var(--gradient-brand);
  min-height: clamp(380px, 62vh, 560px);
}
.slide {
  position: absolute; inset: 0; opacity: 0; visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  display: flex; align-items: center;
  padding: clamp(2.5rem, 7vw, 5rem) 0;
}
.slide.is-active { position: relative; opacity: 1; visibility: visible; }
.slide-bg { position: absolute; inset: 0; z-index: 0; }
.slide-1 .slide-bg { background: linear-gradient(135deg, #0c4b86, #0e79b6); }
.slide-2 .slide-bg { background: linear-gradient(135deg, #22274c, #0c4b86); }
.slide-3 .slide-bg { background: linear-gradient(135deg, #0e79b6, #128c7e); }
.slide-bg::after {
  content: attr(data-ghost);
  position: absolute; right: -2%; bottom: -12%;
  font-size: clamp(7rem, 22vw, 16rem); font-weight: 900; letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.08); line-height: 1;
  white-space: nowrap;
}
.slide-inner { position: relative; z-index: 1; max-width: 680px; color: #fff; }
.slide-eyebrow {
  text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.78rem;
  font-weight: 700; opacity: 0.9; margin-bottom: 0.9rem;
}
.slide h1, .slide h2 { color: #fff; margin-bottom: 1rem; }
.slide p { color: rgba(255, 255, 255, 0.94); font-size: clamp(1rem, 2.4vw, 1.15rem); margin-bottom: 1.7rem; max-width: 55ch; }
.slide-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.slide .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.65); }
.slide .btn-ghost:hover { border-color: #fff; color: #fff; }

.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.9); color: var(--color-primary);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.carousel-btn:hover { background: #fff; }
.carousel-prev { left: clamp(0.4rem, 2vw, 1.2rem); }
.carousel-next { right: clamp(0.4rem, 2vw, 1.2rem); }
.carousel-dots {
  position: absolute; bottom: 1.1rem; left: 50%; transform: translateX(-50%);
  z-index: 5; display: flex; gap: 0.5rem;
}
.carousel-dots button {
  width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.45);
}
.carousel-dots button[aria-current='true'] { background: #fff; transform: scale(1.2); }

/* ---------- secciones ---------- */
.section { padding: clamp(2.8rem, 7vw, 4.5rem) 0; }
.section-soft { background: var(--color-bg-soft); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto clamp(1.8rem, 4vw, 2.6rem); }
.section-sub { color: var(--color-text-muted); margin-top: 0.5rem; }
.section-kicker {
  color: var(--color-secondary); font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 0.5rem;
}
.page-head { background: var(--gradient-brand); color: #fff; padding: clamp(2rem, 5vw, 3.2rem) 0; }
.page-head h1 { color: #fff; }
.page-head .lead { opacity: 0.95; max-width: 62ch; margin-top: 0.8rem; }
.breadcrumbs { font-size: 0.88rem; margin-bottom: 0.9rem; color: rgba(255, 255, 255, 0.9); }
.breadcrumbs a { color: #fff; text-decoration: underline; }
.breadcrumbs span[aria-hidden] { margin: 0 0.35rem; opacity: 0.7; }
.lead { color: var(--color-text-muted); }
.empty { color: var(--color-text-muted); padding: 2rem 0; }

/* ---------- tarjetas ---------- */
.grid { display: grid; gap: 1.4rem; }
.grid-cats { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card {
  display: flex; flex-direction: column; text-align: center;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden; text-decoration: none;
  color: var(--color-text);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow); color: var(--color-text); }
.card-media { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--gradient-brand); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.ph {
  font-size: clamp(2rem, 6vw, 3rem); font-weight: 800; color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.05em;
}
.card-body { padding: 1.1rem 1rem 1.3rem; display: grid; gap: 0.7rem; justify-items: center; }
.card-title { color: var(--color-primary); }
.card-text { color: var(--color-text-muted); font-size: 0.92rem; }
.card-cta {
  display: inline-block; background: var(--color-primary); color: #fff;
  padding: 0.45rem 1.3rem; border-radius: 999px; font-size: 0.88rem; font-weight: 600;
}
.card:hover .card-cta { background: var(--color-secondary); }

/* ---------- producto ---------- */
.prod-layout { display: grid; gap: 2rem; margin-top: 1.2rem; }
.prod-media { border-radius: var(--radius); border: 1px solid var(--color-border); overflow: hidden; aspect-ratio: 4/3; display: grid; }
.prod-media img { width: 100%; height: 100%; object-fit: cover; }
.prod-info h1 { margin-bottom: 0.4rem; }
.prod-info .lead { margin-bottom: 1.2rem; }
.specs { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.specs caption { text-align: left; color: var(--color-secondary); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; padding-bottom: 0.6rem; }
.specs th, .specs td { text-align: left; padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--color-border); }
.specs th { color: var(--color-text-muted); font-weight: 600; width: 45%; }
.specs tr:nth-child(even) { background: var(--color-bg-soft); }
.prod-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- categoría (v4: sin fichas de producto) ---------- */
.cat-layout { display: grid; gap: 2rem; align-items: start; }
.cat-media { border-radius: var(--radius); border: 1px solid var(--color-border); overflow: hidden; aspect-ratio: 4/3; display: grid; background: var(--gradient-brand); }
.cat-media img { width: 100%; height: 100%; object-fit: cover; }
.cat-info .cat-sub { color: var(--color-primary); margin-bottom: 0.8rem; }
.check-list { display: grid; gap: 0.7rem; margin-bottom: 1.8rem; }
.check-list li { position: relative; padding-left: 1.9rem; color: var(--color-text); }
.check-list li::before {
  content: ''; position: absolute; left: 0; top: 0.42em;
  width: 1.1em; height: 1.1em; border-radius: 50%;
  background: var(--color-whatsapp);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / 0.8em no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / 0.8em no-repeat;
}

/* ---------- nosotros / contacto ---------- */
.value-grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.value-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.6rem; text-align: center; }
.value-card h3 { color: var(--color-primary); margin-bottom: 0.5rem; }
.value-card p { color: var(--color-text-muted); font-size: 0.95rem; }

.contact-layout { display: grid; gap: 2.2rem; }
.contact-list { display: grid; gap: 1rem; margin-top: 1.2rem; }
.contact-list li { display: flex; gap: 0.7rem; align-items: flex-start; }
.contact-list svg { flex: none; margin-top: 0.25rem; color: var(--color-secondary); }
.contact-list a { color: var(--color-text); text-decoration: none; font-weight: 600; }
.contact-list a:hover { color: var(--color-primary); }
.mapa { margin-top: 1.6rem; }
.mapa iframe { width: 100%; height: 320px; border: 1px solid var(--color-border); border-radius: var(--radius); }

.form-grid { display: grid; gap: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field input, .field textarea {
  width: 100%; padding: 0.75rem 0.9rem; border: 1px solid var(--color-border);
  border-radius: 8px; background: var(--color-bg); color: var(--color-text);
}
.field input:focus, .field textarea:focus { border-color: var(--color-secondary); }
.form-note { font-size: 0.85rem; color: var(--color-text-muted); }
.card-pad { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: clamp(1.4rem, 4vw, 2rem); }

/* ---------- footer ---------- */
.site-footer { background: var(--color-navy); color: #eaf6fa; margin-top: auto; }
.site-footer a { color: #eaf6fa; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; gap: 2rem; padding: clamp(2.5rem, 6vw, 4rem) 0 2rem; }
.footer-brand { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.5rem; }
.footer-desc { color: #b9c6d6; font-size: 0.95rem; }
.footer-title { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.85rem; }
.footer-list { display: grid; gap: 0.55rem; font-size: 0.95rem; }
.footer-contact li { display: flex; gap: 0.6rem; align-items: flex-start; }
.footer-contact svg { flex: none; margin-top: 0.2rem; color: #7ec2ea; }
.socials { display: flex; gap: 0.6rem; margin-top: 1rem; }
.socials a {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50%;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
}
.socials a:hover { background: var(--color-secondary); border-color: var(--color-secondary); text-decoration: none; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.15); padding: 1rem 0; font-size: 0.85rem; color: #b9c6d6; }

/* ---------- whatsapp flotante ---------- */
.float-wa {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 140;
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--color-whatsapp); color: var(--color-whatsapp-text);
  padding: 0.75rem 1rem; border-radius: 999px; text-decoration: none;
  font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.float-wa:hover { background: #1eb955; color: var(--color-whatsapp-text); }

/* ---------- utilidades ---------- */
main { min-height: 60vh; }
.mt-2 { margin-top: 2rem; }
.text-center { text-align: center; }
body.no-scroll { overflow: hidden; }

/* ---------- escritorio ---------- */
@media (min-width: 960px) {
  .topbar-inner { justify-content: space-between; text-align: left; padding: 0; }
  .topbar ul:first-child { display: flex; }
  .nav-toggle { display: none; }
  .site-nav { display: block; position: static; padding: 0; border: 0; box-shadow: none; background: none; }
  .site-nav > ul { flex-direction: row; align-items: center; gap: 1.4rem; }
  .header-wa { display: inline-flex; }
  .site-nav .nav-cta { display: none; }

  .has-sub:hover .sub-menu, .has-sub:focus-within .sub-menu, .has-sub.is-open .sub-menu { display: block; }
  .sub-menu { position: absolute; top: 100%; left: 0; margin-top: 0.4rem; }

  .prod-layout { grid-template-columns: 1fr 1.1fr; align-items: start; gap: 2.6rem; }
  .cat-layout { grid-template-columns: 1fr 1.2fr; gap: 2.6rem; }
  .contact-layout { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 2fr 1fr 1.4fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide { transition: none; }
  .btn:hover, .card:hover { transform: none; }
}
