/* Cinematic waiting layer for active customer video cards (studio-cinematic-loader.mjs).
   Only transform/opacity animate on large layers; glows are pre-baked
   gradients. Phase is driven by --phase / --halo-phase (negative delays). */
.cine {
  position: absolute; inset: 0; overflow: hidden;
  contain: layout paint; container-type: size;
  background:
    radial-gradient(ellipse 70% 55% at 50% 44%, #2a1a10 0%, #15110e 46%, #0b0b0c 100%);
  color: #f4efe9;
  --s: clamp(56px, min(27cqi, 30cqh), 124px);
  --phase: 0s; --halo-phase: 0s; --y: 36%;
  --cine-mark: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220.0 0 133.5 100%22%3E%3Cpath d=%22M6.8 81.0 L6.5 81.1 L6.2 81.3 L6.2 81.6 L6.2 81.9 L16.9 99.7 L17.1 99.9 L17.4 100.0 L47.3 100.0 L49.4 99.8 L51.5 99.5 L53.6 99.1 L55.8 98.4 L58.8 97.2 L61.7 95.8 L64.5 94.0 L67.0 91.9 L69.4 89.5 L71.4 86.9 L73.2 84.2 L74.6 81.2 L75.5 78.9 L76.2 76.7 L76.8 74.3 L77.1 71.8 L77.2 69.5 L77.2 67.0 L77.0 64.5 L76.5 62.1 L76.0 59.9 L75.2 57.5 L74.2 55.2 L73.0 53.0 L71.8 51.1 L70.3 49.1 L68.8 47.3 L67.0 45.6 L65.4 44.2 L63.7 43.0 L61.9 41.8 L60.1 40.8 L58.1 40.0 L56.3 39.3 L54.3 38.6 L52.3 38.1 L49.8 37.7 L47.2 37.5 L28.1 37.5 L26.8 37.4 L25.6 37.1 L24.7 36.8 L23.7 36.3 L22.8 35.7 L22.0 35.1 L21.3 34.3 L20.7 33.5 L20.1 32.6 L19.7 31.7 L19.1 29.9 L19.0 28.1 L19.2 26.3 L19.8 24.6 L20.7 23.0 L21.9 21.6 L23.3 20.4 L24.9 19.6 L26.4 19.2 L28.0 19.0 L52.8 19.0 L53.0 18.9 L53.3 18.7 L53.4 18.4 L53.3 18.1 L42.6 0.3 L42.3 0.1 L42.1 0.0 L27.6 0.0 L25.1 0.2 L22.7 0.5 L21.1 0.9 L19.4 1.4 L17.8 2.0 L16.2 2.7 L13.3 4.3 L11.8 5.3 L10.5 6.3 L9.0 7.6 L7.6 9.0 L6.3 10.5 L5.2 12.0 L4.1 13.6 L3.2 15.2 L2.4 17.0 L1.7 18.7 L1.1 20.5 L0.6 22.6 L0.3 24.4 L0.1 26.3 L0.0 28.2 L0.1 30.2 L0.3 32.0 L0.6 33.9 L1.4 37.1 L2.6 40.2 L4.2 43.1 L6.0 45.6 L8.2 48.1 L10.6 50.3 L13.3 52.2 L16.2 53.8 L18.6 54.8 L20.9 55.5 L23.2 56.1 L25.7 56.4 L28.1 56.5 L46.1 56.5 L47.6 56.6 L49.1 56.9 L50.5 57.3 L51.8 57.9 L53.1 58.7 L54.7 60.1 L56.0 61.6 L57.0 63.4 L57.8 65.4 L58.2 67.5 L58.2 69.6 L57.9 71.7 L57.2 73.6 L56.5 75.1 L55.6 76.3 L54.6 77.5 L53.4 78.5 L52.1 79.4 L50.8 80.0 L49.3 80.6 L47.8 80.9 L46.1 81.0 L6.8 81.0Z%22 fill=%22%23ff6a1a%22/%3E%3Cpath d=%22M51.1 0.0 L50.8 0.1 L50.5 0.3 L50.5 0.6 L50.5 0.9 L61.2 18.7 L61.4 18.9 L61.7 19.0 L78.1 19.0 L79.7 19.2 L80.7 19.4 L81.6 19.7 L82.5 20.1 L83.3 20.7 L84.1 21.3 L84.8 22.0 L85.4 22.7 L86.0 23.5 L86.6 24.9 L87.0 26.2 L87.2 27.7 L87.2 29.1 L87.0 30.5 L86.5 31.9 L85.8 33.2 L84.9 34.4 L84.0 35.3 L83.1 36.0 L82.0 36.6 L80.9 37.0 L79.7 37.3 L78.6 37.5 L73.5 37.5 L73.2 37.6 L73.1 37.8 L73.0 38.0 L73.0 38.3 L109.9 99.8 L110.1 99.9 L110.3 100.0 L132.9 100.0 L133.3 99.9 L133.5 99.5 L133.4 99.1 L101.0 45.1 L101.0 44.9 L101.0 44.6 L102.4 42.5 L103.6 40.2 L104.4 38.3 L105.1 36.3 L105.6 34.1 L106.0 31.9 L106.2 29.6 L106.2 27.4 L106.1 25.0 L105.7 22.7 L105.2 20.5 L104.4 18.2 L103.5 16.2 L102.5 14.2 L101.2 12.1 L99.8 10.3 L98.2 8.5 L96.5 6.9 L94.6 5.4 L92.7 4.1 L90.5 2.9 L88.3 2.0 L86.0 1.2 L83.9 0.6 L81.1 0.2 L78.5 0.0 L51.1 0.0Z%22 fill=%22%23ff6a1a%22/%3E%3C/svg%3E");
}
.cine::before, .cine::after { /* letterbox */
  content: ""; position: absolute; left: 0; right: 0; height: 7%; max-height: 22px;
  background: #050505; z-index: 6; pointer-events: none;
}
.cine::before { top: 0; box-shadow: 0 1px 0 #ffffff08; }
.cine::after { bottom: 0; box-shadow: 0 -1px 0 #ffffff08; }

.cine-vignette, .cine-grain { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.cine-vignette { background: radial-gradient(ellipse at center, transparent 48%, #000000b0 100%); }
.cine-grain {
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Stage: bloom, halo, flare, logo ---------- */
.cine-stage {
  position: absolute; left: 50%; top: var(--y);
  width: var(--s); height: var(--s);
  transform: translate(-50%, -50%); z-index: 2;
}
.cine-bloom {
  position: absolute; inset: -60%; border-radius: 50%;
  background: radial-gradient(circle closest-side, #ff6a1a55 0%, #ff6a1a22 45%, #ff6a1a08 78%, transparent 100%);
  opacity: .55; animation: cine-bloom 3.2s cubic-bezier(.4,0,.2,1) var(--phase) infinite;
}
.cine-halo, .cine-halo-soft {
  position: absolute; border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0 6%, #ff6a1a 20%, #ffd2a1 27%, #f3bb7e00 40%,
    transparent 52%, #ff6a1a99 68%, #f3bb7e 74%, transparent 88%);
  animation: cine-rot 8s linear var(--halo-phase) infinite;
}
.cine-halo { inset: -30%;
  -webkit-mask: radial-gradient(closest-side, transparent 86%, #000 88.5%, #000 90.5%, transparent 93%);
          mask: radial-gradient(closest-side, transparent 86%, #000 88.5%, #000 90.5%, transparent 93%);
}
.cine-halo-soft { inset: -42%; opacity: .45; animation-direction: reverse; animation-duration: 13s;
  -webkit-mask: radial-gradient(closest-side, transparent 70%, #0008 82%, transparent 98%);
          mask: radial-gradient(closest-side, transparent 70%, #0008 82%, transparent 98%);
}
.cine-flare {
  position: absolute; left: 50%; top: 50%; width: 520%; height: 18%;
  margin-left: -260%; margin-top: -9%;
  background:
    radial-gradient(ellipse 50% 50% at 50% 50%, #fff6ec 0%, #ffb27acc 6%, #ff6a1a55 18%, transparent 52%);
  opacity: 0; transform: scaleX(.25);
  animation: cine-flare 3.2s cubic-bezier(.2,.7,.2,1) var(--phase) infinite;
}
.cine-flare::after { /* thin bright core */
  content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 1px;
  background: linear-gradient(90deg, transparent, #ffe3c8 35%, #fff 50%, #ffe3c8 65%, transparent);
}
.cine-logo { position: absolute; inset: 14%; perspective: 520px; }
.cine-logo-inner {
  position: absolute; inset: 0; display: grid; place-items: center;
  will-change: transform; transform-style: preserve-3d;
  animation: cine-spin 3.2s var(--phase) infinite;
}
.cine-logo-inner svg { width: 100%; height: auto; overflow: visible; }
.cine-logo-inner svg path { fill: #ff6a1a; }
.cine-logo-inner svg { filter: drop-shadow(0 0 10px #ff6a1a55); }
.cine-sheen {
  position: absolute; inset: 0; overflow: hidden;
  -webkit-mask: var(--cine-mark) center / 100% auto no-repeat;
          mask: var(--cine-mark) center / 100% auto no-repeat;
}
.cine-sheen::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; width: 38%; left: 0;
  background: linear-gradient(100deg, transparent, #fff0 20%, #fffbe9e6 50%, #fff0 80%, transparent);
  transform: translateX(-140%) skewX(-18deg); opacity: 0;
  animation: cine-sheen 3.2s ease-out var(--phase) infinite;
}

/* ---------- Dust motes ---------- */
.cine-motes { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cine-motes i {
  position: absolute; bottom: 12%; width: 3px; height: 3px; border-radius: 50%;
  background: radial-gradient(circle, #ffe2c2 0%, #ff9a5a88 45%, transparent 70%);
  opacity: 0; animation: cine-mote 9s linear infinite;
}
.cine-motes i:nth-child(1) { left: 14%; animation-duration: 10s; animation-delay: -1s; }
.cine-motes i:nth-child(2) { left: 27%; animation-duration: 12s; animation-delay: -6s; transform: scale(.7); }
.cine-motes i:nth-child(3) { left: 39%; animation-duration: 8.5s; animation-delay: -3s; }
.cine-motes i:nth-child(4) { left: 58%; animation-duration: 11s; animation-delay: -8s; }
.cine-motes i:nth-child(5) { left: 69%; animation-duration: 9.5s; animation-delay: -4.5s; }
.cine-motes i:nth-child(6) { left: 81%; animation-duration: 13s; animation-delay: -10s; }
.cine-motes i:nth-child(7) { left: 90%; animation-duration: 10.5s; animation-delay: -2s; }

/* ---------- Copy ---------- */
.cine-copy {
  position: absolute; left: 0; right: 0; top: calc(var(--y) + var(--s) * .5 + min(26px, 6cqh));
  z-index: 4; display: grid; justify-items: center; gap: 7px; padding: 0 18px; text-align: center;
}
.cine-act {
  font: 600 9px/1 "AX Sora", Sora, "AX Inter", Inter, sans-serif; letter-spacing: .34em; text-transform: uppercase;
  color: #f3bb7e; opacity: .55;
}
.cine-line {
  margin: 0; min-height: 1.3em; max-width: 100%;
  font: 300 clamp(14px, 5.6cqi, 21px)/1.25 "AX Sora", Sora, "AX Inter", Inter, sans-serif;
  letter-spacing: .04em; color: #f7f1ea; text-shadow: 0 0 18px #ff6a1a40;
  opacity: 0; transform-origin: 50% 60%;
}
.cine-line.is-in { animation: cine-line-in 1.1s cubic-bezier(.16,.84,.3,1) forwards; }
.cine-line.is-out { animation: cine-line-out .55s ease-in forwards; }
.cine-wait { font: 400 10px/1 Inter, sans-serif; color: #a49a91; letter-spacing: .06em; opacity: .7; }
.cine-warn {
  margin-top: 6px; max-width: 280px; padding: 7px 10px; border-radius: 9px;
  border: 1px solid #e1b76644; background: #332916c9; color: #ebcb8c;
  font: 500 10px/1.5 Inter, sans-serif;
}

/* ---------- Progress hairline ---------- */
.cine-bar {
  position: absolute; left: 0; right: 0; bottom: min(7%, 22px); height: 2px; z-index: 7;
  background: #ffffff0d;
}
.cine-bar i, .cine-bar b {
  position: absolute; inset: 0; display: block; transform-origin: 0 50%;
  transition: transform 1.1s cubic-bezier(.22,.61,.36,1);
}
.cine-bar i { background: linear-gradient(90deg, #ff6a1a00, #ff6a1a 40%, #ffc48f); transform: scaleX(0); }
.cine-bar b { transform: translateX(0); }
.cine-bar b::after {
  content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffb27a 40%, transparent 72%);
}

/* ---------- Warning: calm the illusion ---------- */
.cine.is-warn { --s: clamp(54px, 18cqi, 84px); --y: 30%; }
.cine.is-warn .cine-copy { gap: 5px; }
.cine.is-warn .cine-halo, .cine.is-warn .cine-halo-soft { opacity: .18; animation-duration: 24s; }
.cine.is-warn .cine-flare, .cine.is-warn .cine-sheen, .cine.is-warn .cine-motes { display: none; }
.cine.is-warn .cine-logo-inner { animation: none; opacity: .75; }
.cine.is-warn .cine-bloom { animation: none; opacity: .3; }

/* ---------- Completion reveal ---------- */
.cine-reveal { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
.cine-reveal::before { /* flash */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 40%, #fff7ef 0%, #ffb27a 30%, #ff6a1a00 70%);
  animation: cine-flash .6s ease-out forwards;
}
/* ---------- Pausing / tiers ---------- */
.cine.is-paused *, .cine.is-paused *::before, .cine.is-paused *::after { animation-play-state: paused !important; }
.cine-low-tier .cine-motes, .cine-low-tier .cine-grain, .cine-low-tier .cine-halo-soft { display: none; }
@media (prefers-reduced-motion: reduce) {
  .cine-logo-inner, .cine-halo, .cine-halo-soft, .cine-bloom, .cine-flare, .cine-sheen::before, .cine-motes i { animation: none !important; }
  .cine-flare, .cine-motes { display: none; }
  .cine-line.is-in { animation: cine-fade .6s ease forwards; }
  .cine-line.is-out { animation: cine-fade .4s ease reverse forwards; }
}

/* ---------- Keyframes (3.2s cycle: 1s spin = 31.25%) ---------- */
@keyframes cine-spin {
  0% { transform: rotateY(0deg) scale(1); }
  4% { transform: rotateY(-14deg) scale(.97); }
  27% { transform: rotateY(372deg) scale(1.04); }
  31.25% { transform: rotateY(360deg) scale(1); }
  100% { transform: rotateY(360deg) scale(1); }
}
@keyframes cine-bloom {
  0%, 100% { opacity: .5; transform: scale(.94); }
  18% { opacity: 1; transform: scale(1.08); }
  48% { opacity: .58; transform: scale(.98); }
}
@keyframes cine-flare {
  0%, 20% { opacity: 0; transform: scaleX(.2); }
  29% { opacity: .95; transform: scaleX(1); }
  52% { opacity: 0; transform: scaleX(1.25); }
  100% { opacity: 0; transform: scaleX(.2); }
}
@keyframes cine-sheen {
  0%, 30% { transform: translateX(-140%) skewX(-18deg); opacity: 0; }
  32% { opacity: 1; }
  50% { transform: translateX(330%) skewX(-18deg); opacity: 0; }
  100% { transform: translateX(330%) skewX(-18deg); opacity: 0; }
}
@keyframes cine-rot { to { transform: rotate(360deg); } }
@keyframes cine-mote {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  15% { opacity: .85; }
  70% { opacity: .5; }
  100% { opacity: 0; transform: translate3d(18px, -170px, 0); }
}
@keyframes cine-line-in {
  from { opacity: 0; transform: translateY(6px) scale(1.07); }
  to { opacity: 1; transform: none; }
}
@keyframes cine-line-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-4px) scale(.97); }
}
@keyframes cine-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cine-flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cine-iris {
  from { clip-path: circle(0% at 50% 45%); }
  to { clip-path: circle(75% at 50% 45%); }
}

/* ---------- Host integration ---------- */
.cine-warn[hidden] { display: none; }
.cine-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.history-card .job-media > .cine { z-index: 1; }
/* Completed media "premiere": an iris opening over the freshly delivered card. */
.history-card.cine-premiere .job-media > :is(video, img) { animation: cine-iris .75s cubic-bezier(.7,0,.2,1) both; }
.history-card.cine-premiere .job-media::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #fff7ef 0%, #ffb27a 30%, #ff6a1a00 70%);
  animation: cine-flash .6s ease-out forwards;
}

/* "+N more shots in production" summary card */
.cine-more {
  display: flex; align-items: center; gap: 18px; width: 100%; padding: 18px 22px; border-radius: 17px; text-align: left;
  border: 1px dashed #3a3b3f; background: linear-gradient(90deg, #1b1612, #191a1d 60%); color: #e8e8e6; cursor: pointer;
}
.cine-more:hover, .cine-more:focus-visible { border-color: #ff6a1a66; }
.history-list.grid .cine-more { grid-column: 1 / -1; }
.cine-more-stack { display: flex; }
.cine-more-stack span { width: 34px; height: 34px; margin-left: -10px; border-radius: 50%; display: grid; place-items: center; background: #221a14; border: 1px solid #3a2d22; }
.cine-more-stack span:first-child { margin-left: 0; }
.cine-more-stack svg, .cine-prod-mark svg { width: 16px; height: 12px; }
.cine-more-stack svg path, .cine-prod-mark svg path { fill: #ff6a1a; }
.cine-more-text strong { display: block; font: 500 15px "AX Sora", Sora, "AX Inter", Inter, sans-serif; color: #f4efe9; }
.cine-more-text small { color: #8d8f93; font-size: 11px; }
.cine-more-go { margin-left: auto; color: #f3bb7e; font-size: 12px; white-space: nowrap; }

/* "In production" tab: compact rows, no animation */
.cine-production { display: flex; flex-direction: column; border: 1px solid #26272a; border-radius: 14px; overflow: hidden; }
.cine-production.hidden { display: none; }
.cine-prod-row { position: relative; display: grid; grid-template-columns: 34px minmax(80px, 140px) 1fr 70px auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid #222326; }
.cine-prod-row:first-child { border-top: 0; }
.cine-prod-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #1f1915; border: 1px solid #33271e; }
.cine-prod-model { font-size: 11px; color: #d8d8d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cine-prod-row.is-featured .cine-prod-model::after { content: "On stage"; margin-left: 8px; padding: 2px 6px; border-radius: 5px; background: #ff6a1a22; color: #f3bb7e; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.cine-prod-prompt { font-size: 12px; color: #9a9ca0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cine-prod-elapsed { font: 500 11px ui-monospace, Menlo, monospace; color: #a49a91; text-align: right; }
.cine-prod-row button { font-size: 11px; padding: 6px 9px; border-radius: 7px; background: #2d2e32; color: #e8e8e6; }
.cine-prod-hair { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, #ff6a1a00, #ff6a1a); transform-origin: 0 50%; transform: scaleX(0); }
.cine-prod-empty { padding: 48px 20px; text-align: center; color: #7d7f83; font-size: 12px; }
.history-tabs [data-history-tab="production"] .cine-tab-count { min-width: 16px; padding: 1px 5px; border-radius: 8px; background: #ff6a1a; color: #120a05; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; }
.history-tabs [data-history-tab="production"].hidden { display: none; }
@media (max-width: 720px) {
  .cine-prod-row { grid-template-columns: 30px 1fr 60px auto; }
  .cine-prod-prompt { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .history-card.cine-premiere .job-media > :is(video, img), .history-card.cine-premiere .job-media::after { animation: none; }
}
