/*!
 * Cineskill native · gallery motion support (Claude · Opus 5.5, 2026-12-03). Pairs with gallery-turn.js.
 * Load after gallery-host.css. Nothing here animates by itself: the JS drives transform/opacity with WAAPI.
 */

/* The card in flight: one composited layer, pivoting on its own centre; its back is never drawn. */
body[data-ui=projector][data-host=native].gallery-turning #studio {
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
}

/* Acknowledgement: the value you chose answers on the first frame, before it turns away.
   Lime = a selection; going Back is neutral. */
body[data-host=native] #studio .gm-ack {
  box-shadow: inset 0 0 0 1.5px rgb(var(--gm-accent-rgb, 213, 255, 56)), 0 0 14px -4px rgba(var(--gm-accent-rgb, 213, 255, 56), .55) !important;
  color: rgb(var(--gm-accent-rgb, 213, 255, 56)) !important;
}
body[data-host=native] #studio .gm-ack-back {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .85) !important;
}

/* Frame holders: the outgoing decoded still, exactly over the live one, on the screen's black. */
body[data-host=native] #director-gallery .dg-screen .gm-hold {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
  border-radius: inherit;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
/* While GalleryMotion owns the swap, the live still is never half-dimmed or CSS-faded underneath. */
body[data-host=native] #director-gallery .dg-screen.gm-managed #gallery-image { transition: none; }
body[data-host=native] #director-gallery .dg-screen.gm-managed #gallery-image[data-state="loading"] { opacity: 1; }
body[data-host=native] #director-gallery .dg-screen.gm-managed #gallery-image.gm-arriving { opacity: 0; }

/* Drawer: the JS animates height/padding/opacity/translate; keep children from wrapping mid-flight. */
body[data-host=native] #director-gallery #gallery-refinements { flex-wrap: nowrap; transform-origin: 50% 0; animation: none; }

/* The Filters toggle reads its state immediately (aria-expanded is set at the start of the motion). */
body[data-host=native] #director-gallery #gallery-refine .dg-sliders { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
body[data-host=native] #director-gallery #gallery-refine[aria-expanded="true"] .dg-sliders { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
  body[data-host=native] #director-gallery #gallery-refine .dg-sliders { transition: none; }
}
@media (forced-colors: active) {
  body[data-host=native] #studio .gm-ack, body[data-host=native] #studio .gm-ack-back { outline: 2px solid Highlight; box-shadow: none !important; }
}

/* ───────── Liquid-Glass press (from the owner's iOS 26 reference) ─────────
   Press: the control swells ~4 % and lights up (it never shrinks). Release: a soft spring settles it with one small
   rebound. Film stills are never brightened: thumbnails only swell. */
body[data-host=native] {
  --gm-release: linear(0, 0.053, 0.182, 0.347, 0.519, 0.677, 0.812, 0.918, 0.994, 1.044, 1.072, 1.083, 1.082, 1.073, 1.06,
    1.045, 1.031, 1.019, 1.01, 1.002, 0.998, 0.995, 0.993, 0.993, 0.994, 0.995, 0.996, 0.997, 0.998, 1);
}
body[data-host=native] #studio :is(.tray button, #director-gallery :is(.dg-values > button, .dg-axes > button, .dg-chips > button,
  .dg-scenes > button, .dg-refs > button, .dg-primary, .dg-quiet, .dg-step, .dg-back, .dg-refine, .dg-modes > button)) {
  transition: transform 660ms var(--gm-release), box-shadow 240ms ease-out, background-color 240ms ease-out;
}
body[data-host=native] #studio :is(.tray button, #director-gallery :is(.dg-values > button, .dg-axes > button, .dg-chips > button,
  .dg-refs > button, .dg-quiet, .dg-step, .dg-back, .dg-refine, .dg-modes > button)):active:not(:disabled) {
  transform: scale(1.04);
  background-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 26px -10px rgba(255, 255, 255, .3);
  transition: transform 90ms cubic-bezier(.2, .8, .2, 1), box-shadow 90ms ease-out, background-color 90ms ease-out;
}
body[data-host=native] #studio #director-gallery :is(.dg-scenes > button, .dg-primary):active:not(:disabled) {
  transform: scale(1.04);
  transition: transform 90ms cubic-bezier(.2, .8, .2, 1);
}
body[data-host=native] #studio #director-gallery .dg-primary:active:not(:disabled) { background-color: var(--gm-accent-press, #e6ff80); }

@media (prefers-reduced-motion: reduce) {
  body[data-host=native] #studio :is(.tray button, #director-gallery button) { transition: none !important; }
  body[data-host=native] #studio :is(.tray button, #director-gallery button):active { transform: none !important; }
}

/* ───────── fix: the cat must never flash, crop or land in the wrong place while the window changes size ─────────
   The page switches layout at once, but AppKit applies the new window frame — and the saucer position it reports
   (--native-saucer-x/y) — a frame or two later and not always in the same order. On rapid clicks / double-clicks that
   produced: a giant cat (folded layout sized 100vw × 100vh inside the still-big dial window), a small cat in the top-left
   of the still-big window, or a cat pushed out of the still-small window. The rule below depends only on the window's
   real size, never on the reported position:
     folded + folded-size window  → the 132 × 108 cat at the window's origin (exactly as before);
     folded + window still big    → hidden for those frames (no misplaced cat);
     open   + window still small  → keep showing the folded cat until the window has grown.
   (Belongs in layout.css; kept here so it ships with the motion files.) */
body[data-host=native][data-collapsed=true] .projector-launch,
body[data-host=native][data-collapsed=true] .projector-launch canvas {
  width: 132px !important;
  height: 108px !important;
}
body[data-ui=projector][data-host=native][data-collapsed=true] #launch {
  position: fixed !important; left: 0 !important; top: 0 !important;
  transform: none !important; transition: none !important;
}
@media (min-width: 141px), (min-height: 121px) {
  body[data-host=native][data-collapsed=true] #launch { visibility: hidden !important; }
}
@media (max-width: 140px) and (max-height: 120px) {
  body[data-host=native][data-collapsed=false] #studio { visibility: hidden !important; }
  body[data-ui=projector][data-host=native][data-collapsed=false] #launch {
    visibility: visible !important; position: fixed !important; left: 0 !important; top: 0 !important;
    width: 132px !important; height: 108px !important; transform: none !important; transition: none !important;
  }
  body[data-host=native][data-collapsed=false] #launch canvas { width: 132px !important; height: 108px !important; }
}

/* ───────── calm panel entrances (owner: remove the left-to-right drag trail) ─────────
   Native only. Replaces, for every stage change:
     hull-sweep        a slanted light streak racing across the saucer left → right (the visible "trail")
     native-wing-open  the wing sliding sideways out of the saucer
     saucer-zoom       the tray arriving squashed + blurred (smear)
     frame-back        the tray returning blurred + scaled
   with the same gentle fade used by the gallery: opacity 0 → 1 and a 2 pt settle, no sideways travel, no blur, no squash.
   (Belongs in saucer.css / wing.css; kept here so it ships with the motion files.) */
@keyframes gm-soft-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
body[data-ui=projector][data-host=native]:not([data-stage=idle]) .saucer-metal { animation: none !important; }
body[data-host=native][data-ui=projector]:is([data-stage=axis], [data-stage=results], [data-stage=search]) #studio #browser,
body[data-ui=projector][data-host=native]:is([data-stage=axis], [data-transition=back]) .tray,
body[data-ui=projector][data-host=native]:is([data-stage=search], [data-transition=back]) .instrument-top,
body[data-ui=projector][data-host=native]:is([data-stage=results], [data-transition=back]) .result-top {
  animation: gm-soft-in 320ms cubic-bezier(.33, .9, .5, 1) both !important;
  filter: none !important;
}
@media (prefers-reduced-motion: reduce) {
  body[data-host=native][data-ui=projector] :is(#browser, .tray, .instrument-top, .result-top) { animation-duration: 120ms !important; }
  @keyframes gm-soft-in { from { opacity: 0; } to { opacity: 1; } }
}

/* ───────── the UFO cat keeps one size everywhere (owner: "don't change the size of the ufo cat") ─────────
   Folded it is drawn on a 132 × 108 canvas (saucer ≈ 124 pt wide); the dial hub used 112 × 112 (≈ 105 pt) and the
   choices step 88 × 88 (≈ 83 pt), so it shrank as it opened. Every open state now uses the folded canvas. The saucer is
   positioned by its centre (translate −50 %), so the centre never moves; it sits snugly in the 122 pt hub well.
   Native note: the choices window keeps the cat 58 pt from its edge — widen SaucerWingLayout's margin to 66 so the
   124 pt saucer is not clipped. (Belongs in saucer.css / wing.css.) */
body[data-host=native][data-ui=projector][data-collapsed=false] #launch,
body[data-host=native][data-ui=projector][data-collapsed=false] #launch canvas {
  width: 132px !important;
  height: 108px !important;
}
/* beside the choices, wing.css pins the saucer by its top-left at 88 × 88; keep its centre where it was (+44, +44) */
body[data-host=native][data-ui=projector]:is([data-stage=axis], [data-stage=results], [data-stage=search]) #studio #idle #launch {
  transform: translate(-22px, -10px) !important;
}

/* ───────── the dial grows out of the cat and unfolds (owner: instead of popping out) ─────────
   The ring starts at the cat's own size behind it (scale .47 of 264 pt ≈ the saucer) and grows to full while fading in,
   pivoting exactly on the cat (it used to scale from a point near the top edge). As it grows, the five sectors unfold
   clockwise — Director, Location, Color, Light, Search — each swinging in from −12° while fading, 60 ms apart. */
@keyframes gm-dial-grow {
  from { opacity: 0; transform: scale(.47); }
  45%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}
@keyframes gm-sector-unfold {
  from { opacity: 0; transform: rotate(-12deg); }
  to   { opacity: 1; transform: none; }
}
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets {
  transform-origin: 50% 50% !important;
  animation: gm-dial-grow 640ms cubic-bezier(.22, .8, .28, 1) backwards !important;
}
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet {
  transform-origin: 50% 50%;
  animation: gm-sector-unfold 460ms cubic-bezier(.22, .8, .28, 1) backwards !important;   /* releases the sector when done (hover/press keep working) */
}
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet[data-axis=director] { animation-delay: 170ms !important; }
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet[data-axis=location] { animation-delay: 230ms !important; }
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet[data-axis=color]    { animation-delay: 290ms !important; }
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet[data-axis=light]    { animation-delay: 350ms !important; }
body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet[data-axis=search]   { animation-delay: 410ms !important; }
@media (prefers-reduced-motion: reduce) {
  body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets { animation: gm-soft-in 120ms ease-out both !important; }
  body[data-host=native][data-ui=projector][data-stage=menu] #studio .facets .facet { animation: none !important; }
}

/* While the app itself folds the dial (gallery-turn.js foldNow), keep the saucer drawn exactly where it already is until
   the host's small window arrives — instead of hiding it for those frames. */
@media (min-width: 141px), (min-height: 121px) {
  body.gm-keep-cat[data-ui=projector][data-host=native][data-collapsed=true] #launch {
    visibility: visible !important;
    left: var(--gm-cat-x, 0px) !important;
    top: var(--gm-cat-y, 0px) !important;
  }
}


/* ───────── Mounty's accent is gold (owner) ─────────
   Everything that was lime on Mounty — selection, the dial's chosen section, focus, primary keys — becomes one warm gold
   that matches Mounty's yellow body. Creature keeps lime. Character art is never recoloured.
   (Belongs in saucer.css's Mounty block; kept here so it ships with the motion files.) */
body[data-host=native][data-ui=projector][data-theme=mounty] {
  --gm-accent-rgb: 242, 193, 78;
  --gm-accent-press: #ffd978;
  --accent: #f2c14e; --accent-2: #d9ae58; --accent-ink: #1d1406; --focus: #f2c14e; --signal: #f2c14e;
}
/* the dial: chosen section's glow, its indicator, symbol and label */
body[data-host=native][data-ui=projector][data-theme=mounty] #cine-dial-signal stop:nth-child(1) { stop-color: #b9832a; }
body[data-host=native][data-ui=projector][data-theme=mounty] #cine-dial-signal stop:nth-child(2) { stop-color: #e9b23f; }
body[data-host=native][data-ui=projector][data-theme=mounty] #cine-dial-signal stop:nth-child(3) { stop-color: #f6cb63; }
body[data-host=native][data-ui=projector][data-theme=mounty] #cine-dial-signal stop:nth-child(4) { stop-color: #f8d26f; }
body[data-host=native][data-ui=projector][data-theme=mounty] #studio .dial-indicator,
body[data-host=native][data-ui=projector][data-theme=mounty] .dial-indicator { stroke: #f2c14e !important; }
body[data-host=native][data-ui=projector][data-theme=mounty] #studio .facets .facet[data-dial-current] .dial-legend { fill: #ffe39c !important; }
body[data-host=native][data-ui=projector][data-theme=mounty] #studio .facets .facet[data-dial-current] .dial-symbol,
body[data-host=native][data-ui=projector][data-theme=mounty] .facet:is(:hover, :focus-visible, .has-selection) .dial-symbol { stroke: #f6cd6a !important; }
/* primary keys and pressed modes */
body[data-host=native][data-ui=projector][data-theme=mounty] .saucer-next,
body[data-host=native][data-ui=projector][data-theme=mounty] #studio .media-mode button[aria-pressed=true],
body[data-host=native][data-ui=projector][data-theme=mounty] #studio .copy-skill { background: #f2c14e !important; color: #1d1406 !important; }
body[data-host=native][data-ui=projector][data-theme=mounty] #launch:hover canvas { filter: drop-shadow(0 1px 5px rgba(242, 193, 78, .22)) !important; }

/* ───────── the dial's rail selector is a glowing green spot (owner) ─────────
   The photographed glass capsule is hidden; gallery-turn.js adds the spot to the same carriage, so it glides the same way.
   Lime on Creature, gold on Mounty. A very slow breath on the halo; still under Reduce Motion. */
body[data-host=native][data-ui=projector] .dial-carriage image { display: none !important; }
.gm-spot-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 6; }
/* emissive like the cat's eyes (sampled: core ≈ #fefe98, edge ≈ #a1ac38, then a dim olive haze) — no glint, soft edges */
.gm-spot-c0 { stop-color: #fefe9c; }
.gm-spot-c1 { stop-color: #e3fb5a; }
.gm-spot-c2 { stop-color: #b6d33c; }
.gm-spot-halo { fill: #c6e63c; opacity: .75; transform-box: fill-box; transform-origin: center; animation: gm-spot-breathe 2.8s ease-in-out infinite; }
@keyframes gm-spot-breathe { 0%, 100% { opacity: .6; transform: scale(.94); } 50% { opacity: .85; transform: scale(1.06); } }
body[data-host=native][data-ui=projector][data-theme=mounty] .gm-spot-c0 { stop-color: #fff2b8; }
body[data-host=native][data-ui=projector][data-theme=mounty] .gm-spot-c1 { stop-color: #ffd05e; }
body[data-host=native][data-ui=projector][data-theme=mounty] .gm-spot-c2 { stop-color: #e3a43a; }
body[data-host=native][data-ui=projector][data-theme=mounty] .gm-spot-halo { fill: #f2b53e; }
@media (prefers-reduced-motion: reduce) { .gm-spot-halo { animation: none; } }
@media (forced-colors: active) { .gm-spot-halo { display: none; } .gm-spot-disc { fill: Highlight; filter: none; } }
