/* =========================================================
   EMS · Estudios, Mercados y Suministros, C.A.
   ========================================================= */

:root {
  /* Colores */
  --c-teal-dark: #06484d;
  --c-teal: #0e7a80;
  --c-teal-light: #e3f1f1;
  --c-bg: #f7faf9;
  --c-white: #ffffff;
  --c-text: #16282a;
  --c-text-2: #4e6366;
  --c-line: #cfe0e0;
  --c-cta: #f2b705;
  --c-cta-hover: #ffc823;
  --c-focus: #f2b705;
  --c-error: #a3261d;

  /* Tipografía */
  --f-title: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Medidas */
  --container: 1120px;
  --gutter: 20px;
  --header-h: 72px;
  --radius: 10px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
}

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

h1, h2, h3 {
  font-family: var(--f-title);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5em;
  color: var(--c-teal-dark);
}
h3 { font-family: var(--f-body); font-weight: 700; font-size: 1.125rem; }

p { margin: 0 0 1em; }

a { color: var(--c-teal); text-underline-offset: 3px; }
a[href^="tel:"] { white-space: nowrap; }
a:hover { color: var(--c-teal-dark); }

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--c-cta);
  color: var(--c-text);
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 8px;
  border: 2px solid transparent;
  font: 600 1rem/1.2 var(--f-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--c-cta); color: var(--c-text); }
.btn-primary:hover { background: var(--c-cta-hover); color: var(--c-text); }
.btn-outline-light { border-color: var(--c-white); color: var(--c-white); background: transparent; }
.btn-outline-light:hover { background: var(--c-white); color: var(--c-teal-dark); }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-teal-dark);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

/* Logo a color sobre placa blanca */
.brand {
  display: inline-flex;
  align-items: center;
  background: var(--c-white);
  border-radius: 8px;
  padding: 6px 10px;
  flex-shrink: 0;
}
.brand img { width: auto; height: 40px; }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-list a:not(.btn) {
  color: var(--c-white);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav-list a:not(.btn):hover { border-bottom-color: var(--c-cta); color: var(--c-white); }

.nav-toggle {
  display: none;
  width: 46px; height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  position: absolute;
  left: 50%;
  width: 22px; height: 2px;
  margin-left: -11px;
  background: var(--c-white);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle-bar { top: 50%; margin-top: -1px; }
.nav-toggle-bar::before,
.nav-toggle-bar::after { content: ""; left: 0; margin-left: 0; }
.nav-toggle-bar::before { top: -7px; }
.nav-toggle-bar::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: inline-block; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--c-teal-dark);
    border-top: 1px solid rgba(255, 255, 255, .1);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
  }
  .nav-list a:not(.btn) {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }
  .nav-list a:not(.btn):hover { border-bottom-color: rgba(255, 255, 255, .1); color: var(--c-cta); }
  .nav-cta-item { margin-top: 16px; }
  .nav-cta-item .btn { width: 100%; }
}

/* ---------- Hero ---------- */
.hero {
  background-color: var(--c-teal);
  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: 32px 32px;
  color: var(--c-white);
  padding: 72px 0 80px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
.hero h1 {
  color: var(--c-white);
  font-size: clamp(2.1rem, 6vw, 3.5rem);
  letter-spacing: -.01em;
  max-width: 14ch;
}
.hero-lead {
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  max-width: 34rem;
  color: rgba(255, 255, 255, .92);
  margin-bottom: 1.75em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-visual { width: 100%; }
.ecg { width: 100%; height: auto; overflow: visible; }
.ecg-line {
  fill: none;
  stroke: var(--c-white);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: ecg-draw 2.6s ease-out forwards;
}
@keyframes ecg-draw { to { stroke-dashoffset: 0; } }

@media (min-width: 900px) {
  .hero { padding: 104px 0 112px; }
  .hero-inner { grid-template-columns: 1.15fr 1fr; gap: 56px; }
}

/* ---------- Secciones ---------- */
.section { padding: 72px 0; }
.section-white { background: var(--c-white); }
@media (min-width: 900px) { .section { padding: 96px 0; } }

.section-head { max-width: 46rem; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.section-head p { color: var(--c-text-2); font-size: 1.125rem; margin: 0; }

.grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); gap: 28px; }
}

/* Tarjetas de líneas */
.card {
  display: flex;
  flex-direction: column;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
}
.card-accent { border-left: 4px solid var(--c-teal); }
.card h3 { font-size: 1.25rem; margin-bottom: .75em; }
.spec-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  color: var(--c-text-2);
}
.spec-list li { padding: 7px 0; border-top: 1px solid var(--c-line); }
.spec-list li:first-child { border-top: 0; padding-top: 0; }
.brand-name { color: var(--c-teal-dark); font-weight: 700; }
.card-link {
  margin-top: auto;
  align-self: flex-start;
  font-weight: 600;
  color: var(--c-teal);
}
.card-link::after { content: " →"; }

/* Servicio integral */
.service {
  border-top: 3px solid var(--c-teal);
  padding-top: 18px;
}
.service p { color: var(--c-text-2); margin: 0; }

/* Proyectos */
.stat {
  background: var(--c-teal-light);
  border-radius: var(--radius);
  padding: 28px;
}
.stat-number {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: clamp(2.75rem, 7vw, 3.5rem);
  line-height: 1;
  color: var(--c-teal-dark);
  margin-bottom: 16px;
}
.stat p:last-child { color: var(--c-text-2); margin: 0; }

.details {
  margin-top: 28px;
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
}
.details summary {
  cursor: pointer;
  padding: 18px 24px;
  font-weight: 600;
  color: var(--c-teal-dark);
  list-style-position: inside;
}
.details summary:hover { color: var(--c-teal); }
.details-body { padding: 0 24px 24px; }
.details-body > p { color: var(--c-text-2); max-width: 46rem; }
.centers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 24px;
}
.centers li { padding: 9px 0; border-bottom: 1px solid var(--c-line); }
.centers strong { color: var(--c-teal-dark); }
@media (min-width: 640px) { .centers { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .centers { grid-template-columns: repeat(3, 1fr); } }

/* Nosotros */
.statement {
  background: var(--c-teal-dark);
  color: var(--c-white);
  border-radius: var(--radius);
  padding: 30px;
}
.statement h3 {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--c-white);
}
.statement p { margin: 0; color: rgba(255, 255, 255, .92); }

/* ---------- Contacto ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
@media (min-width: 900px) {
  .contact-grid { grid-template-columns: 1fr 1.1fr; gap: 64px; }
}
.contact-info h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.contact-info > p { color: var(--c-text-2); font-size: 1.125rem; }
.contact-list { margin: 28px 0 0; }
.contact-list > div {
  padding: 14px 0 14px 16px;
  border-left: 3px solid var(--c-teal);
  margin-bottom: 12px;
  background: var(--c-white);
  border-radius: 0 8px 8px 0;
}
.contact-list dt {
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-2);
}
.contact-list dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.contact-list address { font-style: normal; }

.quote-form {
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 28px;
}
@media (max-width: 400px) { .quote-form { padding: 20px; } }
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font: 400 1rem/1.4 var(--f-body);
  color: var(--c-text);
  background: var(--c-white);
  border: 1px solid #9fb7b8;
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 46px;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--c-teal);
  outline-offset: 1px;
  border-color: var(--c-teal);
}
.field [aria-invalid="true"] { border-color: var(--c-error); border-width: 2px; }

.form-status { min-height: 1.5em; margin: 0 0 14px; font-weight: 500; }
.form-status.is-error { color: var(--c-error); }
.form-status.is-ok { color: var(--c-teal-dark); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--c-teal-dark);
  color: rgba(255, 255, 255, .9);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}
.footer-logo {
  display: inline-flex;
  background: var(--c-white);
  border-radius: 8px;
  padding: 6px 10px;
}
.footer-logo img { height: 36px; width: auto; }
.footer-name { margin: 0; font-weight: 600; color: var(--c-white); }
.footer-contact { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.site-footer a { color: var(--c-white); }
.site-footer a:hover { color: var(--c-cta); }
@media (min-width: 900px) { .footer-contact { margin-left: auto; } }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .15);
  font-size: .9375rem;
}
.footer-copy { margin: 0; color: rgba(255, 255, 255, .85); }
.footer-legal {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.form-note {
  margin: 14px 0 0;
  font-size: .875rem;
  color: var(--c-text-2);
}

/* ---------- Páginas legales ---------- */
.header-back {
  color: var(--c-white);
  font-weight: 500;
  text-decoration: none;
}
.header-back:hover { color: var(--c-cta); }

.legal { padding: 56px 0 80px; }
.legal-inner { max-width: 760px; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
.legal-updated { color: var(--c-text-2); margin-bottom: 2em; }
.legal h2 {
  font-size: 1.375rem;
  margin-top: 2em;
  padding-top: 1.25em;
  border-top: 1px solid var(--c-line);
}
.legal ul { padding-left: 1.25em; }
.legal li { margin-bottom: .4em; }
.legal address { font-style: normal; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ecg-line { animation: none; stroke-dashoffset: 0; }
  .btn, .nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { transition: none; }
}
