/* =================================================================
   TEJIDO SOCIAL EMPRESARIAL — TSE
   Sistema de diseño GLOBAL ÚNICO para todo el sitio.
   Reutilizable para HOME + páginas internas + páginas territoriales.
   ================================================================= */

/* ---------- 1. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- 2. VARIABLES ---------- */
:root {
  /* Colores institucionales */
  --azul-inst: #062D6A;
  --azul-tse: #0077E8;
  --cian-tse: #00C9F4;
  --blanco: #FFFFFF;
  --gris-fondo: #F5F8FC;
  --gris-borde: #E3EAF3;
  --texto: #0F172A;
  --texto-suave: #475569;
  --amarillo-acento: #FFC72C;
  --rojo-acento: #E63946;

  /* Tipografía */
  --font-heading: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  /* Radios */
  --radio-sm: 8px;
  --radio-md: 14px;
  --radio-lg: 22px;
  --radio-pill: 999px;

  /* Sombras */
  --sombra-sm: 0 1px 2px rgba(6,45,106,.06), 0 1px 3px rgba(6,45,106,.05);
  --sombra-md: 0 6px 18px rgba(6,45,106,.08);
  --sombra-lg: 0 18px 40px rgba(6,45,106,.12);

  /* Espaciado */
  --sp-1: .5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-5: 3rem;
  --sp-6: 4rem;

  /* Transiciones */
  --t-fast: .18s ease;
  --t-base: .28s ease;
  --t-slow: .5s ease;

  /* Layout */
  --container: 1200px;
  --header-h: 72px;
}

/* ---------- 3. BASE ---------- */
html, body { background: var(--blanco); }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto);
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--azul-inst); line-height: 1.15; letter-spacing: -.01em; }
p { color: var(--texto-suave); }
a:hover { color: var(--azul-tse); }

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

.skip-link {
  position: absolute; top: -100px; left: 12px; z-index: 9999;
  background: var(--azul-inst); color: #fff; padding: 10px 16px;
  border-radius: var(--radio-sm); font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- 4. LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}
.section { padding: 64px 0; }
.section-soft { background: var(--gris-fondo); }

/* ---------- 5. TIPOGRAFÍA ---------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--azul-tse);
  margin-bottom: var(--sp-2);
}
.section-head { max-width: 780px; margin-bottom: var(--sp-5); }
.section-title { font-size: clamp(1.6rem, 4.5vw, 2.4rem); margin-bottom: var(--sp-2); }
.section-subtitle { font-size: 1.05rem; color: var(--texto-suave); }
.text-gradient {
  background: linear-gradient(90deg, var(--azul-tse), var(--cian-tse));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 6. BOTONES ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 12px 22px;
  border-radius: var(--radio-pill);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .95rem;
  line-height: 1;
  transition: transform var(--t-fast), box-shadow var(--t-base), background var(--t-base), color var(--t-base);
  min-height: 44px;
  text-align: center;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--azul-tse), var(--azul-inst));
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,119,232,.28);
}
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,119,232,.35); }
.btn-secondary {
  background: #fff;
  color: var(--azul-inst);
  border: 2px solid var(--gris-borde);
}
.btn-secondary:hover { border-color: var(--azul-tse); color: var(--azul-tse); transform: translateY(-2px); }
.btn-lg { padding: 15px 28px; font-size: 1rem; }
.btn-xl { padding: 18px 36px; font-size: 1.1rem; }

/* ---------- 7. HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #FFFFFF;
  border-bottom: 1px solid transparent;
  transition: box-shadow var(--t-base), border-color var(--t-base), height var(--t-base);
  height: var(--header-h);
}
.site-header.is-scrolled {
  box-shadow: 0 4px 20px rgba(6,45,106,.07);
  border-bottom-color: var(--gris-borde);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.header-logo img { height: 42px; width: auto; transition: opacity var(--t-base), transform var(--t-base); }
.header-logo:hover img { transform: translateY(-1px); }

.main-nav { display: flex; align-items: center; gap: var(--sp-3); }
.nav-list { display: none; gap: var(--sp-3); }
.nav-link {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .92rem;
  color: var(--azul-inst);
  position: relative;
  padding: 6px 0;
  transition: color var(--t-fast);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--azul-tse), var(--cian-tse));
  transition: width var(--t-base);
}
.nav-link:hover::after, .nav-link.is-active::after { width: 100%; }
.nav-link.is-active { color: var(--azul-tse); }

.nav-cta { display: none; }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  border-radius: var(--radio-sm);
  padding: 0 10px;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--azul-inst);
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) 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(-7px) rotate(-45deg); }

/* Menú móvil */
@media (max-width: 899px) {
  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 4px;
    transform: translateY(-110%);
    transition: transform var(--t-base);
    box-shadow: var(--sombra-md);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .main-nav.is-open { transform: translateY(0); }
  .nav-list { display: flex; flex-direction: column; gap: 4px; }
  .nav-link { padding: 14px 8px; font-size: 1rem; border-bottom: 1px solid var(--gris-borde); }
  .nav-link::after { display: none; }
  .nav-cta { display: inline-flex; margin-top: 12px; width: 100%; }
}

/* ---------- 8. HERO ---------- */
.hero { padding-top: 40px; padding-bottom: 56px; }
.hero-grid { display: grid; gap: var(--sp-4); align-items: center; }
.hero-title { font-size: clamp(1.85rem, 7vw, 3.4rem); margin-bottom: var(--sp-2); }
.hero-text { font-size: 1.05rem; margin-bottom: var(--sp-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: var(--sp-2); }
.hero-microcopy { font-size: .9rem; color: var(--texto-suave); }
.hero-media { position: relative; }
.hero-img {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radio-lg);
  box-shadow: var(--sombra-lg);
}
.hero-media::before {
  content: "";
  position: absolute;
  inset: -12px -12px auto auto;
  width: 42%; height: 42%;
  background: radial-gradient(circle at top right, rgba(0,201,244,.28), transparent 70%);
  border-radius: var(--radio-lg);
  z-index: -1;
}

/* ---------- 9. PILARES ---------- */
.pillars-grid { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
.pillar {
  background: #fff;
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio-md);
  padding: 24px;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.pillar:hover { transform: translateY(-4px); box-shadow: var(--sombra-md); border-color: rgba(0,119,232,.25); }
.pillar-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(0,119,232,.08);
  color: var(--azul-tse);
  margin-bottom: 14px;
}
.pillar-icon svg { width: 24px; height: 24px; }
.pillar-title { font-size: 1.1rem; margin-bottom: 6px; }
.pillar-text { font-size: .95rem; }

/* ---------- 10. CARDS BENEFICIOS ---------- */
.cards-grid { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
.card {
  background: #fff;
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio-md);
  padding: 22px;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sombra-md); border-color: rgba(0,119,232,.25); }
.card-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,119,232,.1), rgba(0,201,244,.12));
  color: var(--azul-tse);
  margin-bottom: 14px;
}
.card-icon svg { width: 24px; height: 24px; }
.card-title { font-size: 1.05rem; margin-bottom: 6px; }
.card-text { font-size: .93rem; }

/* ---------- 11. SERVICIOS ---------- */
.services-grid { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
.service {
  background: #fff;
  border-radius: var(--radio-md);
  padding: 26px;
  border-left: 4px solid var(--azul-tse);
  box-shadow: var(--sombra-sm);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.service:hover { transform: translateY(-4px); box-shadow: var(--sombra-md); }
.service-icon { color: var(--azul-tse); margin-bottom: 12px; }
.service-icon svg { width: 28px; height: 28px; }
.service-title { font-size: 1.1rem; margin-bottom: 6px; }
.service-text { font-size: .95rem; }

/* ---------- 12. RECURSOS ---------- */
.resources-grid { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
.resource {
  background: #fff;
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio-md);
  padding: 20px;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.resource:hover { transform: translateY(-4px); box-shadow: var(--sombra-md); }
.resource-cover {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--azul-inst), var(--azul-tse) 55%, var(--cian-tse));
  border-radius: var(--radio-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: #fff;
}
.resource-cover span {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: .04em;
}
.resource-title { font-size: 1rem; margin-bottom: 10px; }
.resource-link {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .9rem;
  color: var(--azul-tse);
  display: inline-flex; align-items: center; gap: 6px;
}
.resource-link::after { content: "→"; transition: transform var(--t-fast); }
.resource-link:hover::after { transform: translateX(4px); }

/* ---------- 13. TERRITORIOS ---------- */
.section-territorios {
  background: linear-gradient(180deg, #fff 0%, var(--gris-fondo) 100%);
}
.territorios-search { position: relative; max-width: 560px; margin-bottom: var(--sp-3); }
.territorios-input {
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radio-pill);
  border: 2px solid var(--gris-borde);
  background: #fff;
  font-size: 1rem;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.territorios-input:focus {
  outline: none;
  border-color: var(--azul-tse);
  box-shadow: 0 0 0 4px rgba(0,119,232,.12);
}
.territorios-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio-md);
  box-shadow: var(--sombra-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 20;
}
.territorios-suggestions li a {
  display: block;
  padding: 12px 18px;
  font-size: .95rem;
  border-bottom: 1px solid var(--gris-borde);
  transition: background var(--t-fast);
}
.territorios-suggestions li:last-child a { border-bottom: 0; }
.territorios-suggestions li a:hover { background: var(--gris-fondo); }

.territorios-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.territorio-chip {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radio-pill);
  background: #fff;
  border: 1px solid var(--gris-borde);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .9rem;
  color: var(--azul-inst);
  transition: transform var(--t-fast), border-color var(--t-base), color var(--t-base), box-shadow var(--t-base);
}
.territorio-chip:hover {
  transform: translateY(-2px);
  border-color: var(--azul-tse);
  color: var(--azul-tse);
  box-shadow: var(--sombra-sm);
}

/* ---------- 14. COMUNIDAD ---------- */
.section-comunidad { background: #fff; }
.comunidad-grid { display: grid; gap: var(--sp-4); align-items: center; }
.comunidad-list {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: var(--sp-3) 0;
}
.comunidad-list li {
  background: rgba(0,119,232,.08);
  color: var(--azul-inst);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .85rem;
  padding: 8px 14px;
  border-radius: var(--radio-pill);
}
.comunidad-img {
  width: 100%;
  aspect-ratio: 5/4;
  object-fit: cover;
  border-radius: var(--radio-lg);
  box-shadow: var(--sombra-lg);
}

/* ---------- 15. CTA FINAL ---------- */
.section-cta-final {
  background: linear-gradient(135deg, var(--azul-inst) 0%, var(--azul-tse) 100%);
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.section-cta-final::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 60%; height: 120%;
  background: radial-gradient(circle at center, rgba(0,201,244,.35), transparent 65%);
  pointer-events: none;
}
.cta-final-inner { position: relative; z-index: 1; max-width: 780px; margin-inline: auto; }
.cta-final-title { color: #fff; font-size: clamp(1.6rem, 5vw, 2.6rem); margin-bottom: var(--sp-2); }
.cta-final-text { color: rgba(255,255,255,.92); font-size: 1.05rem; margin-bottom: var(--sp-3); }
.section-cta-final .btn-primary {
  background: #fff;
  color: var(--azul-inst);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
}
.section-cta-final .btn-primary:hover { color: var(--azul-tse); }
.cta-final-microcopy { color: rgba(255,255,255,.85); font-size: .9rem; margin-top: var(--sp-2); }

/* ---------- 16. FOOTER ---------- */
.site-footer {
  background: var(--azul-inst);
  color: #fff;
  padding: var(--sp-5) 0 0;
}
.footer-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
.footer-logo-wrap {
  display: inline-block;
  background: #fff;
  padding: 10px 16px;
  border-radius: var(--radio-md);
  margin-bottom: var(--sp-2);
}
.footer-logo-wrap img { height: 40px; width: auto; }
.footer-desc { color: rgba(255,255,255,.8); font-size: .95rem; max-width: 340px; }
.footer-title {
  color: #fff;
  font-size: .95rem;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}
.footer-nav ul, .footer-contact ul, .footer-legal ul { display: flex; flex-direction: column; gap: 8px; }
.footer-nav a, .footer-contact a, .footer-legal a {
  color: rgba(255,255,255,.78);
  font-size: .95rem;
  transition: color var(--t-fast);
}
.footer-nav a:hover, .footer-contact a:hover, .footer-legal a:hover { color: var(--cian-tse); }
.footer-bottom {
  margin-top: var(--sp-4);
  border-top: 1px solid rgba(255,255,255,.15);
  padding: var(--sp-2) 0;
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  text-align: center;
}

/* ---------- 17. WHATSAPP ---------- */
.whatsapp-float {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  z-index: 900;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.whatsapp-float svg { width: 28px; height: 28px; }
.whatsapp-float:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 30px rgba(0,0,0,.28); }

/* ---------- 18. REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- 19. PAGE INTERNAS (preparación) ---------- */
.page-hero {
  padding: 48px 0 32px;
  background: linear-gradient(180deg, var(--gris-fondo), #fff);
}
.page-hero h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); margin-bottom: var(--sp-2); }
.page-hero p { max-width: 720px; }

.breadcrumbs { font-size: .85rem; color: var(--texto-suave); margin-bottom: var(--sp-2); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li::after { content: "/"; margin-left: 6px; color: var(--gris-borde); }
.breadcrumbs li:last-child::after { display: none; }
.breadcrumbs a:hover { color: var(--azul-tse); }

.content-block { max-width: 780px; margin-inline: auto; }
.content-block h2 { margin: var(--sp-3) 0 var(--sp-2); }
.content-block h3 { margin: var(--sp-3) 0 var(--sp-1); }
.content-block p { margin-bottom: var(--sp-2); }
.content-block ul { list-style: disc; padding-left: 1.4rem; margin-bottom: var(--sp-2); }
.content-block li { margin-bottom: 6px; color: var(--texto-suave); }

.grid-2 { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }

/* ---------- 20. RESPONSIVE ---------- */
@media (min-width: 560px) {
  .cards-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .resources-grid { grid-template-columns: repeat(2, 1fr); }
  .pillars-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .section { padding: 84px 0; }
  .container { padding-inline: 32px; }
  .hero { padding-top: 56px; padding-bottom: 84px; }
  .hero-grid { grid-template-columns: 1.05fr .95fr; gap: var(--sp-5); }
  .hero-actions { flex-wrap: nowrap; }
  .cards-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: repeat(3, 1fr); }
  .resources-grid { grid-template-columns: repeat(4, 1fr); }
  .pillars-grid { grid-template-columns: repeat(4, 1fr); }
  .comunidad-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav-list { display: flex; }
  .nav-cta { display: inline-flex; }
  .main-nav { position: static; transform: none; box-shadow: none; padding: 0; background: transparent; flex-direction: row; }
}

@media (min-width: 1024px) {
  .container { padding-inline: 40px; }
  .cards-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 21. ACCESIBILIDAD / MOVIMIENTO ---------- */
:focus-visible {
  outline: 3px solid var(--cian-tse);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}