/* The panel inside Resolve and Premiere, drawn as a piece of the studio itself
   (app.imanginable.com): the cosmos theme's dark side (web/src/styles/themes/cosmos.css),
   Nunito with the condensed upper-case label cut (theme.css .label), the running line of
   light round every card and action button (styles/edge.css), cards coming forward as
   they arrive (styles/reveal.css), the work lamp (components/ui/lamp.tsx), and the
   film card's shape (components/ui/film-card.tsx). Reduced motion stills all of it. */
@property --edge-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

:root {
  --ground: #000000; --surface: #0a0a0a; --container: #121212; --container-high: #1c1c1c;
  --outline: #333333; --outline-faint: #1f1f1f;
  --ink: #e8e8e8; --ink-2: #a6a6a6; --ink-3: #7c7c7c;
  --primary: #f0206a; --primary-on: #ffffff; --primary-wash: rgb(240 32 106 / 0.17);
  --work: #fbbe00; --work-wash: rgb(251 190 0 / 0.13);
  --error: #ff6a3d; --error-wash: rgb(255 106 61 / 0.14);
  --spark: #2fe6ff; --mint: #3df5c8;
  --display: "Nunito", system-ui, sans-serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --raise: 0 1px 2px rgb(0 0 0 / 0.2), 0 4px 12px -4px rgb(0 0 0 / 0.3);
  --float: 0 0 0 1px rgb(255 255 255 / 0.08), 0 12px 32px -8px rgb(0 0 0 / 0.55);
  --band: inset 0 -2px 0 rgb(0 0 0 / 0.16), inset 0 1px 0 rgb(255 255 255 / 0.22);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--ground); color: var(--ink);
  font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-optical-sizing: auto; }
body { display: flex; flex-direction: column; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---- the running edge (edge.css) --------------------------------------------- */
.edge { position: relative; isolation: isolate; }
.edge::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit;
  padding: var(--edge-w, 1.5px);
  background: conic-gradient(from var(--edge-angle), transparent 0 58%, var(--primary) 74%,
    var(--spark) 86%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: edge-spin var(--edge-s, 7s) linear infinite; animation-delay: var(--edge-d, 0s);
  pointer-events: none; }
button.edge::before { --edge-w: 1px; --edge-s: 4s; }
@keyframes edge-spin { to { --edge-angle: 360deg; } }

/* ---- the label cut (theme.css) ------------------------------------------------- */
.label { font-family: var(--sans); font-variation-settings: "wdth" 82; font-weight: 750; font-size: 11px;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

/* ---- the bar ------------------------------------------------------------------- */
.top { display: flex; align-items: center; gap: .6rem; padding: .65rem .85rem; background: var(--surface);
  border-bottom: 1px solid var(--outline-faint); position: sticky; top: 0; z-index: 10; }
.top img { width: 26px; height: 26px; object-fit: contain; }
.brand { font: 800 16px/1 var(--display); letter-spacing: -.005em; }
.host { border: 1px solid var(--outline-faint); border-radius: 999px; padding: .15rem .5rem; }
.host:empty { display: none; }
.grow { flex: 1; }
main { flex: 1; padding: 1rem .85rem 1.25rem; }
footer { padding: .5rem .85rem; border-top: 1px solid var(--outline-faint); background: var(--surface); }
footer:empty { display: none; }

h1 { font: 800 22px/1.2 var(--display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 em { font-style: normal; color: var(--primary); }
h2 { font: 700 16px/1.3 var(--display); margin: 0; text-wrap: balance; }
.muted { color: var(--ink-2); }
.meta { color: var(--ink-3); font-size: 12px; }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; }
a { color: var(--primary); }
code { font: 11.5px var(--mono); color: var(--ink-3); }

/* ---- buttons (components/ui/button.tsx: deck, primary, ghost) ------------------- */
button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 32px; padding: 0 .85rem; border-radius: var(--r-sm); font-size: 13px; font-weight: 700;
  background: var(--container); color: var(--ink); border: 1px solid var(--outline-faint);
  transition: background-color .15s, border-color .15s, filter .15s, transform .1s; }
button:hover { background: var(--container-high); border-color: var(--outline); }
button:active { transform: scale(0.97); }
button:disabled { opacity: .4; cursor: default; transform: none; }
button.primary { background: var(--primary); color: var(--primary-on); border-color: transparent; box-shadow: var(--band); }
button.primary:hover { filter: brightness(1.1); box-shadow: var(--band), 0 0 22px var(--primary-wash); }
button.primary:disabled { filter: none; box-shadow: none; }
button.big { width: 100%; height: 44px; font-size: 14.5px; border-radius: var(--r); }
button.link { background: none; border: 0; height: auto; padding: 0; color: var(--ink-2); font-weight: 700; }
button.link:hover { color: var(--ink); background: none; }
input[type="search"], input[type="text"], input[type="number"], select, textarea { width: 100%;
  background: var(--container); border: 1px solid var(--outline-faint); border-radius: var(--r-sm);
  padding: .45rem .65rem; transition: border-color .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--outline); }

/* ---- messages -------------------------------------------------------------------- */
.note { margin: 0; }
.note:not(:empty) { margin: .75rem .85rem 0; padding: .55rem .7rem; border-radius: var(--r-sm); font-size: 13px; }
.note.error { background: var(--error-wash); color: var(--error); border: 1px solid rgb(255 106 61 / .35); }
.note.ok { background: rgb(61 245 200 / .1); color: var(--mint); border: 1px solid rgb(61 245 200 / .3); }
.banner { background: var(--container); border: 1px solid var(--outline-faint); border-radius: var(--r);
  padding: .6rem .7rem; margin-bottom: .8rem; color: var(--ink-2); font-size: 13px; }
.banner.warn { border-color: rgb(251 190 0 / .4); background: var(--work-wash); color: var(--work); }
.callout { border-radius: var(--r); padding: .7rem .8rem; font-size: 13px; }
.callout.error { background: var(--error-wash); color: #ffb49c; border: 1px solid rgb(255 106 61 / .35); }
.callout.ok { background: var(--container); color: var(--ink-2); border: 1px solid var(--outline-faint); }
.callout strong { display: block; margin-bottom: .2rem; color: var(--ink); font: 700 14px/1.3 var(--display); }

/* ---- the work lamp (lamp.tsx) ------------------------------------------------------ */
.lamp { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--outline); background: var(--outline-faint); }
.lamp.on { background: var(--work); border-color: transparent; color: var(--work);
  box-shadow: 0 0 12px currentColor; animation: lamp-pulse 1.6s ease-in-out infinite; }
.lamp.bad { background: var(--error); border-color: transparent; color: var(--error); box-shadow: 0 0 10px currentColor; }
.lamp.good { background: var(--mint); border-color: transparent; }
@keyframes lamp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---- sign-in --------------------------------------------------------------------- */
.hero { display: flex; flex-direction: column; gap: 1rem; }
.hero .mark { width: 72px; height: 72px; object-fit: contain; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.steps li { display: flex; gap: .6rem; align-items: center; color: var(--ink-2); font-size: 13px; }
.steps li b { flex: none; width: 1.45rem; height: 1.45rem; border-radius: 50%; display: inline-grid;
  place-items: center; background: var(--container-high); color: var(--ink); font: 800 11.5px var(--display); }
.code { display: flex; flex-direction: column; gap: .65rem; background: var(--container);
  border-radius: var(--r-lg); padding: 1rem; box-shadow: var(--float); }
.code:empty { display: none; }
.user-code { font: 600 28px/1 var(--mono); letter-spacing: .14em; text-align: center; color: var(--ink);
  padding: .7rem .5rem; background: var(--ground); border: 1px dashed var(--primary); border-radius: var(--r); }
.waiting { display: flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: 13px; }

/* ---- lists: the film card (film-card.tsx) ------------------------------------------ */
.tabs { display: flex; gap: .15rem; margin: 0 0 .8rem; padding: .2rem; background: var(--container);
  border: 1px solid var(--outline-faint); border-radius: var(--r); }
.tabs button { flex: 1; height: 30px; background: none; border: 0; border-radius: var(--r-sm); color: var(--ink-2); }
.tabs button:hover { color: var(--ink); background: var(--container-high); }
.tabs button[aria-selected="true"] { color: var(--ink); background: var(--container-high); box-shadow: inset 0 -2px 0 var(--primary); }
.search { margin-bottom: .7rem; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-lg);
  background: var(--container); border: 1px solid var(--outline-faint); box-shadow: var(--raise); }
.card.working { border-color: rgb(251 190 0 / .45); }
.card.failed { border-color: rgb(255 106 61 / .45); }
.cover { position: relative; aspect-ratio: 16 / 9; background: var(--ground); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0;
  transition: opacity .35s, transform .3s; }
.cover.loaded img { opacity: 1; }
.card:hover .cover.loaded img { transform: scale(1.03); }
.cover .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); }
.cover.loaded .none { display: none; }
.cover .pill { position: absolute; left: .5rem; top: .5rem; display: inline-flex; align-items: center; gap: .4rem;
  background: rgb(0 0 0 / .8); border-radius: 999px; padding: .15rem .5rem; }
.card-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
/* A docked panel is narrow: the card lies on its side, picture left, like the studio's
   card for a tall film — two or three films on screen instead of one. */
@media (max-width: 560px) {
  .rows { grid-template-columns: 1fr; gap: .55rem; }
  .card { flex-direction: row; }
  .card > .cover { width: 38%; flex: none; aspect-ratio: auto; min-height: 100%; }
  .card > .cover .pill { left: .35rem; top: .35rem; right: .35rem; padding: .1rem .4rem; }
  .card > .cover .pill .label { font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-body { padding: .55rem .6rem .45rem; }
  .card-body strong { font-size: 13.5px; }
  .card-foot { border-top: 0; padding: 0 .5rem .5rem; }
  .card-foot .tag { display: none; }
  .holes i { width: 5px; height: 4px; }
}
.card-body { display: flex; flex-direction: column; gap: .25rem; padding: .65rem .75rem .7rem; min-width: 0; }
.card-body strong { font: 700 14.5px/1.3 var(--display); color: var(--ink); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-body .sub { font-size: 12px; color: var(--ink-3); }
.holes { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .3rem; }
.holes i { width: 7px; height: 5px; border-radius: 1.5px; background: var(--ink-2); opacity: .8; }
.holes i.bad { background: var(--error); opacity: 1; }
.holes i.work { background: var(--work); opacity: 1; }
.card-foot { margin-top: auto; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  border-top: 1px solid var(--outline-faint); padding: .45rem .5rem; }
.tag { border: 1px solid var(--outline-faint); border-radius: 999px; padding: 0 .4rem; font-size: 10px; }
.card-foot .actions { margin-left: auto; display: flex; gap: .3rem; }
.card.dim .cover img { filter: grayscale(.6) brightness(.7); }
.empty { color: var(--ink-3); text-align: center; padding: 1.5rem .5rem; grid-column: 1 / -1; }
.skeleton { height: 230px; border-radius: var(--r-lg); background: linear-gradient(90deg,
  var(--container) 0%, var(--container-high) 50%, var(--container) 100%); background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tool-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; }
.tool-row .card-body { padding: 0; flex: 1; }

/* ---- cards coming forward (reveal.css) ------------------------------------------- */
.reveal { animation: reveal-in .55s cubic-bezier(0.34, 1.5, 0.64, 1) both; animation-delay: var(--reveal-delay, 0s);
  transform-origin: 50% 50%; }
@keyframes reveal-in { from { opacity: 0; transform: scale(0.55); } 30% { opacity: 1; } to { opacity: 1; transform: none; } }

/* ---- work ------------------------------------------------------------------------ */
.work { display: flex; flex-direction: column; gap: .8rem; }
.work .back { align-self: flex-start; }
.work-head { display: flex; gap: .75rem; align-items: center; }
.work-head .cover { width: 128px; flex: none; border-radius: var(--r); }
.progress { height: 6px; border-radius: 999px; background: var(--container-high); overflow: hidden; position: relative; }
.progress > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #ff3d7f); transition: width .45s ease; }
.progress.busy > i { width: 32%; background: linear-gradient(90deg, transparent, var(--work), transparent);
  animation: bar-travel 1.3s ease-in-out infinite; }
@keyframes bar-travel { from { left: -32%; } to { left: 100%; } }
.status { color: var(--ink-2); font-size: 13px; margin: 0; }
.status:empty { display: none; }
.path { font: 11.5px/1.45 var(--mono); color: var(--ink-3); word-break: break-all; margin-top: .35rem; }
.changes { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .25rem; font-size: 13px; }
.row-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .65rem; }
.field > span { font-weight: 700; font-size: 13px; }
.result { background: var(--container); border: 1px solid var(--outline-faint); border-radius: var(--r-sm);
  padding: .6rem; max-height: 22rem; overflow: auto; white-space: pre-wrap; font: 11.5px/1.45 var(--mono); }
.result:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0s !important; transition: none !important; }
}
