/* =====================================================
   ARCHIVO GENERAL SAN JUAN — home.css
   Estilos exclusivos de la pantalla Home (home.html).
   Requiere shared.css cargado antes.
   ===================================================== */

/* ─── HOME page wrapper ──────────────────────────────────────────────── */
.pg-home {
  flex: 1;
  display: block;
}

/* ─── Hero ───────────────────────────────────────────────────────────── */
.home-hero {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 72px;
  position: relative;
  background:
    linear-gradient(180deg, oklch(99% 0.005 70 / 0.88) 0%, oklch(97% 0.01 60 / 0.82) 100%),
    image-set(
      url('../assets/cabecera-naranja.webp') type('image/webp'),
      url('../assets/cabecera-naranja.jpg')  type('image/jpeg')
    ) center / cover no-repeat;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, oklch(98.5% 0.01 70) 100%);
  pointer-events: none;
}

.hero-h1 {
  font-family: var(--fu);
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 700;
  color: var(--ct);
  line-height: 1.16;
  letter-spacing: -0.5px;
  max-width: 32ch;
  margin-bottom: 20px;
  position: relative;
  text-wrap: balance;
}

.hero-h1 .accent { color: var(--cp-act); }

.hero-h2 {
  font-family: var(--fb);
  font-size: clamp(16px, 2vw, 18px);
  color: var(--ct2);
  line-height: 1.65;
  max-width: 52ch;
  margin-bottom: 4px;
  position: relative;
}

.home-search-wrap {
  width: 100%;
  max-width: 620px;
  position: relative;
}

/* Override search pill inside hero */
.home-hero .search-pill {
  background: var(--csurf);
  box-shadow: 0 2px 12px oklch(0% 0 0 / 0.1), 0 8px 24px oklch(0% 0 0 / 0.08);
}

.home-hero .search-pill:focus-within {
  box-shadow: 0 4px 16px oklch(0% 0 0 / 0.14), 0 10px 32px oklch(0% 0 0 / 0.1);
}

/* ─── Hero: chips de contexto ────────────────────────────────────────── */
.hero-chips-wrap {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin-top: 0;
  margin-bottom: 24px;
  position: relative;
  flex-wrap: wrap;
}

.segmented-buttons {
  display: flex;
  border-radius: 9999px;
  border: 1.5px solid var(--cbrd2);
  background: var(--csurf);
  overflow: hidden;
}

.seg-btn {
  font-family: var(--fu);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--ct2);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.seg-btn:hover {
  color: var(--ct);
  background: var(--cmuted);
}

.seg-btn.active {
  background: var(--cp);
  color: oklch(100% 0 0);
  font-weight: 600;
}

.seg-btn.active:hover { background: var(--cp-dk); }

.seg-div {
  width: 1px;
  background: var(--cbrd2);
}

.action-chip {
  font-family: var(--fu);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px 8px 20px;
  border-radius: 9999px;
  border: 1.5px solid var(--cbrd2);
  background: var(--csurf);
  color: var(--cp-dk);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 44px;
}

.action-chip:hover {
  border-color: var(--cp);
  background: oklch(from var(--cp) l c h / 0.04);
}

.action-chip.active {
  border-color: var(--cp);
  background: oklch(from var(--cp) l c h / 0.1);
  color: var(--cp-dk);
}

.action-chip svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.revistas-cta-wrap {
  width: 100%;
  max-width: 620px;
  position: relative;
  text-align: center;
  display: none;
}

.btn-large-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--fu);
  font-size: 16px;
  font-weight: 700;
  color: var(--cton);
  background: var(--cp);
  border: none;
  border-radius: 9999px;
  padding: 14px 32px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  box-shadow: 0 4px 12px oklch(from var(--cp) l c h / 0.2);
}

.btn-large-cta:hover {
  background: var(--cp-dk);
  transform: translateY(-1px);
}

.btn-large-cta svg {
  width: 18px;
  height: 18px;
}

.hero-periodo {
  font-family: var(--fu);
  font-size: 13px;
  color: var(--ct3);
  margin-top: 16px;
  margin-bottom: 20px;
  position: relative;
  min-height: 1.2em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hero-periodo svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
  flex-shrink: 0;
}

/* ─── Revistas link en hero ──────────────────────────────────────────── */
.hero-revistas-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.hero-revistas-wrap .hero-revistas-label {
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ct3);
  margin-right: 0;
  white-space: nowrap;
}

.hero-revistas-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0;
  font-family: var(--fu);
  font-size: 13px;
  font-weight: 600;
  color: var(--ct3);
  text-decoration: none;
  padding: 6px 14px 6px 16px;
  min-height: 44px;
  border-radius: 9999px;
  border: 1.5px solid var(--cbrd2);
  background: var(--csurf);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  position: relative;
}

.hero-revistas-link:hover {
  border-color: var(--cp);
  color: var(--cp-dk);
  background: oklch(from var(--cp) l c h / 0.04);
}

.hero-revistas-link svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}


/* ─── Banner Destacado — M3 Snackbar inline ───────────────────────── */
.destacado-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: oklch(from var(--cp) l c h / 0.08);
  border-radius: 4px;
  padding: 12px 16px 12px 14px;
  width: 100%;
  max-width: 620px;
  margin-bottom: 20px;
}

.destacado-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cp-dk);
  margin-top: 1px;
  flex-shrink: 0;
}

.destacado-icon svg {
  width: 18px;
  height: 18px;
}

.destacado-text {
  font-family: var(--fu);
  font-size: 13.5px;
  color: var(--ct);
  line-height: 1.5;
  letter-spacing: 0.1px;
  flex: 1;
  min-width: 0;
  margin: 0;
}

.destacado-badge {
  display: inline-flex;
  font-family: var(--fu);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--cton);
  background: var(--cp);
  padding: 1px 7px;
  border-radius: 3px;
  line-height: 1.7;
  vertical-align: 2px;
  margin-right: 5px;
}

.destacado-link {
  font-family: var(--fu);
  font-size: 13px;
  font-weight: 600;
  color: var(--cp-act);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  min-height: 44px;
  border-radius: 4px;
  letter-spacing: 0.1px;
  align-self: center;
  position: relative;
  overflow: hidden;
  transition: color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.destacado-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cton);
  opacity: 0;
  transition: opacity 0.15s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

.destacado-link:hover::after  { opacity: 0.08; }
.destacado-link:active::after { opacity: 0.12; }
.destacado-link:focus-visible { outline: 2px solid var(--cp-act); outline-offset: 2px; }

.destacado-link svg {
  width: 13px;
  height: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .destacado-link,
  .destacado-link::after { transition: none; }
}

/* ─── Context chips (hero) ───────────────────────────────────────────── */
.hero-context-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: 100%;
  max-width: 620px;
  margin-top: 14px;
  position: relative;
}

.hero-context-chips.visible { display: flex; }

.context-chip-label {
  font-family: var(--fu);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ct3);
}

.context-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px 10px 16px;
  border-radius: 9999px;
  border: 1.5px solid var(--cbrd2);
  background: var(--csurf);
  color: var(--cp-dk);
  font-family: var(--fu);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  min-height: 44px;
}

.context-chip-btn:hover {
  border-color: var(--cp);
  background: oklch(from var(--cp) l c h / 0.04);
}

.context-chip-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ─── Skeleton loading ───────────────────────────────────────────────── */
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.skel {
  border-radius: 4px;
  background: var(--cmuted);
  position: relative;
  overflow: hidden;
}

.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      transparent 0%,
      oklch(93% 0.008 70 / 0.8) 50%,
      transparent 100%);
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ─── Sección base ───────────────────────────────────────────────────── */
.home-section {
  padding: 80px 24px;
  background: var(--cbg);
}

.home-section--white  { background: var(--csurf); }
.home-section--muted  { background: var(--cmuted); }

.section-inner {
  max-width: 1060px;
  margin: 0 auto;
}

.sec-label {
  font-family: var(--fu);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cp-dk);
  margin-bottom: 8px;
}

.sec-title {
  font-family: var(--fu);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--ct);
  margin-bottom: 12px;
  line-height: 1.2;
}

.sec-sub {
  font-family: var(--fb);
  font-size: 16px;
  color: var(--ct2);
  line-height: 1.75;
  margin-bottom: 44px;
}

/* ─── Institución (2 col) ────────────────────────────────────────────── */
.inst-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 64px;
  align-items: start;
}

.inst-body {
  font-family: var(--fb);
  font-size: 16px;
  color: var(--ct2);
  line-height: 1.8;
  margin-bottom: 28px;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--fu);
  font-size: 14px;
  font-weight: 700;
  color: var(--cp-dk);
  text-decoration: none;
  transition: color 0.15s, gap 0.15s;
}

.cta-link:hover {
  color: var(--cp-act);
  gap: 10px;
}

.cta-link svg {
  width: 14px;
  height: 14px;
}

.inst-stats-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--cbrd);
  border-radius: 14px;
  overflow: hidden;
}

.inst-stat {
  background: var(--csurf);
  padding: 24px 28px;
}

.inst-stat:first-child { border-radius: 14px 14px 0 0; }
.inst-stat:last-child  { border-radius: 0 0 14px 14px; }

.inst-stat-num {
  font-family: var(--fu);
  font-size: 36px;
  font-weight: 700;
  color: var(--cp-dk);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

.inst-stat-lbl {
  font-family: var(--fb);
  font-size: 13px;
  color: var(--ct3);
  line-height: 1.4;
}

/* ─── Servicios — 3 Pilares M3 ───────────────────────────────────────── */
.svc-pillars {
  display: flex;
  flex-direction: column;
  gap: var(--gsj-space-4);
  padding: var(--gsj-space-10) var(--gsj-container-pad) 0;
  max-width: calc(1060px + 48px);
  margin-inline: auto;
}

.pilar {
  border-radius: var(--gsj-radius-xl);
  overflow: hidden;
}

.pilar--tramites { background: var(--gsj-color-primary-container); }
.pilar--cultura  { background: var(--gsj-color-secondary-container); }
.pilar--sipar    { background: var(--gsj-color-bg-muted); }

.pilar__body {
  display: grid;
  grid-template-columns: 55fr 45fr;
  min-height: 320px;
}

.pilar__content {
  padding: var(--gsj-space-8);
  display: flex;
  flex-direction: column;
  gap: var(--gsj-space-6);
}

.pilar__media { overflow: hidden; }
.pilar__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pilar__header {
  display: flex;
  align-items: center;
  gap: var(--gsj-space-4);
}

.pilar__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--gsj-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pilar--tramites .pilar__icon,
.pilar--sipar    .pilar__icon {
  background: var(--gsj-color-primary);
  color: var(--gsj-color-on-primary);
}

.pilar--cultura .pilar__icon {
  background: var(--gsj-color-accent);
  color: oklch(19.2% 0 0);
}

.pilar__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pilar__label {
  font-family: var(--gsj-font-heading);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gsj-color-primary-text);
}

.pilar__name {
  font-family: var(--gsj-font-heading);
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 700;
  color: var(--gsj-color-text);
  line-height: var(--gsj-line-height-snug);
  margin: 0;
}

.pilar__services {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--gsj-space-8);
  flex: 1;
}

.pilar__service-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--gsj-space-3) 0;
  border-top: 1px solid var(--gsj-color-border);
}

.pilar__service-title {
  font-family: var(--gsj-font-heading);
  font-size: var(--gsj-font-size-subheadline);
  font-weight: var(--gsj-font-weight-semibold);
  color: var(--gsj-color-text);
  line-height: var(--gsj-line-height-snug);
}

.pilar__service-desc {
  font-family: var(--gsj-font-body);
  font-size: var(--gsj-font-size-footnote);
  color: var(--gsj-color-text-secondary);
  line-height: var(--gsj-line-height-normal);
}

.pilar__cta {
  display: flex;
  align-items: center;
  gap: var(--gsj-space-4);
  flex-wrap: wrap;
}

.pilar__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gsj-space-2);
  font-family: var(--gsj-font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--gsj-color-on-primary);
  background: var(--gsj-color-primary);
  text-decoration: none;
  border-radius: var(--gsj-radius-full);
  padding: 10px 24px;
  min-height: 44px;
  transition: background var(--gsj-duration-fast) var(--gsj-ease-standard);
}

.pilar__btn:hover { background: var(--gsj-color-primary-hover); }

.pilar__btn:focus-visible {
  outline: 3px solid oklch(from var(--gsj-color-primary) l c h / 0.65);
  outline-offset: 2px;
}

.pilar__btn svg { flex-shrink: 0; }

.pilar__btn-secondary {
  display: inline-flex;
  align-items: center;
  font-family: var(--gsj-font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--gsj-color-primary-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 0;
  min-height: 44px;
  transition: color var(--gsj-duration-fast) var(--gsj-ease-standard);
}

.pilar__btn-secondary:hover { color: var(--gsj-color-primary-active); }

.pilar__btn-secondary:focus-visible {
  outline: 3px solid oklch(from var(--gsj-color-primary) l c h / 0.65);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (max-width: 720px) {
  .pilar__body { grid-template-columns: 1fr; }
  .pilar__media { order: -1; min-height: 200px; aspect-ratio: 16 / 7; }
  .pilar__services { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .pilar { border-radius: var(--gsj-radius-lg); }
  .pilar__content { padding: var(--gsj-space-6); }
}

/* ─── Z-Pattern estructura ───────────────────────────────────────────── */
.z-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 3px;
}

.z-row:first-child .z-text  { border-radius: 14px 0 0 0; }
.z-row:first-child .z-visual { border-radius: 0 14px 0 0; }
.z-row:last-child  .z-text  { border-radius: 0 0 14px 0; }
.z-row:last-child  .z-visual { border-radius: 0 0 0 14px; }

.z-row.flip .z-text   { order: 2; border-radius: 0; }
.z-row.flip .z-visual { order: 1; border-radius: 0; }

.z-row:first-child.flip .z-text   { border-radius: 0 14px 0 0; }
.z-row:first-child.flip .z-visual { border-radius: 14px 0 0 0; }
.z-row:last-child.flip  .z-text   { border-radius: 0 0 0 14px; }
.z-row:last-child.flip  .z-visual { border-radius: 0 0 14px 0; }

.z-text {
  background: var(--csurf);
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.z-dept-num {
  font-family: var(--fu);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cp-dk);
  margin-bottom: 10px;
}

.z-dept-title {
  font-family: var(--fu);
  font-size: 18px;
  font-weight: 700;
  color: var(--ct);
  margin-bottom: 12px;
  line-height: 1.25;
}

.z-dept-desc {
  font-family: var(--fb);
  font-size: 16px;
  color: var(--ct2);
  line-height: 1.75;
}

.z-visual {
  background: var(--cmuted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 8px;
  text-align: center;
  min-height: 200px;
}

.z-visual-num {
  font-family: var(--fu);
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 700;
  color: var(--cp-dk);
  letter-spacing: -2px;
  line-height: 1;
}

.z-visual-lbl {
  font-family: var(--fb);
  font-size: 13px;
  color: var(--ct3);
  line-height: 1.4;
}

.z-visual-icon {
  color: var(--cp);
  opacity: 0.25;
}

.z-visual-icon svg {
  width: 56px;
  height: 56px;
}

/* Contenedor del bloque Z completo */
.z-container {
  max-width: 1060px;
  margin: 32px auto 0;
  border-radius: 14px;
  overflow: hidden;
}

/* Número más pequeño (Dto. 02 — "1991") */
.z-visual-num--sm {
  font-size: clamp(32px, 4vw, 52px);
}

/* Label descriptivo largo (Secretaría Técnica) */
.z-visual-lbl--coord {
  font-size: 15px;
  color: var(--ct2);
  max-width: 16ch;
}


/* ─── FAQ Acordeón ───────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  max-width: 780px;
}

.faq-item { border-bottom: 1px solid var(--cbrd); }
.faq-item:first-child { border-top: 1px solid var(--cbrd); }

.faq-q {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  gap: 16px;
  font-family: var(--fu);
  font-size: 16px;
  font-weight: 600;
  color: var(--ct);
  text-align: left;
  transition: color 0.15s;
}

.faq-q:hover { color: var(--cp-dk); }

.faq-q svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ct3);
  transition: transform 0.25s var(--ease), color 0.15s;
}

.faq-item.open .faq-q svg {
  transform: rotate(45deg);
  color: var(--cp-dk);
}

.faq-item.open .faq-q { color: var(--cp-dk); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
}

.faq-item.open .faq-a { max-height: 600px; }

.faq-a-inner {
  font-family: var(--fb);
  font-size: 16px;
  color: var(--ct2);
  line-height: 1.75;
  padding-bottom: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .skel::after { animation: none; }
}

/* ─── Responsive home ────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .inst-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .inst-stats-col {
    flex-direction: row;
    gap: 0;
  }

  .inst-stat { flex: 1; }
  .inst-stat:first-child { border-radius: 14px 0 0 14px; }
  .inst-stat:last-child  { border-radius: 0 14px 14px 0; }

  .svc-item { grid-template-columns: 40px 1fr; }

  .z-row,
  .z-row.flip { grid-template-columns: 1fr; }

  .z-row .z-visual,
  .z-row.flip .z-visual { order: unset; }

  .z-row .z-text,
  .z-row.flip .z-text { order: unset; border-radius: 0 !important; }

  .z-row .z-visual,
  .z-row.flip .z-visual { border-radius: 0 !important; }

  .z-row:first-child .z-text   { border-radius: 14px 14px 0 0 !important; }
  .z-row:last-child  .z-visual { border-radius: 0 0 14px 14px !important; }
}

@media (max-width: 480px) {
  .inst-stats-col {
    flex-direction: column;
    gap: 2px;
  }

  .inst-stat { flex: unset; }
  .inst-stat:first-child { border-radius: 14px 14px 0 0; }
  .inst-stat:last-child  { border-radius: 0 0 14px 14px; }
}

@media (max-width: 560px) {
  .svc-item.svc-hidden { display: none; }

  .services-more-btn { display: block; }

  .hero-h1 { max-width: 100%; }
}
