/* Elevage Studio. Every colour, font, radius and size here comes from tokens.css. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  /* The font shorthand resets numeral settings, so this is forced: numbers are tabular everywhere. */
  font-variant-numeric: tabular-nums !important;
  scrollbar-width: thin;
  scrollbar-color: var(--selected) transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--surround-dark);
  font: var(--t-body);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button,
select {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Focus shows for keyboard use only */
:focus {
  outline: none;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.icon {
  display: block;
  flex-shrink: 0;
}

/* 1.5px strokes at any icon size */
.icon * {
  vector-effect: non-scaling-stroke;
}

/* ===========================================================================
   Shell: panels docked to the window edges and to each other, around one
   rectangular viewport. Only popovers and the tool dock float.
   ======================================================================== */

.app {
  --scene-w: var(--w-scene);
  --inspector-w: var(--w-inspector);
  /* The viewport: what the panels leave free */
  --inset-top: var(--h-topbar);
  --inset-left: var(--scene-w);
  --inset-right: var(--inspector-w);
  --inset-bottom: var(--h-sheet);

  position: relative;
  height: 100vh;
  overflow: hidden;
}

.app.is-scene-collapsed {
  --scene-w: var(--w-strip);
}

.app.is-inspector-collapsed {
  --inspector-w: var(--w-strip);
}

/* Docked panel: flush, square, one shared background. A 1px divider on the
   side that meets a neighbour or the viewport is its only edge. */
.panel {
  position: absolute;
  z-index: 1;
  background: var(--card);
  transition: opacity var(--t-fast), visibility var(--t-fast), width var(--t-fast), left var(--t-fast), right var(--t-fast);
}

/* Floating card: popover menus and the new project screen */
.card {
  position: absolute;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

/* Tab: leave only the image, full-window */
.app.is-bare .panel,
.app.is-bare .overlay {
  visibility: hidden;
  opacity: 0;
}

.topbar {
  top: 0;
  left: 0;
  right: 0;
  z-index: 2; /* its view menu drops over the panels below */
  height: var(--h-topbar);
  border-bottom: 1px solid var(--line);
}

.side {
  top: var(--inset-top);
  bottom: 0;
  overflow: hidden;
}

.side--scene {
  --body-w: calc(var(--w-scene) - var(--s-3) * 2 - 1px);
  left: 0;
  width: var(--scene-w);
  border-right: 1px solid var(--line);
}

.side--inspector {
  --body-w: calc(var(--w-inspector) - var(--s-3) * 2 - 1px);
  right: 0;
  width: var(--inspector-w);
  border-left: 1px solid var(--line);
}

/* Fixed width, so nothing reflows while the panel collapses */
.side__body {
  display: flex;
  flex-direction: column;
  width: var(--body-w);
  height: 100%;
  margin: 0 var(--s-3);
  padding: var(--s-3) 0;
  transition: opacity var(--t-fast), visibility var(--t-fast);
}

.app.is-scene-collapsed .side--scene .side__body,
.app.is-inspector-collapsed .side--inspector .side__body {
  visibility: hidden;
  opacity: 0;
}

/* Centred in the 40px strip a collapsed panel leaves */
.side__toggle {
  position: absolute;
  z-index: 1;
  top: var(--s-1);
  right: var(--s-1);
}

.side--scene .side__toggle {
  right: calc(var(--s-1) - 1px); /* its divider is on this side */
}

.side__title {
  margin: 0 0 var(--s-3);
  padding: 0 var(--s-2);
  font: var(--t-title);
}

.sheet {
  left: var(--inset-left);
  right: var(--inset-right);
  bottom: 0;
  height: var(--h-sheet);
  border-top: 1px solid var(--line);
}

/* ===========================================================================
   Shared controls
   ======================================================================== */

/* Buttons (7.7) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--h-btn);
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-field);
  background: transparent;
  font: var(--t-body);
  color: var(--text);
  transition: background var(--t-fast);
}

.btn:hover {
  background: var(--hover);
}

.btn:active {
  background: var(--selected);
}

.btn--primary {
  border-color: transparent;
  background: var(--primary);
  font-weight: var(--weight-strong);
  color: var(--on-primary);
}

.btn--primary:hover,
.btn--primary:active {
  background: var(--text);
}

.btn--block {
  width: 100%;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: var(--h-btn);
  height: var(--h-btn);
  padding: 0;
  border: 0;
  border-radius: var(--r-field);
  background: transparent;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn:active,
.icon-btn[aria-expanded="true"][aria-haspopup] {
  background: var(--selected);
  color: var(--text);
}

/* Segmented control (7.5) */
.seg {
  display: flex;
  gap: var(--s-0);
  height: var(--h-row);
  padding: var(--s-0);
  border-radius: var(--r-field);
  background: var(--field);
}

.seg button {
  flex: 1;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-thumb);
  background: transparent;
  font: var(--t-small);
  color: var(--text-2);
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}

.seg button:hover {
  color: var(--text);
}

.seg button[aria-checked="true"],
.seg button[aria-pressed="true"] {
  background: var(--selected);
  color: var(--text);
}

.progress {
  display: block;
  height: var(--h-track);
  background: var(--line-strong);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width var(--t-fast);
}

/* Waiting on something that reports no progress: a short bar travelling along the track */
.is-busy > i {
  width: 30% !important;
  animation: busy 1.4s linear infinite;
}

@keyframes busy {
  from { transform: translateX(-100%); }
  to { transform: translateX(334%); }
}

/* ===========================================================================
   Top bar
   ======================================================================== */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-4);
  padding: 0 var(--s-pill) 0 var(--s-4);
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  min-width: 0;
}

.topbar__right {
  justify-content: flex-end;
  gap: var(--s-2);
}

.brand {
  margin-right: var(--s-2);
  font: var(--t-brand);
}

.topbar__sep {
  color: var(--text-3);
}

.switcher {
  position: relative;
  min-width: 0;
}

.switcher select {
  max-width: var(--w-switcher);
  height: var(--h-row);
  padding: 0 var(--s-6) 0 var(--s-2);
  border: 0;
  border-radius: var(--r-field);
  background: transparent;
  appearance: none;
  text-overflow: ellipsis;
  transition: background var(--t-fast);
}

.switcher--project select {
  font: var(--t-title);
}

.switcher select:hover {
  background: var(--hover);
}

.switcher option {
  background: var(--card);
  font: var(--t-body);
  color: var(--text);
}

/* Chevron */
.switcher::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--s-3);
  width: var(--s-pill);
  height: var(--s-pill);
  border: solid var(--text-3);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

.queue-status {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
  width: var(--w-status);
  margin-right: var(--s-1);
  font: var(--t-small);
  color: var(--text-2);
}

.queue-status[hidden] {
  display: none;
}

.queue-status__text {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-status__text span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A failed AI render: the message stays until clicked */
.queue-status.is-error {
  cursor: pointer;
}

.queue-status.is-error .icon,
.insp-error .icon {
  color: var(--warn);
}

.queue-status.is-error .progress {
  visibility: hidden;
}

.render-btn {
  padding: 0 var(--s-4);
}

.render-btn__count {
  min-width: var(--s-4);
  padding: 0 var(--s-1);
  border-radius: var(--r-pill);
  background: var(--on-primary);
  font: var(--t-value);
  color: var(--primary);
  text-align: center;
}

.render-btn__count[hidden] {
  display: none;
}

/* ===========================================================================
   Scene list (7.9)
   ======================================================================== */

.scene-list {
  flex: 1;
  min-height: 0;
  /* scrollbar sits in the panel's padding */
  margin-right: calc(var(--s-3) * -1);
  padding-right: var(--s-3);
  overflow-y: auto;
}

.scene-group + .scene-group {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.scene-group__title {
  display: flex;
  justify-content: space-between;
  margin: 0 0 var(--s-1);
  padding: 0 var(--s-2);
  font: var(--t-section);
  letter-spacing: var(--tracking-section);
  text-transform: uppercase;
  color: var(--text-3);
}

.scene-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.scene-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  height: var(--h-row);
  padding: 0 var(--s-2);
  border: 0;
  border-radius: var(--r-field);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}

.scene-row--child {
  padding-left: calc(var(--s-2) + var(--s-6));
}

.scene-row:hover {
  background: var(--hover);
}

.scene-row:active,
.scene-row.is-selected {
  background: var(--selected);
  color: var(--text);
}

.scene-row.is-off .scene-row__name,
.scene-row.is-off .icon {
  opacity: 0.4;
}

.scene-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-row__meta {
  font: var(--t-value);
  color: var(--text-3);
}

.swatch {
  flex-shrink: 0;
  width: var(--icon);
  height: var(--icon);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-thumb);
}

/* ===========================================================================
   Tools
   ======================================================================== */

.tool {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--h-btn);
  height: var(--h-btn);
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}

.tool:hover {
  background: var(--hover);
  color: var(--text);
}

.tool[aria-checked="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

/* Tool dock (7.8): a pill floating above the contact sheet */
.dock {
  position: absolute;
  z-index: 1;
  left: calc((var(--inset-left) + 100% - var(--inset-right)) / 2);
  bottom: calc(var(--inset-bottom) + var(--gap-dock));
  display: flex;
  gap: var(--s-1);
  height: var(--h-dock);
  padding: calc(var(--s-1) - 1px);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
  transition: left var(--t-fast), opacity var(--t-fast), visibility var(--t-fast);
}

/* Tool name and shortcut, below the dock */
.tool::after {
  content: attr(data-tip) "  " attr(data-key);
  position: absolute;
  top: calc(100% + var(--s-pill));
  left: 50%;
  padding: var(--s-0) var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--field);
  font: var(--t-small);
  color: var(--text);
  white-space: pre;
  opacity: 0;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity var(--t-fast);
}

.tool:hover::after,
.tool:focus-visible::after {
  opacity: 1;
}

/* ===========================================================================
   Viewport
   ======================================================================== */

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--surround-dark);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene.is-dragging {
  cursor: grabbing;
}

/* ---- Film gate (6): marks around and over the crop. The dimming outside the
   crop is drawn by the renderer, so the surround stays a pure token colour. ---- */

.gate {
  --ink: var(--mark-70);
  --bracket-ink: var(--mark-70);
  position: absolute;
  pointer-events: none;
}

/* Readouts sit on the picture, brackets on the surround: each flips to dark ink on a light ground */
.hud[data-ink="dark"] {
  --ink: var(--mark-dark-70);
}

.viewport[data-surround="light"] .gate {
  --bracket-ink: var(--mark-dark-70);
}

.gate__marks {
  position: absolute;
  inset: 0;
}

/* Corner brackets, one grid step outside the crop so they never touch the image */
.gate__bracket {
  position: absolute;
  width: var(--bracket);
  height: var(--bracket);
  border: 0 solid var(--bracket-ink);
}

.gate__bracket--tl { top: calc(var(--s-1) * -1); left: calc(var(--s-1) * -1); border-width: 1px 0 0 1px; }
.gate__bracket--tr { top: calc(var(--s-1) * -1); right: calc(var(--s-1) * -1); border-width: 1px 1px 0 0; }
.gate__bracket--bl { bottom: calc(var(--s-1) * -1); left: calc(var(--s-1) * -1); border-width: 0 0 1px 1px; }
.gate__bracket--br { bottom: calc(var(--s-1) * -1); right: calc(var(--s-1) * -1); border-width: 0 1px 1px 0; }

/* Lines that cross the picture invert whatever is under them, so they read on
   a pale backdrop and a dark bottle alike */
.gate__lines {
  position: absolute;
  inset: 0;
  mix-blend-mode: difference;
}

.gate__cross {
  position: absolute;
  top: calc(50% - var(--cross) / 2);
  left: calc(50% - var(--cross) / 2);
  width: var(--cross);
  height: var(--cross);
}

.gate__cross::before,
.gate__cross::after {
  content: "";
  position: absolute;
  background: var(--mark-50);
}

.gate__cross::before { top: calc(50% - 0.5px); left: 0; right: 0; height: 1px; }
.gate__cross::after { left: calc(50% - 0.5px); top: 0; bottom: 0; width: 1px; }

/* Rule of thirds and safe area: off until switched on in the view menu */
.gate__third,
.gate__safe {
  display: none;
  position: absolute;
}

.gate__third { background: var(--mark-35); }
.gate__third--v1 { top: 0; bottom: 0; left: 33.333%; width: 1px; }
.gate__third--v2 { top: 0; bottom: 0; left: 66.666%; width: 1px; }
.gate__third--h1 { left: 0; right: 0; top: 33.333%; height: 1px; }
.gate__third--h2 { left: 0; right: 0; top: 66.666%; height: 1px; }

.gate__safe {
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--mark-35);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  shape-rendering: crispEdges;
}

.viewport[data-thirds] .gate__third,
.viewport[data-safe] .gate__safe {
  display: block;
}

/* Readouts, 8px inside the crop corners */
.hud {
  position: absolute;
  font: var(--t-hud);
  color: var(--ink);
  text-transform: uppercase;
  white-space: nowrap;
}

.hud--tl { top: var(--s-2); left: var(--s-2); }
.hud--tr { top: var(--s-2); right: var(--s-2); }
.hud--bl { bottom: var(--s-2); left: var(--s-2); display: grid; gap: var(--s-1); }
.hud--br { bottom: var(--s-2); right: var(--s-2); }

.hud__hint {
  transition: opacity var(--t-camera);
}

.hud__hint.is-seen {
  opacity: 0;
}

/* A finished render laid exactly over the crop, in place of the live view */
.gate__render {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gate__render[hidden],
.seg[hidden],
.viewport[data-showing] .crop-bar,
.viewport[data-showing] .gate__lines,
.viewport[data-showing] .hud {
  display: none;
}

/* Shot tag and format switch, just above the crop. Wider than a narrow crop if it has to be. */
.gate__bar {
  position: absolute;
  bottom: calc(100% + var(--s-2));
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  width: max-content;
  min-width: 100%;
  transform: translateX(-50%);
}

.gate__bar > * {
  pointer-events: auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: var(--h-row);
  padding: 0 var(--s-2);
  border-radius: var(--r-field);
  background: var(--field);
  font: var(--t-small);
  color: var(--text-2);
  white-space: nowrap;
}

/* Stays right-aligned when the tag is hidden in Preview */
.crop-bar,
#render-switch {
  margin-left: auto;
}

.crop-bar button {
  padding: 0 var(--s-2);
  font: var(--t-value);
}

/* Preview shows only what will be exported */
.viewport[data-mode="preview"] .gate__marks,
.viewport[data-mode="preview"] .tag {
  display: none;
}

/* ---- Lighting plan (7.12 styling on the existing top-down plan), at the
   foot of the Scene panel ---- */

.studio-map {
  flex-shrink: 0;
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  user-select: none;
}

.plan__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--d-mini);
  padding-left: var(--s-2);
}

.plan__toggle {
  display: grid;
  place-items: center;
  width: var(--d-mini);
  height: var(--d-mini);
  padding: 0;
  border: 0;
  border-radius: var(--r-thumb);
  background: transparent;
  color: var(--text-3);
  transition: background var(--t-fast), color var(--t-fast);
}

.plan__toggle:hover {
  background: var(--hover);
  color: var(--text);
}

.studio-map.is-collapsed .plan__toggle .icon {
  transform: rotate(180deg);
}

.studio-map.is-collapsed .plan__svg {
  display: none;
}

.plan__svg {
  display: block;
  margin: var(--s-2) auto 0;
  overflow: visible;
}

/* Short windows: a smaller plan, so the scene list above it still fits without scrolling */
@media (max-height: 860px) {
  .plan__svg {
    width: var(--d-plan-compact);
    height: var(--d-plan-compact);
  }
}

.plan__disc {
  fill: var(--field);
  stroke: var(--line);
}

.plan__rings circle {
  fill: none;
  stroke: var(--line);
}

.plan__front,
.plan__letter {
  font: var(--t-hud);
  pointer-events: none;
}

.plan__front {
  letter-spacing: var(--tracking-section);
  text-transform: uppercase;
  text-anchor: middle;
  fill: var(--text-3);
}

.plan__letter {
  dominant-baseline: central;
  fill: var(--mark-70);
}

.plan__product {
  fill: var(--primary);
}

/* A light's beam, seen from above; kept inside the plan's circle */
.plan__spread {
  fill: var(--line);
}

.plan__svg {
  clip-path: circle(50%);
}

/* Camera: its wedge is the field of view */
.plan__cone {
  fill: var(--line);
  stroke: var(--mark-25);
  stroke-linejoin: round;
}

.plan__shadow {
  fill: var(--line);
}

.plan__beam {
  stroke: var(--mark-50);
  stroke-dasharray: 3 3;
  opacity: 0;
}

.plan__beam.is-on {
  opacity: 1;
}

.plan__dot {
  cursor: grab;
  outline: none;
}

.plan__dot:active {
  cursor: grabbing;
}

.plan__hit,
.plan__ring {
  fill: transparent;
  stroke: transparent;
}

.plan__dot.is-selected .plan__ring,
.plan__dot:focus-visible .plan__ring {
  stroke: var(--accent);
}

/* Lights run from warm to cool with their colour temperature */
.plan__body {
  fill: color-mix(in srgb, var(--light-cool) calc(var(--cool, 0.5) * 100%), var(--light-warm));
}

.plan__dot--camera .plan__body {
  fill: var(--mark-60);
}

.plan__dot.is-off .plan__body {
  fill: transparent;
  stroke: var(--text-3);
}

.plan__dot.is-off .plan__letter {
  fill: var(--text-3);
}

/* ===========================================================================
   Contact sheet
   ======================================================================== */

/* Cells (7.11): 88px high in one scrolling row. Each is the shot's thumbnail
   with its name, format and badges beside it. */

.sheet {
  padding: calc(var(--s-3) - 1px) var(--s-3) 0;
}

.sheet__strip {
  display: flex;
  gap: var(--s-2);
  /* the scrollbar, when there is one, sits in the panel's bottom padding */
  height: calc(var(--h-cell) + var(--s-3));
  padding-bottom: var(--s-3);
  overflow-x: auto;
  overflow-y: hidden;
}

.shot {
  position: relative;
  flex-shrink: 0;
  display: flex;
  gap: var(--s-2);
  height: var(--h-cell);
  padding: var(--s-1) var(--s-2) var(--s-1) var(--s-1);
  border-radius: var(--r-thumb);
  background: var(--field);
  transition: background var(--t-fast);
}

.shot:hover {
  background: var(--hover);
}

/* Selected: a lighter cell with 4px around the image. No coloured border. */
.shot.is-active {
  background: var(--selected);
}

/* The whole cell opens the shot; the stars sit above it */
.shot__open {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
}

.shot__img {
  position: relative;
  flex-shrink: 0;
  height: 100%;
  border-radius: var(--r-thumb);
  background: var(--card);
  pointer-events: none;
}

.shot__img img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

/* Several renders: a 2px offset edge behind the thumbnail */
.shot.is-stack .shot__img::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--text-3);
  transform: translate(var(--s-0), calc(var(--s-0) * -1));
}

.shot__info {
  display: flex;
  flex-direction: column;
  width: calc(var(--icon) * 5);
  min-width: 0;
  pointer-events: none;
}

.shot__name {
  overflow: hidden;
  font: var(--t-small);
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shot.is-active .shot__name {
  color: var(--text);
}

.shot__crop {
  font: var(--t-value);
  color: var(--text-3);
}

.shot__info .stars {
  position: relative;
  margin-top: auto;
  pointer-events: auto;
}

.shot__badges {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--icon);
  padding: 0 var(--s-0);
}

/* Badges are quiet until set */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font: var(--t-value);
  color: var(--text-3);
}

.badge.is-set {
  color: var(--text-2);
}

.badge.is-pass {
  color: var(--pass);
}

/* Rendering: a 2px accent bar along the bottom of the cell (empty while queued) */
.shot__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--h-track);
  border-radius: 0 0 var(--r-thumb) var(--r-thumb);
  background: var(--line-strong);
  overflow: hidden;
  pointer-events: none;
}

.shot__progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width var(--t-fast);
}

.shot-new {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--s-1);
  width: var(--h-cell);
  height: var(--h-cell);
  border: 0;
  border-radius: var(--r-thumb);
  background: var(--field);
  font: var(--t-small);
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}

.shot-new:hover {
  background: var(--hover);
  color: var(--text);
}

.shot-new:active {
  background: var(--selected);
}

/* Stars (contact sheet + inspector) */
.stars {
  display: flex;
}

.star {
  display: grid;
  place-items: center;
  padding: var(--s-0);
  border: 0;
  border-radius: var(--r-thumb);
  background: none;
  color: var(--text-3);
  transition: color var(--t-fast);
}

.star:hover {
  color: var(--text-2);
}

.star.is-on {
  color: var(--text);
}

/* A set star is filled: ratings are data, and brightness alone is too weak a signal */
.star.is-on .icon {
  fill: currentColor;
}

/* ===========================================================================
   Inspector
   ======================================================================== */

.inspector {
  flex: 1;
  min-height: 0;
  margin-right: calc(var(--s-3) * -1);
  padding-right: var(--s-3);
  overflow-y: auto;
}

/* Header (7.10): the name, with its type beneath */
.insp-head {
  padding: 0 var(--h-btn) var(--s-3) 0; /* clear of the collapse button */
}

.insp-head__title {
  margin: 0;
  overflow: hidden;
  font: var(--t-title);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insp-head__type {
  margin-top: var(--s-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-label,
.insp-head__type {
  font: var(--t-section);
  letter-spacing: var(--tracking-section);
  text-transform: uppercase;
  color: var(--text-3);
}

.section-label {
  margin: 0;
}

.insp-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
}

.insp-empty,
.insp-tip {
  margin: 0;
  font: var(--t-small);
  color: var(--text-3);
}

.insp-tip {
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

/* ---- Fields ---- */

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.field--inline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: var(--h-row);
}

.field__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  height: var(--h-row);
}

.field__label {
  color: var(--text-2);
}

.field__hint {
  display: block;
  font: var(--t-small);
  color: var(--text-3);
}

.field__value {
  font: var(--t-value);
  color: var(--text-2);
}

.field__readout {
  font: var(--t-small);
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.field__text {
  height: var(--h-row);
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-field);
  background: var(--field);
}

.field__text:focus {
  border-color: var(--accent);
  outline: none;
}

/* Ruler slider (7.1): the ruler moves under a fixed marker */
.ruler__readout {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.ruler__value {
  font: var(--t-value-lg);
  color: var(--text);
}

.ruler__unit {
  margin-left: calc(var(--s-1) * -1);
  font: var(--t-value);
  color: var(--text-3);
}

/* How far the value sits from its default: clockwise above it, anticlockwise below */
.ring {
  fill: none;
  stroke-width: 1.5;
  transform: rotate(-90deg);
}

.ring.is-negative {
  transform: scaleX(-1) rotate(-90deg);
}

.ring__track { stroke: var(--line-strong); }
.ring__arc { stroke: var(--text); }

.ruler__scale {
  position: relative;
  height: var(--ruler-marker);
  margin: var(--s-1) 0 var(--s-2);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  /* ticks fade out over the outer 32px (7.1) */
  mask-image: linear-gradient(to right, transparent, black var(--ruler-fade), black calc(100% - var(--ruler-fade)), transparent);
}

.ruler__strip {
  position: absolute;
  top: calc((var(--ruler-marker) - var(--ruler-tick)) / 2);
  left: 50%;
  height: var(--ruler-tick);
  transition: transform var(--t-fast);
}

.ruler__scale.is-dragging .ruler__strip {
  transition: none;
}

.ruler__strip i {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  margin-left: -0.5px;
  background: var(--mark-25);
}

.ruler__strip i.is-major {
  background: var(--mark-50);
}

.ruler__marker {
  position: absolute;
  top: 0;
  left: calc(50% - var(--ruler-mark) / 2);
  width: var(--ruler-mark);
  height: 100%;
  background: var(--accent);
}

/* Compact slider row (7.3) */
.pill {
  padding: var(--s-0) var(--s-pill);
  border: 1px solid transparent;
  border-radius: var(--r-field);
  background: var(--field);
  font: var(--t-value);
  color: var(--text-2);
}

.pill.is-changed {
  border-color: var(--accent);
  color: var(--text);
}

.slider__track {
  position: relative;
  height: var(--s-3);
}

.slider__track::before,
.slider__fill {
  content: "";
  position: absolute;
  top: calc(50% - var(--h-track) / 2);
  left: 0;
  height: var(--h-track);
  pointer-events: none;
}

.slider__track::before {
  right: 0;
  background: var(--line-strong);
}

.slider__fill {
  /* ends under the centre of the knob */
  width: calc(var(--d-knob) / 2 + var(--v, 0) * (100% - var(--d-knob)));
  background: var(--mark-60);
}

.slider__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
}

.slider__input::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}

.slider__input::-moz-range-track {
  height: 100%;
  background: transparent;
}

.slider__input::-webkit-slider-thumb {
  width: var(--d-knob);
  height: var(--d-knob);
  margin-top: calc((var(--s-3) - var(--d-knob)) / 2);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--primary);
  appearance: none;
}

.slider__input::-moz-range-thumb {
  width: var(--d-knob);
  height: var(--d-knob);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--primary);
}

/* "More": exact values as number field pairs (7.4) */
.more {
  justify-self: start;
  height: var(--h-row);
  padding: 0;
  border: 0;
  background: none;
  font: var(--t-small);
  color: var(--text-2);
  transition: color var(--t-fast);
}

.more:hover {
  color: var(--text);
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-2);
}

.pair[hidden] {
  display: none;
}

.num {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--h-row);
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-field);
  background: var(--field);
  font: var(--t-value);
}

.num:focus-within {
  border-color: var(--accent);
}

.num__letter {
  color: var(--text-3);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.num__unit {
  color: var(--text-3);
}

.num__input {
  flex: 1;
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
}

.num__input:focus-visible {
  outline: none; /* the field's border shows focus */
}

/* Colour: the current colour as a square, then preset circles */
.field__colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--h-row);
}

.field__color {
  width: var(--d-swatch);
  height: var(--d-swatch);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-thumb);
  background: none;
  overflow: hidden;
  appearance: none;
  cursor: pointer;
}

.field__color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.field__color::-webkit-color-swatch {
  border: 0;
  border-radius: 0;
}

.field__color::-moz-color-swatch {
  border: 0;
  border-radius: 0;
}

.chip {
  width: var(--d-swatch);
  height: var(--d-swatch);
  padding: 0;
  border: 1px solid var(--line-strong); /* so dark swatches hold their edge against the card */
  border-radius: var(--r-pill);
  background: var(--chip);
}

/* Selected: a 1px accent ring with a 2px gap */
.chip[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--accent);
}

/* Switch: white when on, like the active tool */
.switch {
  position: relative;
  flex-shrink: 0;
  width: var(--h-row);
  height: var(--s-4);
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--field);
  appearance: none;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.switch::after {
  content: "";
  position: absolute;
  top: var(--s-0);
  left: var(--s-0);
  width: var(--d-knob);
  height: var(--d-knob);
  border-radius: var(--r-pill);
  background: var(--text-3);
  transition: transform var(--t-fast), background var(--t-fast);
}

.switch:checked {
  border-color: transparent;
  background: var(--primary);
}

.switch:checked::after {
  background: var(--on-primary);
  transform: translateX(var(--s-3));
}

/* Renders list */
.render-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}

.render-job {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--s-1);
  font: var(--t-small);
  color: var(--text-2);
}

.render-job__preview {
  display: block;
  width: 100%;
  border-radius: var(--r-thumb);
}

.render-list .insp-empty {
  grid-column: 1 / -1;
}

.render-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-thumb);
  background: var(--field);
}

/* The render now showing in the frame */
.render-thumb.is-shown {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.render-thumb__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  overflow: hidden;
}

.render-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.render-thumb__kind,
.render-thumb__dl {
  position: absolute;
  border-radius: var(--r-thumb);
  background: var(--card);
  color: var(--text);
}

.render-thumb__kind {
  top: var(--s-1);
  left: var(--s-1);
  padding: 0 var(--s-1);
  font: var(--t-section);
  letter-spacing: var(--tracking-section);
  pointer-events: none;
}

.render-thumb__dl {
  right: var(--s-1);
  bottom: var(--s-1);
  display: grid;
  place-items: center;
  width: var(--s-6);
  height: var(--s-6);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.render-thumb:hover .render-thumb__dl,
.render-thumb__dl:focus-visible {
  opacity: 1;
}

.insp-error {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--s-1);
  margin: 0;
  font: var(--t-small);
  color: var(--text-2);
}

.insp-error .icon {
  margin-top: var(--s-0);
}

/* View menu: a small card floating under the top bar */
.menu {
  top: calc(100% + var(--gap-edge));
  right: var(--gap-edge);
  z-index: 2;
  display: grid;
  gap: var(--s-2);
  width: var(--w-menu);
  padding: var(--s-3);
}

.menu[hidden] {
  display: none;
}

.menu--wide {
  width: var(--w-menu-wide);
}

.menu .field__hint {
  margin-top: var(--s-1);
}

/* Dim the controls used exclusively by the AI step. */
.menu.is-reference-only .field:has([data-quality], [data-complexity], [data-lighting], textarea) {
  opacity: 0.4;
  pointer-events: none;
}

.field__text--area {
  height: auto;
  padding: var(--s-pill) var(--s-2);
  font: var(--t-small);
  color: var(--text);
  resize: vertical;
}

/* ===========================================================================
   New project: a solid screen over the studio
   ======================================================================== */

.setup {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: var(--s-4);
  background: var(--surround-dark);
}

.setup[hidden] {
  display: none;
}

.setup__card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(var(--w-setup), 100%);
  max-height: 100%;
}

.setup__head,
.setup__foot,
.setup__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.setup__head {
  padding: var(--s-1) var(--s-1) 0 var(--s-2);
}

.setup__head .side__title {
  margin: 0;
}

.setup__body {
  display: grid;
  gap: var(--s-3);
  min-height: 0;
  padding: var(--s-2) var(--s-4) var(--s-4);
  overflow-y: auto;
}

.setup__foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
}

.setup__note {
  flex: 1;
  font: var(--t-small);
  color: var(--text-3);
}

/* Label artwork */
.drop {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--h-drop);
  padding: var(--s-2) var(--s-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-field);
  background: var(--field);
  color: var(--text-2);
  text-align: left;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.drop:hover {
  background: var(--hover);
}

.drop.is-over {
  border-color: var(--accent);
}

.drop.has-artwork {
  border-style: solid;
  border-color: transparent;
}

.drop__thumb {
  height: calc(var(--h-drop) - var(--s-4));
  border-radius: var(--r-thumb);
}

.drop__text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.drop__name {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop__meta,
.drop__action {
  font: var(--t-small);
  color: var(--text-3);
}

.drop__action {
  color: var(--text-2);
}

/* Container library */
.containers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--w-container), 1fr));
  gap: var(--s-2);
}

.container {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  padding: var(--s-2);
  border: 0;
  border-radius: var(--r-thumb);
  background: var(--field);
  text-align: left;
  transition: background var(--t-fast);
}

.container:hover {
  background: var(--hover);
}

.container.is-selected {
  background: var(--selected);
}

.container__shape {
  flex-shrink: 0;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.container.is-selected .container__shape {
  stroke: var(--text);
}

.container__band {
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

.container__text {
  display: grid;
  min-width: 0;
}

.container__name {
  font: var(--t-small);
  color: var(--text-2);
}

.container.is-selected .container__name {
  color: var(--text);
}

.container__meta {
  font: var(--t-value);
  color: var(--text-3);
}

/* The artwork closes (nearly) all the way round this one */
.container__fit {
  margin-top: var(--s-1);
  font: var(--t-value);
  color: var(--text);
}

.container__fit::before {
  content: "";
  display: inline-block;
  width: var(--s-pill);
  height: var(--s-pill);
  margin-right: var(--s-1);
  border-radius: var(--r-pill);
  background: var(--accent);
}
