/* =========================================================
   Layout — cabecera, portada, manifiesto, cierre, footer
   ========================================================= */

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.is-scrolled { border-bottom-color: rgba(0,0,0,.1); }

.site-header__brand { display: flex; align-items: center; gap: 14px; }
.site-header__logo { position: relative; display: block; }
.site-header__logo img { display: block; height: 34px; width: auto; }
/* Franja Gobierno de Chile: decorativa, sobre el logotipo y alineada con la M.
   Posición absoluta: no suma altura a la cabecera ni desplaza logo o navegación. */
.site-header__logo::before {
  content: "";
  position: absolute; left: 0; bottom: calc(100% + 7px);
  width: 52%; height: 3px;
  background: linear-gradient(to right, #0f69b5 0 45%, #eb3d45 45% 100%);
  pointer-events: none;
}
.site-header__lab {
  font-family: var(--f-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-left: 14px;
  border-left: 1px solid rgba(0,0,0,.2);
  line-height: 1;
}

.site-nav ul { display: flex; gap: clamp(12px, 2.4vw, 32px); }
.site-nav a {
  font-size: .86rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  padding: 6px 0;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease-out);
}
.site-nav a:hover::after,
.site-nav a:focus-visible::after { transform: scaleX(1); }

/* Cabecera alineada (diseño aprobado) a la columna de 1140 px de
   mnba.gob.cl. El fondo sigue a todo el ancho; logotipo y navegación se
   alinean con los márgenes del contenido. Bajo ~1250 px vuelve al margen normal.
   Para desactivarla, quitar la clase `cabecera-alineada` de <body>. */
.cabecera-alineada .site-header {
  padding-inline: max(var(--gutter), calc((100% - var(--contenido, 1140px)) / 2));
}

@media (max-width: 640px) {
  :root { --header-h: 60px; }
  .site-header__logo img { height: 28px; }
  .site-header__logo::before { bottom: calc(100% + 6px); }
  .site-nav li:not(:last-child) { display: none; }
}

/* ---------- Portada ---------- */
.hero {
  position: relative;
  min-height: min(calc(100svh - var(--header-h)), 1000px);
  padding: clamp(24px, 5vh, 56px) var(--gutter) clamp(32px, 6vh, 72px);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr auto auto;
  column-gap: var(--gap);
  row-gap: clamp(24px, 4vh, 48px);
  isolation: isolate;
  overflow: hidden;
}

.hero__eyebrow { grid-column: 1 / -1; color: var(--ink-soft); }
.hero__eyebrow .sep { color: var(--blue); margin: 0 .3em; }

.hero__title {
  grid-column: 1 / -1;
  align-self: center;
  display: flex; flex-direction: column;
  line-height: .86;
  font-weight: 400;
}
.hero__title-serif {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: clamp(4rem, 15.5vw, 15rem);
  letter-spacing: -.03em;
}
.hero__title-sans {
  font-family: var(--f-sans);
  font-weight: 700;
  font-size: clamp(3.4rem, 12.5vw, 12.5rem);
  letter-spacing: -.055em;
  margin-left: 24%;
}

/* El punto digital */
.hero__dot {
  --size: clamp(220px, 44vmin, 560px);
  position: absolute; z-index: -1;
  width: var(--size); aspect-ratio: 1;
  right: 8%; top: 14%;
  border-radius: 50%;
  background: var(--blue);
  transform: translate3d(var(--dx, 0px), var(--dy, 0px), 0);
  transition: transform .9s var(--ease-out);
  translate: 0 var(--sy, 0px);   /* deriva con el scroll (depth.js) */
  animation: dot-in 1.4s var(--ease-out) both;
}
.hero__pulse {
  position: absolute; width: 18px; height: 18px;
  left: 50%; top: 50%; margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--orange);
}
.hero__pulse::before,
.hero__pulse::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--white);
  animation: pulse 3.2s var(--ease-out) infinite;
}
.hero__pulse::after { animation-delay: 1.6s; }

@keyframes pulse {
  from { transform: scale(1); opacity: .9; }
  to   { transform: scale(12); opacity: 0; }
}
@keyframes dot-in {
  from { transform: scale(.02); }
  to   { transform: scale(1); }
}

.hero__lead {
  grid-column: 1 / span 5;
  display: grid; gap: 14px;
  max-width: 34ch;
}
.hero__lead p:first-child {
  font-family: var(--f-serif);
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  line-height: 1.12;
}
.hero__lead-small { color: var(--ink-soft); font-size: .95rem; }

/* El índice se superpone al punto como una hoja de papel sobre el lienzo */
.hero__index {
  grid-column: 8 / -1;
  align-self: end;
  position: relative;
  background: var(--paper);
  padding: 14px 18px 4px;
  margin: 0 -18px;
}
.hero__index-label { color: var(--ink-soft); margin-bottom: 10px; }
.hero__index ol { border-top: 1px solid var(--ink); }
.hero__index li { border-bottom: 1px solid rgba(0,0,0,.14); }
.hero__index a {
  display: flex; align-items: baseline; gap: 14px;
  padding: 8px 0;
  text-decoration: none;
  font-size: .95rem;
  transition: padding-left .35s var(--ease-out), color .2s;
}
.hero__index a::after {
  content: ""; margin-left: auto; align-self: center;
  width: 9px; height: 9px; border-radius: 50%;
  flex: none;
}
.hero__index li[data-type="interactivo"] a::after { background: var(--ink); }
.hero__index li[data-type="audiovisual"] a::after { border: 1.5px solid var(--ink); }
.hero__index a:hover,
.hero__index a:focus-visible { padding-left: 10px; color: var(--blue); }
.hero__index .mono { color: var(--ink-soft); }

.hero__cue {
  grid-column: 1 / -1;
  justify-self: start;
  text-decoration: none;
  display: inline-flex; gap: 8px;
}
.hero__cue span { display: inline-block; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(5px); } }

@media (max-width: 900px) {
  .hero { grid-template-rows: auto auto auto auto auto; }
  .hero__dot { right: -12%; top: 10%; }
  .hero__title { margin-top: clamp(96px, 18vh, 200px); }
  .hero__title-sans { margin-left: 10%; }
  .hero__lead, .hero__index { grid-column: 1 / -1; }
}

/* ---------- Manifiesto + leyenda ---------- */
.statement {
  padding: clamp(80px, 16vh, 180px) var(--gutter);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 56px;
}
.statement__text {
  grid-column: 3 / span 9;
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: clamp(2rem, 5.2vw, 5rem);
  line-height: 1;
  letter-spacing: -.035em;
}
.statement__text em {
  display: block;
  font-family: var(--f-serif);
  font-weight: 400;
  letter-spacing: -.02em;
  padding-left: 1.4em;
  color: var(--blue);
}

.legend {
  grid-column: 3 / span 8;
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap);
  border-top: 1px solid var(--ink);
  padding-top: 18px;
}
.legend dt { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.legend dd { color: var(--ink-soft); font-size: .92rem; margin-top: 4px; }
.legend__dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.legend__dot--fill { background: var(--ink); }
.legend__dot--ring { border: 2px solid var(--ink); }

@media (max-width: 720px) {
  .statement__text, .legend { grid-column: 1 / -1; }
  .legend { grid-template-columns: 1fr; }
}

/* ---------- Cierre ---------- */
.closing {
  position: relative;
  background: var(--blue);
  color: var(--white);
  padding: clamp(96px, 20vh, 220px) var(--gutter);
  overflow: hidden;
  display: grid; gap: 32px; justify-items: start;
  isolation: isolate;
}
.closing__dot {
  position: absolute; z-index: -1;
  width: clamp(280px, 60vw, 900px); aspect-ratio: 1;
  right: -14%; top: 50%;
  border-radius: 50%;
  background: var(--sky);
  opacity: .35;
  transform: translateY(-50%);
  translate: 0 var(--sy, 0px);   /* deriva con el scroll (depth.js) */
}
.closing__text {
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: clamp(2.2rem, 7vw, 7rem);
  letter-spacing: -.045em;
  line-height: .95;
}
.closing__text em {
  font-family: var(--f-serif);
  font-weight: 400;
  letter-spacing: -.02em;
}
.closing__link {
  font-size: 1rem; font-weight: 600;
  text-decoration: none;
  padding: 14px 22px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  transition: background .3s, color .3s;
}
.closing__link:hover,
.closing__link:focus-visible { background: var(--white); color: var(--blue); }
.closing :focus-visible { outline-color: var(--white); }

/* ---------- Footer institucional ---------- */
.site-footer {
  background: var(--black);
  color: var(--white);
  padding: clamp(48px, 8vh, 80px) var(--gutter) 28px;
  font-size: .92rem;
}
.site-footer :focus-visible { outline-color: var(--white); }
.anchos-mixtos .site-footer {
  padding-inline: max(var(--gutter), calc((100% - var(--contenido)) / 2));
}
.site-footer__top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: clamp(24px, 5vw, 72px);
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,.2);
}
/* Identificador oficial SERPAT + MNBA (SVG original, en blanco) */
.site-footer__brand { display: block; }
.site-footer__brand img { display: block; height: 96px; width: auto; }
.site-footer__info { display: grid; gap: 10px; color: rgba(255,255,255,.8); line-height: 1.5; }
.site-footer__address { font-style: normal; display: grid; gap: 4px; }
.site-footer__info a,
.site-footer__social a { color: rgba(255,255,255,.8); text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 3px; }
.site-footer__social a { text-decoration: none; }
.site-footer__info a:hover,
.site-footer__info a:focus-visible,
.site-footer__social a:hover,
.site-footer__social a:focus-visible { color: var(--white); text-decoration: underline; text-decoration-color: currentColor; }
.site-footer__social { display: grid; gap: 6px; }

.site-footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px;
  padding-top: 20px;
  color: rgba(255,255,255,.55);
}

@media (max-width: 760px) {
  .site-footer__top { grid-template-columns: 1fr; gap: 28px; }
  .site-footer__brand img { height: 80px; }
  .site-footer__social { display: flex; flex-wrap: wrap; gap: 8px 20px; }
}
