/* SPEC-008 · «Tu carátula» (js/caratulas.js). Everything is scoped to .caratulas. */
.caratulas .caratulas-meta { margin: .25rem 0 0; font-weight: 500; }
.caratulas .caratulas-aviso:empty { display: none; }
.caratulas .caratulas-aviso[data-kind="error"],
.caratulas .caratulas-fallo { color: #b3452c; }
.caratulas .caratulas-estado { margin: 1rem 0; }
.caratulas .caratulas-ronda-titulo { margin: 1rem 0 .5rem; font-size: 1rem; }
.caratulas .caratulas-grilla {
  display: grid; gap: 14px; margin: .75rem 0 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
/* SPEC-062 · a batch of 20: as the section grows the grid takes 2, 4 or 5 columns (all divide 20),
   so every row of the batch is full. Without container queries the grid above stays. */
@supports (container-type: inline-size) {
  .caratulas { container-type: inline-size; }
  .caratulas .caratulas-grilla { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  @container (min-width: 560px) { .caratulas .caratulas-grilla { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @container (min-width: 800px) { .caratulas .caratulas-grilla { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
}
.caratulas .caratula { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.caratulas .caratula-imagen {
  display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 6px; background: rgba(128,128,128,.14);
}
.caratulas .caratula-imagen[hidden] { display: none; }
/* SPEC-061 · a cover on its way (being made or downloading): a band of light sweeps across a
   tile that stands out from the page; js/caratulas.js keeps every tile on the same clock
   (SWEEP_MS = 1.6 s) so a repaint never restarts it. The failure tile has no sweep. */
.caratulas .cover-wait {
  position: relative; box-sizing: border-box; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: .5rem; padding: .75rem;
  width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line-2, #cdc4b0);
  background-color: var(--line, #e4ddcd);
  background-image:
    linear-gradient(100deg, transparent 30%, rgba(205,169,78,.38) 43%, rgba(255,255,255,.5) 50%, rgba(205,169,78,.38) 57%, transparent 70%),
    linear-gradient(160deg, var(--line, #e4ddcd), var(--line-2, #cdc4b0));
  background-image:
    linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--gold, #9a7a1c) 38%, transparent) 43%, rgba(255,255,255,.5) 50%, color-mix(in srgb, var(--gold, #9a7a1c) 38%, transparent) 57%, transparent 70%),
    linear-gradient(160deg, var(--line, #e4ddcd), var(--line-2, #cdc4b0));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 120% 0, 0 0;
  animation: cover-sweep 1.6s linear infinite;
}
.caratulas .cover-wait-text {
  padding: .2rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 500;
  background: var(--surface, #fffdf8); color: var(--muted, #4f5257); border: 1px solid var(--line, #e4ddcd);
}
.caratulas .cover-wait--failed {
  justify-content: center; text-align: center; animation: none;
  background-image: none; background-color: var(--surface-2, #f5f1e7); border-style: dashed;
}
.caratulas .cover-wait--failed .cover-wait-text { background: none; border: 0; padding: 0; }
.caratulas .caratula--elegida .caratula-imagen { outline: 3px solid var(--gold, #b8902f); outline-offset: 2px; }
.caratulas .caratula-pie { display: flex; justify-content: center; }
.caratulas .caratula-marca { font-size: .85rem; font-weight: 600; color: var(--gold-soft, #9a7a1c); }
.caratulas .caratulas-accion { margin: .25rem .5rem .75rem 0; }
.caratulas .cover-upload-prompt { margin: .25rem 0 .75rem; }
.caratulas .caratulas-ronda { margin: .5rem 0; }
.caratulas .caratulas-ronda > summary,
.caratulas .caratulas-subir > summary { cursor: pointer; font-weight: 500; }
.caratulas .caratulas-subir { margin-top: 1rem; }
.caratulas .caratulas-subir-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; max-width: 34rem; }
/* SPEC-070 RF-D1: the studio's own disclosure arrow, file button and boxes (no native look). */
.caratulas .caratulas-ronda > summary, .caratulas .caratulas-subir > summary { list-style: none; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; }
.caratulas .caratulas-ronda > summary::-webkit-details-marker, .caratulas .caratulas-subir > summary::-webkit-details-marker { display: none; }
.caratulas .caratulas-ronda > summary::before, .caratulas .caratulas-subir > summary::before {
  content: ''; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; opacity: .7; }
.caratulas details[open] > summary::before { transform: rotate(45deg); }
.caratulas .caratulas-archivo-elegir { display: inline-flex; align-items: center; gap: .75rem; flex-wrap: wrap; cursor: pointer; position: relative; }
.caratulas .caratulas-archivo { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.caratulas .caratulas-archivo-boton { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem 1rem; border-radius: .6rem;
  border: 1px solid var(--line-2, rgba(128,128,128,.35)); font-weight: 500; }
.caratulas .caratulas-archivo-elegir:hover .caratulas-archivo-boton, .caratulas .caratulas-archivo:focus-visible + .caratulas-archivo-boton { border-color: var(--gold, #cda94e); color: var(--gold, #cda94e); }
.caratulas .caratulas-archivo-nombre { color: var(--muted); font-size: .88rem; }
.caratulas .caratulas-casilla input { accent-color: var(--gold, #cda94e); width: 1.05rem; height: 1.05rem; }
.caratulas .caratulas-casilla { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.caratulas .caratulas-borrador { opacity: .7; font-size: .78rem; }
.caratulas .caratulas-enviar { align-self: flex-start; }
.caratulas .caratulas-enviar[disabled] { opacity: .5; cursor: not-allowed; }
@keyframes cover-sweep { from { background-position: 120% 0, 0 0; } to { background-position: -20% 0, 0 0; } }
/* Reduced motion: the band stands still across the middle of the tile, still clearly visible. */
@media (prefers-reduced-motion: reduce) {
  .caratulas .cover-wait { animation: none; background-position: 50% 0, 0 0; }
}
/* SPEC-063 · a drawn cover opens full size: a zoom-in cursor and a visible keyboard focus. */
.caratulas .caratula-imagen[role="button"] { cursor: zoom-in; }
.caratulas .caratula-imagen[role="button"]:focus-visible { outline: 2px solid var(--gold, #9a7a1c); outline-offset: 3px; }
/* The viewer lives on <body> (outside .caratulas): always a dark layer, in light and dark themes. */
.cover-viewer {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  background: rgba(8, 10, 14, .94); color: #f3f0e8; outline: none;
  animation: cover-viewer-in .16s ease-out;
}
.cover-viewer[hidden] { display: none; }
.cover-viewer-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
}
.cover-viewer-count { font-size: .9rem; font-variant-numeric: tabular-nums; opacity: .85; }
.cover-viewer-close,
.cover-viewer-step {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  padding: 0; border: 1px solid rgba(243, 240, 232, .28); border-radius: 50%;
  background: rgba(20, 24, 32, .72); color: #f3f0e8; font: inherit; font-size: 1.6rem; line-height: 1;
  cursor: pointer;
}
.cover-viewer-close:hover,
.cover-viewer-step:hover { background: rgba(40, 46, 58, .9); }
.cover-viewer-close:focus-visible,
.cover-viewer-step:focus-visible,
.cover-viewer-choose:focus-visible { outline: 2px solid #cda94e; outline-offset: 2px; }
.cover-viewer-step[hidden] { display: none; }
.cover-viewer-frame {
  position: relative; flex: 1 1 auto; min-height: 0; margin: 0; padding: 0 16px;
  display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.cover-viewer-image {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: 4px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.cover-viewer-prev { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); }
.cover-viewer-next { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); }
.cover-viewer-bar {
  display: flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}
.cover-viewer-mark { font-weight: 600; color: #e6cd86; }
/* Phone width: the image fills the width with the 16 px gutter (a taller one scrolls inside the
   frame, centred by its auto margins so its top is never cut); the arrows sit at the bottom. */
@media (max-width: 600px) {
  .cover-viewer-image { width: 100%; max-height: none; margin: auto 0; }
  .cover-viewer-frame { overflow-y: auto; align-items: flex-start; }
  .cover-viewer-prev, .cover-viewer-next { top: auto; bottom: 12px; transform: none; }
  .cover-viewer-prev { left: 28px; }
  .cover-viewer-next { right: 28px; }
}
@keyframes cover-viewer-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cover-viewer { animation: none; }
}
