/* The 5:7 layout matches images._save_layers. Only an opened card has art layers. */
.layered-thumbnail, .layered-surface {
  position: relative; width: 100%; aspect-ratio: 5 / 7; max-width: 360px;
  margin-inline: auto; user-select: none;
}
.layered-thumbnail { z-index: 2; }
.layered-thumbnail > img, .layered-poster { display: block; width: 100%; height: 100%; object-fit: contain; }
.layered-caption {
  /* Safe interior of the title plate, away from its ornamental border. */
  position: absolute; left: 22%; right: 22%; top: 84.2%; height: 5%;
  box-sizing: border-box; padding: 0 1%; overflow: clip;
  display: flex; flex-direction: column; justify-content: center; gap: 0;
  text-align: center; container-type: inline-size; pointer-events: none;
  color: #faeac3; text-shadow: 0 .04em .08em #000;
}
.layered-caption span {
  display: block; flex: 0 0 auto; min-width: 0; width: 100%; margin-bottom: .35cqi;
  font: 600 calc(2.8cqi * var(--caption-label-scale, 1))/1 ui-monospace, monospace;
  text-transform: uppercase; letter-spacing: .12em; white-space: nowrap;
}
.layered-caption strong {
  display: block; flex: 0 0 auto; min-width: 0; width: 100%; margin: 0;
  font: 600 calc(7cqi * var(--fit-text, 1))/1.08 Georgia, serif;
  white-space: normal; overflow-wrap: anywhere; text-wrap: balance;
}
.layered-caption[data-caption-lines="1"] strong { white-space: nowrap; }
.layered-surface { height: 100%; max-width: none; transform-style: preserve-3d; backface-visibility: hidden; }
.layered-poster { backface-visibility: hidden; }
.card3d-layered {
  /* A small relief that collapses with the actual viewing angle. Safe flat default
     while JS loads, also for browsers still caching the previous viewer module. */
  --layer-depth: 0;
  --subject-depth: 6px;
  --frame-depth: 10px;
  --caption-depth: 10px;
}
.card3d-layered .card3d-front { clip-path: none; isolation: auto; transform-style: preserve-3d; }
.card3d-layered .card3d-front > .card3d-gloss,
.card3d-layered .card3d-front > .card3d-sparkle { display: none; }
.art-layer { position: absolute; pointer-events: none; backface-visibility: hidden; }
.art-layer img { display: block; width: 100%; height: 100%; object-fit: contain; }
.art-background { inset: 6% 6.8% 8.9%; overflow: hidden; transform: translateZ(0); }
.art-background img { object-fit: cover; }
.art-subject { inset: 0; transform: translateZ(calc(var(--subject-depth, 0px) * var(--layer-depth, 0))) scale(.78) translateY(-2%); }
.art-frame { inset: 0; transform: translateZ(calc(var(--frame-depth, 0px) * var(--layer-depth, 0))); }
.layered-surface.is-ready .layered-caption { transform: translateZ(calc(var(--frame-depth, 0px) * var(--layer-depth, 0))); backface-visibility: hidden; }
.layered-surface.is-ready > .layered-poster { visibility: hidden; }
/* The existing composition gives the edge and back of the turn one coherent
   surface. Switch only after the relief has reached zero; no extra assets/load. */
.is-flat-art .layered-surface.is-ready:has(> .layered-poster) > .art-layer { visibility: hidden; }
.is-flat-art .layered-surface.is-ready > .layered-poster { visibility: visible; }
.card3d-layered.is-flat-art .card3d-front,
.card3d-layered.is-flat-art .layered-surface { transform-style: flat; }
.art-foil {
  position: absolute; inset: 0; mask-size: 100% 100%; mask-repeat: no-repeat;
  /* Oro y blanco calido: una lamina violeta o cian sobre el personaje le cambiaba el
     color del arte (la capa roja salia morada) en cuanto se pasaba el raton. */
  background: linear-gradient(115deg, transparent 22%, #f7cc8640 34%, #fff1d055 46%, #ffd58a40 56%, transparent 70%);
  background-size: 260% 260%; background-position: calc(var(--holo-x, .5) * 100%) calc(var(--holo-y, .4) * 100%);
  mix-blend-mode: soft-light; opacity: calc((.15 + var(--active, 0) * .45) * var(--layer-depth, 0));
}
.art-frame .art-foil { background-image: radial-gradient(ellipse, #ffe6a388, transparent 60%); }
/* El tamano del cromo en el visor vive en card3d.css (.card-viewer .card3d). */
.layered-open { display: block; width: 100%; border: 0; padding: 0; background: transparent; color: inherit; cursor: zoom-in; }
.layered-thumbnail img, .layered-surface img { -webkit-user-drag: none; }
.art-fields { border: 1px solid var(--line); padding: 16px; min-width: 0; display: grid; gap: 14px; }
.art-fields legend { color: var(--ink-card, var(--text)); font-size: var(--fs-xs); padding-inline: 5px; }
.art-fields label { display: grid; gap: 8px; font-size: var(--fs-xs); min-width: 0; }
.art-fields select { width: 100%; padding: 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.art-fields small { color: var(--muted); line-height: 1.5; }
.art-guide { padding: 14px; border: 1px solid var(--line); }
.art-guide summary { cursor: pointer; font-weight: 700; line-height: 1.5; }
.art-guide-layout { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.art-guide-layout img { width: 100%; height: auto; }
.art-guide-layout p { margin: 0 0 12px; font-size: var(--fs-xs); line-height: 1.65; }
.art-guide-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 18px; }
.art-fields .art-brief { width: 100%; min-height: 200px; margin-top: 16px; font-size: var(--fs-xs); }
.art-frame-library { margin-block: 22px; }
.art-frame-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.art-frame-choice { min-width: 0; text-align: center; }
.art-frame-choice > a { display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: var(--fs-label); color: #eed8a4; }
.art-frame-option { width: 100%; min-width: 0; padding: 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); cursor: pointer; }
.art-frame-option img { width: 100%; max-width: 72px; height: auto; margin: 0 auto 10px; }
.art-frame-option span { font-size: var(--fs-label); }
.art-frame-option[aria-pressed="true"] { border-color: #e6c374; background: #e6c37414; }
.art-fields [data-status="error"] { color: #ffb3ae; }
.art-fields [data-status="warning"] { color: #f3d08b; }
.art-fields [data-status="ready"] { color: #a6dbc1; }
.art-check-status { font-size: var(--fs-xs); line-height: 1.6; }
.art-fields .art-guide-toggle { display: flex; align-items: center; gap: 9px; margin-block: 18px; line-height: 1.5; }
.art-fields .art-guide-toggle input { width: auto; flex: 0 0 auto; }
.art-preview-empty { padding: 32px 16px; border: 1px dashed var(--line); font-size: var(--fs-xs); color: var(--muted); text-align: center; line-height: 1.6; }
.art-placement-guides { display: none; position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.show-art-guides .art-placement-guides { display: block; }
.art-placement-guides i { position: absolute; }
.art-subject-guide { inset: 9.4% 11% 12.6%; border: 1px dashed #6bdea9; }
.art-title-guide { left: 22%; right: 22%; top: 84.2%; height: 5%; border: 1px dashed #f6d380; background: #f6d38018; }
@media (max-width: 480px) {
  .art-guide-layout { grid-template-columns: 1fr; }
  .art-guide-layout img { max-width: 150px; margin-inline: auto; }
}
.art-fields [hidden], [data-layer-preview][hidden], [data-preview-card][hidden] { display: none; }
[data-layer-preview] { width: 100%; max-width: 320px; margin: auto; }
[data-layer-preview] .layered-surface { transform-style: flat; }
[data-layer-preview] .art-layer, [data-layer-preview] .layered-caption { transform: none; }
[data-layer-preview] .art-subject { transform: scale(.78) translateY(-2%); }
[data-layer-preview] .layered-caption { z-index: 2; }
@media (max-width: 600px) {
  .card3d-layered { --subject-depth: 4px; --frame-depth: 7px; --caption-depth: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .art-foil { display: none; }
  /* JS snaps to the requested pose here, so a separate CSS rotation transition
     would put the art depth and the visible angle out of sync during a flip. */
  .card3d-layered .card3d-inner { transition: none; }
}
