/* Document index and the continuous list of local PDF viewers. */
.documents-layout {
  max-width: 1180px;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.documents-stack {
  display: grid;
  min-width: 0;
  gap: 34px;
}

.documents-index {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  z-index: 5;
  display: grid;
  min-width: 0;
  max-height: calc(100vh - var(--header-height) - 32px);
  max-height: calc(100dvh - var(--header-height) - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  gap: 5px;
  padding: 16px 11px;
  border: 1px solid #dce5f0;
  border-radius: 15px;
  background: #fffefa;
  box-shadow: 0 4px 16px #10264a06;
}

.documents-index-label {
  margin: 0 9px 9px;
  color: #5c6d84;
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.documents-index a.document-index-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 45px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #405371;
  background: transparent;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
  white-space: normal;
  transition: background-color 160ms ease, color 160ms ease;
}

.document-index-link > i { flex: none; width: 16px; font-size: .95rem; text-align: center; }
.document-index-link > span { min-width: 0; }
.documents-index a.document-index-link:hover { color: #174291; background: #eef3fb; }

.documents-index a.document-index-link[aria-current="location"] {
  background: #eaf1fd;
  color: #174291;
  font-weight: 750;
  box-shadow: inset 3px 0 #cc1b29;
}

.documents-layout--single { max-width: 1000px; grid-template-columns: minmax(0, 1fr); }
.documents-layout[data-reveal], .documents-stack[data-reveal], .documents-index[data-reveal] { opacity: 1; transform: none; animation: none; transition: none; }

.doc-card {
  min-width: 0;
  scroll-margin-top: 8px;
  padding: clamp(22px, 3.5vw, 38px);
  border: 1px solid #dce5f0;
  border-radius: 22px;
  background: #fffefa;
  box-shadow: 0 8px 26px #10264a08;
}

.doc-card > .eyebrow {
  margin-bottom: 19px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #edf3fc;
  color: #405777;
  font-size: .65rem;
  letter-spacing: .055em;
}

.doc-card > .eyebrow::before { display: none; }
.doc-card > h2 { margin: 0 0 12px; padding-left: 19px; border-left: 4px solid #cc1b29; color: #10264a; font-size: clamp(1.55rem, 2.6vw, 2.2rem); line-height: 1.18; }
.doc-card > p { margin-left: 23px; max-width: 65ch; color: #52647f; font-size: .93rem; line-height: 1.7; }

.doc-card .doc-actions {
  gap: 10px;
  margin-top: 25px;
  padding: 14px;
  border: 1px solid #e1e8f2;
  border-radius: 12px;
  background: #f5f8fd;
}

.doc-actions .button, .doc-actions .preview-pdf { min-height: 44px; padding: 11px 16px; border-radius: 9px; font-size: .77rem; font-weight: 650; line-height: 1.45; text-align: center; white-space: normal; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.doc-actions .button { background: #174291; color: #fff; }
.doc-actions .button:hover { background: #123a82; color: #fff; box-shadow: 0 3px 10px #17429114; }
.doc-actions .button-light { background: #fffefa; color: #174291; border-color: #bdcce2; }
.doc-actions .button-light:hover { background: #eaf1fc; color: #123d89; border-color: #9fb6db; box-shadow: none; }
.doc-actions .preview-pdf { margin-left: auto; background: transparent; border-color: transparent; color: #405575; }
.doc-actions .preview-pdf:hover { background: #e8effa; border-color: #cad7eb; color: #174291; }

.doc-card iframe {
  width: 100%;
  max-width: 100%;
  height: clamp(520px, 72vh, 760px);
  margin-top: 23px;
  border: 1px solid #d7e1ed;
  border-top: 12px solid #10264a;
  border-radius: 16px;
  background: #f0f4fa;
  box-shadow: 0 4px 16px #10264a08;
}

.doc-card .doc-viewer { position: relative; min-width: 0; margin-top: 23px; }
.doc-viewer-tools { display: flex; justify-content: flex-end; padding: 10px 13px; border-radius: 14px 14px 0 0; background: #10264a; }
.doc-interaction { min-height: 36px; padding: 7px 11px; border: 1px solid #c6d4e9; border-radius: 7px; background: #fffefa; color: #174291; font: 650 .7rem/1.4 var(--font); text-align: center; transition: background-color 160ms ease, border-color 160ms ease; }
.doc-interaction:hover { background: #edf4ff; border-color: #a7c0e8; }
.doc-interaction[aria-expanded="true"] { background: #dbe9ff; color: #10264a; border-color: #92b2e4; }
.doc-interaction:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.doc-card .doc-viewer iframe { margin-top: 0; border-top-width: 1px; border-radius: 0 0 15px 15px; pointer-events: none; }
.doc-card .doc-viewer.is-interactive iframe { pointer-events: auto; }

.doc-card .doc-viewer-tools { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.doc-viewer-label { color: #e2ebf9; font-size: .72rem; line-height: 1.4; }
.doc-preview-surface { display: grid; place-items: center; height: clamp(520px, 72vh, 760px); padding: 17px; overflow: hidden; border: 1px solid #d7e1ed; border-top: 0; border-radius: 0 0 15px 15px; background: #f0f4fa; }
.doc-preview-surface img { width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 4px 9px #10264a12); }

@media (max-width: 700px) {
  .doc-preview-surface { height: clamp(300px, 120vw, 480px); padding: 10px; }
}

.documents-index a.document-index-link:focus-visible, .doc-actions a:focus-visible, .doc-actions button:focus-visible { outline: 3px solid #174291; outline-offset: 3px; }

@media (max-width: 900px) {
  .documents-layout { display: block; }
  .documents-index {
    top: var(--header-height);
    z-index: 12;
    display: flex;
    align-items: center;
    max-width: 100%;
    max-height: none;
    gap: 5px;
    margin-bottom: 22px;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    border-radius: 12px;
    scrollbar-width: thin;
  }
  .documents-index-label { display: none; }
  .documents-index a.document-index-link { flex: none; min-height: 42px; gap: 8px; padding: 9px 12px; font-size: .74rem; white-space: nowrap; }
  .documents-index a.document-index-link[aria-current="location"] { box-shadow: inset 0 -3px #cc1b29; }
  .documents-stack { gap: 25px; }
  .doc-card { scroll-margin-top: 64px; }
}

@media (max-width: 700px) {
  .doc-card { padding: 23px 19px; border-radius: 20px; }
  .doc-card > h2 { padding-left: 15px; font-size: 1.6rem; }
  .doc-card > p { margin-left: 19px; font-size: .88rem; }
  .doc-card .doc-actions { padding: 11px; gap: 8px; }
  .doc-actions .button, .doc-actions .preview-pdf { justify-content: center; width: 100%; margin-left: 0; padding-inline: 10px; }
  .doc-card iframe { height: 480px; border-radius: 12px; border-top-width: 9px; }
}

@media (max-width: 420px) {
  main:is([data-page="documentos"], [data-page="cuenta-publica"]) .inner-hero h1 { font-size: clamp(2rem, 8.5vw, 2.5rem); }
}

.documents-layout--single .doc-card { scroll-margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .documents-index a.document-index-link, .doc-actions .button, .doc-actions .preview-pdf, .doc-interaction { transition: none; }
}
