/* Start templates: the card, the category tabs and the carousel, shared by /main (Vidi Chat) and /templates.
   Brand tokens come from vidi-brand.css. Motion names follow the owner's list (12 Nov 2026): GlowOrbit,
   CinematicReveal, SilkReveal, ElasticBounce. Hover behaviour only where the device can hover; everything stops
   for prefers-reduced-motion. */
@property --fb-orbit { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.vt { --vt-bg: #16171c; --vt-card: rgb(41 43 52 / .72); --vt-card-solid: #24262e; --vt-line: rgb(255 255 255 / .08);
  --vt-line-2: rgb(255 255 255 / .16); --vt-soft: rgb(255 255 255 / .58); --vt-muted: var(--vb-muted, #c4bec9);
  --vt-faint: #8f8a97; --vt-violet: #7a5cff; --vt-ease: cubic-bezier(.2, .8, .2, 1); }
.vt svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

@keyframes GlowOrbit { to { --fb-orbit: 360deg; } }
@keyframes CinematicReveal { from { opacity: 0; filter: blur(12px); transform: translateY(26px) scale(.96); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes SilkReveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes ElasticBounce { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes WordRise { from { transform: translateY(110%); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes CtaShine { 0%, 55% { left: -60%; } 100% { left: 130%; } }

/* Staggered word reveal (.stg, words wrapped by VidiTemplates.words) */
.vt .stg .w { display: inline-block; overflow: hidden; vertical-align: top; padding: .06em .02em .1em; margin: -.06em -.02em -.1em; }
.vt .stg .w > span { display: inline-block; animation: WordRise .9s var(--vt-ease) both; animation-delay: calc(var(--i, 0) * 55ms + 60ms); }

/* Shimmer sweep on call-to-action buttons */
.vt .sh { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.vt .sh::after { content: ""; position: absolute; top: -20%; bottom: -20%; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgb(255 255 255 / .55), transparent);
  transform: skewX(-20deg); animation: CtaShine 3.6s ease-in-out infinite; }

/* ---------- Category tabs with a liquid underline ---------- */
.vt-tabs { overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 4px 4px 14px; }
.vt-tabs::-webkit-scrollbar { display: none; }
.vt-tabs-in { position: relative; display: inline-flex; gap: 6px; }
.vt-tab { position: relative; min-height: 38px; padding: 0 15px; border: 1.5px solid var(--vt-line-2); border-radius: 99px; background: transparent; color: var(--vt-soft);
  font: 500 14px/1 var(--vb-body); white-space: nowrap; cursor: pointer; transition: color .25s, border-color .25s, background .25s, transform .2s var(--vt-ease); }
.vt-tab[aria-selected="true"] { color: var(--vb-paper); border-color: rgb(255 131 168 / .7); background: var(--vb-hi-tint); }
.vt-tab[aria-selected="true"].pop { animation: ElasticBounce .45s cubic-bezier(.3, 1.6, .5, 1); }
.vt-tab small { margin-left: 6px; font: 500 10px var(--vb-mono); color: var(--vt-faint); }
.vt-ink { position: absolute; left: 0; bottom: -9px; width: 0; height: 3px; border-radius: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--vb-hi), #ffc2d4 50%, var(--vt-violet)); box-shadow: 0 0 14px rgb(255 131 168 / .7); }
@media (hover: hover) {
  .vt-tab:hover { color: var(--vb-paper); border-color: rgb(255 131 168 / .45); transform: translateY(-1px); }
}

/* ---------- Template card ---------- */
.vt-card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 8px 8px 12px; border: 1px solid var(--vt-line); border-radius: 20px;
  background: var(--vt-card); backdrop-filter: blur(10px); transition: transform .35s var(--vt-ease), box-shadow .35s, border-color .3s; }
.vt-card.enter { animation: CinematicReveal .85s var(--vt-ease) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.vt-card::before { content: ""; position: absolute; inset: -1.5px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--fb-orbit), transparent 0 55%, var(--vb-hi) 70%, #ffd1de 78%, var(--vt-violet) 86%, transparent 96%);
  -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); opacity: 0; transition: opacity .35s; }
.vt-card::after { content: ""; position: absolute; inset: 10% 8% -4%; z-index: -1; border-radius: 30px; pointer-events: none;
  background: radial-gradient(closest-side, rgb(255 131 168 / .45), rgb(122 92 255 / .2), transparent); filter: blur(24px); opacity: 0; transition: opacity .4s; }
.vt-card.is-active { transform: translateY(-8px); border-color: transparent; box-shadow: 0 26px 50px rgb(0 0 0 / .45); }
.vt-card.is-active::before { opacity: 1; animation: GlowOrbit 2.6s linear infinite; }
.vt-card.is-active::after { opacity: 1; }
.vt-media { position: relative; overflow: hidden; aspect-ratio: 9 / 16; max-width: 100%; border-radius: 14px; background: var(--vt-card-solid); cursor: pointer; isolation: isolate; }
.vt-media img, .vt-media video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--vt-ease), opacity .35s; }
.vt-media video { opacity: 0; }
.vt-card.is-playing .vt-media video { opacity: 1; transform: scale(1.04); }
.vt-media::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgb(22 23 28 / .35), transparent 22%, transparent 62%, rgb(22 23 28 / .85)); }
.vt-cat, .vt-dur { position: absolute; z-index: 2; top: 10px; padding: 4px 8px; border-radius: 8px; background: rgb(22 23 28 / .7); backdrop-filter: blur(6px);
  font: 500 10px/1.3 var(--vb-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--vb-paper); }
.vt-cat { left: 10px; } .vt-dur { right: 10px; }
.vt-hook { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: 14px; margin: 0; color: var(--vb-paper); font: 600 14px/1.3 var(--vb-body);
  text-shadow: 0 2px 6px rgb(0 0 0 / .6); text-wrap: balance; transition: opacity .3s, transform .4s var(--vt-ease); }
.vt-card.is-playing .vt-hook { opacity: 0; transform: translateY(8px); }
.vt-play { position: absolute; z-index: 2; left: 50%; top: 46%; width: 52px; height: 52px; margin: -26px 0 0 -26px; display: grid; place-items: center; border-radius: 50%;
  background: rgb(22 23 28 / .55); border: 1.5px solid rgb(255 255 255 / .5); backdrop-filter: blur(6px); color: var(--vb-paper); pointer-events: none;
  transition: opacity .3s, transform .3s var(--vt-ease); }
.vt .vt-play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; margin-left: 3px; }
.vt-card.is-playing .vt-play { opacity: 0; transform: scale(1.3); }
.vt-card.is-paused .vt-play { opacity: 1; transform: none; }
.vt-bar { position: absolute; z-index: 2; left: 10px; right: 10px; bottom: 7px; height: 3px; border-radius: 3px; background: rgb(255 255 255 / .18); opacity: 0; transition: opacity .3s; overflow: hidden; }
.vt-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--vb-hi); }
.vt-card.is-playing .vt-bar { opacity: 1; }
.vt-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; padding: 0 4px; }
.vt-title { margin: 0; padding: 0; border: 0; background: none; color: var(--vb-paper); font: 600 15.5px/1.25 var(--vb-body); text-align: left; text-decoration: none;
  text-transform: none; letter-spacing: 0; text-wrap: balance; }
a.vt-title:hover { color: var(--vb-hi); }
.vt-style { margin: 0 0 10px; color: var(--vt-faint); font: 400 11px/1.4 var(--vb-mono); letter-spacing: .02em; }
.vt-use { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 7px; align-self: stretch; margin-top: auto;
  min-height: 40px; padding: 0 12px; border: 1.5px solid var(--vt-line-2); border-radius: 99px; background: transparent; color: var(--vb-paper);
  font: 600 13.5px/1.1 var(--vb-body); text-decoration: none; cursor: pointer; transition: background .25s, color .25s, border-color .25s; }
.vt .vt-use svg { width: 15px; height: 15px; }
.vt-use:focus-visible, .vt-use.done { background: var(--vb-hi); border-color: var(--vb-hi); color: var(--vb-hi-ink); }
.vt-use.done { animation: ElasticBounce .45s; }
@media (hover: hover) {
  .vt-card:hover { transform: translateY(-8px); border-color: transparent; box-shadow: 0 26px 50px rgb(0 0 0 / .45); }
  .vt-card:hover::before { opacity: 1; animation: GlowOrbit 2.6s linear infinite; }
  .vt-card:hover::after { opacity: 1; }
  .vt-card:hover .vt-media img { transform: scale(1.04); }
  .vt-card:hover .vt-use { background: var(--vb-hi); border-color: var(--vb-hi); color: var(--vb-hi-ink); }
  .vt-play { opacity: 0; transform: scale(.7); }
}

/* ---------- Carousel ---------- */
.vt-car { position: relative; }
.vt-track { display: grid; grid-auto-flow: column; grid-auto-columns: 196px; gap: 16px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scroll-padding: 0 4px; padding: 14px 4px 22px; margin: -6px -4px 0; scrollbar-width: none; scroll-behavior: smooth;
  -webkit-mask: linear-gradient(90deg, transparent, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent);
  mask: linear-gradient(90deg, transparent, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent); }
.vt-track::-webkit-scrollbar { display: none; }
.vt-track > .vt-card { scroll-snap-align: start; }
.vt-arrow { position: absolute; z-index: 3; top: 158px; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--vt-line-2); border-radius: 50%;
  background: rgb(29 30 36 / .82); backdrop-filter: blur(10px); color: var(--vb-paper); box-shadow: 0 10px 30px rgb(0 0 0 / .4); cursor: pointer;
  transition: opacity .25s, transform .25s var(--vt-ease), border-color .2s, color .2s; }
.vt-arrow:hover:not(:disabled) { border-color: var(--vb-hi); transform: scale(1.08); color: var(--vb-hi); }
.vt-arrow:disabled { opacity: 0; pointer-events: none; }
.vt-prev { left: -22px; } .vt-next { right: -22px; }
.vt-car-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.vt-count { font: 500 11px var(--vb-mono); color: var(--vt-faint); letter-spacing: .06em; }
.vt-dots { display: none; gap: 5px; }
.vt-dots i { width: 6px; height: 6px; border-radius: 6px; background: var(--vb-ink-3); transition: width .3s var(--vt-ease), background .3s; }
.vt-dots i.on { width: 18px; background: var(--vb-hi); }
@media (max-width: 760px) {
  .vt-track { grid-auto-columns: 62%; margin: -6px -16px 0; padding: 14px 16px 22px; scroll-padding: 0 16px; -webkit-mask: none; mask: none; }
  .vt-arrow { display: none; }
  .vt-dots { display: flex; }
}

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