/* Favorites · Helix browse. Loaded only on /favorites.
   Everything that changes existing chrome is scoped to html[data-preview="favorites-stream"] body.fav-helix-mode,
   one full selector per comma branch. Colours come from the active theme vars (folio-lilac). Do not edit focus.js. */

html[data-preview="favorites-stream"] body.fav-helix-mode #wg-vp,
html[data-preview="favorites-stream"] body.fav-helix-mode .wg-hud,
html[data-preview="watch-grid"][data-home-3d] body.fav-helix-mode #wg-vp,
html[data-preview="watch-grid"][data-home-3d] body.fav-helix-mode .wg-hud{display: none !important}

.hx-stage{
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 2;
  overflow: hidden;
  perspective: var(--hx-persp, 1000px);
  perspective-origin: 50% 46%;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  background:
    radial-gradient(ellipse 46% 54% at 50% 48%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 70% at 50% 50%, color-mix(in srgb, var(--card) 55%, transparent), transparent 75%),
    var(--bg);
}
.hx-stage[hidden]{display: none}
.hx-stage.hx-drag{cursor: grabbing}
.hx-tilt,
.hx-helix{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

/* cylinder floor lines */
.hx-ring{
  position: absolute;
  left: calc(var(--hx-r, 400px) * -1);
  top: calc(var(--hx-r, 400px) * -1);
  width: calc(var(--hx-r, 400px) * 2);
  height: calc(var(--hx-r, 400px) * 2);
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--fg) 9%, transparent);
  pointer-events: none;
}

.hx-card{
  --o: 1;
  --ob: 1;
  --w: 0;
  position: absolute;
  left: calc(var(--hx-cw) / -2);
  top: calc(var(--hx-ch) / -2);
  width: var(--hx-cw);
  height: var(--hx-ch);
  transform-style: preserve-3d;
  cursor: pointer;
}
.hx-face{
  position: absolute;
  inset: 0;
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.hx-front{
  opacity: var(--o);
  display: grid;
  grid-template-rows: var(--hx-ph) 1fr;
  gap: 7px;
  padding: 0;
  background: transparent;
}
.hx-pv{
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.hx-ph{
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 32% 34%, color-mix(in srgb, var(--c, var(--accent)) 34%, var(--card)), transparent 64%),
    radial-gradient(circle at 78% 80%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    color-mix(in srgb, var(--stage) 70%, var(--card));
}
/* Poster still of the real demo (assets/posters/<id>.webp, shot on the same 480×300 stage). Always under the iframe. */
.hx-img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.hx-img[hidden]{display: none}
/* Live demo: rendered at 1.6× and scaled down, so the demo composes as on a real stage.
   Transparent until loaded, then fades in over the poster, so going live / freezing never blanks the tile. */
.hx-pv iframe{
  position: absolute;
  left: 0;
  top: 0;
  width: 160%;
  height: 160%;
  border: 0;
  transform: scale(.625);
  transform-origin: 0 0;
  pointer-events: none;
  background: var(--card);
  opacity: 0;
  transition: opacity .35s ease;
}
.hx-pv iframe.hx-in{opacity: 1}
.hx-cap{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
  font: 600 12px/18px var(--font);
  color: var(--fg);
  min-width: 0;
}
.hx-cap .hx-no{
  font: 700 10px/18px var(--font);
  letter-spacing: .08em;
  color: var(--mu);
}
.hx-cap b{
  font: 700 13px/18px var(--font-d, var(--font));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hx-cap em{
  font: 600 10px/16px var(--font);
  font-style: normal;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--on-accent, #fff);
  background: var(--c, var(--accent));
  white-space: nowrap;
}
/* only cards past the front arc (edge-on / around the back) wash toward the room colour; the front arc stays crisp */
.hx-wash{
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: var(--bg);
  opacity: var(--w);
  pointer-events: none;
}
.hx-back{
  transform: rotateY(180deg);
  opacity: var(--ob);
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--fg) 8%, transparent);
  background: color-mix(in srgb, var(--card) 40%, var(--bg));
}
.hx-back{overflow: hidden}
/* back of a card: the same poster, softened and dimmed (the only filter in Helix; fronts and live demos stay sharp) */
.hx-bimg{
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(var(--hx-ph) + 12px);
  object-fit: cover;
  object-position: 50% 0;
  transform: scaleX(-1);
  filter: blur(3px) saturate(.85);
  opacity: .55;
  pointer-events: none;
}
.hx-bimg[hidden]{display: none}
.hx-back span{
  position: relative;
  font: 800 clamp(48px, calc(var(--hx-cw) * .32), 96px)/1 var(--font-d, var(--font));
  letter-spacing: -.04em;
  color: color-mix(in srgb, var(--fg) 13%, transparent);
}
.hx-card.hx-front-on .hx-pv{
  border-color: color-mix(in srgb, var(--accent) 55%, var(--fg) 10%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 28px 60px -22px color-mix(in srgb, var(--accent) 45%, rgba(0, 0, 0, .5));
}
.hx-card.hx-has-poster .hx-ph{opacity: 0}
.hx-remix .hx-ph::after{
  content: "今日拼接";
  position: absolute;
  left: 12px;
  bottom: 10px;
  font: 700 11px/1 var(--font);
  letter-spacing: .1em;
  color: color-mix(in srgb, var(--fg) 45%, transparent);
}

/* info + spine */
.hx-hud{
  position: absolute;
  left: max(20px, env(safe-area-inset-left));
  top: 18px;
  z-index: 3000;
  display: grid;
  gap: 4px;
  max-width: min(320px, 42vw);
  pointer-events: none;
  color: var(--fg);
}
.hx-hud .hx-hno{font: 700 11px/1 var(--font); letter-spacing: .12em; color: var(--mu)}
.hx-hud .hx-ht{font: 700 clamp(17px, 2vw, 22px)/1.2 var(--font-d, var(--font))}
.hx-hud .hx-hk{justify-self: start; font: 600 10px/18px var(--font); padding: 0 8px; border-radius: 999px; color: var(--on-accent, #fff); background: var(--c, var(--accent))}
.hx-hud .hx-hk:empty{display: none}
.hx-hud small{font: 500 11px/1.4 var(--font); color: var(--mu); margin-top: 4px}
.hx-spine{
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  top: 14%;
  bottom: 14%;
  z-index: 3000;
  width: 18px;
  cursor: ns-resize;
  touch-action: none;
}
.hx-spine::before{
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--fg) 18%, transparent);
}
.hx-knob{
  position: absolute;
  left: 3px;
  top: 0;
  width: 12px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--accent) 70%, transparent);
}
.hx-sr{position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap}

/* flat host for the real card while focus.js has it open (no transform here: position:fixed must reach the viewport) */
.hx-host{position: fixed; z-index: 44; left: 0; top: 0}
.hx-host[hidden]{display: none}
.hx-host > .card:not(.dd-focused){width: 100%; height: 100%; margin: 0; overflow: hidden}

@media (max-width: 719px){
  .hx-hud{top: 12px; max-width: 70vw}
  .hx-hud small{display: none}
  .hx-spine{right: 6px}
}
@media (prefers-reduced-motion: reduce){
  .hx-pv iframe{transition: none}
}

/* Optional tessellated poster surface. Load helix-surface.js before helix.js. */
/* Keep every ancestor of panels preserve-3d. No filter/overflow/opacity on the container. */
.hx-surface{position:absolute;left:0;top:0;transform-style:preserve-3d;pointer-events:none}
.hx-surface[hidden]{display:none}
.hx-surface-panel{position:absolute;left:0;top:0;transform-origin:0 0;transform-style:preserve-3d}
.hx-surface-panel>i{position:absolute;inset:0;display:block;background-repeat:no-repeat;backface-visibility:hidden;-webkit-backface-visibility:hidden;pointer-events:none}
.hx-surface-front{background-image:var(--hx-surface-front-image);transform:translateZ(.08px);opacity:var(--hx-surface-front-opacity,var(--o,1))}
/* rotateY + scaleX cancels the texture reversal in local coordinates; viewed from
   the other side the same artwork is naturally mirrored like a thin sheet. */
.hx-surface-back{background-image:var(--hx-surface-back-image);transform:rotateY(180deg) scaleX(-1) translateZ(.08px);opacity:1}
/* Opaque panels + room-color wash avoid double-alpha stripes at overlaps. */
.hx-surface-back::after{content:"";position:absolute;inset:0;background:var(--bg,#0e0c14);opacity:calc(1 - var(--o,1));pointer-events:none}
/* Only activate on a successfully decoded image. Missing/cross-origin/canvas
   failure leaves ALL existing flat-poster/gradient fallback markup intact. */
.hx-card.hx-surface-ready>.hx-front .hx-img,
.hx-card.hx-surface-ready>.hx-front .hx-ph{visibility:hidden}
.hx-card.hx-surface-ready>.hx-front .hx-pv{background:transparent;border-color:transparent;box-shadow:none;overflow:visible}
.hx-card.hx-surface-ready>.hx-front .hx-pv iframe{border-radius:12px}
.hx-card.hx-surface-ready>.hx-back{background:transparent;border:0;overflow:visible}
.hx-card.hx-surface-ready>.hx-back .hx-bimg{visibility:hidden}
.hx-card.hx-surface-ready>.hx-back span{align-self:end;font-size:18px;padding-bottom:12px}
.hx-card.hx-surface-ready .hx-wash{display:none}
.hx-stage.hx-surface-mode .hx-card .hx-pv iframe.hx-in{opacity:var(--hx-live-alpha,1)}
@media(prefers-reduced-motion:reduce){.hx-card .hx-pv iframe{transition:none}}

/* Session-only opt-in: flat Helix stays the default on every new page. */
.hx-options{position:absolute;right:54px;top:18px;z-index:3100;display:grid;justify-items:end;gap:5px;color:var(--fg)}
.hx-surface-toggle{display:flex;align-items:center;gap:7px;min-height:34px;padding:6px 11px;border:1px solid color-mix(in srgb,var(--fg) 16%,transparent);border-radius:999px;background:var(--card);color:var(--fg);font:600 11px/1.2 var(--font);cursor:pointer}
.hx-surface-toggle i{position:relative;width:25px;height:15px;border-radius:20px;background:color-mix(in srgb,var(--fg) 24%,var(--card))}
.hx-surface-toggle i::after{content:"";position:absolute;left:3px;top:3px;width:9px;height:9px;border-radius:50%;background:var(--card)}
.hx-surface-toggle[aria-checked="true"] i{background:var(--accent)}
.hx-surface-toggle[aria-checked="true"] i::after{left:13px;background:var(--on-accent,#fff)}
.hx-surface-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.hx-surface-toggle:disabled{opacity:.5;cursor:not-allowed}
.hx-options small{font:500 9px/1.3 var(--font);color:var(--mu)}
@media(max-width:719px){.hx-options{top:12px;right:18px}.hx-hud{max-width:calc(100% - 176px)}.hx-hud .hx-ht{overflow-wrap:anywhere}}
