/* Galería (app v2, mockups/app_v2/galeria.html): colecciones en el mando oscuro, mosaico sobre la mesa
   clara. El mosaico lo coloca 46-gallery.js (posición absoluta en columnas: añadir no mueve nada). */

.gal { display: grid; grid-template-columns: 228px minmax(0, 1fr); height: 100%; min-height: 0; }
.gal__side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.navi { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-align: left; }
.navi .grow { flex: 1; }
.navi .n { font: 400 11.5px/1 var(--f-num); color: var(--muted); }
.navi:hover { background: var(--surface-2); color: var(--text); }
.navi[aria-current="true"] { background: var(--active-bg); color: var(--text); }
.navi .icon { width: 17px; height: 17px; }
.navi .sw { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; flex: none; }
.navi .sw.veil .icon { width: 12px; height: 12px; }
.navi--add { color: var(--muted); }
.gal__label { padding: 18px 10px 8px; }
.gal__cols { display: flex; flex-direction: column; gap: 2px; }
.gal__col { position: relative; display: flex; align-items: center; }
.gal__col > .navi { padding-right: 34px; }
.gal__col .menu-anchor { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.gal__colmore { opacity: 0; color: var(--muted); }
.gal__col:hover .gal__colmore, .gal__col:focus-within .gal__colmore, .gal__col.is-menu .gal__colmore { opacity: 1; }
.gal__col .menu { right: 0; min-width: 180px; }
.gal__col:hover .n, .gal__col:focus-within .n { visibility: hidden; }
.gal__colform { padding: 2px 0; }
.gal__colform .field { height: 34px; min-height: 34px; padding: 0 10px; font-size: 13px; }
.gal__colerr { padding: 6px 10px; font-size: 12.5px; color: var(--danger); }
@media (hover: none) { .gal__colmore { opacity: 1; } .gal__col .n { visibility: hidden; } }

.gal__main { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--bg); color: var(--text); }
.gal__bar { display: flex; align-items: center; gap: 8px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.gal__search { flex: 1; max-width: 440px; }
.gal__search .field { height: 38px; min-height: 38px; }
.gal__opdot { position: absolute; right: 6px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--sel); }
.gal__opmenu { left: 0; right: auto; }
.gal__scroll { overflow-y: auto; padding: 18px 24px 120px; min-height: 0; }
.img-grid { position: relative; }
.gal__day { position: absolute; left: 0; top: 0; height: 22px; display: flex; align-items: flex-end; margin: 0; }
.img-card { position: absolute; left: 0; top: 0; border-radius: 8px; overflow: hidden; background: var(--surface); }
.img-tile { display: block; width: 100%; height: 100%; padding: 0; border-radius: 8px; overflow: hidden; }
.img-tile > img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms ease, opacity var(--dur); }
.img-tile:hover > img { transform: scale(1.02); }
.img-tile .img-live { width: 100%; height: 100%; justify-content: center; padding: 10px; }
.img-tile .img-err { width: 100%; height: 100%; justify-content: center; background: var(--surface); }
.img-tile.is-error { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent); }
.img-mark { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: rgb(0 0 0 / 0.45); color: var(--star); backdrop-filter: blur(4px); pointer-events: none; transition: opacity var(--dur); }
.img-mark .icon { width: 14px; height: 14px; fill: currentColor; }
.img-card .prefs-tile { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px; padding: 22px 8px 8px; background: linear-gradient(180deg, transparent, rgb(0 0 0 / 0.55)); opacity: 0; transition: opacity var(--dur); }
.prefs-tile .pref { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: rgb(0 0 0 / 0.35); backdrop-filter: blur(4px); }
.prefs-tile .pref .icon { width: 16px; height: 16px; }
.prefs-tile .pref[aria-pressed="true"] { color: var(--accent); }
.prefs-tile .pref[aria-pressed="true"] .icon { fill: currentColor; }
.prefs-tile .pref:hover { background: rgb(0 0 0 / 0.6); }
@media (hover: hover) {
  .img-card:hover .prefs-tile, .img-card:focus-within .prefs-tile { opacity: 1; }
  .img-card:hover .img-mark { opacity: 0; }
}
@media (hover: none) { .img-card .prefs-tile { display: none; } }
.img-grid.is-selecting .prefs-tile { display: none; }

/* Selección: casilla real cubriendo la tarjeta, con la marca de la maqueta arriba a la izquierda */
.img-pick { position: absolute; inset: 0; cursor: pointer; }
.img-pick__box { position: absolute; opacity: 0; width: 1px; height: 1px; }
.img-pick__tick { position: absolute; left: 8px; top: 8px; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid rgb(255 255 255 / 0.9); background: rgb(0 0 0 / 0.25); display: grid; place-items: center; color: transparent; }
.img-pick__tick .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.img-pick__box:focus-visible + .img-pick__tick { outline: 2px solid var(--sel); outline-offset: 2px; }
.img-card.is-selected { outline: 2px solid var(--sel); outline-offset: -2px; }
.img-card.is-selected .img-tile > img { opacity: 0.8; }
.img-card.is-selected .img-pick__tick { background: var(--sel); border-color: var(--sel); color: var(--on-sel); }

.img-more { display: flex; justify-content: center; padding: 18px 0; }
.gal__none { padding: 40px 0; text-align: center; color: var(--muted); font-size: 14px; }
.img-empty { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 48px 0; text-align: center; }
.img-empty .empty__text { color: var(--text-2); }
.img-starters-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 760px; }
.img-starters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; width: 100%; }

/* Barra de selección flotante */
.selbar { position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; bottom: 22px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; max-width: calc(100% - 32px); padding: 6px; border-radius: 16px; background: var(--raise); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); }
.selbar__info, .selbar__acts { display: flex; align-items: center; gap: 4px; }
.selbar__info::after { content: ''; width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.selbar__n { display: inline-flex; align-items: center; padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.selbar .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.selbar .btn-danger.arm { color: var(--bg); }
.selbar__note { flex-basis: 100%; text-align: center; font-size: 11.5px; color: var(--muted); padding: 0 8px 2px; }

@media (max-width: 1180px) { .img-starters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 899.98px) {
  .gal { display: flex; flex-direction: column; }
  .gal__side { flex: none; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; padding: 10px 12px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .gal__side::-webkit-scrollbar { display: none; }
  .gal__label { display: none; }
  .gal__cols { flex-direction: row; gap: 6px; }
  .gal__col { flex: none; }
  .navi { flex: none; width: auto; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; white-space: nowrap; }
  .navi .grow, .navi .n { display: none; }
  .navi .sw { width: 18px; height: 18px; border-radius: 4px; margin-left: -4px; }
  .gal__col > .navi { padding-right: 12px; }
  .gal__col .menu-anchor { position: static; transform: none; }
  .gal__col:not([class*="is-"]) .gal__colmore { display: none; }
  .gal__col:has(.navi[aria-current]) .gal__colmore, .gal__col.is-menu .gal__colmore { display: inline-flex; opacity: 1; }
  .gal__col .menu { top: calc(100% + 6px); right: auto; left: 0; position: fixed; }
  .gal__colform .field { width: 160px; }
  .gal__main { flex: 1; min-height: 0; }
  .gal__bar { padding: 10px 12px; gap: 6px; }
  .gal__search { max-width: none; }
  .gal__bar > .grow { display: none; }
  .gal__scroll { padding: 12px 12px 110px; }
  .img-starters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .selbar { position: fixed; left: 8px; right: 8px; width: auto; margin: 0; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); flex-direction: column; align-items: stretch; gap: 2px; max-width: none; }
  .selbar__info, .selbar__acts { justify-content: space-between; }
  .selbar__info::after { display: none; }
  .selbar__acts .sep { margin-left: auto; }
  .selbar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .selbar .btn:not(.btn-icon):not(.arm):not([data-img-sel-all]) { width: 38px; padding: 0; }
  .selbar .btn.arm .lbl, .selbar [aria-busy="true"] .lbl { position: static; width: auto; height: auto; clip: auto; }
  .selbar [data-img-sel-all] { font-size: 12px; }
}
