/* «Magia con IA», tanda G (D-038): the realistic version's flip on the
   artwork page, the waiting line, the video page and the colouring page.
   Everything here is the room's own look: the veil of the notes, the
   Instrument type, no new colours. */

/* ---------- «Original» / «De verdad» ----------
   Two radios, drawn as one quiet segmented pill. With «De verdad» checked
   the realistic picture takes the drawing's place on the wall; it works
   without JavaScript. */
.obra .magic-real-stage { display: none; }
.obra:has(#magic-real:checked) .viewer-stage:not(.magic-real-stage) { display: none; }
.obra:has(#magic-real:checked) .magic-real-stage { display: flex; }
.magic-flip {
  display: flex;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 0.5rem;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: var(--veil, var(--paper));
}
.magic-flip legend { padding: 0; }
.magic-flip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.magic-flip label {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.magic-flip input:checked + label { background: var(--ink); color: var(--wall); }
.magic-flip input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: 2px; }

/* «Imagen creada con IA»: said whenever the picture is on the wall. */
.magic-ai-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.magic-ai-label .icon { width: 1rem; height: 1rem; flex: none; }
.obra:not(:has(#magic-real:checked)) > .magic-ai-label { display: none; }
.magic-real-manage { display: none; justify-content: center; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
.obra:has(#magic-real:checked) .magic-real-manage { display: flex; }
.magic-real-manage form { margin: 0; }
.magic-real-manage button { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; }
.magic-video-make button, .magic-video-delete button { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; }

/* ---------- Waiting, and a failure said once ---------- */
.magic-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  max-width: 34rem;
  margin: 0.25rem auto 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
.magic-status.is-error { color: var(--danger, var(--ink)); }
.magic-status .icon { width: 1.1rem; height: 1.1rem; flex: none; }
.magic-status a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.magic-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: magic-spin 0.9s linear infinite;
  flex: none;
}
@keyframes magic-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .magic-spinner { animation: none; border-top-color: color-mix(in srgb, var(--ink) 25%, transparent); }
}
[data-magic-form] [aria-busy="true"] { opacity: 0.5; }

/* ---------- The video page ----------
   The clip hangs like the drawing, on the room's wall under its light:
   as large as the first screen allows, the label and the controls under
   it, nothing under the tab bar. */
.magic-video-stage {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
  padding: clamp(0.75rem, 3vw, 2rem) 0 clamp(0.75rem, 2vw, 1.5rem);
  background: radial-gradient(ellipse 55% 45% at 50% 0%, var(--light), transparent 75%) no-repeat;
}
.magic-video {
  display: block;
  width: min(100%, calc((100svh - 17rem) * 16 / 9));
  max-width: 60rem;
  aspect-ratio: 16 / 9;
  height: auto;
  padding: clamp(0.4rem, 1.5vw, 1rem);
  background: #fff;
  box-shadow: var(--mat-shadow);
  object-fit: contain;
}
.magic-video-stage.is-portrait .magic-video {
  width: min(100%, calc((100svh - 17rem) * 9 / 16), 28rem);
  aspect-ratio: 9 / 16;
}
.magic-video-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.75rem;
}
.magic-video-tools .magic-ai-label { margin: 0; }
.magic-sound { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; }
.magic-sound i { display: contents; font-style: normal; }
.magic-sound[aria-pressed="false"] .magic-sound-on,
.magic-sound[aria-pressed="true"] .magic-sound-off { display: none; }
.magic-video-make, .magic-video-delete {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  max-width: 30rem;
  margin: 1rem auto 0;
  text-align: center;
}
.magic-video-make p { margin: 0; font-size: 0.9rem; }
.magic-video-page .exhibit-label { margin-top: 0.5rem; }

/* ---------- The colouring page ----------
   One sheet of A4, the line art as large as the margins allow and a
   small footer. coloring-portrait.css or coloring-landscape.css sets the
   paper. The sheet is always white paper; the room around it follows the
   theme on screen. */
.coloring-body { min-height: 100vh; }
.coloring-toolbar {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem var(--gutter) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.coloring-hint { flex-basis: 100%; margin: 0; }
.coloring-sheets {
  display: flex;
  justify-content: center;
  padding: 1.5rem var(--gutter) 4rem;
}
.coloring-sheet {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  width: min(var(--sheet-w), 100%);
  aspect-ratio: var(--sheet-ratio);
  padding: 7cqw 7cqw 4cqw;
  background: #fff;
  color: #1d1b18;
  box-shadow: var(--mat-shadow);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.coloring-art {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coloring-art img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.coloring-footer {
  flex: none;
  margin: 3cqw 0 0;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 2.6cqw;
  color: #6b665e;
  overflow-wrap: anywhere;
}
@media print {
  :root { color-scheme: light; }
  /* A print is taken at an animation's first frame: style.css's entrance
     ("settle") would print the sheet blank, as the book found (D-025). */
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html, body, .coloring-body { margin: 0; padding: 0; min-height: 0; background: #fff; }
  .coloring-toolbar { display: none; }
  .coloring-sheets { display: block; padding: 0; }
  .coloring-sheet {
    width: var(--sheet-w);
    height: var(--sheet-h);
    aspect-ratio: auto;
    margin: 0;
    box-shadow: none;
    overflow: hidden;
  }
}
