/* ==========================================================================
   HIC Systems — Sistema base
   Compartido por index y páginas de servicio.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Tinta */
  --ink:        #12161c;
  --ink-2:      #3d4753;
  --ink-3:      #656f7c;   /* 4.7:1 sobre --paper-2, el fondo más claro */

  /* Papel */
  --paper:      #ffffff;
  --paper-2:    #f7f5f2;
  --paper-3:    #efebe5;

  /* Líneas */
  --line:       #e3ded8;
  --line-2:     #cdc6bc;
  --line-dark:  rgba(255,255,255,0.11);

  /* Marca */
  --brand:       #0b63ce;
  --brand-ink:   #084a9c;
  --brand-soft:  #eaf2fd;
  --brand-light: #5aa9f5;   /* sobre fondo oscuro */

  /* Acento cálido (tierra de Extremadura) — 5.3:1 sobre papel blanco */
  --clay:       #b8481a;
  --clay-soft:  #fbeee7;

  /* Estado */
  --ok:         #1f7a4d;
  --warn:       #9a6100;
  --danger:     #b42318;

  /* Superficies oscuras */
  --dark:        #12161c;
  --dark-2:      #191f27;
  --dark-text:   #a6b0bd;
  --dark-muted:  #838d9a;  /* 4.85:1 sobre las tarjetas --dark-2 */

  /* Tipografía */
  --sans: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Newsreader", Georgia, serif;

  /* Medidas */
  --wrap:    1180px;
  --wrap-sm: 760px;
  --radius:  4px;
  --radius-lg: 8px;
  --header-h: 68px;

  /* Movimiento */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur:  200ms;
}

html { color-scheme: light; }

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-ink); }

::selection { background: var(--brand); color: #fff; }

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

/* Nada de animaciones para quien las ha desactivado */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   3. Tipografía
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 5.2vw, 3.9rem); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.85rem, 3.6vw, 2.6rem); letter-spacing: -0.028em; }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.35rem); }
h4 { font-size: 1.02rem; letter-spacing: -0.012em; }

p { text-wrap: pretty; }

/* Etiqueta superior en monoespaciada: el sello "de ingeniería" del sitio */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--clay);
  flex-shrink: 0;
}
.eyebrow--plain::before { display: none; }

.lead {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.6;
  color: var(--ink-2);
}

.muted { color: var(--ink-3); }
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   4. Estructura
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

.section {
  padding-block: clamp(4rem, 9vw, 7rem);
  scroll-margin-top: calc(var(--header-h) + 8px);
}
.section--tight { padding-block: clamp(3rem, 6vw, 4.5rem); }
.section--alt   { background: var(--paper-2); }

/* Sección oscura: el ancla visual del sitio */
.section--dark {
  background: var(--dark);
  color: var(--dark-text);
  position: relative;
  overflow: hidden;
}
/* Brillo azul animado de fondo */
.section--dark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 12% 25%, rgba(90,169,245,0.10) 0%, transparent 62%),
    radial-gradient(ellipse 55% 55% at 90% 78%, rgba(90,169,245,0.06) 0%, transparent 60%);
  animation: section-glow 14s ease-in-out infinite alternate;
}
.section--dark > * { position: relative; z-index: 1; }
.section--dark h1, .section--dark h2,
.section--dark h3, .section--dark h4 { color: #fff; }
.section--dark .eyebrow { color: #8b96a3; }
.section--dark .lead    { color: var(--dark-text); }
.section--dark a        { color: var(--brand-light); }

@keyframes section-glow {
  0%   { transform: scale(1) translate(0, 0); opacity: 0.7; }
  50%  { transform: scale(1.15) translate(2%, 3%); opacity: 1; }
  100% { transform: scale(1) translate(-2%, -2%); opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .section--dark::before { animation: none; }
}

.section-head { max-width: 620px; margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.section-head .eyebrow { margin-bottom: 1.1rem; }
.section-head h2 + p   { margin-top: 1rem; }

.rule { height: 1px; background: var(--line); border: 0; }

/* --------------------------------------------------------------------------
   5. Botones
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  min-height: 46px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 0.85em; }

.btn--primary {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}
.btn--primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.btn--ghost:hover { border-color: var(--ink); background: var(--paper-2); color: var(--ink); }

.btn--clay {
  background: var(--clay);
  color: #fff;
  border: 1px solid var(--clay);
}
.btn--clay:hover { background: #a8410f; border-color: #a8410f; color: #fff; }

.section--dark .btn--ghost { color: #fff; border-color: rgba(255,255,255,0.28); }
.section--dark .btn--ghost:hover { background: rgba(255,255,255,0.07); border-color: #fff; color: #fff; }
/* Los botones sólidos no deben heredar el color de enlace de la sección oscura */
.section--dark a.btn--primary, .section--dark a.btn--primary:hover,
.section--dark a.btn--clay,    .section--dark a.btn--clay:hover { color: #fff; }
.section--dark a.btn--ok, .section--dark a.btn--ok:hover { color: #000; }

.btn--lg { padding: 1.05rem 2rem; min-height: 54px; font-size: 1rem; }
.btn--block { width: 100%; }

/* Enlace con flecha */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}
.arrow-link i { transition: transform var(--dur) var(--ease); font-size: 0.78em; }
.arrow-link:hover i { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   6. Salto al contenido
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 2000;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 1rem; color: #fff; }

/* --------------------------------------------------------------------------
   7. Cabecera
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: rgba(255,255,255,0.88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.site-header[data-scrolled="true"] { border-bottom-color: var(--line); }

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brand img { height: 30px; width: auto; filter: invert(1); }

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 1.9rem); }
.site-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding-block: 0.4rem;
  border-bottom: 1.5px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--clay); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--clay); }
/* Kit Digital destacado en verde, como en la versión original */
.site-nav a.nav-kit { color: var(--ok); font-weight: 600; }
.site-nav a.nav-kit:hover { color: #18603c; border-bottom-color: var(--ok); }
/* El botón del nav no debe heredar el color de enlace de la barra */
.site-nav a.btn { border-bottom: none; padding-block: 0.7rem; }
.site-nav a.btn--primary,
.site-nav a.btn--primary:hover { color: #fff; }
.site-nav a.btn--ghost { color: var(--ink); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  touch-action: manipulation;
}
.nav-toggle:hover { background: var(--paper-2); }
.nav-toggle__bars { display: block; width: 18px; height: 11px; position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.nav-toggle__bars::before { top: 0; }
.nav-toggle__bars::after  { bottom: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(4.75px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after  { transform: translateY(-4.75px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 999;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem clamp(1.25rem, 5vw, 2.5rem) 1.5rem;
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
  display: block;
  padding: 0.95rem 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.mobile-nav a:last-of-type { border-bottom: none; }
.mobile-nav a.nav-kit { color: var(--ok); font-weight: 600; }
.mobile-nav a.btn { margin-top: 1.1rem; width: 100%; border-bottom: none; }
.mobile-nav a.btn--primary,
.mobile-nav a.btn--primary:hover { color: #fff; }

@media (max-width: 900px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
}

/* --------------------------------------------------------------------------
   8. Pie
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--dark);
  color: var(--dark-text);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
  font-size: 0.9rem;
}
.site-footer a { color: var(--dark-text); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line-dark);
}
.footer-brand img { height: 28px; width: auto; margin-bottom: 0.9rem; }
.footer-brand p { max-width: 34ch; line-height: 1.7; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.6rem;
  align-items: center;
  max-width: 640px;
}
.footer-links a { font-size: 0.86rem; }

.footer-zones {
  padding-block: 2rem;
  border-bottom: 1px solid var(--line-dark);
  font-size: 0.82rem;
  line-height: 2.1;
  color: var(--dark-muted);
}
.footer-zones strong { color: #8b96a3; font-weight: 600; margin-right: 0.4rem; }
.footer-zones a { white-space: nowrap; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 2rem;
  font-size: 0.82rem;
  color: var(--dark-muted);
}
.footer-social { display: flex; gap: 0.6rem; }
.footer-social a {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.footer-social a:hover { border-color: #fff; background: rgba(255,255,255,0.06); text-decoration: none; }

@media (max-width: 760px) {
  .footer-top { flex-direction: column; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   9. Botón flotante de WhatsApp
   -------------------------------------------------------------------------- */
.wa-float {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  background: #1f7a4d;
  color: #fff;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(18,22,28,0.18);
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.wa-float:hover { background: #18603c; color: #fff; transform: translateY(-2px); }
.wa-float i { font-size: 1.15rem; }
@media (max-width: 560px) {
  .wa-float span { display: none; }
  .wa-float { padding: 0.9rem; }
  .wa-float i { font-size: 1.35rem; }
}

/* --------------------------------------------------------------------------
   10. Aviso de cookies
   -------------------------------------------------------------------------- */
.cookie-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 1500;
  background: var(--ink);
  color: var(--dark-text);
  padding: 1rem clamp(1.25rem, 5vw, 2.5rem) max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-dark);
}
.cookie-bar[hidden] { display: none; }
.cookie-bar__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.cookie-bar p { font-size: 0.86rem; line-height: 1.6; flex: 1; min-width: 260px; }
.cookie-bar a { color: var(--brand-light); }
.cookie-bar__btns { display: flex; gap: 0.6rem; flex-shrink: 0; }
.cookie-bar .btn { min-height: 42px; padding: 0.6rem 1.2rem; font-size: 0.88rem; }
.cookie-bar .btn--ghost { color: #fff; border-color: rgba(255,255,255,0.28); }
.cookie-bar .btn--ghost:hover { background: rgba(255,255,255,0.08); border-color: #fff; }

/* --------------------------------------------------------------------------
   11. Aparición al hacer scroll

   Se oculta SOLO si JavaScript está activo (clase .js en <html>). Sin JS el
   contenido se ve entero: nunca una página en blanco por un script que falla.
   -------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 520ms var(--ease), transform 520ms var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
}
