/* Yap Studio · the template gallery (yap-gallery.js): native-aspect cards in justified rows, the All templates sheet
   and the pop-up player. Speaks the page tokens (--card, --card2, --ink, --muted, --border, --sun) so both themes
   follow; slush kills box-shadow globally, nothing here relies on it. */
.yg-just{--yg-h:240px;--yg-gap:14px;display:flex;flex-wrap:wrap;gap:var(--yg-gap);align-items:flex-start}
.yg-just .yg-fill{flex:10000 1 0;min-width:0;height:0}
.yg-card{--ar:.5625;flex:var(--ar) 1 calc(var(--yg-h) * var(--ar));max-width:calc(var(--yg-h) * var(--ar) * 1.7);min-width:0;
  container-type:inline-size;display:flex;flex-direction:column;cursor:pointer;outline:none;color:var(--ink,#000);
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.yg-m{position:relative;display:block;width:100%;aspect-ratio:var(--ar);border-radius:14px;overflow:hidden;background:#15151a;
  border:1px solid var(--yg-line,rgba(0,0,0,.16));transition:transform .16s ease,border-color .16s ease}
html[data-theme="dark"] .yg-m{--yg-line:rgba(255,255,255,.14)}
.yg-m img,.yg-m video,.yg-m .ysch{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
.yg-m video{opacity:0;transition:opacity .18s ease}
.yg-card.is-playing .yg-m video{opacity:1}
.yg-card:hover .yg-m,.yg-card.is-hot .yg-m{transform:translateY(-2px);border-color:var(--border,#000)}
.yg-card:focus-visible .yg-m{outline:3px solid var(--sun,#ffd731);outline-offset:2px}
.yg-card.is-picked .yg-m{border:2px solid var(--ink,#000);box-shadow:0 0 0 2px var(--sun,#ffd731)}
.yg-card:hover .ysch .g b:nth-child(1){height:75%}.yg-card:hover .ysch .g b:nth-child(2){height:45%}.yg-card:hover .ysch .g b:nth-child(3){height:90%}
.yg-badge{position:absolute;left:7px;top:7px;z-index:3;background:rgba(0,0,0,.74);color:#fff;font-size:11px;font-weight:800;line-height:1.3;padding:2px 8px;border-radius:999px;white-space:nowrap;max-width:calc(100% - 44px);overflow:hidden;text-overflow:ellipsis}
.yg-badge.pick{background:var(--sun,#ffd731);color:#000}
.yg-badge b{font-weight:inherit}
.yg-sheet:focus,.yg-lb:focus{outline:none}
.yg-badge.cook{background:var(--sun,#ffd731);color:#000;animation:ygPulse 1.2s infinite}
.yg-badge.soon{left:auto;right:7px;top:auto;bottom:7px;background:rgba(255,255,255,.92);color:#000}
.yg-card.is-picked .yg-badge.soon,.yg-card .yg-badge+.yg-badge.soon{bottom:7px}
.yg-ar{position:absolute;left:7px;bottom:7px;z-index:2;font-size:10px;font-weight:800;letter-spacing:.04em;color:#fff;background:rgba(0,0,0,.55);padding:1px 6px;border-radius:6px;opacity:.85}
.yg-zoom,.yg-playbtn{position:absolute;z-index:3;display:grid;place-items:center;border:0;padding:0;cursor:pointer;color:#fff;background:rgba(0,0,0,.62);border-radius:50%}
.yg-zoom{right:7px;top:7px;width:30px;height:30px;opacity:0;transition:opacity .15s ease,background .15s ease}
.yg-zoom svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.yg-zoom:hover{background:#000}
.yg-card:hover .yg-zoom,.yg-card:focus-visible .yg-zoom,.yg-card.is-hot .yg-zoom{opacity:1}
@media (hover:none){.yg-zoom{opacity:.92}}
.yg-playbtn{display:none;left:50%;top:50%;width:42px;height:42px;transform:translate(-50%,-50%)}
.yg-playbtn svg{width:18px;height:18px;fill:currentColor;margin-left:2px}
.yg-meta{display:flex;flex-direction:column;gap:2px;padding:8px 2px 0;min-width:0}
.yg-n{font-size:13.5px;font-weight:800;line-height:1.2;overflow-wrap:anywhere}
.yg-d{font-size:12px;color:var(--muted,#444);line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.yg-card.is-soon .yg-n{color:var(--muted,#444)}
/* narrow cards (a 9:16 thumbnail in a small row): the name stays, the rest goes */
@container (max-width:118px){.yg-d{display:none}.yg-badge b{display:none}.yg-n{font-size:12px}.yg-ar{display:none}.yg-badge{font-size:10px;padding:1px 6px;left:5px;top:5px}.yg-zoom{width:26px;height:26px;right:5px;top:5px}}
@keyframes ygPulse{0%,100%{opacity:1}50%{opacity:.5}}

/* reduced motion: nothing plays on hover; the ▶ plays the preview */
html.yg-rm .yg-playbtn{display:grid}
html.yg-rm .yg-card.is-hot .yg-playbtn{opacity:.35}
@media (prefers-reduced-motion:reduce){
  .yg-m,.yg-m video,.yg-zoom{transition:none}
  .yg-card:hover .yg-m,.yg-card.is-hot .yg-m{transform:none}
  .yg-badge.cook{animation:none}
}

/* the compact rail inside the Studio */
.yg-just.yg-rail{--yg-s:128px;--yg-gap:10px;align-items:flex-end}
.yg-rail .yg-fill{display:none}
.yg-rail .yg-card{flex:0 0 auto;width:calc(var(--yg-s) * var(--sq));max-width:100%}
.yg-rail .yg-m{border-radius:11px}
.yg-rail .yg-meta{padding-top:6px;height:86px;overflow:hidden}
.yg-meta>*{flex-shrink:0}
.yg-rail .yg-n{font-size:12.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.yg-rail .yg-d{font-size:11px}
.yg-x{display:flex;flex-direction:column;gap:1px;font-size:10.5px;color:var(--muted,#444);margin-top:2px}
.yg-x em{font-style:normal;font-weight:800;color:var(--ink,#000)}
@media (max-width:480px){.yg-just.yg-rail{--yg-s:102px;--yg-gap:8px}}

/* ── All templates ── */
html.yg-lock,html.yg-lock body{overflow:hidden}
.yg-sheet{position:fixed;inset:0;z-index:9000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(10,10,12,.55);
  -webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
.yg-sheet-in{width:min(1320px,100%);height:100%;max-height:calc(100dvh - 48px);display:flex;flex-direction:column;background:var(--card,#fff);color:var(--ink,#000);
  border:1px solid var(--border,#000);border-radius:24px;overflow:hidden}
.yg-sh-head{display:flex;align-items:flex-start;gap:16px;padding:20px 24px 10px}
.yg-sh-tt{flex:1;min-width:0}
.yg-sheet,.yg-lb{font-family:Inter,system-ui,-apple-system,sans-serif;text-align:left}
.yg-sh-head h2{margin:0;font-family:'Anton',Impact,sans-serif;font-weight:400;font-size:28px;text-transform:uppercase;letter-spacing:0;line-height:1;color:var(--ink,#000)}
.yg-sh-head p{margin:4px 0 0;font-size:13px;color:var(--muted,#444)}
.yg-k{display:inline-grid;place-items:center;min-width:20px;height:20px;border:1px solid currentColor;border-radius:6px;font-size:12px;line-height:1}
.yg-sh-x,.yg-lb-x{flex:0 0 auto;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;border:1px solid var(--border,#000);background:var(--card,#fff);color:var(--ink,#000);cursor:pointer}
.yg-sh-x svg,.yg-lb-x svg,.yg-lb-nav svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.yg-sh-x:hover{background:var(--sun,#ffd731);color:#000}
.yg-sh-x:focus-visible,.yg-chip:focus-visible,.yg-lb-x:focus-visible,.yg-lb-nav:focus-visible,.yg-use:focus-visible,.yg-btn:focus-visible{outline:3px solid var(--sun,#ffd731);outline-offset:2px}
.yg-chips{display:flex;gap:8px;padding:4px 24px 12px;overflow-x:auto;scrollbar-width:none;flex:0 0 auto}
.yg-chips::-webkit-scrollbar{display:none}
.yg-chip{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--yg-line,rgba(0,0,0,.2));background:transparent;color:var(--ink,#000);border-radius:999px;padding:7px 13px;font:inherit;font-size:13px;font-weight:700;cursor:pointer}
html[data-theme="dark"] .yg-chip{--yg-line:rgba(255,255,255,.2)}
.yg-chip small{font-size:11px;font-weight:700;color:var(--muted,#444)}
.yg-chip:hover{border-color:var(--ink,#000)}
.yg-chip.on{background:var(--ink,#000);color:var(--card,#fff);border-color:var(--ink,#000)}
.yg-chip.on small{color:inherit;opacity:.7}
.yg-sh-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 24px 28px;scrollbar-width:thin}
.yg-sec+.yg-sec{margin-top:26px}
.yg-sheet .yg-sec-h{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin:0 0 12px;font-family:inherit;font-size:15px;text-transform:none;letter-spacing:0;line-height:1.3}
.yg-sec-h b{font-weight:900}
.yg-sec-h span{font-size:12.5px;font-weight:500;color:var(--muted,#444)}
.yg-just.yg-full{--yg-h:250px}
.yg-empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:60px 16px;text-align:center;color:var(--muted,#444)}
.yg-empty b{color:var(--ink,#000);font-size:15px}
.yg-btn{border:1px solid var(--border,#000);background:var(--card,#fff);color:var(--ink,#000);border-radius:999px;padding:8px 16px;font:inherit;font-weight:700;cursor:pointer}
.yg-spin{width:22px;height:22px;border-radius:50%;border:2.5px solid var(--sun,#ffd731);border-top-color:transparent;animation:ygSpin .7s linear infinite}
@keyframes ygSpin{to{transform:rotate(360deg)}}
@media (max-width:1100px){.yg-just.yg-full{--yg-h:220px}}
@media (max-width:820px){.yg-sheet{padding:12px}.yg-sheet-in{max-height:calc(100dvh - 24px);border-radius:20px}.yg-just.yg-full{--yg-h:190px;--yg-gap:12px}
  .yg-sh-head{padding:16px 16px 8px}.yg-chips{padding:4px 16px 10px}.yg-sh-body{padding:4px 16px 24px}}
@media (max-width:520px){.yg-sheet{padding:0}.yg-sheet-in{max-height:none;height:100dvh;border-radius:0;border:0}.yg-just.yg-full{--yg-h:150px;--yg-gap:10px}
  .yg-sh-head h2{font-size:19px}.yg-sh-head p{font-size:12px}}

/* ── the pop-up player ── */
.yg-lb{--ar:.5625;--side:76px;--chrome:150px;position:fixed;inset:0;z-index:9100;display:flex;align-items:center;justify-content:center;background:rgba(6,6,8,.95);color:#f3efe6}
.yg-lb-fig{margin:0;display:flex;flex-direction:column;align-items:center;gap:14px;max-width:calc(100vw - 24px)}
.yg-lb-stage{position:relative;width:min(calc(100vw - var(--side) * 2),calc((100dvh - var(--chrome)) * var(--ar)));aspect-ratio:var(--ar);background:#000;border-radius:16px;overflow:hidden;border:1px solid rgba(255,255,255,.14)}
.yg-lb-stage video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;display:block}
.yg-lb-sch{position:absolute;inset:0;display:flex;align-items:flex-end;justify-content:center;padding:18px}
.yg-lb-sch>span:last-child{position:relative;z-index:2;font-size:13px;font-weight:700;background:rgba(0,0,0,.7);color:#fff;padding:4px 12px;border-radius:999px}
.yg-lb-cap{display:flex;align-items:center;gap:16px;flex-wrap:wrap;justify-content:space-between;width:max(100%,min(640px,calc(100vw - 32px)))}
.yg-lb-t{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1 1 260px}
.yg-lb-t b{font-size:18px;font-weight:900;line-height:1.2}
.yg-lb-t>span{font-size:13.5px;color:#cfcac0}
.yg-lb-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.yg-lb-chips i{font-style:normal;font-size:11.5px;font-weight:700;padding:2px 9px;border-radius:999px;border:1px solid rgba(255,255,255,.22);color:#e6e1d6}
.yg-lb-act{display:flex;align-items:center;gap:12px;flex:0 0 auto}
.yg-lb-n{font-size:12.5px;color:#a8a49b;font-variant-numeric:tabular-nums}
.yg-use{border:0;background:var(--sun,#ffd731);color:#000;border-radius:999px;padding:11px 20px;font:inherit;font-size:14px;font-weight:800;cursor:pointer;white-space:nowrap}
.yg-use:hover:not([disabled]){filter:brightness(1.06)}
.yg-use.on{background:#f3efe6}
.yg-use[disabled]{background:rgba(255,255,255,.16);color:#cfcac0;cursor:not-allowed}
.yg-lb-x{position:absolute;right:18px;top:18px;z-index:2;background:rgba(255,255,255,.1);border-color:rgba(255,255,255,.24);color:#fff}
.yg-lb-x:hover{background:rgba(255,255,255,.22)}
.yg-lb-nav{position:absolute;top:50%;z-index:2;transform:translateY(-50%);display:grid;place-items:center;width:48px;height:48px;border-radius:50%;border:1px solid rgba(255,255,255,.24);background:rgba(255,255,255,.1);color:#fff;cursor:pointer}
.yg-lb-nav:hover{background:rgba(255,255,255,.22)}
.yg-lb-nav[hidden]{display:none}
.yg-lb-nav.prev{left:16px}.yg-lb-nav.next{right:16px}
@media (max-width:640px){
  .yg-lb{--side:12px;--chrome:210px;align-items:flex-start;padding-top:64px}
  .yg-lb-x{right:12px;top:12px}
  .yg-lb-nav{top:auto;bottom:18px;transform:none;width:44px;height:44px}
  .yg-lb-nav.prev{left:12px}.yg-lb-nav.next{right:12px}
  .yg-lb-cap{padding:0 4px}
  .yg-lb-act{width:100%;justify-content:center;padding:0 52px}
  .yg-lb-t b{font-size:16px}
}

/* ── round 2: variant chips on a card and in the pop-up ── */
.yg-vars{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.yg-var{appearance:none;border:1px solid var(--line,rgba(0,0,0,.18));background:transparent;color:var(--ink,#000);font:inherit;font-size:11px;font-weight:700;line-height:1.2;padding:3px 8px;border-radius:999px;cursor:pointer;white-space:nowrap}
.yg-var:hover{border-color:var(--ink,#000)}
.yg-var.on{background:var(--ink,#000);color:var(--bg,#fff);border-color:var(--ink,#000)}
.yg-rail .yg-meta{height:auto;min-height:86px}
.yg-rail .yg-var{font-size:10px;padding:2px 6px}
.yg-vars.lb{margin:6px 0 2px}
.yg-vars.lb .yg-var{color:#fff;border-color:rgba(255,255,255,.35);font-size:12px;padding:4px 10px}
.yg-vars.lb .yg-var.on{background:#fff;color:#000;border-color:#fff}
.yg-btn.yg-script{margin-right:8px}
@container (max-width:118px){.yg-vars{display:none}}

/* ── round 2 schematics (a card whose reference media is not on this machine) ── */
.ysch.yg-s{background:linear-gradient(160deg,#20202a,#101015);overflow:hidden}
.ysch.yg-s .p{position:absolute;left:50%;bottom:0;width:42%;height:46%;transform:translateX(-50%);border-radius:50% 50% 12% 12%/38% 38% 12% 12%;background:#c9b8a6}
.ysch.yg-s .p::before{content:"";position:absolute;left:50%;top:-44%;width:52%;aspect-ratio:1;transform:translateX(-50%);border-radius:50%;background:#e4d3c1}
.ysch.word .w{position:absolute;left:0;right:0;top:46%;text-align:center;font:600 clamp(14px,22cqw,44px)/1 Georgia,serif;color:#fff;z-index:2;text-shadow:0 2px 10px rgba(0,0,0,.4)}
.ysch.side .l,.ysch.side .r{position:absolute;top:44%;display:flex;flex-direction:column;gap:5px;width:22%}
.ysch.side .l{left:6%;align-items:flex-end}.ysch.side .r{right:6%}
.ysch.side b{display:block;height:5px;width:100%;border-radius:3px;background:#fff}.ysch.side .r b:last-child{opacity:.4;width:70%}
.ysch.win{background:#000}.ysch.win .wn{position:absolute;left:5%;right:5%;top:50%;aspect-ratio:1;transform:translateY(-58%);border-radius:6%;overflow:hidden;background:linear-gradient(160deg,#3a3a46,#1b1b22)}
.ysch.win .u{position:absolute;left:30%;right:30%;bottom:12%;height:6px;border-radius:3px;background:#f4ec3f}
.ysch.cards .c{position:absolute;width:44%;aspect-ratio:1;border-radius:8%;background:#f3eee4;box-shadow:0 8px 20px rgba(0,0,0,.35);z-index:1}
.ysch.cards .c1{left:8%;top:12%;transform:rotate(-6deg)}.ysch.cards .c2{right:8%;top:20%;transform:rotate(5deg);background:#e2554a}
.ysch.mont .f{position:absolute;inset:0;background:linear-gradient(160deg,#5a4a3a,#1d1a17)}
.ysch.mont .f2{left:34%;background:linear-gradient(160deg,#36506a,#141c26)}.ysch.mont .f3{left:67%;background:linear-gradient(160deg,#6a5e3a,#24200f)}
.ysch.mont .w{position:absolute;left:12%;right:12%;top:44%;height:12%;border-radius:4px;background:rgba(255,255,255,.9)}
.yg-var.soon{opacity:.6;border-style:dashed}
