/* Catálogo y biblioteca: portadas protagonistas y controles compartidos. */
.discovery-page { padding: 0; background: transparent; box-shadow: none; }
.discovery-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.8rem; }
.discovery-heading h1 { color: var(--ink); font-size: clamp(2rem, 4vw, 3rem); margin: .4rem 0; }
.discovery-heading h2 { color: var(--ink); margin: .4rem 0; font-size: 1.65rem; }
.discovery-heading p { color: var(--muted); margin: .4rem 0; font-size: .88rem; }
.discovery-heading > a { flex-shrink: 0; }
.discovery-collections { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.5rem; }
.discovery-collections a { display: flex; gap: 1rem; align-items: center; padding: .9rem 1.1rem; border-radius: 12px; color: var(--violet-dark); border: 1px solid var(--line); background: #f6f2ff; text-decoration: none; font-size: .8rem; }
.discovery-collections a[aria-current], .discovery-collections a:hover { border-color: var(--violet); background: #eee6ff; }
.discovery-filters { border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 1.25rem; margin-bottom: 2rem; }
.discovery-filter-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.discovery-filter-row > label { flex: 1 1 180px; min-width: 0; }
.discovery-filter-row > .discovery-search { flex: 2 1 260px; }
.discovery-filters label, .discovery-inline-form label, .discovery-filter-row label { font-size: .78rem; color: var(--ink); }
.discovery-filter-row input, .discovery-filter-row select, .discovery-inline-form input:not([type="checkbox"]), .discovery-inline-form select { display: block; width: 100%; min-width: 0; min-height: 44px; padding: .7rem; margin-top: .35rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--ink); background: #fff; }
.discovery-filter-options { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin-top: 1rem; }
.discovery-filter-options label { display: flex; align-items: center; gap: .3rem; min-height: 44px; cursor: pointer; }
.discovery-filter-options > a { font-size: .75rem; }
.discovery-results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.discovery-results-heading h2 { color: var(--ink); font-size: 1.3rem; margin: 0; }
.discovery-results-heading p { font-size: .8rem; color: var(--muted); }
.discovery-results-heading > p { white-space: nowrap; }
.discovery-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.6rem 1.2rem; }
.discovery-card { min-width: 0; display: flex; flex-direction: column; }
.discovery-cover { display: block; position: relative; aspect-ratio: 2 / 3; border-radius: 3px 9px 9px 3px; overflow: hidden; background: #f0e9fc; box-shadow: 2px 5px 14px #25134514; text-decoration: none; }
.discovery-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.discovery-cover-placeholder { display: flex; flex-direction: column; justify-content: space-between; padding: 12%; width: 100%; height: 100%; text-align: center; color: #533490; background: linear-gradient(145deg, #e4daf8, #faf7ff); }
.discovery-cover-placeholder strong { font: 400 clamp(1rem, 2vw, 1.3rem)/1.3 Georgia, serif; overflow-wrap: anywhere; }
.discovery-cover-placeholder small { font-size: .6rem; }
.discovery-adult { position: absolute; right: .5rem; top: .5rem; border-radius: 6px; background: #30203fe8; color: #fff; padding: .2rem .4rem; font-size: .65rem; }
.discovery-card-copy { padding-top: .85rem; }
.discovery-card h3 { margin: 0 0 .3rem; font-size: .88rem; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.discovery-card h3 a { color: var(--ink); text-decoration: none; }
.discovery-card h3 a:hover { color: var(--violet-dark); text-decoration: underline; }
.discovery-author { margin: 0 0 .6rem; color: var(--muted); font-size: .73rem; overflow-wrap: anywhere; }
.discovery-available, .discovery-status { display: inline-block; padding: .25rem .45rem; border-radius: 5px; font-size: .62rem; background: var(--violet-tint); color: var(--violet-dark); }
.discovery-available { color: #28633c; background: #edf6ee; }
.discovery-affinity { display: block; color: var(--violet-dark); font-size: .65rem; }
.discovery-deadline { font-size: .65rem; color: var(--muted); }
.discovery-card-action { display: block; font-size: .75rem; margin-top: .8rem; min-height: 32px; }
.discovery-text-button { padding: .4rem 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .68rem; cursor: pointer; min-height: 44px; text-align: left; }
.discovery-text-button:hover { color: var(--violet-dark); text-decoration: underline; }
.discovery-empty { border: 1px dashed #cfc1eb; border-radius: 16px; padding: 3rem 1.5rem; text-align: center; background: #faf7ff; }
.discovery-empty h2 { color: var(--ink); font: 400 1.5rem/1.4 Georgia, serif; }
.discovery-empty p { font-size: .85rem; color: var(--muted); }
.discovery-shelves { display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.discovery-shelves a { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: .85rem; }
.discovery-shelves a[aria-current] { background: var(--violet); color: #fff; }
.discovery-shelves a span { background: #ffffff44; border: 1px solid #b6a1e333; border-radius: 6px; font-size: .7rem; min-width: 1.5rem; text-align: center; }
.discovery-note { font-size: .8rem; color: var(--muted); }
.discovery-pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 2rem 0; font-size: .8rem; }
.discovery-preferences { max-width: 850px; }
.discovery-choices { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 1rem 0; min-width: 0; }
.discovery-choices legend { font-weight: 500; padding: 0 .4rem; font-size: .9rem; }
.form .discovery-choices label, .discovery-choices label { display: inline-flex; align-items: center; gap: .5rem; margin: .3rem; padding: .6rem .8rem; background: #faf7ff; border: 1px solid var(--line); border-radius: 8px; font-weight: 400; font-size: .8rem; cursor: pointer; }
.discovery-choices label:has(input:checked) { border-color: var(--violet); background: #eee6ff; color: var(--violet-dark); }
.form .discovery-choices input, .form .discovery-check input, .discovery-check input { width: 1rem; height: 1rem; min-height: 0; padding: 0; margin: 0; flex-shrink: 0; }
.form .discovery-check, .discovery-check { display: flex; align-items: center; gap: .5rem; font-size: .8rem; min-height: 44px; }
.discovery-choices p { font-size: .75rem; }
.discovery-recommendations { margin: 3rem 0; }
.discovery-profile-links { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 16px; margin: 1.5rem 0; }
.discovery-profile-links > div { flex: 1 1 220px; }
.discovery-profile-links h2 { color: var(--ink); font-size: 1.1rem; margin: 0; }
.discovery-profile-links p { margin: .5rem 0; color: var(--muted); font-size: .8rem; }
.wishlist-box { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1.25rem; margin: 1.2rem 0; }
.wishlist-box p { color: var(--muted); font-size: .75rem; margin: 0; }
.wishlist-box button[aria-pressed="true"] { background: var(--violet-tint); }
.discovery-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.discovery-badges > * { border-radius: 5px; background: #f3edfc; color: var(--violet-dark); font-size: .68rem; padding: .25rem .5rem; text-decoration: none; }
.discovery-organize { margin: 1rem 0; font-size: .8rem; }
.discovery-organize summary, .discovery-term-list summary { cursor: pointer; min-height: 44px; padding: .7rem 0; color: var(--violet-dark); }
.discovery-organize p { font-size: .72rem; color: var(--muted); }
.discovery-inline-form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin: .7rem 0; }
.discovery-inline-form > label { flex: 1 1 150px; min-width: 0; }
.discovery-inline-form > select { flex: 1 1 160px; }
.discovery-admin-section { padding: 1.5rem; margin-bottom: 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.discovery-admin-section > p { font-size: .85rem; color: var(--muted); }
.discovery-admin-section h2 { color: var(--ink); }
.discovery-collection-list { list-style: none; padding: 0; }
.discovery-collection-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.discovery-collection-list small { display: block; color: var(--muted); }
.discovery-book-picker { max-height: 350px; overflow-y: auto; }
.app-header .app-nav a[aria-current="page"] { color: var(--violet-dark); box-shadow: inset 0 -2px var(--violet); background: transparent; }
@media (prefers-reduced-motion: no-preference) { .discovery-cover { transition: transform .18s ease; } .discovery-cover:hover { transform: translateY(-4px); } }
@media (max-width: 1050px) { .discovery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .app-header .app-nav { gap: 1rem; } .app-header .app-nav a { font-size: .82rem; } .app-header .user-menu-label { display: none; } }
@media (max-width: 720px) {
    .discovery-heading { align-items: flex-start; flex-direction: column; gap: .6rem; }
    .discovery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .discovery-results-heading { flex-wrap: wrap; gap: .3rem; }
    .discovery-shelves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .discovery-shelves a { justify-content: space-between; font-size: .78rem; padding: .7rem; }
    .discovery-filter-options { gap: .5rem .8rem; }
}
@media (max-width: 480px) {
    .discovery-page { width: calc(100% - 2rem); margin: 1.5rem auto; }
    .discovery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; }
    .discovery-admin-section, .discovery-preferences { padding: 1rem; }
    .discovery-filters { padding: 1rem; }
    .discovery-pagination { gap: .5rem; }
    .discovery-choices label { max-width: 100%; overflow-wrap: anywhere; }
}

/* Novedades: estante en Explorar e insignia "Nuevo" (libros de los últimos Discovery::NEW_DAYS días). */
.discovery-new-badge { position: absolute; left: .5rem; top: .5rem; z-index: 1; border-radius: 6px; background: var(--violet); color: #fff; padding: .2rem .45rem; font-size: .62rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 2px 6px #25134526; }
.discovery-latest { margin: 0 0 2.5rem; padding: 1.5rem 1.6rem 1.8rem; border: 1px solid #e4daf8; border-radius: 20px; background: linear-gradient(180deg, #f7f3ff, #fff 60%); }
.discovery-latest-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.discovery-latest-heading h2 { margin: .4rem 0 .2rem; font: 400 clamp(1.5rem, 3vw, 2rem)/1.2 Georgia, serif; color: var(--ink); }
.discovery-latest-heading p { margin: 0; color: var(--muted); font-size: .85rem; }
.discovery-latest-heading > a { color: var(--violet-dark); font-size: .82rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.discovery-latest-heading > a:hover { text-decoration: underline; }
@media (max-width: 640px) { .discovery-latest { padding: 1.1rem 1rem 1.3rem; } }

/* La biblioteca personal del lector. */
body:has(.reader-library) { background: #fdfbfc; }
.page.reader-library { border: 0; box-shadow: none; padding: 0; max-width: 1160px; }
.library-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(180px, .8fr); align-items: center; gap: 2rem; padding: 2.5rem 3rem; margin-bottom: 1.5rem; border: 1px solid #eae0f5; border-radius: 22px; background: linear-gradient(115deg, #faf7fc, #eee7fa); }
.library-hero h1 { font: 500 clamp(2.2rem, 4vw, 3.5rem)/1.08 Georgia, serif; letter-spacing: -.045em; color: #171344; margin: 1rem 0; }
.library-hero h1 em { font-weight: 400; color: #8051ff; }
.library-hero p { max-width: 510px; font-size: .85rem; line-height: 1.8; color: #666184; }
.library-discover { display: inline-flex; align-items: center; gap: 1rem; padding: .8rem 1.2rem; margin-top: .5rem; border-radius: 999px; background: #8051ff; color: #fff; font-size: .8rem; text-decoration: none; }
.library-discover:hover { background: #6433dc; }
.library-illustration { display: block; width: 100%; max-width: 300px; height: auto; justify-self: center; }
.reader-library .discovery-shelves { gap: .65rem; border-bottom: 1px solid #e9e2f3; }
.reader-library .discovery-shelves a { background: #f6f1fc; border: 1px solid #e9e0f6; color: #665b7e; }
.reader-library .discovery-shelves a[aria-current] { background: #8051ff; color: #fff; border-color: #8051ff; }
.library-shelf-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin: 1.8rem 0 1.3rem; }
.library-shelf-heading h2 { color: #171344; font: 500 1.8rem Georgia, serif; margin: .35rem 0 0; }
.library-shelf-heading > span { color: #817b9f; font-size: .75rem; }
.reader-library .library-bookcase { gap: 2rem 1.4rem; padding: 1.5rem; border: 1px solid #e8e0f0; border-radius: 16px; background: #f8f4fb; }
.library-bookcase .discovery-card { position: relative; padding: .6rem .6rem 1rem; border-bottom: 8px solid #d5c3ba; border-radius: 5px; background: linear-gradient(180deg, #ffffffa8, #eee6df80); box-shadow: 0 8px 10px -8px #53403b65; }
.library-bookcase .discovery-card-copy { flex: 1; }
.reader-library .discovery-card h3 { color: #171344; font-size: .8rem; }
.reader-library .discovery-author { font-size: .7rem; }
.reader-library .discovery-empty { background: #faf7fc; border-color: #d9c9ed; }
.reader-library .discovery-empty h2 { color: #171344; }
.library-discover:focus-visible, .reader-library .discovery-shelves a:focus-visible { outline: 2px solid #8051ff; outline-offset: 3px; }
@media (max-width: 760px) {
    .library-hero { padding: 1.5rem; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
    .library-illustration { max-width: 210px; }
    .reader-library .library-bookcase { padding: .75rem; gap: 1.3rem .75rem; }
}
@media (max-width: 440px) {
    .library-hero h1 { font-size: 2.2rem; }
    .library-bookcase .discovery-card { padding: .4rem .4rem .8rem; }
}

/* Perfil: un recorrido personal, con miniaturas editoriales. */
body:has(.reader-profile) { background: #fdfbfc; }
.page.reader-profile { max-width: 1160px; padding: 0; border: 0; box-shadow: none; background: transparent; }
.profile-editorial-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(150px, .7fr); gap: 2rem; align-items: center; background: linear-gradient(115deg, #faf7fc, #efe7fa); border: 1px solid #ebe1f5; border-radius: 22px; padding: 2rem 2.5rem; margin-bottom: 1.5rem; }
.profile-editorial-hero h1 { color: #171344; font: 500 clamp(2rem, 3.8vw, 3.3rem)/1.12 Georgia, serif; letter-spacing: -.04em; margin: .8rem 0; }
.profile-editorial-hero h1 em { color: #8051ff; font-weight: 400; }
.profile-editorial-hero p { color: #666184; max-width: 510px; font-size: .85rem; line-height: 1.8; margin-bottom: 1.2rem; }
.profile-editorial-hero > img { width: 100%; max-width: 220px; height: auto; justify-self: center; }
.profile-editorial-hero .btn-secondary { border-radius: 999px; font-size: .8rem; background: #fff9; }
.reader-profile .profile-header { border: 1px solid #e8e0f2; border-radius: 16px; padding: 1.5rem; background: #fff; }
.reader-profile .user-info { min-width: 0; }
.reader-profile .user-info > div { min-width: 0; overflow-wrap: anywhere; }
.reader-profile .points-summary { border-radius: 16px; }
.profile-reading-world { margin: 2rem 0; }
.profile-reading-world h2, .reader-profile > h2, .reader-profile .points-recent h2 { color: #171344; font: 500 1.7rem/1.25 Georgia, serif; }
.profile-reading-world h2 { margin: .4rem 0 1.2rem; }
.profile-illustrated-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.profile-illustrated-links > a { display: flex; flex-direction: column; align-items: flex-start; padding: 1.2rem 1.4rem; border: 1px solid #e9e0f3; border-radius: 14px; background: #f8f4fd; color: #171344; text-decoration: none; min-width: 0; }
.profile-illustrated-links img { width: 110px; height: 85px; object-fit: contain; margin: 0 0 .8rem; }
.profile-illustrated-links strong { font-size: .9rem; display: flex; align-items: center; justify-content: space-between; width: 100%; gap: .5rem; }
.profile-illustrated-links strong span { color: #8051ff; }
.profile-illustrated-links a > span { color: #77708b; font-size: .75rem; line-height: 1.7; margin-top: .4rem; }
.profile-illustrated-links a:hover { background: #f0e8fc; border-color: #c5acee; }
.profile-illustrated-links a:focus-visible { outline: 2px solid #8051ff; outline-offset: 3px; }
.reader-profile .points-recent-heading h2 { display: flex; align-items: center; gap: .65rem; }
.profile-points-art { object-fit: contain; flex-shrink: 0; }
.reader-profile .campaign-row { border-radius: 12px; background: #fff; border-color: #e9e0f3; }
@media (max-width: 680px) {
    .profile-editorial-hero { grid-template-columns: minmax(0, 1fr); padding: 1.5rem; gap: .5rem; }
    .profile-editorial-hero > img { max-width: 160px; }
    .profile-illustrated-links { grid-template-columns: minmax(0, 1fr); }
    .profile-illustrated-links > a { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: .3rem 1rem; }
    .profile-illustrated-links img { grid-row: 1 / 3; width: 80px; height: 65px; margin: 0; }
    .profile-illustrated-links a > span { margin: 0; }
    .reader-profile .points-recent-heading { align-items: flex-start; flex-direction: column; gap: .5rem; }
}

/* Preferencias: continuidad con el rincón del lector. */
.discovery-preferences .preferences-form{max-width:none;margin:0}
.preferences-panel{padding:1.75rem 2rem;margin:0 0 1.25rem;border:1px solid #e8e0f2;border-radius:16px;background:#fff;box-shadow:0 4px 20px #32245a04}
.preferences-panel h2{margin:.6rem 0 .75rem;color:#171344;font:500 1.7rem/1.25 Georgia,serif}
.preferences-intro{margin:0 0 1.25rem;font-size:.85rem;line-height:1.8;color:#666184}
.preferences-panel .discovery-choices{padding:0;margin:1rem 0;border:0}
.preferences-panel .discovery-choices legend{padding:0;margin-bottom:.65rem;color:#666184;font-size:.8rem}
.preferences-form .discovery-choices label{min-height:44px;box-sizing:border-box;padding:.65rem 1rem;border-radius:999px;background:#fcfaff;border-color:#e8e0f2;color:#666184}
.preferences-form .discovery-choices label:has(input:checked){background:#f0e9ff;border-color:#bda3f7;color:#6236a5}
.preferences-form .discovery-choices label:focus-within{outline:2px solid #8051ff;outline-offset:3px}
.preferences-form input[type=checkbox]{accent-color:#8051ff}
.preferences-panel .discovery-note{max-width:76ch;color:#77708b;font-size:.78rem;line-height:1.8}
.preferences-form .discovery-email-pref label{margin-left:0;border-radius:12px}
.preferences-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:.75rem;padding:.5rem 0 1rem}
.preferences-actions .btn-primary,.preferences-actions .btn-secondary{border-radius:999px;font-size:.8rem}
@media(max-width:600px){.preferences-panel{padding:1.25rem}.preferences-actions>*{flex:1 1 100%;text-align:center}.preferences-form .discovery-choices label{margin:.25rem .2rem .25rem 0}}