/* Amergent Partners — Información corporativa: document library and PDF viewer. Loaded after site.css.
   Mobile-first: base rules are for phones; the original desktop layout returns in steps (filter bar
   in one row from lg, table-like document rows from xl) and renders exactly as designed at 1440px. */

/* ── Hero ───────────────────────────────────────────────────────────── */

.ic-hero { --hero-min: 520px; --focus: 50% 45%; }
.ic-hero .crumbs,
.ic-hero .crumbs a { color: var(--color-neutral-300); }
.ic-hero .page-hero__body { padding-bottom: clamp(40px, 1.127vw + 35.78px, 52px); }
.ic-hero .page-hero__copy { gap: 22px; }
.ic-hero .page-hero__aside { gap: 18px; }
.ic-hero__meta { font-size: var(--fs-13); color: var(--color-neutral-300); font-variant-numeric: tabular-nums; }
.ic-hero__date { white-space: nowrap; }
/* The long eyebrow may wrap on the narrowest phones. */
.ic-hero .eyebrow--nowrap { white-space: normal; }

@media (min-width: 480px) {
  .ic-hero .eyebrow--nowrap { white-space: nowrap; }
}

@media (min-width: 1024px) {
  .ic-hero .crumbs { top: calc(var(--nav-h) + var(--safe-top) + 28px); }
  .ic-hero .page-hero__body { grid-template-columns: minmax(0,1fr) minmax(0,460px); gap: 72px; }
  .ic-hero .page-hero__title { font-size: clamp(56px, 5.4vw, 88px); }
  .ic-hero .page-hero__title > span { white-space: nowrap; }
}

@media (hover: hover) {
  .ic-hero .crumbs a:hover { color: var(--color-bg); }
}

/* ── Library ────────────────────────────────────────────────────────── */

/* The filter bar is full-bleed; the bar and the list each carry the side padding. */
.library { padding: 0 0 var(--space-section-lg); background: var(--color-bg); }
/* No anchor bar on this page: #biblioteca lands right under the nav, where the filter bar sticks. */
.page--inner section.library { scroll-margin-top: calc(var(--nav-h) + var(--safe-top)); }

/* Filter bar. Phones: search, then category, then year + order; it scrolls with the page so it
   never covers the list. From md (on screens tall enough) it sticks under the nav: search on top,
   the three selects in one row. From lg: the original single row (always sticky). */
.filters {
  position: relative; z-index: 4;
  display: flex; flex-direction: column; gap: 12px; padding: 20px var(--pad-x) 12px;
  background: color-mix(in srgb, var(--color-bg) 96%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-text);
}
.filters__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 8px; }
.filters__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filters__field--search,
.filters__field--cat { flex: 1 0 100%; }
.filters__field--year,
.filters__field--order { flex: 1 1 160px; }
.filters__label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-neutral-800); }

.filters__search {
  display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 14px;
  border: 1px solid var(--color-text); background: var(--color-bg); cursor: text;
}
.filters__search:focus-within { box-shadow: inset 0 0 0 1px var(--color-text); }
.filters__search > svg { flex: none; }
/* 16px: iOS does not zoom into the field. */
.filters__input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: 16px; color: var(--color-text);
}
.filters__input:focus-visible { outline: none; }
.filters__input::placeholder { color: var(--color-neutral-600); }
.filters__clear {
  display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; margin-right: -10px; padding: 0;
  border: 0; background: transparent; color: var(--color-text); cursor: pointer;
}
.filters__clear[hidden] { display: none; }
.filters__kbd {
  display: flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px;
  font-size: 12px; color: var(--color-neutral-700); border: 1px solid var(--color-neutral-400);
}

.filters__select { position: relative; display: block; }
.filters__select select {
  width: 100%; height: 48px; padding: 0 36px 0 14px;
  border: 1px solid var(--color-text); border-radius: 0; background: var(--color-bg);
  font-family: inherit; font-size: 16px; color: var(--color-text);
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
.filters__select select:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--color-text); }
.filters__select .ic { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; stroke-width: 2.5; }

.filters__status { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 44px; }
.filters__count { min-width: 0; font-size: 13px; color: var(--color-neutral-700); font-variant-numeric: tabular-nums; }
.filters__reset {
  flex: none; display: flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--color-text); cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.filters__reset[hidden] { display: none; }
/* Column titles of the table-like rows: only shown from xl. */
.filters__cols {
  display: none;
  padding: 10px 12px 0; margin-top: 4px; border-top: 1px solid var(--color-neutral-300);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-neutral-800);
}
.filters__cols > span:nth-child(5) { text-align: right; }

/* No keyboard on touch screens: hide the "/" shortcut hint. */
@media (hover: none), (pointer: coarse) {
  .filters__kbd { display: none; }
}

@media (min-width: 768px) {
  .filters__field--cat { flex: 1.6 1 0; }
  .filters__field--year,
  .filters__field--order { flex: 1 1 0; }
}

@media (min-width: 768px) and (min-height: 600px) {
  .filters { position: sticky; top: calc(var(--nav-h) + var(--safe-top)); }
}

.library__list { display: flex; flex-direction: column; padding: 8px var(--pad-x) 0; }
.library__noscript { margin: 24px 0 0; font-size: 16px; }

/* Loading skeleton rows. */
.doc-skel {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  min-height: 60px; padding: 16px 12px 16px 44px; border-bottom: 1px solid var(--color-neutral-300);
}
.doc-skel > span { display: block; background: var(--color-surface); }
.doc-skel > span:first-child { width: 80%; height: 15px; }
.doc-skel > span:last-child { width: min(248px, 100%); height: 44px; }

/* Empty and error notices. */
.doc-notice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
  margin-top: 24px; padding: 24px 20px; border: 1px dashed var(--color-neutral-500);
}
.doc-notice p { margin: 0; font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.doc-notice__btn {
  flex: none; min-height: 44px; padding: 11px 15px; border: 1px solid var(--color-text); background: transparent; color: var(--color-text);
  font-family: inherit; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.doc-notice__btn--solid { padding: 12px 16px; border: 0; background: var(--color-text); color: var(--color-bg); font-weight: 600; }

/* Category group. */
.doc-group { display: flex; flex-direction: column; margin-top: 28px; }
.doc-group__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px;
  padding: 14px 12px; background: var(--color-surface); border-top: 1px solid var(--color-text);
}
.doc-group__n { flex: none; width: 20px; font-size: 13px; letter-spacing: 0.08em; color: var(--color-neutral-800); font-variant-numeric: tabular-nums; }
.doc-group__name { flex: 1 1 0; min-width: 0; margin: 0; font-size: clamp(19px, 0.282vw + 17.94px, 22px); font-weight: 400; line-height: 1.2; letter-spacing: -0.01em; }
.doc-group__count {
  flex: 1 0 calc(100% - 32px); margin-left: 32px;
  font-size: var(--fs-13); color: var(--color-neutral-800); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.doc-group__empty {
  display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 12px; padding: 20px 12px;
  border-bottom: 1px solid var(--color-neutral-300); font-size: var(--fs-15); color: var(--color-neutral-800);
}
.doc-group__rows { list-style: none; margin: 0; padding: 0; }

/* Document row. Phones: number + title, then period · format · size, then the two buttons.
   md: the buttons move beside the title. xl: the original table-like row, where .doc__main
   and .doc__meta dissolve (display: contents) into the shared column grid. */
.doc {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px;
  padding: 6px 12px 16px; border-bottom: 1px solid var(--color-neutral-300); transition: background 200ms ease;
}
.doc:focus-within { background: var(--color-surface); }
.doc__idx { flex: none; width: 20px; font-size: 13px; color: var(--color-neutral-700); font-variant-numeric: tabular-nums; }
.doc__main { flex: 1 1 calc(100% - 32px); min-width: 0; display: flex; flex-direction: column; }
/* The padding makes the title a 44px touch target; the meta line tucks back under it. */
.doc__title { display: block; padding: 11px 0; font-size: 16px; line-height: 1.4; text-decoration: none; color: var(--color-text); text-wrap: pretty; }
/* Each detail carries its "·" separator; the negative left margin pushes the separator of whichever
   item starts a line outside the clipped box, so a wrapped line never begins with a dot. */
.doc__meta { display: flex; flex-wrap: wrap; align-items: baseline; margin-top: -8px; overflow: hidden; }
.doc__meta > span { margin: 0 20px 0 -20px; }
.doc__meta > span::before {
  content: "·"; content: "·" / ""; display: inline-block; width: 20px; text-align: center; color: var(--color-neutral-600);
}
.doc__date { font-size: var(--fs-14); color: var(--color-neutral-800); font-variant-numeric: tabular-nums; }
.doc__date.is-pending { color: var(--color-neutral-600); }
.doc__fmt { font-size: var(--fs-13); color: var(--color-neutral-700); }
.doc__size { font-size: var(--fs-14); color: var(--color-neutral-800); font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc__actions {
  flex: 1 0 calc(100% - 32px); max-width: 280px; margin: 10px 0 0 32px;
  display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 8px;
}
.doc__view,
.doc__dl {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  border: 1px solid var(--color-text); background: transparent; color: var(--color-text);
  font-family: inherit; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background 200ms ease, color 200ms ease;
}
.doc__view { cursor: pointer; }
.doc__view svg,
.doc__dl svg { flex: none; }
/* The row's primary action darkens while the row is hovered or has focus. */
.doc:focus-within .doc__view { background: var(--color-text); color: var(--color-bg); }

@media (min-width: 768px) {
  .doc-skel { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; padding: 8px 12px 8px 52px; }
  .doc-skel > span:first-child { width: 50%; }
  .doc-skel > span:last-child { width: 248px; }

  .doc-notice { flex-direction: row; justify-content: space-between; align-items: center; gap: 24px; padding: 28px 32px; }

  .doc-group__head { display: grid; grid-template-columns: 20px minmax(0,1fr) auto; gap: 20px; align-items: center; padding: 16px 12px; }
  .doc-group__n { width: auto; }
  .doc-group__count { margin-left: 0; }
  .doc-group__empty { gap: 20px; }

  .doc { flex-wrap: nowrap; column-gap: 20px; padding: 4px 12px 10px; }
  .doc__main { flex-basis: 0; }
  .doc__actions { align-self: center; flex: none; width: 248px; max-width: none; margin: 0; }
}

/* ── lg: the original filter bar; xl: the original table-like rows ───── */

/* The design's minimum width was 1280px. From lg the filter bar is the original single row (with
   narrower selects until xl); the rows stay stacked (title + details | buttons) until xl, where
   the table-like column grid and its header row return. */
@media (min-width: 1024px) {
  .filters { position: sticky; top: calc(var(--nav-h) + var(--safe-top)); gap: 14px; padding: 20px var(--pad-x) 16px; }
  .filters__row { flex-wrap: nowrap; gap: 16px; }
  .filters__field--search { flex: 1; }
  .filters__field--cat { flex: none; width: 260px; }
  .filters__field--year,
  .filters__field--order { flex: none; width: 150px; }
  .filters__search { height: 44px; }
  .filters__clear { width: 28px; height: 28px; margin-right: 0; }
  .filters__select select { height: 44px; font-size: 15px; }
  .filters__status { gap: 24px; min-height: 20px; }
  .filters__count { white-space: nowrap; }
  .filters__reset {
    display: block; min-height: 0; padding: 0 0 2px; border-bottom: 1px solid var(--color-text); text-decoration: none;
  }

  .doc-notice__btn { min-height: 0; }
}

@media (min-width: 1280px) {
  .filters__field--cat { width: 340px; }
  .filters__field--year { width: 190px; }
  .filters__field--order { width: 170px; }

  /* Columns shared by the header row and every document row. */
  .doc-grid { display: grid; grid-template-columns: 48px minmax(0,1fr) 140px 52px 84px 248px; gap: 20px; }

  .doc-skel { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 0 24px; align-items: center; padding: 0; }
  .doc-skel > span:first-child { grid-column: 4 / span 6; width: 80%; }
  .doc-skel > span:last-child { grid-column: 10 / span 3; width: auto; height: 36px; }

  .doc-group__head { grid-template-columns: 48px minmax(0,1fr) auto; }
  .doc-group__empty { grid-template-columns: 48px minmax(0,1fr); }

  .doc { align-items: center; min-height: 60px; padding: 10px 12px; }
  .doc__idx { width: auto; }
  .doc__main,
  .doc__meta { display: contents; }
  .doc__title { padding: 0; }
  .doc__meta > span { margin: 0; }
  .doc__meta > span::before { content: none; }
  .doc__size { text-align: right; }
  .doc__actions { align-self: auto; width: auto; }
  .doc__view,
  .doc__dl { height: 40px; }
}

@media (hover: hover) {
  .filters__clear:hover { background: var(--color-neutral-200); }
  .doc-notice__btn:hover { background: var(--color-surface); }
  .doc-notice__btn--solid:hover { background: var(--color-neutral-800); }
  .doc:hover { background: var(--color-surface); }
  .doc__title:hover { text-decoration: underline; color: var(--color-text); }
  .doc:hover .doc__view { background: var(--color-text); color: var(--color-bg); }
  .doc__dl:hover { background: var(--color-surface); color: var(--color-text); }
}

/* ── PDF viewer (dialog) ────────────────────────────────────────────── */

/* Full screen at every size. Phones: the title gets two lines and the two actions share a second
   row; the details become a strip above the document. From md the bar is one row; from lg the
   details sit in a side column (the original layout). Safe areas pad the edges. */
.pdfv {
  position: fixed; inset: 0; z-index: 30;
  display: grid; grid-template-rows: auto minmax(0,1fr);
  background: color-mix(in srgb, black 35%, var(--color-text)); color: var(--color-bg);
  font-family: var(--font-body);
  animation: pdfv-fade 280ms ease both;
}
.pdfv[hidden] { display: none; }
@keyframes pdfv-fade { from { opacity: 0; } to { opacity: 1; } }

.pdfv__bar {
  position: relative; display: grid; grid-template-columns: minmax(0,1fr); align-items: center; gap: 8px;
  padding: calc(6px + var(--safe-top)) max(12px, env(safe-area-inset-right, 0px)) 12px max(4px, env(safe-area-inset-left, 0px));
  background: var(--color-text); border-bottom: 1px solid var(--color-neutral-800);
}
.pdfv__id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pdfv__close {
  display: flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; padding: 0;
  border: 0; background: transparent; color: var(--color-bg); cursor: pointer;
}
.pdfv__sep { flex: none; width: 1px; height: 32px; background: var(--color-neutral-800); }
.pdfv__names { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pdfv__cat { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-neutral-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfv__title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  font-size: 16px; line-height: 1.25; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis;
}

.pdfv__actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding-left: 8px; }
.pdfv__tab,
.pdfv__dl {
  display: flex; align-items: center; justify-content: space-between; height: 44px;
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.pdfv__tab { gap: 12px; padding: 0 14px; border: 1px solid var(--color-neutral-700); color: var(--color-bg); }
.pdfv__dl { gap: 24px; padding: 0 16px; background: var(--color-bg); color: var(--color-text); }
.pdfv__dl svg { flex: none; }

.pdfv__main { display: grid; grid-template-rows: auto minmax(0,1fr); min-height: 0; }
.pdfv__aside { display: flex; flex-direction: column; min-height: 0; background: var(--color-text); border-bottom: 1px solid var(--color-neutral-800); }
.pdfv__meta {
  display: grid; grid-template-columns: auto minmax(0,1fr); align-items: baseline; gap: 4px 16px; margin: 0;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  font-size: var(--fs-13);
}
.pdfv__meta dt { color: var(--color-neutral-500); }
.pdfv__meta dd { margin: 0; }

.pdfv__stage { position: relative; min-width: 0; min-height: 0; margin-bottom: env(safe-area-inset-bottom, 0px); }
.pdfv__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }

.pdfv__loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding-top: 32px; pointer-events: none;
}
.pdfv__loading[hidden] { display: none; }
.pdfv__skel {
  width: min(720px, calc(100% - 2 * var(--gutter))); aspect-ratio: 8.5 / 11;
  background: color-mix(in srgb, var(--color-bg) 8%, transparent);
  animation: pdfv-pulse 1600ms ease-in-out infinite;
}
@keyframes pdfv-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.pdfv__chip { position: absolute; top: 56px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--color-text); font-size: 13px; }

.pdfv__error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--gutter); overflow-y: auto; }
.pdfv__error[hidden] { display: none; }
.pdfv__card {
  display: flex; flex-direction: column; gap: 16px; max-width: 420px; padding: 24px;
  border: 1px solid var(--color-neutral-700); background: var(--color-text);
}
.pdfv__card-t { font-size: clamp(19px, 0.282vw + 17.94px, 22px); letter-spacing: -0.01em; }
.pdfv__card-d { font-size: var(--fs-14); line-height: 1.55; color: var(--color-neutral-400); }
.pdfv__card-a {
  align-self: flex-start; display: flex; align-items: center; gap: 20px; height: 44px; padding: 0 16px;
  background: var(--color-bg); color: var(--color-text); font-size: 13px; font-weight: 600; text-decoration: none;
}

@media (min-width: 768px) {
  .pdfv__bar {
    grid-template-columns: minmax(0,1fr) auto; gap: 24px; height: calc(72px + var(--safe-top));
    padding: var(--safe-top) max(20px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  }
  .pdfv__id { gap: 16px; }
  .pdfv__cat { overflow: visible; }
  .pdfv__title { display: block; -webkit-line-clamp: none; line-clamp: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pdfv__actions { display: flex; justify-content: flex-end; align-items: center; padding-left: 0; }
  .pdfv__error { padding: 48px; }
  .pdfv__card { padding: 32px; }
}

@media (min-width: 1024px) {
  .pdfv__main { grid-template-columns: 240px minmax(0,1fr); grid-template-rows: none; }
  .pdfv__aside { border-bottom: 0; border-right: 1px solid var(--color-neutral-800); }
  .pdfv__meta { align-items: normal; gap: 10px 16px; padding: 20px; border-bottom: 1px solid var(--color-neutral-800); }
  .pdfv__meta dd { text-align: right; }
}

@media (hover: hover) {
  .pdfv__close:hover { background: color-mix(in srgb, var(--color-bg) 12%, transparent); }
  .pdfv__tab:hover { border-color: var(--color-bg); color: var(--color-bg); }
  .pdfv__dl:hover { background: var(--color-neutral-300); color: var(--color-text); }
  .pdfv__card-a:hover { background: var(--color-neutral-300); color: var(--color-text); }
}

/* ── Reduced motion ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .pdfv, .pdfv__skel { animation: none; }
  .doc, .doc__view, .doc__dl { transition: none; }
}
