/* =========================================================
   MI ATRIL: la selección de obras del visitante, como un carrito.
   Cada obra tiene "Al atril"; las obras elegidas se ven en la zona terracota de la portada,
   paradas sobre la repisa de un atril, y se piden todas juntas con una sola solicitud.
   La sección y el botón de la barra: site/catalogo-atril.php. Comportamiento: site/assets/js/atril.js.
   MOBILE FIRST: lo de arriba es para celular; los @media (min-width) agrandan.
   ========================================================= */

/* La zona terracota de la portada mide lo que mide el atril (antes: una pantalla entera vacía).
   Al ver un compositor, una búsqueda o una categoría vuelve a medir una pantalla, como siempre. */
.cen-zone-terracota:has(#cen-view-novedades.is-active) { min-height: 0; }

.czm-atril { position: relative; z-index: 2; padding: 8px 0 16px; color: #ffffff; font-family: var(--font-sans); }
.czm-atril [hidden] { display: none !important; }
.czm-atril :focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }

/* ---------- Encabezado: "Tu selección / Mi atril / 3 obras · 2 compositores" + Solicitar ---------- */
.czm-atril-cabeza { display: flex; flex-direction: column; gap: 18px; margin-bottom: 30px; }
.czm-atril-kicker { display: block; margin-bottom: 6px; font-size: 0.58rem; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: rgba(255, 255, 255, 0.75); }
.czm-atril-titulo { margin: 0; font-family: var(--font-serif); font-size: 2.1rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.5px; color: #ffffff; }
.czm-atril-titulo:focus { outline: none; }
.czm-atril-resumen { margin: 6px 0 0; font-family: 'Cormorant Garamond', var(--font-serif); font-style: italic; font-size: 1.2rem; line-height: 1.3; color: #ffe8e2; }

.czm-atril-acciones { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.czm-atril .czm-atril-solicitar { min-height: 48px; font-size: 0.66rem; }
.czm-atril .czm-atril-solicitar svg { width: 16px; height: 16px; flex-shrink: 0; }
.czm-atril-vaciar { align-self: center; min-height: 40px; margin: 0; padding: 0; border: 0; background: none; color: #ffffff; font-family: var(--font-sans); font-size: 0.6rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(0, 0, 0, 0.25); cursor: pointer; }

/* ---------- Atril vacío: dibujo del atril + cómo funciona ---------- */
.czm-atril-vacio { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 32px 20px; border: 1.5px dashed rgba(255, 255, 255, 0.45); border-radius: 10px; text-align: center; }
.czm-atril-dibujo { width: 112px; height: auto; color: #ffffff; flex-shrink: 0; }
.czm-atril-vacio-titulo { margin: 0 0 8px; font-family: var(--font-serif); font-size: 1.45rem; font-weight: 700; line-height: 1.2; color: #ffffff; }
.czm-atril-vacio-txt p.czm-atril-vacio-ayuda { max-width: 470px; margin: 0 auto; font-size: 0.88rem; line-height: 1.6; color: rgba(255, 255, 255, 0.92); }
.czm-atril-vacio-ayuda strong { white-space: nowrap; }
.czm-atril-pasos { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin: 20px 0 0; padding: 0; list-style: none; }
.czm-atril-pasos li { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 0.6rem; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #ffffff; }
.czm-atril-pasos b { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #ffffff; color: #b44f34; font-size: 0.66rem; letter-spacing: 0; }
.czm-atril-ir-fila { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.czm-atril-ir { min-height: 42px; margin: 0; padding: 0 18px; border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 21px; background: transparent; color: #ffffff; font-family: var(--font-sans); font-size: 0.6rem; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; cursor: pointer; transition: background .2s, color .2s; }

/* ---------- Las obras, paradas sobre la repisa del atril ---------- */
.czm-atril-hojas { --hueco: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px var(--hueco); margin: 0; padding: 0 0 0; list-style: none; }
.czm-atril-hoja { position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0; }
.czm-atril-hoja-ver { position: relative; display: block; width: 100%; margin: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.czm-atril .czm-atril-hoja .cen-mini-img { display: block; margin: 0; background: #fbf8f3; transform-origin: bottom center; transition: transform .3s ease, box-shadow .3s ease; }
/* La repisa: cada hoja pinta su tramo y se une con el de la de al lado (por eso sale medio hueco a cada lado) */
.czm-atril-hoja-ver::after { content: ''; position: absolute; left: calc(var(--hueco) / -2); right: calc(var(--hueco) / -2); bottom: -10px; height: 10px; border-radius: 2px; background: #222222; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 14px -6px rgba(0, 0, 0, 0.45); }
.czm-atril-quitar { position: absolute; top: -12px; right: -10px; z-index: 3; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #ffffff; color: #1a1a1a; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); cursor: pointer; transition: background .2s, color .2s; }
.czm-atril-quitar svg { width: 16px; height: 16px; }
.czm-atril-ficha { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; }
.czm-atril-dot { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: 'Cormorant Garamond', var(--font-serif); font-style: italic; font-size: 1rem; line-height: 1.25; color: #ffe8e2; }
.czm-atril-meta { font-size: 0.56rem; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(255, 255, 255, 0.78); font-variant-numeric: lining-nums tabular-nums; }
.czm-atril-ver { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin: 2px 0 0; padding: 0; border: 0; background: none; color: #1a1a1a; font-family: var(--font-sans); font-size: 0.56rem; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; cursor: pointer; }
.czm-atril-ver svg { width: 12px; height: 12px; flex-shrink: 0; }
/* La obra recién puesta baja hasta la repisa */
.czm-atril-hoja.is-nueva .cen-mini-img { animation: czm-atril-bajar .5s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes czm-atril-bajar { from { opacity: 0; transform: translateY(-26px) rotate(-2deg); } to { opacity: 1; transform: none; } }

/* Con muchas obras, "Solicitar" también al final: en celular desde 4 obras; en pantallas grandes, desde 9 */
.czm-atril-pie { display: flex; justify-content: center; margin-top: 44px; }
.czm-atril-pie .czm-atril-solicitar { width: 100%; }

/* ---------- Botón "Mi atril" en la barra negra ---------- */
.czm-atril-boton { position: relative; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 36px; height: 36px; margin: 0 4px 0 auto; padding: 0; border: 0; border-radius: 18px; background: transparent; color: #ffffff; font-family: var(--font-sans); font-size: 0.6rem; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; cursor: pointer; transition: background .2s, border-color .2s; }
.czm-atril-boton svg { width: 20px; height: 20px; flex-shrink: 0; }
.czm-atril-boton-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.czm-atril-boton-n { position: absolute; top: -3px; right: -5px; display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.8); font-size: 0.6rem; font-weight: 700; letter-spacing: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.czm-atril-boton.tiene-obras .czm-atril-boton-n { background: var(--cen-terracota); color: #ffffff; }
.czm-atril-boton.is-salto .czm-atril-boton-n { animation: czm-atril-salto .45s ease; }
@keyframes czm-atril-salto { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.45); } }

/* ---------- "Al atril" en cada obra ---------- */
/* Escritorio: texto junto a Compartir, con el mismo estilo; ya puesta, pastilla blanca "En tu atril" */
.czm-obra-atril { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; margin: 0; padding: 0; border: 0; border-radius: 17px; background: none; color: var(--ob-tinta, #ffffff); font-family: 'Montserrat', sans-serif; font-size: 0.6rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ob-linea, rgba(0, 0, 0, 0.15)); line-height: 1.2; white-space: nowrap; cursor: pointer; transition: background .2s, color .2s, padding .2s; }
.czm-obra-atril svg { width: 15px; height: 15px; flex-shrink: 0; }
.czm-obra-atril[aria-pressed="true"] { padding: 0 12px; background: #ffffff; color: #b44f34; text-decoration: none; }
/* Celular y tablet: botón redondo junto al título (en el pie ya no cabe junto a Compartir y Solicitar) */
.czm-obra-atril-icono { flex-shrink: 0; align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -6px 0 0 auto; padding: 0; border: 1.5px solid rgba(255, 255, 255, 0.6); border-radius: 50%; background: transparent; color: #ffffff; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.czm-obra-atril-icono svg { width: 21px; height: 21px; }
.czm-obra-atril-icono[aria-pressed="true"] { border-color: #ffffff; background: #ffffff; color: #b44f34; }
.czm-obras .czm-entry-main > .czm-title-wrapper { flex: 1 1 0; min-width: 0; }

/* Portadas de Ediciones Recientes: botón redondo arriba a la izquierda */
.czm-atril-mini { position: absolute; top: 6px; left: 6px; z-index: 11; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.94); color: #1a1a1a; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); cursor: pointer; transition: opacity .2s, background .2s, color .2s; }
.czm-atril-mini svg { width: 17px; height: 17px; }
.czm-atril-mini[aria-pressed="true"] { background: #1a1a1a; color: #ffffff; }

/* ---------- Aviso de abajo ("«Nyx» quedó en tu atril · Ver atril") ---------- */
.czm-atril-aviso { position: fixed; left: 50%; bottom: 88px; z-index: 10040; display: flex; align-items: center; gap: 14px; box-sizing: border-box; width: max-content; max-width: calc(100vw - 32px); padding: 10px 10px 10px 18px; border-radius: 14px; background: rgba(17, 17, 17, 0.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #ffffff; font-family: var(--font-sans); font-size: 0.8rem; line-height: 1.35; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); opacity: 0; visibility: hidden; transform: translate(-50%, 16px); transition: opacity .25s, transform .25s, visibility 0s linear .25s; }
.czm-atril-aviso.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.czm-atril-aviso-txt { min-width: 0; }
.czm-atril-aviso-btn { flex-shrink: 0; min-height: 36px; margin: 0; padding: 0 14px; border: 0; border-radius: 18px; background: #ffffff; color: #1a1a1a; font-family: var(--font-sans); font-size: 0.6rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; cursor: pointer; }
.czm-atril-aviso-btn[hidden] { display: none; }

/* ---------- Solicitud con varias obras (el mismo formulario de siempre) ---------- */
.czm-modo-atril .czm-input-group:has(> #req_obra),
.czm-modo-atril .czm-input-group:has(> #req_autor) { display: none; }
.czm-atril-material { margin: 0 0 20px; }
.czm-atril-material ol { max-height: 200px; margin: 0; padding: 0; overflow-y: auto; border: 1px solid #eeeeee; border-radius: 4px; list-style: none; counter-reset: obra; }
.czm-atril-material li { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 9px 12px; border-bottom: 1px solid #f3f3f3; counter-increment: obra; }
.czm-atril-material li:last-child { border-bottom: 0; }
.czm-atril-material li::before { content: counter(obra); flex-shrink: 0; width: 16px; font-size: 0.6rem; font-weight: 700; color: var(--cen-terracota); }
.czm-atril-material-t { flex: 1; min-width: 0; font-family: var(--font-serif); font-size: 0.88rem; font-weight: 700; color: #111111; }
.czm-atril-material-c { flex-shrink: 0; max-width: 45%; font-size: 0.55rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #888888; text-align: right; }

/* ---------- Mouse: efectos al pasar ---------- */
@media (hover: hover) {
    .czm-atril-hoja-ver:hover .cen-mini-img { transform: translateY(-5px); box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3); }
    .czm-atril-quitar:hover { background: #1a1a1a; color: #ffffff; }
    .czm-atril-ver:hover { text-decoration: underline; text-underline-offset: 3px; }
    .czm-atril-vaciar:hover { text-decoration-color: currentColor; }
    .czm-atril-ir:hover { background: #ffffff; color: #b44f34; }
    .czm-atril-boton:hover { background: rgba(255, 255, 255, 0.18); }
    .czm-obra-atril:not([aria-pressed="true"]):hover { text-decoration-color: currentColor; }
    .czm-obra-atril-icono:not([aria-pressed="true"]):hover { border-color: #ffffff; background: rgba(255, 255, 255, 0.12); }
    /* En la portada el botón aparece al pasar el mouse (o si la obra ya está en el atril) */
    .czm-atril-mini:not([aria-pressed="true"]) { opacity: 0; }
    .cen-card-inner:hover .czm-atril-mini, .czm-atril-mini:focus-visible { opacity: 1; }
    .czm-atril-mini:hover { background: #1a1a1a; color: #ffffff; }
    .czm-atril-aviso-btn:hover { background: #f0e6e2; }
}

/* ---------- Tablet chica ---------- */
@media (min-width: 600px) {
    .czm-atril-hojas { --hueco: 24px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .czm-atril-boton { margin-right: 10px; }
    .czm-atril-aviso { bottom: 28px; }
    .czm-atril-pie .czm-atril-solicitar { width: auto; min-width: 320px; }
}

/* ---------- Tablet ---------- */
@media (min-width: 768px) {
    .czm-atril { padding-bottom: 16px; }
    .czm-atril:not(.tiene-muchas) .czm-atril-pie { display: none; }
    .czm-atril-cabeza { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
    .czm-atril-titulo { font-size: 2.6rem; }
    .czm-atril-acciones { flex-direction: row-reverse; align-items: center; gap: 22px; }
    .czm-atril .czm-atril-solicitar { padding: 0 22px; }
    .czm-atril-vacio { flex-direction: row; justify-content: center; gap: 48px; padding: 40px 48px; text-align: left; }
    .czm-atril-dibujo { width: 140px; }
    .czm-atril-vacio-txt p.czm-atril-vacio-ayuda { margin: 0; }
    .czm-atril-pasos, .czm-atril-ir-fila { justify-content: flex-start; }
    .czm-atril-hojas { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px var(--hueco); }
    /* "Mi atril" con texto: desde aquí cabe junto al título sin partirlo en dos renglones */
    .czm-atril-boton { width: auto; height: 32px; margin-right: 12px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 16px; background: rgba(255, 255, 255, 0.1); }
    .czm-atril-boton svg { width: 17px; height: 17px; }
    .czm-atril-boton-txt { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .czm-atril-boton-n { position: static; }
}

/* ---------- Escritorio: "Al atril" va junto a Compartir; el botón redondo se quita ---------- */
@media (min-width: 1024px) {
    .czm-obra-atril-icono { display: none; }
    .czm-obras .czm-entry-main > .czm-title-wrapper { flex: 1 1 auto; }
    .czm-atril-hojas { --hueco: 28px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .czm-atril-hoja.is-nueva .cen-mini-img, .czm-atril-boton.is-salto .czm-atril-boton-n { animation: none; }
    .czm-atril-aviso { transition: none; }
}
