/* ===========================================================================
   ILAMDOCS — hoja del SITIO PÚBLICO
   ---------------------------------------------------------------------------
   La paleta sale del logo (muestreado: #802068). De ahí, una escala de morados
   con el 700 como color de marca, más neutros cálidos para que el blanco no
   compita con las portadas.

   El panel tiene su propia hoja (`custom/css/style.css`); esto no la toca.
   =========================================================================== */

:root {
    /* Marca */
    --brand-900: #3d0b31;
    --brand-800: #5a1449;
    --brand-700: #802068;   /* el color del logo */
    --brand-600: #982a7e;
    --brand-500: #b04a94;
    --brand-300: #d9a3c9;
    --brand-100: #f4e6ef;
    --brand-50:  #fbf3f8;

    /* Neutros con un punto de morado */
    --ink:    #1f1a1e;
    --body:   #4b444d;
    --muted:  #7b7280;
    --line:   #eae3e9;
    --line-2: #f2ecf1;
    --surface: #ffffff;
    --canvas:  #fbf9fb;

    /* Tipografía */
    --font-display: "Newsreader", Georgia, "Times New Roman", serif;
    --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Ritmo */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --gutter: clamp(1rem, 2.5vw, 2rem);
    --max: 1180px;

    /* Movimiento: curvas fuertes, nada de ease-in */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --shadow-1: 0 1px 2px rgba(61, 11, 49, .05), 0 1px 1px rgba(61, 11, 49, .04);
    --shadow-2: 0 10px 24px -12px rgba(61, 11, 49, .22), 0 2px 6px -2px rgba(61, 11, 49, .08);
}

/* ---------------------------------------------------------------- base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--body);
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .display {
    font-family: var(--font-display);
    color: var(--ink);
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.15;
    margin: 0;
}

h1 { font-size: clamp(2rem, 1.35rem + 2.4vw, 3.15rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.4rem); }

p { margin: 0 0 .85em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-800); }

mark {
    background: var(--brand-100);
    color: var(--brand-900);
    padding: 0 .12em;
    border-radius: 3px;
    font-weight: 600;
}

:focus-visible {
    outline: 2px solid var(--brand-700);
    outline-offset: 2px;
    border-radius: 4px;
}

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

.shell {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.clamp-1, .clamp-2, .clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

/* -------------------------------------------------------------- cabecera ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}

.site-header__bar {
    display: flex;
    align-items: center;
    gap: clamp(.75rem, 2vw, 2rem);
    min-height: 68px;
}

.brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand img { height: 38px; width: auto; display: block; }

.nav-main {
    display: none;
    align-items: center;
    gap: 1.1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-main a {
    color: var(--body);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-decoration: none;
    padding: .35rem 0;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.nav-main a:hover,
.nav-main a[aria-current="page"] {
    color: var(--brand-700);
    border-bottom-color: var(--brand-300);
}

.nav-item--menu { position: relative; }

.nav-menu-toggle {
    background: none;
    border: 0;
    font: inherit;
    color: var(--body);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: .35rem 1.1rem .35rem 0;
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.nav-menu-toggle::after {
    content: "";
    width: 6px; height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 180ms var(--ease-out);
}

.nav-item--menu[data-open="true"] .nav-menu-toggle { color: var(--brand-700); }
.nav-item--menu[data-open="true"] .nav-menu-toggle::after {
    transform: translateY(1px) rotate(-135deg);
}

.nav-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: -14px;
    min-width: 280px;
    margin: 0;
    padding: .5rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    display: none;
}

.nav-item--menu[data-open="true"] .nav-menu { display: block; }

.nav-menu a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem .7rem;
    border-radius: var(--radius-sm);
    border: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: .93rem;
    font-weight: 500;
    color: var(--ink);
    transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out);
}

.nav-menu a:hover { background: var(--brand-50); color: var(--brand-700); }
.nav-menu__count {
    color: var(--muted);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

.header-social {
    display: none;
    align-items: center;
    gap: .15rem;
    padding-right: .5rem;
    margin-right: .25rem;
    border-right: 1px solid var(--line);
}

/* Las redes sociales son lo primero que sobra cuando la cabecera se aprieta:
   por debajo de 1280 px viven solo en el pie. */
@media (min-width: 1280px) {
    .header-social { display: flex; }
}

.header-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 1rem;
    transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out);
}

.header-social a:hover { color: var(--brand-700); background: var(--brand-50); }

/* Buscador de la cabecera (solo en escritorio; en móvil vive en el panel) */
.search-mini {
    display: none;
    align-items: center;
    gap: .4rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .3rem .35rem .3rem .8rem;
    transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.search-mini--wide {
    display: flex;
    width: 100%;
    margin-top: 1rem;
}
.search-mini--wide input { flex: 1; width: auto; }

@media (min-width: 992px) {
    .search-mini { display: flex; }
    .search-mini--wide { display: none; }
}

.search-mini:focus-within {
    border-color: var(--brand-300);
    box-shadow: 0 0 0 3px var(--brand-50);
}

.search-mini i { color: var(--muted); font-size: .92rem; }

.search-mini input {
    border: 0;
    background: none;
    font: inherit;
    font-size: .9rem;
    color: var(--ink);
    width: 9.5rem;
    padding: .15rem 0;
    outline: none;
}

.search-mini input::placeholder { color: var(--muted); }

.search-mini button {
    border: 0;
    background: var(--brand-700);
    color: #fff;
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: .42rem .85rem;
    cursor: pointer;
    transition: transform 150ms var(--ease-out), background-color 150ms var(--ease-out);
}

.search-mini button:hover { background: var(--brand-800); }
.search-mini button:active { transform: scale(.96); }

.nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 10px;
    color: var(--ink);
    font-size: 1.15rem;
    cursor: pointer;
}

/* Menú móvil (desplegable, sin JS de terceros) */
.nav-mobile {
    display: none;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: .75rem 0 1rem;
}
.nav-mobile[data-open="true"] { display: block; }
.nav-mobile ul { list-style: none; margin: 0; padding: 0; }
.nav-mobile a {
    display: block;
    padding: .7rem 0;
    border-bottom: 1px solid var(--line-2);
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
}
.nav-mobile a:hover { color: var(--brand-700); }

@media (min-width: 992px) {
    .nav-main { display: flex; }
    .nav-burger { display: none; }
    .nav-mobile { display: none !important; }
}

@media (max-width: 575.98px) {
    .search-mini input { width: 6.5rem; }
    .brand img { height: 32px; }
}

/* --------------------------------------------------------------- pie ---- */
.site-footer {
    margin-top: clamp(3rem, 8vw, 6rem);
    background: var(--brand-900);
    color: rgba(255, 255, 255, .72);
    padding: clamp(2.5rem, 5vw, 4rem) 0 2rem;
    font-size: .9rem;
}

.site-footer a { color: rgba(255, 255, 255, .86); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer h4 {
    color: #fff;
    font-family: var(--font-ui);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: .9rem;
}
.site-footer__grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .site-footer__grid { grid-template-columns: 1.2fr 1fr 1fr; }
}
.site-footer__logos { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.site-footer__logos img { height: 34px; width: auto; opacity: .92; }
.site-footer__bottom {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .14);
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.5rem;
    justify-content: space-between;
    font-size: .82rem;
    color: rgba(255, 255, 255, .6);
}

/* -------------------------------------------------------------- migas ---- */
.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--muted);
    padding: 1.25rem 0 0;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand-700); text-decoration: underline; }
.crumbs span[aria-hidden] { opacity: .5; }

/* --------------------------------------------------- cabecera de página ---- */
.page-head {
    padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(1.5rem, 3vw, 2.25rem);
}

.page-head__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--brand-600);
    margin-bottom: .85rem;
}

.page-head__eyebrow::before {
    content: "";
    width: 22px; height: 2px;
    background: var(--brand-300);
}

.page-head h1 { margin-bottom: .6rem; text-wrap: balance; }

.page-head__lead {
    max-width: 62ch;
    color: var(--muted);
    font-size: clamp(1rem, .95rem + .25vw, 1.1rem);
}
.page-head__lead p { margin-bottom: .5em; }

.page-head__stats {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.75rem;
    margin-top: 1.35rem;
    font-size: .85rem;
    color: var(--muted);
}
.page-head__stats b {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-right: .3rem;
}

/* ------------------------------------------------------- rejilla de cards ---- */
.grid-cards {
    display: grid;
    gap: clamp(1rem, 2vw, 1.5rem);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 255px), 1fr));
}

/* Secciones de la portada: 5 tarjetas en 4 columnas dejan una huérfana en la
   última fila; a 3 columnas quedan 3 + 2. */
.grid-cards--secciones {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

/* Portada: objeto con proporción fija, sin saltos al cargar */
.cover {
    position: relative;
    display: block;
    overflow: hidden;
    background-color: var(--brand-50);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9a3c9' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.5A2.5 2.5 0 0 1 6.5 3H20v18H6.5A2.5 2.5 0 0 1 4 18.5z'/%3E%3Cpath d='M8 3v18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 34% auto;
}

.cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Un velo muy leve del morado de marca: las portadas vienen de mil fuentes
   (escaneos, capturas, PDF convertidos) y sin algo que las una la rejilla se ve
   como un collage. No oculta nada: es un 4-10 %. */
.cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(128, 32, 104, .04), rgba(61, 11, 49, .10));
    pointer-events: none;
}

/* --- Portada tipográfica (documentos sin imagen) --------------------------- */
.cover--vacia {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-image: none;
    padding: 1.15rem 1rem 1rem 1.5rem;
}
.cover--v0 { background: linear-gradient(155deg, #fdf6fa 0%, #f2dfec 100%); }
.cover--v1 { background: linear-gradient(155deg, #f9f4f9 0%, #ece2ee 100%); }
.cover--v2 { background: linear-gradient(155deg, #fdf7f4 0%, #f2e3dd 100%); }

.cover__lomo {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 7px;
    background: linear-gradient(180deg, var(--brand-500), var(--brand-800));
    opacity: .5;
}

.cover__titulo {
    margin-block: auto;
    font-family: var(--font-display);
    font-size: 1.04rem;
    line-height: 1.32;
    letter-spacing: -.005em;
    color: var(--brand-900);
    text-align: left;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
}

.cover__pie {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand-600);
    font-variant-numeric: tabular-nums;
}

.cover--wide .cover__titulo { font-size: 1.15rem; -webkit-line-clamp: 3; }

@media (max-width: 575.98px) {
    .cover--vacia { padding: .9rem .8rem .8rem 1.2rem; }
    .cover__titulo { font-size: .95rem; -webkit-line-clamp: 4; }
}

.cover--wide { aspect-ratio: 16 / 10; }
.cover--book { aspect-ratio: 3 / 4; }

/* Tarjeta de subcategoría (página de categoría) */
.sub-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-1);
    transition: transform 200ms var(--ease-out),
                box-shadow 200ms var(--ease-out),
                border-color 200ms var(--ease-out);
}

.sub-card .cover { border-bottom: 1px solid var(--line-2); }

.sub-card__body {
    padding: 1.1rem 1.15rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex: 1;
}

.sub-card__title {
    font-family: var(--font-display);
    font-size: 1.16rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.25;
    letter-spacing: -.01em;
}

.sub-card__desc {
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.5;
}

.sub-card__foot {
    margin-top: auto;
    padding-top: .85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-size: .8rem;
    color: var(--brand-700);
    font-weight: 600;
}

.sub-card__count {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--brand-50);
    color: var(--brand-700);
    border: 1px solid var(--brand-100);
    border-radius: 999px;
    padding: .18rem .6rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sub-card__go {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    transition: gap 180ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .sub-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-2);
        border-color: var(--brand-100);
    }
    .sub-card:hover .cover img { transform: scale(1.03); }
    .sub-card:hover .sub-card__go { gap: .55rem; }
}

.sub-card .cover img { transition: transform 400ms var(--ease-out); }
.sub-card:active { transform: translateY(-1px) scale(.997); }

/* Tarjeta de publicación (documento) */
.pub-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 200ms var(--ease-out),
                box-shadow 200ms var(--ease-out),
                border-color 200ms var(--ease-out);
}

.pub-card .cover { border-bottom: 1px solid var(--line-2); }
.pub-card .cover img { transition: transform 400ms var(--ease-out); }

.pub-card__body {
    padding: .95rem 1.05rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}

.pub-card__kicker {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand-600);
    font-variant-numeric: tabular-nums;
}

.pub-card__kicker .dot { color: var(--line); }

.pub-card__title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--ink);
    letter-spacing: -.005em;
}

.pub-card__author {
    font-size: .82rem;
    color: var(--muted);
    line-height: 1.45;
}

.pub-card__foot {
    margin-top: auto;
    padding-top: .8rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--brand-700);
    transition: gap 180ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .pub-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-2);
        border-color: var(--brand-100);
    }
    .pub-card:hover .cover img { transform: scale(1.035); }
    .pub-card:hover .pub-card__foot { gap: .55rem; }
}
.pub-card:active { transform: translateY(-1px) scale(.997); }

/* ------------------------------------------------------------ barra de ---- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .85rem 1.25rem;
    padding: .85rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.toolbar__count {
    font-size: .87rem;
    color: var(--muted);
}
.toolbar__count b { color: var(--ink); font-variant-numeric: tabular-nums; }

.toolbar__group { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.field-inline {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--muted);
}

.select {
    appearance: none;
    font: inherit;
    font-size: .84rem;
    color: var(--ink);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%237b7280' stroke-width='1.4'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .55rem center;
    background-size: 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .38rem 1.9rem .38rem .8rem;
    cursor: pointer;
    transition: border-color 150ms var(--ease-out);
}
.select:hover { border-color: var(--brand-300); }

/* ------------------------------------------------------------ paginación ---- */
.pager {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: clamp(2rem, 4vw, 3rem) 0 0;
}
.pager__list {
    display: flex;
    align-items: center;
    gap: .3rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}
.pager__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 .55rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--body);
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.pager__link:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.pager__link[aria-current="page"] {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
    font-weight: 600;
}
.pager__link[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.pager__gap { color: var(--muted); padding: 0 .25rem; }
.pager__note { font-size: .8rem; color: var(--muted); }

/* ------------------------------------------------------------ búsqueda ---- */
.search-hero {
    padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.25rem, 3vw, 2rem);
}

.search-form { max-width: 760px; }

.search-form__label {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    color: var(--ink);
    font-weight: 500;
    letter-spacing: -.015em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.search-big {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .45rem .45rem .45rem 1.1rem;
    box-shadow: var(--shadow-1);
    transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.search-big:focus-within {
    border-color: var(--brand-300);
    box-shadow: 0 0 0 4px var(--brand-50);
}
.search-big > i { color: var(--muted); font-size: 1.15rem; }
.search-big input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: clamp(1rem, .95rem + .3vw, 1.1rem);
    color: var(--ink);
    padding: .55rem 0;
    outline: none;
}
.search-big input::placeholder { color: var(--muted); }
.search-big__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.search-big__clear:hover { background: var(--brand-50); color: var(--brand-700); }

.btn-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid var(--brand-700);
    background: var(--brand-700);
    color: #fff;
    font: inherit;
    font-size: .87rem;
    font-weight: 600;
    border-radius: 999px;
    padding: .62rem 1.15rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 150ms var(--ease-out), background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.btn-solid:hover { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.btn-solid:active { transform: scale(.97); }

.btn-quiet {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--body);
    font: inherit;
    font-size: .85rem;
    font-weight: 500;
    border-radius: 999px;
    padding: .5rem .95rem;
    text-decoration: none;
    transition: border-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.btn-quiet:hover { border-color: var(--brand-300); color: var(--brand-700); }
.btn-quiet:active { transform: scale(.97); }

.search-form__hint {
    margin-top: .85rem;
    font-size: .84rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .9rem;
    align-items: center;
}
.search-form__hint kbd {
    font-family: var(--font-ui);
    font-size: .74rem;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: .05rem .35rem;
    color: var(--body);
    background: var(--surface);
}

/* Filtros / facetas */
.facets {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: 1.1rem;
    align-items: center;
}
.facets__label {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: .25rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--body);
    border-radius: 999px;
    padding: .32rem .75rem;
    font-size: .82rem;
    text-decoration: none;
    transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.chip:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-50); }
.chip[aria-pressed="true"], .chip--active {
    background: var(--brand-700);
    border-color: var(--brand-700);
    color: #fff;
}
.chip[aria-pressed="true"]:hover, .chip--active:hover { color: #fff; background: var(--brand-800); }
.chip__count {
    font-variant-numeric: tabular-nums;
    opacity: .7;
    font-size: .76rem;
}

/* Resultados: filas legibles, pensadas para escanear títulos */
.results {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}
.result {
    display: grid;
    grid-template-columns: 62px 1fr;
    gap: 1rem;
    padding: 1.15rem 0;
    border-bottom: 1px solid var(--line);
    align-items: start;
}
.result__thumb {
    width: 62px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--line-2);
}
.result__thumb .cover { aspect-ratio: 3 / 4; background-size: 44% auto; }

.result__title {
    font-family: var(--font-display);
    font-size: 1.14rem;
    font-weight: 500;
    line-height: 1.3;
    margin: 0 0 .3rem;
    letter-spacing: -.005em;
}
.result__title a { color: var(--ink); text-decoration: none; }
.result__title a:hover { color: var(--brand-700); text-decoration: underline; }

.result__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .1rem 0;
    font-size: .82rem;
    color: var(--muted);
}

/* Separador entre datos: un `·` antes de cada uno menos el primero. Sale del CSS
   y no de la plantilla porque así no hay que llevar la cuenta de cuál es el
   primero cuando faltan autor, revista o año. */
.result__meta > * + *::before {
    content: "·";
    margin: 0 .55rem;
    opacity: .45;
}

.result__where { color: var(--brand-600); font-weight: 500; }
.result__desc {
    margin-top: .4rem;
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.55;
}
.result__tags { margin-top: .45rem; display: flex; flex-wrap: wrap; gap: .35rem; }

.tag {
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: 4px;
    padding: .12rem .4rem;
}

@media (min-width: 768px) {
    .result { grid-template-columns: 96px 1fr; gap: 1.5rem; padding: 1.4rem 0; }
    .result__thumb { width: 96px; }
}

/* Estado vacío */
.empty {
    text-align: center;
    padding: clamp(2.5rem, 6vw, 4.5rem) 1rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    border-radius: 999px;
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.empty h2 { margin-bottom: .5rem; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 1.25rem; }
.empty__actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

/* --------------------------------------------------------- ficha documento ---- */
.doc-layout {
    display: grid;
    gap: clamp(1.5rem, 4vw, 3rem);
    grid-template-columns: 1fr;
    padding-bottom: 1rem;
}
@media (min-width: 900px) {
    .doc-layout { grid-template-columns: minmax(260px, 340px) 1fr; align-items: start; }
    .doc-cover { position: sticky; top: 92px; }
}
.doc-cover__frame {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-1);
}
.doc-cover__frame .cover { aspect-ratio: 3 / 4; }
.doc-cover__note {
    margin-top: .75rem;
    font-size: .78rem;
    color: var(--muted);
    text-align: center;
}

.doc-title { margin-bottom: .4rem; }
.doc-subtitle {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--muted);
    font-style: italic;
    margin-bottom: .9rem;
}

.doc-counts {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .9rem;
    font-size: .82rem;
    color: var(--muted);
    padding-bottom: 1.15rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.35rem;
}
.doc-counts span { display: inline-flex; align-items: center; gap: .35rem; }

.doc-meta {
    display: grid;
    gap: 0;
    margin: 0 0 1.5rem;
    border-top: 1px solid var(--line-2);
}
.doc-meta__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .1rem .75rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--line-2);
    font-size: .92rem;
}
.doc-meta__row dt {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.doc-meta__row dd { margin: 0; color: var(--body); overflow-wrap: anywhere; }
@media (min-width: 640px) {
    .doc-meta__row { grid-template-columns: 190px 1fr; align-items: baseline; padding: .55rem 0; }
}

.doc-cta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    padding: 1.15rem 0;
}
.btn-large {
    font-size: .95rem;
    padding: .8rem 1.4rem;
}

.doc-prose { margin-top: 1.5rem; }
.doc-prose h2, .doc-prose h3 { margin-bottom: .6rem; }
.doc-prose details {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .9rem 1.1rem;
    background: var(--surface);
}
.doc-prose summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink);
    list-style: none;
}
.doc-prose summary::-webkit-details-marker { display: none; }
.doc-prose summary::after {
    content: "+";
    float: right;
    color: var(--brand-700);
    font-weight: 600;
}
.doc-prose details[open] summary::after { content: "–"; }
.doc-prose details > div { margin-top: .8rem; color: var(--body); font-size: .93rem; }

/* Relacionados */
.related { margin-top: clamp(2.5rem, 5vw, 4rem); }.related__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.25rem;
}
.related__head h2 { font-size: 1.25rem; }

/* ------------------------------------------------------------- portada ---- */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--brand-800), var(--brand-900) 55%, #2a0722);
    color: #fff;
    padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 7vw, 5rem);
}
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 60% at 85% 15%, rgba(217, 163, 201, .28), transparent 70%),
        radial-gradient(45% 45% at 10% 90%, rgba(152, 42, 126, .35), transparent 70%);
    pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; max-width: 20ch; }
.hero p {
    color: rgba(255, 255, 255, .82);
    max-width: 56ch;
    font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
    margin-top: 1rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.75rem; }
.hero .btn-solid { background: #fff; border-color: #fff; color: var(--brand-800); }
.hero .btn-solid:hover { background: var(--brand-100); border-color: var(--brand-100); color: var(--brand-900); }
.hero .btn-quiet {
    background: transparent;
    border-color: rgba(255, 255, 255, .35);
    color: #fff;
}
.hero .btn-quiet:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .08); }

.section {
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 0;
}
.section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}
.section__head p { color: var(--muted); margin: .35rem 0 0; max-width: 56ch; }
.section__link {
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.section__link:hover { text-decoration: underline; }

.prose-block { max-width: 68ch; }
.prose-block p { color: var(--body); }
.prose-block h2 { margin-bottom: .75rem; }

/* Reproductor incrustado: el HTML viene con width/height fijos del sitio viejo,
   asi que se fuerza la proporcion aqui (una ficha de video no puede salir con
   un iframe de 560 px en medio de una columna). */
.doc-embed {
    max-width: 900px;
    margin: 0 auto 2rem;
}
.doc-embed iframe,
.doc-embed video,
.doc-embed embed,
.doc-embed object {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #000;
}
.doc-embed p { color: var(--muted); font-size: .9rem; }

/* Lista de archivos de una ficha (clase `Archivo`: todos los PDF del número) */
.doc-files {
    margin: 1.5rem 0 0;
    padding: 1.15rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.doc-files__title {
    font-family: var(--font-ui);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .9rem;
}
.doc-files__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--brand-100);
    color: var(--brand-800);
    font-size: .74rem;
    font-variant-numeric: tabular-nums;
}
.doc-files__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .15rem;
}
.doc-files__item a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    margin-inline: -.6rem;
    border-radius: var(--radius-sm);
    color: var(--body);
    text-decoration: none;
    font-size: .9rem;
    transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.doc-files__item a:hover { background: var(--brand-50); color: var(--brand-800); }
.doc-files__item i { color: var(--brand-600); flex: 0 0 auto; }
.doc-files__nombre {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-files__peso {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------- accesibilidad ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .sub-card:hover, .pub-card:hover, .sub-card:active, .pub-card:active {
        transform: none;
    }
    .sub-card:hover .cover img, .pub-card:hover .cover img { transform: none; }
}

@media (prefers-contrast: more) {
    :root { --line: #cdbccb; --muted: #5f5765; }
    .sub-card, .pub-card, .cover { border-color: var(--line); }
}
