/* Novira Translate, T2: Perspectives (the processing screen).
   The cinematic stage on top, the real job status directly under it. Page colours come from the
   same neutral palette as the opening workspace (T1); the artwork itself uses its own atmospheric
   colours. Nothing here reserves space for advertising: a placement could be appended after .px-status. */

body:has(#progressSection:not(.hidden)) {
  --bg: #101010; --bg-elevated: #101010; --surface: #171717; --surface-2: #141414;
  --border: #303030; --border-focus: #F3E8D6;
  --accent: #E7D5BA; --accent-hover: #F3E8D6; --accent-soft: #BAA991; --accent-ink: #171717;
  --text: #F2F2F2; --text-2: #A4A4A4; --text-3: #A4A4A4;
  --t2-ease: cubic-bezier(.2, .8, .2, 1);
  background: #101010;
}
/* The opening workspace stays in the page (it is restored on cancel or retry) but is not part of this screen. */
body:has(#progressSection:not(.hidden)) #uploadSection { display: none; }

#progressSection {
  display: block; position: relative; overflow: visible;
  min-height: calc(100vh - var(--header-h)); padding: 32px 24px 64px; background: #101010;
}
.px-wrap { width: 100%; max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }

/* ── Stage ─────────────────────────────────────────────────────────────────── */
.px-stage { width: 100%; max-width: 1040px; position: relative; transition: opacity 360ms var(--t2-ease); }
.pv-viewport { position: relative; width: 100%; aspect-ratio: 800 / 410; background: #101010; overflow: hidden; contain: layout paint; }
.pv-art { position: absolute; inset: 0; overflow: hidden; transition: opacity 400ms var(--t2-ease); }
.pv-viewport.is-held .pv-art { opacity: .55; }
.pv-atmosphere { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; opacity: .82; transition: opacity 400ms var(--t2-ease); }
.pv-viewport.is-held .pv-atmosphere { opacity: .45; }
.pv-world { position: absolute; left: 50%; top: 0; width: 800px; height: 410px; margin-left: -400px; transform-origin: 50% 0; transform: scale(var(--pv-s, 1)); }
.pv-scene { position: absolute; left: 0; top: 0; width: 800px; height: 410px; }
.pv-scene[data-on="0"] { visibility: hidden; }
.pv-scene[data-on="0"] * { animation-play-state: paused !important; }
.pv-env { position: absolute; left: 0; top: 0; width: 800px; height: 410px; }
/* the camera push: each depth wrapper scales about the form by its own share of --k, so the near world moves more than the far */
.pv-px { position: absolute; left: 0; top: 0; width: 800px; height: 410px; transform-origin: 400px 166px; transform: scale(calc(1 + (var(--k, 1) - 1) * var(--dp, 1))); }
.pv-l { position: absolute; left: 0; top: 0; display: block; overflow: hidden; }
.pv-form-l { position: absolute; left: 290px; top: 56px; overflow: visible; }
/* the page canvas takes over at the edges: no visible frame */
.pv-edge {
  position: absolute; inset: -1px; pointer-events: none; z-index: 10;
  background:
    linear-gradient(90deg, #101010 0, rgba(16,16,16,0) 17%, rgba(16,16,16,0) 83%, #101010 100%),
    linear-gradient(180deg, #101010 0, rgba(16,16,16,0) 13%, rgba(16,16,16,0) 80%, #101010 100%);
}

/* ambient movement: transform and opacity only, each layer on its own */
.pv-m1 { animation: pv-drift 64s linear infinite; }
.pv-m2 { animation: pv-drift 46s linear infinite reverse; }
.pv-m3 { animation: pv-drift 36s linear infinite; }
.pv-m4 { animation: pv-drift 27s linear infinite reverse; }
.pv-c1 { animation: pv-drift 88s linear infinite; }
.pv-c2 { animation: pv-drift 58s linear infinite reverse; }
.pv-halo { animation: pv-halo 9s ease-in-out infinite alternate; }
@keyframes pv-halo { from { opacity: .72; } to { opacity: 1; } }
@keyframes pv-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-800px, 0, 0); } }
.pv-d1 { --sw: 2px; animation: pv-sway 54s ease-in-out infinite alternate; }
.pv-d2 { --sw: 4px; animation: pv-sway 46s ease-in-out infinite alternate-reverse; }
.pv-d3 { --sw: 7px; animation: pv-sway 38s ease-in-out infinite alternate; }
.pv-d4 { --sw: 9px; animation: pv-sway 32s ease-in-out infinite alternate-reverse; }
@keyframes pv-sway { from { transform: translate3d(calc(var(--sw) * -1), 0, 0); } to { transform: translate3d(var(--sw), 0, 0); } }

.pv-lf { animation: pv-breathe 8s ease-in-out infinite alternate; }
.pv-lw { animation: pv-breathe 12s ease-in-out infinite alternate-reverse; }
.pv-haze { animation: pv-drift 40s linear infinite; }
.pv-haze2 { animation-duration: 28s; animation-direction: reverse; }
@keyframes pv-breathe { from { opacity: .66; } to { opacity: 1; } }

.pv-swell { animation: pv-drift 130s linear infinite; }
.pv-g1 { animation: pv-glint 7s ease-in-out infinite alternate; }
.pv-g2 { animation: pv-glint 11s ease-in-out infinite alternate-reverse; }
.pv-bloom { animation: pv-breathe 9s ease-in-out infinite alternate; }
@keyframes pv-glint { from { opacity: .3; } to { opacity: 1; } }
.pv-ripple { opacity: 0; transform-origin: 50% 50%; animation: pv-ripple var(--rd) cubic-bezier(.25, .55, .35, 1) infinite; animation-delay: var(--rl); }
@keyframes pv-ripple { 0% { opacity: 0; transform: scale(.16); } 14% { opacity: .95; } 100% { opacity: 0; transform: scale(1.5); } }
.pv-sl { animation: pv-slice var(--p) ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes pv-slice { from { transform: translateX(calc(var(--a) * -1)); } to { transform: translateX(var(--a)); } }

.pv-viewport[data-motion="paused"] * { animation-play-state: paused !important; }
.pv-viewport[data-reduced="1"] * { animation: none !important; }
.pv-viewport[data-reduced="1"] .pv-ripple { opacity: 0; }
.pv-viewport[data-reduced="1"] .pv-pause { display: none; }

.pv-pause {
  position: absolute; right: 14px; bottom: 12px; z-index: 11; width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: rgba(16,16,16,.6); border: 1px solid #303030; color: #A4A4A4;
  transition: color .15s, border-color .15s;
}
.pv-pause::after { content: ''; position: absolute; inset: -8px; }
.pv-pause:hover { color: #F3E8D6; border-color: #A4A4A4; }
.pv-pause:focus-visible { outline: 2px solid #F3E8D6; outline-offset: 2px; }
.pv-pause .pv-ic-play, .pv-pause[data-paused="1"] .pv-ic-pause { display: none; }
.pv-pause[data-paused="1"] .pv-ic-play { display: block; }

/* ── Status, directly below the stage ───────────────────────────────────────── */
.px-status { position: relative; z-index: 2; width: 100%; max-width: 480px; margin: -6px auto 0; display: flex; flex-direction: column; gap: 20px; }
.px-status .prog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.px-status .prog-title { font-size: clamp(26px, 3vw, 38px); font-weight: 550; letter-spacing: -.04em; line-height: 1.15; color: #F3E8D6; margin: 0; }
.px-status .prog-sub { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: #A4A4A4; }
.px-langs { margin: -8px 0 0; font-size: 13px; line-height: 1.5; color: #F2F2F2; }
.px-langs .px-to { color: #A4A4A4; padding: 0 6px; }
.px-langs .px-more { color: #A4A4A4; }

.px-status .prog-meter { display: flex; flex-direction: column; gap: 10px; }
.px-track { position: relative; height: 3px; border-radius: 2px; background: #303030; overflow: hidden; }
#progBarFill { height: 100%; width: 0; border-radius: 2px; background: #E7D5BA; transition: width 400ms var(--t2-ease); }
.px-track.is-indeterminate::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 28%; border-radius: 2px;
  background: linear-gradient(90deg, rgba(231,213,186,0), rgba(231,213,186,.6), rgba(231,213,186,0));
  animation: px-sweep 2.4s cubic-bezier(.4, 0, .2, 1) infinite;
}
@keyframes px-sweep { from { transform: translateX(-100%); } to { transform: translateX(360%); } }
.px-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 1.4; color: #A4A4A4; }
#progPageLabel { color: #F3E8D6; }
#progressMsg { min-height: 22px; font-size: 14px; line-height: 1.6; color: #A4A4A4; transition: opacity .2s; }
/* an interruption is told in words and a dash, not by colour alone */
#progressSection[data-conn="lost"] #progressMsg { color: #F3E8D6; }
#progressSection[data-conn="lost"] #progressMsg::before { content: '\2014\00a0'; }
#progressSection[data-conn="lost"] .px-track::after { animation-play-state: paused; opacity: .35; }

.px-status .btn { border-radius: 7px; min-height: 40px; font-size: 14px; font-weight: 600; }
.px-status .btn-primary { background: #E7D5BA; color: #171717; border: 0; }
.px-status .btn-primary:hover { background: #F3E8D6; }
.px-status .btn-outline { background: transparent; color: #F2F2F2; border: 1px solid #4A4A4A; }
.px-status .btn-outline:hover { border-color: #A4A4A4; background: #141414; }
.px-status .btn:focus-visible { outline: 2px solid #F3E8D6; outline-offset: 3px; }
#progCancelBtn { flex: none; white-space: nowrap; padding: 0 16px; }
#pagesGrid { gap: 6px; }
.page-progress-thumb { border-color: #303030; }

/* a job that did not fully finish: the artwork rests, the actions stay */
#progressSection.is-failed .px-stage, #progressSection.is-attention .px-stage { opacity: .45; }

/* ready: the screen dissolves while the result is already there; nothing waits for it */
#progressSection.is-resolving {
  position: fixed; left: 0; right: 0; top: var(--header-h); bottom: 0; z-index: 50;
  min-height: 0; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity 360ms var(--t2-ease);
}

@media (max-width: 700px) {
  #progressSection { padding: 16px 20px 40px; }
  .pv-viewport { aspect-ratio: 1.35 / 1; }
  .px-status { margin-top: -4px; gap: 18px; }
  .pv-pause { right: 8px; bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .px-track.is-indeterminate::after { animation: none; width: 100%; opacity: .22; }
  #progBarFill, .px-stage, .pv-art, .pv-atmosphere, #progressSection.is-resolving { transition-duration: .01ms; }
}
