/* ===================== BASE ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--color-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
.container { width: min(100% - 2.4rem, var(--container)); margin-inline: auto; }
.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: .16em; font-size: .72rem;
  font-weight: 700; color: var(--color-accent); margin: 0 0 .6rem;
}
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding: .7rem 1.3rem; border-radius: var(--radius);
  background: var(--color-primary); color: #fff; border: 0; cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--color-primary); border: 1.5px solid currentColor; }
.btn--ghost:hover { background: var(--primary-soft); }
.btn--accent { background: var(--color-accent); }
.btn--accent:hover { background: color-mix(in srgb, var(--color-accent) 82%, #000); }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* ===================== TOP BAR ===================== */
.gov-bar {
  background: var(--color-secondary); color: #fff; font-size: .8rem;
}
.gov-bar .container { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: 1rem; }
.gov-bar a { color: #fff; opacity: .9; }
.gov-social { display: flex; gap: .9rem; }

/* ===================== HEADER ===================== */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.site-header .container { display: flex; align-items: center; gap: 1.2rem; min-height: 78px; }
.brand { display: flex; align-items: center; gap: .8rem; }
.brand img { height: 48px; width: auto; }
.brand__text { font-family: var(--font-display); font-weight: 700; line-height: 1.05; color: var(--ink-900); font-size: 1.02rem; max-width: 22ch; }
.brand__text span { display: block; font-size: .72rem; font-weight: 500; color: var(--ink-500); letter-spacing: .02em; }
.main-nav { margin-left: auto; display: flex; gap: .3rem; align-items: center; }
.main-nav a {
  font-family: var(--font-display); font-weight: 600; font-size: .92rem;
  color: var(--ink-700); padding: .5rem .8rem; border-radius: var(--radius);
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--color-primary); background: var(--primary-soft); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; margin-left: auto; padding: .4rem; }
.nav-toggle span { display: block; width: 26px; height: 2px; background: var(--ink-900); margin: 5px 0; transition: .2s; }

/* ===================== HERO (signature) ===================== */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% -10%, color-mix(in srgb, var(--color-primary) 16%, transparent), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  border-bottom: 1px solid var(--line);
}
/* Curvas de nivel (tierra colorada) como firma visual, discretas */
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    repeating-radial-gradient(circle at 88% 12%,
      transparent 0 38px,
      color-mix(in srgb, var(--color-accent) 22%, transparent) 38px 39px);
  -webkit-mask-image: linear-gradient(to left, #000, transparent 62%);
          mask-image: linear-gradient(to left, #000, transparent 62%);
}
.hero .container { position: relative; z-index: 1; padding: clamp(3rem, 7vw, 6rem) 0 clamp(2.6rem, 5vw, 4.5rem); max-width: 62ch; }
.hero h1 { font-size: var(--step-fluid-h1); color: var(--ink-900); }
.hero p { font-size: 1.18rem; color: var(--ink-700); max-width: 54ch; margin-bottom: 1.8rem; }
.hero__actions { display: flex; gap: .8rem; flex-wrap: wrap; }

/* ===================== SECCIONES ===================== */
.section { padding: clamp(2.6rem, 5vw, 4.5rem) 0; }
.section--alt { background: var(--paper-2); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.section__head h2 { font-size: var(--step-fluid-h2); margin: 0; }
.section__head p { margin: .4rem 0 0; color: var(--ink-500); max-width: 60ch; }
.section__link { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }

/* ===================== BLOQUE DE VIDEO ===================== */
/* Cuando el video es el primer bloque hace de cabecera: arranca pegado al
   encabezado del sitio y ocupa todo el ancho disponible. */
.section--cabecera { padding-top: clamp(1.2rem, 2.5vw, 2rem); }

.blk-video { max-width: 900px; margin: 0 auto; }
.blk-video--cabecera { max-width: none; position: relative; }
.blk-video video {
  width: 100%; height: auto; display: block;
  background: #000; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}

/* Boton de sonido de la cabecera. El video de portada va sin la barra del
   navegador, asi que este es el unico control que se ofrece: chico, en una
   esquina, para no competir con la imagen. */
.blk-video__sonido {
  position: absolute; right: clamp(.6rem, 1.5vw, 1.1rem); bottom: clamp(.6rem, 1.5vw, 1.1rem);
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .8rem; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .82rem; font-weight: 600; line-height: 1;
  color: #fff; background: rgba(17, 17, 17, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background-color .18s ease, opacity .18s ease;
}
.blk-video__sonido:hover { background: rgba(17, 17, 17, .82); }
/* El foco tiene que verse sobre cualquier fotograma, claro u oscuro. */
.blk-video__sonido:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.blk-video__sonido[hidden] { display: none; }

/* Triangulo/altavoz dibujado con bordes: evita cargar un icono aparte. */
.blk-video__sonido-ico {
  width: 0; height: 0; display: inline-block;
  border-style: solid; border-width: .3rem .5rem .3rem 0;
  border-color: transparent currentColor transparent transparent;
}
/* Con el sonido activo, el altavoz se rellena para que se note el cambio de
   estado sin depender solo del texto. */
.blk-video__sonido[aria-pressed="true"] .blk-video__sonido-ico {
  border-width: .32rem .55rem .32rem 0;
}

@media (max-width: 480px) {
  /* En pantalla chica el texto se come el video: queda solo el icono. */
  .blk-video__sonido-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .blk-video__sonido { padding: .5rem .6rem; }
}

/* El texto que acompana al video, debajo. Ancho de lectura comodo. */
.blk-video__texto { max-width: 68ch; margin: clamp(2rem, 4vw, 3rem) auto 0; }
.blk-video__texto h2 { font-size: var(--step-fluid-h2); margin: 0 0 1rem; }
.blk-video__texto .article__body > *:first-child { margin-top: 0; }
.blk-video__texto .article__body > *:last-child { margin-bottom: 0; }

/* ===================== BLOQUE DE TEXTO LIBRE ===================== */
/* Seccion que el panel deja escribir a mano, con imagen opcional al lado. */
.blk-text { display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
.blk-text .article__body { max-width: 68ch; }
.blk-text img {
  width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.blk-text--img { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.blk-text--img .article__body { max-width: none; }
@media (max-width: 820px) { .blk-text--img { grid-template-columns: 1fr; } }

/* ===================== MENSAJE DEL SUBSECRETARIO ===================== */
/* Cargo completo debajo del nombre, en tono secundario. */
.cargo { margin: -.4rem 0 1.1rem; color: var(--ink-500); font-weight: 500; }
.authority {
  display: grid; grid-template-columns: 300px 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
}
.authority__photo { position: relative; }
.authority__photo img {
  width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.authority__photo::before {
  content: ""; position: absolute; inset: 16px -16px -16px 16px; z-index: -1;
  border-radius: var(--radius-lg); background: var(--primary-soft);
  border: 1.5px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
}
.authority__ph {
  width: 100%; aspect-ratio: 4/5; border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--primary-soft), var(--accent-soft));
  display: grid; place-items: center; color: var(--ink-300); text-align: center;
  font-family: var(--font-display); font-weight: 600; box-shadow: var(--shadow-md); padding: 1rem;
}
.authority blockquote { margin: 0; font-size: 1.24rem; line-height: 1.55; color: var(--ink-900); font-family: var(--font-display); font-weight: 500; }
.authority .sign { margin-top: 1.3rem; }
.authority .sign strong { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.authority .sign span { color: var(--ink-500); font-size: .92rem; }

/* ===================== GRILLAS DE TARJETAS ===================== */
.grid { display: grid; gap: var(--gap); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease; box-shadow: var(--shadow-sm);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); text-decoration: none; }
.card__media { aspect-ratio: 16/10; background: var(--primary-soft); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__ph { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(160deg, var(--primary-soft), var(--accent-soft)); color: var(--ink-300); font-family: var(--font-display); font-weight: 700; }
.card__body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card__body h3 { margin: 0; font-size: 1.16rem; color: var(--ink-900); }
.card__body p { margin: 0; color: var(--ink-500); font-size: .95rem; }
.card__meta { font-size: .8rem; color: var(--color-accent); font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* ===================== AGENDA ===================== */
.agenda-item { display: grid; grid-template-columns: 90px 1fr; gap: 1.2rem; align-items: center; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.agenda-date { text-align: center; background: var(--color-primary); color: #fff; border-radius: var(--radius); padding: .55rem .3rem; font-family: var(--font-display); line-height: 1; }
.agenda-date .d { font-size: 1.7rem; font-weight: 700; display: block; }
.agenda-date .m { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.agenda-item h3 { margin: 0 0 .2rem; font-size: 1.12rem; }
.agenda-item .loc { color: var(--ink-500); font-size: .9rem; }

/* ===================== ARTICULO / DETALLE ===================== */
.article { max-width: 760px; margin-inline: auto; padding: clamp(2rem,5vw,3.5rem) 0; }
.article__cover { border-radius: var(--radius-lg); margin: 1.5rem 0; box-shadow: var(--shadow-md); width:100%; }
.article__body { font-size: 1.08rem; color: var(--ink-700); }
.article__body h2, .article__body h3 { color: var(--ink-900); margin-top: 1.6em; }
.article__body p { margin: 0 0 1.1em; }
.crumb { font-size: .85rem; color: var(--ink-500); margin-bottom: .5rem; }

/* ===================== GALERIA ===================== */
.masonry { columns: 3 240px; column-gap: var(--gap); }
.masonry a { display: block; margin-bottom: var(--gap); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); break-inside: avoid; }
.masonry img { width: 100%; }
.masonry figcaption { padding: .5rem .7rem; font-size: .85rem; color: var(--ink-500); background: var(--paper); }

/* ===================== CONTACTO ===================== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
.field { margin-bottom: 1rem; }
.field label { display: block; font-family: var(--font-display); font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: var(--radius);
  font: inherit; background: var(--paper); color: var(--ink-900);
}
.field input:focus, .field textarea:focus { border-color: var(--color-primary); outline: none; }
.contact-info dt { font-family: var(--font-display); font-weight: 700; color: var(--color-primary); margin-top: 1rem; }
.hp { position: absolute; left: -9999px; }
.notice { padding: .9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.notice--ok { background: var(--primary-soft); color: var(--primary-dark); }
.notice--err { background: #fdecec; color: #a12; }

/* ===================== FOOTER ===================== */
.site-footer { background: var(--color-secondary); color: #dfe7ee; margin-top: 2rem; }
.site-footer a { color: #fff; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; padding: 2.8rem 0 2rem; }
.footer-logos { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; padding: 1.4rem 0; border-top: 1px solid rgba(255,255,255,.15); }
.footer-logos img { height: 46px; width: auto; background: #fff; padding: 6px 10px; border-radius: var(--radius); }
.footer-nav h4 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; }
.footer-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; font-size: .92rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding: 1rem 0; font-size: .82rem; opacity: .85; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .authority { grid-template-columns: 1fr; }
  .authority__photo { max-width: 320px; }
  .contact-grid, .footer-top { grid-template-columns: 1fr; }
  .main-nav { position: fixed; inset: 78px 0 auto 0; background: var(--paper); flex-direction: column; align-items: stretch; padding: .6rem 1.2rem 1.2rem; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md); display: none; }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
}
@media (max-width: 560px) {
  .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .masonry { columns: 1; }
  .gov-bar .container span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
