/* Documentos de gestión (módulo gobpe): sección del inicio, página propia y vista previa.
   Usa los colores y variables del sitio (site.css). */

/* ---------- Mensaje "pronto publicaremos": legible sobre fondo claro y oscuro ---------- */
.cprevs__vacio {
  background: rgba(255, 255, 255, .94);
  color: #1F4D36;
  border: 1px dashed var(--green-brand);
  font-weight: 600;
}

/* ---------- Tarjeta de documento ---------- */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.doc {
  --c: var(--green-brand);
  display: flex; gap: 14px; padding: 18px;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 40, 30, .05);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.doc:hover { transform: translateY(-3px); box-shadow: 0 18px 32px -20px rgba(20, 60, 40, .35); }
.doc__ic {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff);
}
.doc__ic svg { width: 22px; height: 22px; }
.doc__b { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.doc__meta { display: flex; align-items: center; gap: 8px; margin: 0; }
.doc__tag { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.doc__meta .badge-new { margin-left: 0; padding: 2px 9px; font-size: .68rem; }
.doc__t { margin: 0; font-size: 1rem; line-height: 1.35; font-weight: 700; letter-spacing: -.005em; overflow-wrap: anywhere; }
.doc__t a { color: inherit; text-decoration: none; }
.doc__t a:hover { color: var(--green-700); text-decoration: underline; }
.doc__f { margin: 0; color: var(--ink-soft); font-size: .88rem; }
.doc__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.doc__acts .btn { padding: .5rem .85rem; font-size: .85rem; }
.doc__acts svg { width: 16px; height: 16px; }

/* ---------- Sección del inicio ---------- */
.section--docs { background: var(--bg-soft); }

/* ---------- Página de documentos: años ---------- */
.ydoc { margin: 0 0 22px; }
.ydoc > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 16px;
  padding: 12px 18px 12px 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 6px 18px -12px rgba(20, 60, 40, .3);
}
.ydoc > summary::-webkit-details-marker { display: none; }
.ydoc__anio {
  align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 108px; padding: 14px 18px;
  color: #fff; background: linear-gradient(135deg, var(--green-500), var(--green-700));
}
.ydoc:nth-of-type(3n+2) .ydoc__anio { background: linear-gradient(135deg, #38a3c8, #1E5670); }
.ydoc:nth-of-type(3n+3) .ydoc__anio { background: linear-gradient(135deg, #e0b02a, #a87a00); }
.ydoc__anio small { font-size: .68rem; letter-spacing: .14em; opacity: .9; }
.ydoc__anio b { font-size: 1.65rem; line-height: 1; letter-spacing: -.02em; }
.ydoc__info { flex: 1; font-weight: 700; }
.ydoc__info small { display: block; font-weight: 500; color: var(--ink-soft); }
.ydoc__n { padding: 3px 12px; border-radius: 999px; background: var(--green-100); color: var(--green-800); font-size: .8rem; font-weight: 700; }
.ydoc__chev { color: var(--green-700); transition: transform .25s var(--ease); }
.ydoc__chev svg { width: 20px; height: 20px; }
.ydoc[open] .ydoc__chev { transform: rotate(180deg); }
.ydoc__cuerpo { padding-top: 16px; }

/* ---------- Vista previa del documento ---------- */
.doc-dlg {
  width: min(960px, calc(100% - 24px)); height: min(88vh, 820px); max-height: calc(100% - 24px); padding: 0; border: 0; border-radius: 20px;
  background: #fff; color: var(--ink); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6); overflow: hidden;
}
.doc-dlg[open] { display: flex; flex-direction: column; }
.doc-dlg::backdrop { background: rgba(4, 25, 15, .62); backdrop-filter: blur(3px); }
.doc-dlg__top { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.doc-dlg__top h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.doc-dlg__top p { margin: 2px 0 0; color: var(--ink-soft); font-size: .85rem; }
.doc-dlg__x { margin-left: auto; flex: none; width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--bg-soft); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.doc-dlg__x:hover { background: var(--green-100); }
.doc-dlg__cuerpo { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #eef1f4; }
.doc-dlg__marco { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.doc-dlg__sin { margin: auto; padding: 28px; max-width: 520px; text-align: center; color: var(--ink-soft); }
.doc-dlg__sin p { margin: 0 0 12px; }
.doc-dlg__archivos { margin: 10px 0 0; padding: 0; list-style: none; text-align: left; font-size: .9rem; }
.doc-dlg__archivos li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.doc-dlg__archivos svg { width: 16px; height: 16px; flex: none; color: var(--green-brand); }
.doc-dlg__pie { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line); background: #fff; }
.doc-dlg__aviso { margin: 0; color: var(--ink-soft); font-size: .82rem; }

@media (max-width: 640px) {
  .ydoc__anio { min-width: 84px; padding: 12px; }
  .ydoc__anio b { font-size: 1.3rem; }
  .doc { padding: 14px; }
  .doc-dlg { height: 92vh; border-radius: 14px; }
}

/* Buscador */
.doc[hidden], .ydoc[hidden], .secc-panel[hidden] { display: none; }
.filters--secc { justify-content: center; margin-bottom: 18px; }
.secc-ayuda { text-align: center; color: var(--ink-soft); margin: 4px 0 8px; }
.secc-ayuda[hidden] { display: none; }
.secc-panel { margin-top: 10px; scroll-margin-top: 90px; }

.acc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bloque plegable del cuadro multianual dentro de cada año */

/* Encabezado de la sección en el inicio: mismo estilo que "Convocatorias" (centrado, verde y con raya amarilla) */
.section--docs .section-head { display: block; text-align: center; margin-bottom: clamp(24px, 4vw, 40px); }
.section--docs .section-head h2 {
  display: inline-block; position: relative; margin: 0 0 22px; padding-bottom: 18px;
  font-size: clamp(2.4rem, 1.5rem + 3.4vw, 3.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -.035em;
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-brand) 60%, var(--green-500) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.section--docs .section-head h2::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 56px; height: 4px; margin-left: -28px; border-radius: 4px;
  background: linear-gradient(90deg, #f5c518, #ffd84d);
}
.section--docs .section-head__side { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.section--docs .section-head__side p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.section--docs .link-more { color: var(--green-800); border-bottom: 1px solid rgba(46, 139, 87, .4); }
.section--docs .link-more:hover { border-bottom-color: var(--green-brand); }

/* Botones grandes con imagen (Convocatorias y Documentos de gestión) */
.bigbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; max-width: 1080px; margin: 0 auto 22px; } /* centrados; nunca se montan unos sobre otros */
.bigbtn {
  position: relative; display: block; flex: 1 1 170px; max-width: 230px; min-width: 0; min-height: 0; aspect-ratio: 4 / 3; overflow: hidden; isolation: isolate;
  border-radius: 20px; background: linear-gradient(160deg, color-mix(in srgb, var(--c, #2E8B57) 16%, #fff), color-mix(in srgb, var(--c, #2E8B57) 38%, #fff));
  box-shadow: 0 10px 24px -16px rgba(10, 40, 35, .55); border: 3px solid transparent; color: #fff; text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.bigbtn:hover { transform: translateY(-4px); box-shadow: 0 20px 30px -18px rgba(10, 40, 35, .65); }
.bigbtn:focus-visible { outline: 3px solid var(--sky-400); outline-offset: 3px; }
.bigbtn__img { position: absolute; inset: 0; display: grid; place-items: center; z-index: -1; }
.bigbtn__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.bigbtn:hover .bigbtn__img img { transform: scale(1.07); }
.bigbtn__art { display: grid; place-items: center; width: 52%; max-width: 120px; height: 62%; padding-bottom: 26px; color: var(--c, #2E8B57); }
.bigbtn__art svg { width: 100%; height: 100%; }
.bigbtn__img img + .bigbtn__art { display: none; } /* con foto real no se muestra el dibujo */
.bigbtn::after { /* sombra bajo el texto para que se lea sobre cualquier foto */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 30, 22, 0) 38%, rgba(6, 30, 22, .78) 100%);
}
.bigbtn__txt { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 13px; text-align: left; }
.bigbtn__txt b { font-size: clamp(1.02rem, .9rem + .5vw, 1.25rem); line-height: 1.1; letter-spacing: -.01em; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.bigbtn__txt small { font-size: .78rem; line-height: 1.25; opacity: .92; text-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.bigbtn__n {
  position: absolute; top: 10px; right: 10px; min-width: 34px; padding: 3px 11px; border-radius: 999px; text-align: center;
  background: rgba(255, 255, 255, .94); color: var(--green-800); font-weight: 800; font-size: .92rem; box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}
.bigbtn.is-active { border-color: var(--green-brand, #2E8B57); box-shadow: 0 0 0 4px rgba(46, 139, 87, .22), 0 22px 32px -18px rgba(10, 40, 35, .7); transform: translateY(-3px); }
.bigbtn.is-active::before { /* pestaña que apunta al panel que se abre */
  content: ""; position: absolute; left: 50%; bottom: -1px; z-index: 2; width: 22px; height: 11px; transform: translateX(-50%);
  background: var(--green-brand, #2E8B57); clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.bigbtn.is-empty { filter: saturate(.55); opacity: .78; }
.bigbtn.is-empty .bigbtn__n { background: rgba(255, 255, 255, .75); color: var(--ink-soft); }
@media (max-width: 559px) {
  .bigbtns { gap: 10px; }
  .bigbtn { flex: 0 0 calc(50% - 5px); max-width: none; aspect-ratio: auto; min-height: 140px; border-radius: 16px; }
  .bigbtn__txt small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bigbtn, .bigbtn__img img { transition: none; } .bigbtn:hover, .bigbtn.is-active { transform: none; } }

/* Sin foto subida: fondo de color propio con su dibujo o ícono en claro */
.bigbtn.sin-foto { background: linear-gradient(150deg, var(--c, #2E8B57), color-mix(in srgb, var(--c, #2E8B57) 58%, #06241a)); }
.bigbtn.sin-foto .bigbtn__art { color: rgba(255, 255, 255, .92); }
.bigbtn.sin-foto::after { background: linear-gradient(180deg, rgba(6, 30, 22, 0) 55%, rgba(6, 30, 22, .45) 100%); }
.bigbtn.sin-foto.is-empty { filter: none; opacity: .62; }

/* ---------- Miniatura del documento (la imagen de gob.pe o la primera página del PDF) ---------- */
.cprev__media img.mini-gob, .cprev__media img.mini-pdf { object-fit: cover; object-position: top center; background: #fff; }
.cprev__media img.mini-tipo { opacity: 1; }
.doc__ic { position: relative; overflow: hidden; }
.doc__ic.tiene-mini { width: 62px; height: 82px; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 6px 14px -8px rgba(20, 40, 30, .5); align-self: flex-start; }
.doc__ic.tiene-mini .doc__ic-i { display: none; }
.doc__ic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }

/* ---------- Todo centrado: tarjetas de convocatorias y de documentos ---------- */
.cprevs.cprevs { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.cprevs.cprevs > .cprev { flex: 1 1 300px; max-width: 400px; min-width: 0; }
.docs-grid.docs-grid { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.docs-grid.docs-grid > .doc { flex: 1 1 330px; max-width: 460px; min-width: 0; }

/* Los botones se ven siempre igual (con o sin publicaciones); al elegir uno solo cambia su marco, no su color */
.bigbtn.is-empty, .bigbtn.sin-foto.is-empty { filter: none; opacity: 1; }
.bigbtn.is-empty .bigbtn__n { background: #fff; color: var(--ink-soft); }
.cprev__ayuda { display: inline-flex; align-items: center; gap: 5px; color: var(--green-700, #1F6B3F); font-weight: 700; }
.cprev__ayuda .icon { width: 14px; height: 14px; }
@media (hover: none) { .cprev__ayuda { display: inline-flex; } }
