/* ============================================================
   CanCal Ingeniería y Servicios SpA — style.css
   Paleta y tipografía según GUIA-WEB.md del kit de marca.
   ============================================================ */

:root {
  --navy: #123E7A;
  --blue: #1877D2;
  --skyblue: #4EA8EE;
  --orange: #F5891C;
  --dark: #0B1B30;
  --text: #17222E;
  --text-secondary: #5F6B77;
  --white: #FFFFFF;
  --line: #DCE4EC;

  --bar-blue: #1877D2;
  --bar-green: #2E9E4F;
  --bar-yellow: #F0B31A;
  --bar-red: #D62828;

  --font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --max: 1180px;
  --radius: 4px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: clamp(2rem, 4.2vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; max-width: 62ch; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 72px 0; }

.eyebrow-free-heading { margin-bottom: 1.25rem; }

/* Accesibilidad */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--orange);
  color: var(--white);
  padding: 12px 20px;
  z-index: 1000;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ============ Botones ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 600;
  font-size: .98rem;
  padding: 13px 26px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: #DD7A0E; color: var(--white); }
.btn-outline-dark { border-color: rgba(255,255,255,.55); color: var(--white); }
.btn-outline-dark:hover { border-color: var(--white); background: rgba(255,255,255,.08); }
.btn-outline-light { border-color: var(--navy); color: var(--navy); }
.btn-outline-light:hover { background: var(--navy); color: var(--white); }
.btn-block { width: 100%; justify-content: center; }

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  z-index: 500;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
}
.brand { display: flex; flex-direction: column; gap: 6px; }
.brand img { height: 40px; width: auto; }
.brand-bar { display: flex; height: 3px; width: 150px; }
.brand-bar span { flex: 1; }
.brand-bar span:nth-child(1) { background: var(--bar-blue); }
.brand-bar span:nth-child(2) { background: var(--bar-green); }
.brand-bar span:nth-child(3) { background: var(--bar-yellow); }
.brand-bar span:nth-child(4) { background: var(--bar-red); }

.main-nav ul {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
  font-size: .98rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] { border-bottom-color: var(--orange); }

.header-actions { display: flex; align-items: center; gap: 18px; }
.header-phone {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  font-size: .95rem;
  white-space: nowrap;
}
.header-phone svg { flex-shrink: 0; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  .main-nav.is-open { max-height: 320px; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 8px 24px 18px; }
  .main-nav a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .header-phone span.phone-text { display: none; }
}

/* ============ Hero (fondo oscuro tipo plano técnico) ============ */
.hero {
  position: relative;
  background: var(--dark);
  color: var(--white);
  overflow: hidden;
  padding: 88px 0 0;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 30% 30%, black 45%, transparent 85%);
}
.hero-inner {
  position: relative;
  max-width: 640px;
}
.hero p.lead {
  color: #C3DBF0;
  font-size: 1.1rem;
  max-width: 52ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 28px 0 56px; }

.pulse-divider { display: block; width: 100%; height: auto; }
.pulse-divider path {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-pulse 1.6s ease-out .3s forwards;
}
@keyframes draw-pulse { to { stroke-dashoffset: 0; } }

/* ============ Franja de confianza ============ */
.trust-strip {
  background: #F4F8FC;
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
}
.trust-strip .container {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--navy);
  font-size: .95rem;
}
.trust-item svg { flex-shrink: 0; color: var(--orange); }

/* ============ Tarjetas con marco tipo diagrama ============ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 40px;
}
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

.blueprint-card {
  position: relative;
  padding: 32px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}
.blueprint-card::before,
.blueprint-card::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--skyblue);
  border-style: solid;
  border-width: 0;
}
.blueprint-card::before { top: -1px; left: -1px; border-top-width: 3px; border-left-width: 3px; }
.blueprint-card::after { bottom: -1px; right: -1px; border-bottom-width: 3px; border-right-width: 3px; }
.blueprint-card .icon { color: var(--orange); margin-bottom: 18px; }
.blueprint-card h3 { margin-bottom: 10px; }
.blueprint-card p { color: var(--text-secondary); font-size: .96rem; margin-bottom: 0; }

/* ============ Sección alterna texto/gráfico ============ */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 32px; } }
.split.reverse .split-media { order: -1; }
@media (max-width: 900px) { .split.reverse .split-media { order: 0; } }

.value-list { list-style: none; margin: 24px 0 0; padding: 0; }
.value-list li {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.value-list li:last-child { border-bottom: 1px solid var(--line); }
.value-list svg { flex-shrink: 0; color: var(--orange); margin-top: 3px; }
.value-list strong { display: block; color: var(--navy); margin-bottom: 2px; }
.value-list span.desc { color: var(--text-secondary); font-size: .95rem; }

.split-media {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ Franja CTA ============ */
.cta-band {
  background: var(--navy);
  color: var(--white);
  text-align: center;
}
.cta-band h2 { color: var(--white); margin-bottom: .4em; }
.cta-band p { color: #C3DBF0; margin: 0 auto 28px; }

/* ============ Servicios: bloques detallados ============ */
.service-block { padding: 56px 0; border-bottom: 1px solid var(--line); }
.service-block:last-of-type { border-bottom: none; }
.service-block ul { padding-left: 20px; color: var(--text-secondary); }
.service-block li { margin-bottom: 6px; }

/* ============ Nosotros ============ */
.about-hero-media { text-align: center; padding: 48px 0; background: #F4F8FC; }
.about-hero-media img { margin: 0 auto; max-width: 380px; }

.founders-note {
  border-left: 3px solid var(--orange);
  padding: 4px 0 4px 22px;
  color: var(--text-secondary);
  font-style: normal;
  max-width: 62ch;
}

/* ============ Contacto ============ */
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  text-decoration: none;
  color: var(--text);
}
.contact-card:hover { border-color: var(--skyblue); }
.contact-card svg { flex-shrink: 0; color: var(--orange); }
.contact-card strong { display: block; color: var(--navy); margin-bottom: 2px; }
.contact-card span { color: var(--text-secondary); font-size: .95rem; }

.contact-map {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 16px;
}
.contact-map iframe { width: 100%; height: 220px; border: 0; display: block; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  color: var(--navy);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--skyblue); }

.form-note {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .95rem;
}
.form-note.success { background: #E7F5EC; color: #1E7A3D; border: 1px solid #BCE3C9; }
.form-note.error { background: #FDECEC; color: #B3271F; border: 1px solid #F3C6C4; }

/* ============ Footer ============ */
.site-footer { background: var(--dark); color: #B9C6D4; padding: 56px 0 24px; }
.footer-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
}
@media (max-width: 760px) { .footer-top { grid-template-columns: 1fr; gap: 32px; } }
.footer-top img { height: 34px; margin-bottom: 14px; }
.footer-top h4 { color: var(--white); font-size: 1rem; margin-bottom: 14px; }
.footer-top ul { list-style: none; margin: 0; padding: 0; }
.footer-top li { margin-bottom: 10px; }
.footer-top a { color: #B9C6D4; text-decoration: none; font-size: .95rem; }
.footer-top a:hover { color: var(--white); }
.footer-bar { display: flex; height: 3px; width: 100%; margin-bottom: 20px; }
.footer-bar span { flex: 1; }
.footer-bar span:nth-child(1) { background: var(--bar-blue); }
.footer-bar span:nth-child(2) { background: var(--bar-green); }
.footer-bar span:nth-child(3) { background: var(--bar-yellow); }
.footer-bar span:nth-child(4) { background: var(--bar-red); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .85rem;
  color: #7E8FA1;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ============ WhatsApp flotante ============ */
.whatsapp-float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #25D366;
  color: var(--white);
  padding: 14px 20px 14px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.whatsapp-float span.wa-text { white-space: nowrap; }
@media (max-width: 560px) {
  .whatsapp-float span.wa-text { display: none; }
  .whatsapp-float { padding: 14px; }
}

/* ============ Utilidades de sección ============ */
.section-head { max-width: 640px; margin-bottom: 8px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.bg-tint { background: #F4F8FC; }

/* ============ Asistente virtual (cotizador guiado) ============ */
.assistant-toggle {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--navy);
  color: var(--white);
  padding: 14px 20px 14px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: .95rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.assistant-toggle svg { flex-shrink: 0; }
@media (max-width: 560px) {
  .assistant-toggle .assist-text { display: none; }
  .assistant-toggle { padding: 14px; }
}

.assistant-panel {
  position: fixed;
  z-index: 650;
  bottom: 90px;
  left: 22px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: min(560px, 72vh);
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(11,27,48,.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
}
.assistant-panel[hidden] { display: none; }

.assistant-head {
  background: var(--dark);
  color: var(--white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.assistant-head strong { display: block; font-size: .98rem; }
.assistant-head span { display: block; font-size: .8rem; color: #9FB4C9; }
.assistant-close {
  background: none;
  border: none;
  color: #C3DBF0;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}
.assistant-close:hover { color: var(--white); }

.assistant-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F7FAFC;
}

.msg { max-width: 86%; padding: 10px 13px; border-radius: 10px; font-size: .92rem; line-height: 1.45; }
.msg-bot { align-self: flex-start; background: var(--white); border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 2px; }
.msg-user { align-self: flex-end; background: var(--navy); color: var(--white); border-bottom-right-radius: 2px; }

.assist-options { display: flex; flex-direction: column; gap: 8px; align-self: flex-start; max-width: 92%; }
.assist-option-btn {
  font-family: var(--font);
  text-align: left;
  background: var(--white);
  border: 1.5px solid var(--skyblue);
  color: var(--navy);
  padding: 9px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
}
.assist-option-btn:hover { background: #EAF4FD; }

.assistant-summary {
  align-self: stretch;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  font-size: .88rem;
  color: var(--text-secondary);
}
.assistant-summary dt { color: var(--navy); font-weight: 600; margin-top: 8px; }
.assistant-summary dt:first-child { margin-top: 0; }
.assistant-summary dd { margin: 2px 0 0; }

.assistant-input-row {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--white);
}
.assistant-input-row input,
.assistant-input-row textarea {
  flex: 1;
  font-family: var(--font);
  font-size: .92rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: none;
}
.assistant-send {
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: .9rem;
}

.assist-final-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.assist-status { font-size: .82rem; color: var(--text-secondary); margin-top: 6px; }
.assist-status.ok { color: #1E7A3D; }
.assist-status.err { color: #B3271F; }

/* ============ Fundadores (Nosotros) ============ */
.founders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}
@media (max-width: 640px) { .founders-grid { grid-template-columns: 1fr; } }
.founder-role { color: var(--navy); font-weight: 600; margin-bottom: 6px; font-size: .95rem; }

/* ============ Animaciones al hacer scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ============ Sellos de confianza (badges) ============ */
.trust-item {
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(11,27,48,.05);
  border-radius: 999px;
  padding: 10px 18px 10px 14px;
}

/* ============ Preguntas frecuentes ============ */
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--orange);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin: 10px 0 0; color: var(--text-secondary); }

/* ============ Bloques por tipo de cliente ============ */
.client-type-card .icon { color: var(--blue); }
