/* ==================================================================
   HAPCOM SPA — hoja de estilos única.
   Todos los colores y medidas viven en :root para mantención simple.
   ================================================================== */

:root {
  --background: #ffffff;
  --foreground: #14161f;
  --surface: #f7f7f9;
  --muted: #6b6f7d;
  --border: rgba(20, 22, 31, 0.14);
  --border-soft: rgba(20, 22, 31, 0.08);
  --primary: #3d4fd6;
  --accent: #a32fb0;
  --brand-blue: #2f5ad9;
  --brand-purple: #b0248c;
  --gradient-brand: linear-gradient(100deg, var(--brand-blue), var(--accent) 55%, var(--brand-purple));
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --wrap: 80rem;
}

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

html { scroll-behavior: smooth; }

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

img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; transition: color 0.3s ease; }
ul { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 7vw, 5.25rem); line-height: 0.95; max-width: 60rem; }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.05; max-width: 46rem; }
h3 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.2; }
h4 { font-size: 1.25rem; }

p { margin: 0; }

/* ---------- utilidades ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }
@media (min-width: 768px) { .wrap { padding: 0 2.5rem; } }

.section { padding: 7rem 1.5rem; }
@media (min-width: 768px) { .section { padding: 10rem 2.5rem; } }

.band { background: rgba(247, 247, 249, 0.6); border-top: 1px solid var(--border); }
.bordered-top { border-top: 1px solid var(--border); }

.eyebrow {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin: 0;
}
.eyebrow.accent { color: var(--primary); letter-spacing: 0.25em; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.strong-text { color: var(--foreground); }
.lead { font-size: 1.0625rem; color: var(--muted); max-width: 36rem; line-height: 1.7; }
.mt-8 { margin-top: 0.5rem; }
.mt-16 { margin-top: 1rem; }
.mt-24 { margin-top: 1.5rem; }
.mt-96 { margin-top: 7rem; }

.grad {
  background-image: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rule { height: 1px; width: 2.5rem; background-image: var(--gradient-brand); margin: 1rem 0; }

/* ---------- ghost buttons ---------- */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1rem 2rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--muted);
  background: none;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.btn-ghost.strong { color: var(--foreground); border-color: rgba(20, 22, 31, 0.25); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.55rem 1.25rem; color: var(--foreground); }

/* ---------- header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: background-color 0.4s ease, border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}
.brand img { height: 1.5rem; width: auto; }
@media (min-width: 768px) { .brand img { height: 1.75rem; } }

.nav-desktop { display: none; align-items: center; gap: 2.5rem; }
.nav-desktop a {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.nav-desktop a:hover { color: var(--foreground); }
@media (min-width: 900px) { .nav-desktop { display: flex; } }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  align-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  cursor: pointer;
}
.nav-toggle span { display: block; width: 14px; height: 1px; background: var(--foreground); transition: transform 0.3s ease; }
.nav-toggle.is-open span:first-child { transform: translateY(3px) rotate(45deg); }
.nav-toggle.is-open span:last-child { transform: translateY(-3px) rotate(-45deg); }
@media (min-width: 900px) { .nav-toggle { display: none; } }

.nav-mobile {
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  padding: 0.5rem 1.5rem 2rem;
}
.nav-mobile a {
  display: block;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-size: 1.5rem;
}
@media (min-width: 900px) { .nav-mobile { display: none !important; } }

/* ---------- hero ---------- */
.hero-inner { padding-top: 9rem; padding-bottom: 4rem; }
@media (min-width: 768px) { .hero-inner { padding-top: 12rem; padding-bottom: 6rem; } }
.hero-inner h1 { margin-top: 2.5rem; }
.hero-bottom {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}
@media (min-width: 900px) {
  .hero-bottom { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}
.hero-actions { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 560px) { .hero-actions { flex-direction: row; } }
.hero-figure { margin: 0; overflow: hidden; }
.hero-figure img { height: 58svh; width: 100%; object-fit: cover; }
@media (min-width: 768px) { .hero-figure img { height: 78svh; } }

/* ---------- nosotros ---------- */
.about-grid { display: grid; gap: 4rem; }
@media (min-width: 1000px) { .about-grid { grid-template-columns: 1.05fr 0.95fr; gap: 6rem; } }
.about-grid h2 { margin-top: 2rem; }
.prose { margin-top: 2rem; display: grid; gap: 1.5rem; color: var(--muted); line-height: 1.75; }
.about-figure { margin: 0; }
@media (min-width: 1000px) { .about-figure { padding-top: 4rem; } }
.about-figure img { aspect-ratio: 4 / 5; width: 100%; object-fit: cover; transition: transform 1s ease; }
.about-figure img:hover { transform: scale(1.03); }
.about-figure figcaption { margin-top: 1rem; }

.stats { margin-top: 4rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3rem 2rem; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat-value { font-family: var(--font-display); font-size: clamp(2.25rem, 4vw, 3rem); letter-spacing: -0.02em; }

/* ---------- servicios ---------- */
.cards { margin-top: 5rem; display: grid; gap: 2rem; }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  transition: border-color 0.5s ease;
}
.card:hover { border-color: rgba(61, 79, 214, 0.6); }
.card-media { overflow: hidden; }
.card-media img { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; opacity: 0.9; transition: transform 1s ease, opacity 1s ease; }
.card:hover .card-media img { transform: scale(1.04); opacity: 1; }
.card-body { padding: 2rem; display: flex; flex-direction: column; flex: 1; }
.card-index { font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.3em; color: var(--muted); }
.card-body h3 { margin-top: 1.25rem; }
.ticks { margin-top: 2rem; display: grid; gap: 0.75rem; font-size: 0.875rem; color: var(--muted); }
.ticks li { display: flex; gap: 0.75rem; }
.dot { margin-top: 0.6rem; width: 4px; height: 4px; border-radius: 999px; flex: 0 0 auto; background-image: var(--gradient-brand); }

/* ---------- proyectos ---------- */
.carousel { margin-top: 4rem; display: grid; gap: 2.5rem; }
@media (min-width: 1000px) { .carousel { grid-template-columns: 1.15fr 0.85fr; align-items: end; } }
.carousel-figure { margin: 0; overflow: hidden; }
.carousel-figure img { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; }
.carousel-info h3 { margin-top: 1.25rem; }
.carousel-controls { margin-top: 2.5rem; display: flex; align-items: center; gap: 0.75rem; }
.carousel-controls button {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.carousel-controls button:hover { border-color: var(--primary); color: var(--primary); }
.carousel-controls span { margin-left: 0.75rem; }

.table-scroll { margin-top: 2rem; overflow-x: auto; }
table.hitos { width: 100%; min-width: 46rem; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
table.hitos th {
  font-weight: 400;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  padding: 1rem 1.5rem 1rem 0;
  border-bottom: 1px solid var(--border);
}
table.hitos td { padding: 1.25rem 1.5rem 1.25rem 0; border-bottom: 1px solid var(--border-soft); }
table.hitos tbody tr { transition: background-color 0.3s ease; }
table.hitos tbody tr:hover { background: rgba(247, 247, 249, 0.8); }

.intl { margin-top: 6rem; display: grid; gap: 2rem; }
@media (min-width: 768px) { .intl { grid-template-columns: repeat(3, 1fr); } }
.intl-item { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.intl-item h4 { margin-top: 1rem; font-family: var(--font-display); }

/* ---------- contacto ---------- */
.contact-grid { display: grid; gap: 4rem; }
@media (min-width: 1000px) { .contact-grid { grid-template-columns: 0.9fr 1.1fr; gap: 6rem; } }
.contact-grid h2 { margin-top: 2rem; }
.contact-details { margin-top: 3rem; display: grid; gap: 2rem; }
.contact-name { font-family: var(--font-display); font-size: 1.25rem; }
.contact-list { display: grid; gap: 1rem; }
.contact-list a:hover { color: var(--primary); }

.form { display: grid; gap: 2rem; }
.form-row { display: grid; gap: 2rem; }
@media (min-width: 600px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form label { display: block; }
.form input,
.form textarea {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 1rem 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
  border-radius: 0;
}
.form textarea { resize: none; }
.form input::placeholder,
.form textarea::placeholder { color: rgba(107, 111, 125, 0.7); }
.form input:focus,
.form textarea:focus { outline: none; border-bottom-color: var(--primary); }
.form button { justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.alert { font-size: 0.875rem; margin-bottom: 1.5rem; padding: 1rem 1.25rem; border: 1px solid var(--border); }
.alert.ok { border-color: rgba(61, 79, 214, 0.4); color: var(--primary); }
.alert.bad { border-color: rgba(190, 60, 60, 0.4); color: #b03636; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); }
.footer-grid { display: grid; gap: 3rem; padding-top: 4rem; padding-bottom: 4rem; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.2fr 0.8fr; } }
.footer-logo { height: 1.5rem; width: auto; }
.footer-right { display: flex; flex-direction: column; gap: 2rem; }
@media (min-width: 768px) { .footer-right { align-items: flex-end; text-align: right; } }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.footer-nav a { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); }
.footer-nav a:hover { color: var(--foreground); }
.footer-contact a { display: block; }
.footer-contact a:hover { color: var(--foreground); }
.footer-bottom { border-top: 1px solid var(--border); padding: 1.5rem 0; }

/* ---------- animaciones ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal[data-visible="true"] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
