/* =============================================================
   Impresiones Victor S.A.C. — Hoja de estilos
   Solo CSS3 vanilla. Mobile-first. Sin dependencias.
   -------------------------------------------------------------
   Índice:
   1. Variables (:root)        — colores, tipografía, espaciado
   2. Reset y base
   3. Utilidades (container, botones, reveal)
   4. Header / Navbar
   5. Hero
   6. Secciones genéricas
   7. Estadísticas
   8. Tarjetas "por qué elegirnos"
   9. Bloque asesoramiento (split)
   10. Servicios (líneas, chips, CTA)
   11. Contacto (datos + formulario)
   12. Footer
   13. Botones flotantes (WhatsApp / volver arriba)
   14. Media queries (tablet / desktop)
   15. Accesibilidad / prefers-reduced-motion
   ============================================================= */

/* ============ 1. VARIABLES ============ */
:root {
  /* Paleta de marca (ajustar el rojo si se tiene el valor exacto) */
  --rojo:         #E2231A;   /* Rojo principal: marca, CTA, acentos */
  --rojo-oscuro:  #B71C12;   /* Hover / active */
  --carbon:       #2B2B2B;   /* Texto principal / fondos oscuros */
  --gris:         #6B6B6B;   /* Texto secundario */
  --gris-claro:   #F4F4F4;   /* Fondos de sección alternos */
  --blanco:       #FFFFFF;
  --whatsapp:     #0E7A35;   /* Verde WhatsApp accesible: blanco encima ≈ 5.5:1 (cumple WCAG AA) */
  --whatsapp-osc: #0B6128;   /* Hover / texto de éxito: más oscuro, mayor contraste */

  /* Tipografía: stack del sistema (costo cero, sin requests, funciona offline) */
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Tamaños fluidos con clamp() */
  --fs-h1:   clamp(2rem, 5vw + 1rem, 3.5rem);
  --fs-h2:   clamp(1.6rem, 3vw + 0.6rem, 2.4rem);
  --fs-h3:   clamp(1.15rem, 1.2vw + 0.8rem, 1.4rem);
  --fs-lead: clamp(1.05rem, 1vw + 0.7rem, 1.25rem);
  --fs-base: 1rem;

  /* Layout */
  --maxw: 1140px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 10px;
  --radius-sm: 6px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .10);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .16);

  --header-h: 68px;
  --transition: .25s ease;
}

/* ============ 2. RESET Y BASE ============ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Compensa el header fijo al saltar a una ancla */
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--carbon);
  background: var(--blanco);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--carbon); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 1rem; }

a { color: var(--rojo); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--rojo-oscuro); }

ul { margin: 0; padding: 0; list-style: none; }

.nowrap { white-space: nowrap; }

/* Ícono SVG genérico */
.icon { width: 1.25em; height: 1.25em; flex: none; }

/* Foco visible para navegación por teclado */
:focus-visible {
  outline: 3px solid var(--rojo);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Enlace de salto (accesibilidad) */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1000;
  background: var(--carbon);
  color: #fff;
  padding: .75rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* El hero es el destino del enlace de salto (tabindex="-1"); al recibir foco
   programático no mostramos contorno porque no es un elemento interactivo. */
.hero[tabindex]:focus { outline: none; }

/* ============ 3. UTILIDADES ============ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.1;
  padding: .8rem 1.4rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--rojo); color: #fff; }
.btn--primary:hover { background: var(--rojo-oscuro); color: #fff; }

.btn--outline { background: transparent; color: var(--rojo); border-color: var(--rojo); }
.btn--outline:hover { background: var(--rojo); color: #fff; }

.btn--whatsapp { background: var(--whatsapp); color: #fff; }
.btn--whatsapp:hover { background: var(--whatsapp-osc); color: #fff; }

.btn--lg { padding: 1rem 1.7rem; font-size: 1.05rem; }
.btn--block { width: 100%; }

/* --- Animaciones de aparición (IntersectionObserver añade .is-visible) --- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease, transform .6s ease;
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ============ 4. HEADER / NAVBAR ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(140%) blur(6px);
  /* Borde inferior como sombra interior: NO suma altura al header, así --header-h (68px)
     coincide exactamente con scroll-padding-top y con el top del menú móvil. */
  box-shadow: inset 0 -1px 0 #eee;
  transition: box-shadow var(--transition), padding var(--transition);
}
.site-header.is-scrolled { box-shadow: inset 0 -1px 0 #eee, var(--shadow-md); }

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

/* --- Logo tipográfico --- */
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--carbon); }
.logo:hover { color: var(--carbon); }
.logo__bar {
  width: 6px;
  height: 34px;
  background: var(--rojo);
  border-radius: 2px;
  /* Detalle gráfico: barra/diagonal roja evocando el brochure */
  transform: skewX(-12deg);
  flex: none;
}
.logo__text { display: flex; flex-direction: column; line-height: 1; }
.logo__name {
  font-weight: 800;
  letter-spacing: .04em;
  font-size: clamp(.95rem, 2.4vw, 1.15rem);
}
.logo__sub {
  font-weight: 700;
  letter-spacing: .35em;
  font-size: .62rem;
  color: var(--rojo);
  margin-top: 2px;
}

/* --- Navegación --- */
.main-nav { display: flex; align-items: center; gap: 1.6rem; }
.nav-list { display: flex; align-items: center; gap: 1.4rem; }
.nav-list a {
  color: var(--carbon);
  font-weight: 600;
  padding: .3rem 0;
  position: relative;
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--rojo);
  transition: width var(--transition);
}
.nav-list a:hover { color: var(--rojo); }
.nav-list a:hover::after { width: 100%; }

/* --- Hamburguesa (oculta en desktop) --- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  width: 26px; height: 3px;
  background: var(--carbon);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
/* Estado abierto: convierte el ícono en una "X" */
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ============ 5. HERO ============ */
.hero {
  position: relative;
  color: #fff;
  /* Fondo: gradiente sutil carbón/gris. Para usar foto real, ver comentario en index.html */
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(226, 35, 26, .35), transparent 60%),
    linear-gradient(135deg, #1f1f1f 0%, #2B2B2B 55%, #3a3a3a 100%);
  padding: clamp(3.5rem, 9vw, 7rem) 0;
}
.hero__inner { max-width: 760px; }
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .8rem;
  font-weight: 700;
  color: #ffb3ae;
  margin: 0 0 1rem;
}
.hero__title { color: #fff; margin-bottom: .4rem; }
.hero__tagline {
  font-size: var(--fs-lead);
  font-weight: 700;
  /* Rojo aclarado: asegura contraste AA (~5:1) sobre el fondo oscuro del hero.
     (El rojo de marca puro no alcanza 4.5:1 sobre fondo oscuro.) */
  color: #FF8A82;
  margin-bottom: 1rem;
}
.hero__lead { font-size: var(--fs-lead); color: #e6e6e6; max-width: 60ch; }
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  margin-top: 1.8rem;
}

/* ============ 6. SECCIONES GENÉRICAS ============ */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section--alt { background: var(--gris-claro); }

.section__head { max-width: 760px; margin-bottom: 2.5rem; }
.section__kicker {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .78rem;
  font-weight: 800;
  color: var(--rojo);
  margin-bottom: .5rem;
}
/* En secciones de fondo gris (#F4F4F4) el rojo puro no llega a 4.5:1; usa el rojo oscuro */
.section--alt .section__kicker { color: var(--rojo-oscuro); }
.section__title { margin-bottom: .6rem; }
.section__intro { font-size: var(--fs-lead); color: var(--gris); max-width: 70ch; }

/* ============ 7. ESTADÍSTICAS ============ */
.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  margin-top: 2.5rem;
}
.stat {
  background: var(--gris-claro);
  border-left: 5px solid var(--rojo);
  border-radius: var(--radius-sm);
  padding: 1.4rem 1.5rem;
  text-align: center;
}
.stat__num {
  display: block;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: var(--rojo);
  line-height: 1.1;
}
.stat__label { display: block; color: var(--gris); font-weight: 600; margin-top: .3rem; }

/* ============ 8. TARJETAS "POR QUÉ ELEGIRNOS" ============ */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
}
.card {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: var(--radius);
  padding: 1.8rem 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(226, 35, 26, .1);
  color: var(--rojo);
  margin-bottom: 1rem;
}
.card__icon .icon { width: 28px; height: 28px; }
.card__title { margin-bottom: .4rem; }
.card__text { color: var(--gris); margin: 0; }

/* ============ 9. BLOQUE ASESORAMIENTO (split) ============ */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
.split__body p { color: var(--gris); font-size: var(--fs-lead); }
.media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  color: #cfcfcf;
  font-weight: 600;
  letter-spacing: .03em;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, #2b2b2b, #444);
  box-shadow: var(--shadow-md);
}
.media-placeholder__icon { width: 64px; height: 64px; opacity: .85; }

/* ============ 10. SERVICIOS ============ */
.lines {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  margin-bottom: 3rem;
}
.line-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem 1.6rem 1.6rem;
  border: 1px solid #ececec;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.line-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 5px;
  background: var(--rojo);
}
.line-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.line-card__tag {
  display: inline-block;
  font-size: 2rem;
  font-weight: 800;
  color: rgba(226, 35, 26, .18);
  line-height: 1;
}
.line-card__title { margin: .4rem 0 .3rem; color: var(--rojo); }
.line-card__text { color: var(--gris); margin: 0; }

/* --- Trabajos / chips --- */
.works__title { margin-bottom: 1.6rem; }
.works__group { margin-bottom: 1.8rem; }
.works__subtitle {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--carbon);
  border-left: 4px solid var(--rojo);
  padding-left: .6rem;
  margin-bottom: .9rem;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}
.chips li {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 999px;
  padding: .45rem .9rem;
  font-size: .9rem;
  color: var(--carbon);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}
.chips li:hover { border-color: var(--rojo); color: var(--rojo); transform: translateY(-2px); }

/* CTA de cierre */
.works__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 2rem;
  padding: 1.6rem 1.8rem;
  background: #fff;
  border: 1px dashed var(--rojo);
  border-radius: var(--radius);
}
.works__cta p { margin: 0; font-weight: 700; font-size: 1.05rem; }

/* ============ 11. CONTACTO ============ */
.contact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
.contact-list { display: grid; gap: 1.2rem; }
.contact-item { display: flex; align-items: flex-start; gap: .9rem; }
.contact-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  flex: none;
  border-radius: 50%;
  background: rgba(226, 35, 26, .1);
  color: var(--rojo);
}
.contact-item__label {
  display: block;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gris);
  font-weight: 700;
}
.contact-item__value {
  display: block;
  color: var(--carbon);
  font-weight: 600;
  word-break: break-word;
}
.contact-item__value:hover { color: var(--rojo); }
.map-link { display: inline-block; margin-top: 1.4rem; font-weight: 700; }

/* --- Formulario --- */
.contact__form {
  background: var(--gris-claro);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 2rem);
}
.form-title { margin-bottom: .3rem; }
.form-note { color: var(--gris); margin-bottom: 1.4rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.req { color: var(--rojo); }
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--carbon);
  padding: .75rem .85rem;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--rojo);
  box-shadow: 0 0 0 3px rgba(226, 35, 26, .15);
}
/* Estado inválido (lo marca el JS añadiendo .has-error) */
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--rojo); }
.field__error {
  display: block;
  color: var(--rojo-oscuro);
  font-size: .85rem;
  margin-top: .35rem;
  min-height: 1em;
}
.form-feedback { margin: 1rem 0 0; font-weight: 600; min-height: 1.4em; }
.form-feedback.ok { color: var(--whatsapp-osc); }

/* ============ 12. FOOTER ============ */
.site-footer { background: var(--carbon); color: #d9d9d9; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-block: 3rem;
}
.logo--footer .logo__name { color: #fff; }
.logo--footer:hover { color: #fff; }
.footer-tagline { color: #b3b3b3; margin: 1rem 0 0; max-width: 40ch; }
.footer-col__title {
  color: #fff;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 1rem;
}
.footer-contact a,
.footer-links a { color: #d9d9d9; }
.footer-contact a:hover,
.footer-links a:hover { color: #fff; }
.footer-contact li,
.footer-links li { margin-bottom: .6rem; word-break: break-word; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-block: 1.2rem;
  font-size: .9rem;
  color: #a8a8a8;
}
.footer-bottom p { margin: 0; }

/* ============ 13. BOTONES FLOTANTES ============ */
.float-wa {
  position: fixed;
  right: clamp(1rem, 3vw, 1.6rem);
  bottom: clamp(1rem, 3vw, 1.6rem);
  z-index: 90;
  width: 58px; height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--whatsapp);
  color: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition), background var(--transition);
}
.float-wa:hover { background: var(--whatsapp-osc); color: #fff; transform: scale(1.08); }
.float-wa svg { width: 32px; height: 32px; }

.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 1.6rem);
  bottom: calc(clamp(1rem, 3vw, 1.6rem) + 70px);
  z-index: 90;
  width: 46px; height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--carbon);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  /* Oculto hasta que el JS añade .is-visible */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition),
              visibility var(--transition), background var(--transition);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--rojo); }
.to-top svg { width: 26px; height: 26px; }

/* ============ 14. MEDIA QUERIES ============ */

/* --- Tablet (≥ 600px) --- */
@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .lines { grid-template-columns: repeat(3, 1fr); }
}

/* --- Desktop (≥ 768px) --- */
@media (min-width: 768px) {
  .split { grid-template-columns: 1fr 1fr; gap: 3rem; }
  .contact { grid-template-columns: 1.1fr 1fr; gap: 3rem; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

/* --- Desktop amplio (≥ 992px) --- */
@media (min-width: 992px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
}

/* --- Menú móvil (≤ 767px): se despliega bajo el header --- */
@media (max-width: 767px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: 100%;
    /* max-height (no height:auto) para poder ANIMAR la apertura.
       visibility:hidden saca enlaces y CTA del orden de tabulación cuando está cerrado. */
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: var(--shadow-md);
    transition: max-height var(--transition), visibility var(--transition);
  }
  .main-nav.is-open {
    /* Limita al viewport y permite scroll interno en pantallas bajas/landscape
       para que el CTA del final siempre sea alcanzable. */
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    overflow-x: hidden;
    visibility: visible;
    padding: .5rem 0 1.2rem;
  }

  .nav-list { flex-direction: column; align-items: stretch; gap: 0; width: 100%; }
  .nav-list a {
    display: block;
    padding: .9rem var(--gutter);
    border-bottom: 1px solid #f0f0f0;
  }
  .nav-list a::after { display: none; }

  .nav-cta { margin: .9rem var(--gutter) 0; }
}

/* ============ 15. ACCESIBILIDAD / MOVIMIENTO REDUCIDO ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
