/* Viral template library (/templates). Cards are light (cover + text); the player loads only in the viewer. */
.tp-hero { padding-block: var(--space-6) var(--space-5); }
.tp-hero h1 { font-size: clamp(2.6rem, 1.6rem + 4.4vw, 4.75rem); margin-bottom: var(--space-4); }
.tp-hero .lede { max-width: 62ch; margin-bottom: var(--space-5); }
.tp-tools { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.tp-tools input[type=search] { flex: 1 1 260px; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-field); background: var(--surface); color: var(--ink); font: inherit; }
.tp-tools select { height: 44px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-field); background: var(--surface); color: var(--ink); font: inherit; }
.tp-tools .btn { height: 44px; }
.tp-pfs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: var(--space-4); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); }
.tp-pf { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: var(--fs-small); }
.tp-pf svg { width: 16px; height: 16px; }
.tp-pf:hover { color: var(--ink); }
.tp-pf[aria-current] { background: var(--ink); color: var(--bg); }
.tp-india { font-size: var(--fs-small); color: var(--ink-3); margin: -8px 0 var(--space-4); }
.tp-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tp-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: var(--fs-small); white-space: nowrap; background: var(--surface); }
.tp-chip span { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tp-chip:hover { color: var(--ink); border-color: var(--ink-2); }
.tp-chip[aria-current] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tp-chip[aria-current] span { color: inherit; opacity: .7; }

.tp-wrap { padding-bottom: var(--section-y); }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-5) var(--space-4); }
.tp-card { position: relative; min-width: 0; }
.tp-link { display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.tp-cover { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: hsl(var(--hue) 45% 22%); box-shadow: var(--shadow-rest); transform: translateZ(0); transition: transform .2s ease, box-shadow .2s ease; }
.tp-card:hover .tp-cover, .tp-link:focus-visible .tp-cover { transform: translateY(-3px); box-shadow: var(--shadow-machine); }
.tp-link:focus-visible { outline: none; }
.tp-link:focus-visible .tp-cover { outline: 3px solid var(--focus); outline-offset: 3px; }
.tp-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.tp-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; opacity: 0; transition: opacity .3s; background: transparent; }
.tp-vid.is-on { opacity: 1; }
.tp-snd { position: absolute; z-index: 4; right: 6px; top: 44px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(6px); }
.tp-snd svg { width: 20px; height: 20px; }
.tp-snd[aria-pressed="true"] { background: var(--primary, #2f6fed); }
.tp-snd:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tp-poster { position: absolute; inset: 0; display: flex; align-items: center; padding: 18px 16px; background: radial-gradient(120% 70% at 20% 10%, hsl(var(--hue) 70% 58% / .55), transparent 60%), linear-gradient(160deg, hsl(var(--hue) 55% 30%), hsl(calc(var(--hue) + 30) 50% 14%)); color: #fff; }
.tp-poster span { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.15rem, .9rem + .9vw, 1.5rem); line-height: 1.05; text-transform: uppercase; letter-spacing: .01em; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance; }
.tp-cover::after { content: ""; position: absolute; inset: 55% 0 0; z-index: 2; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); pointer-events: none; }
.tp-badge { position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 4px; color: #fff; font-weight: 700; font-size: .8rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.tp-badge svg { width: 16px; height: 16px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.tp-plat { top: 10px; right: 10px; width: 28px; height: 28px; justify-content: center; border-radius: 50%; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
.tp-celeb { top: 12px; left: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(240, 78, 54, .92); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; text-shadow: none; }
.tp-views { left: 10px; bottom: 10px; font-variant-numeric: tabular-nums; }
.tp-play { position: absolute; z-index: 3; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #111; opacity: 0; transform: scale(.85); transition: opacity .2s, transform .2s; }
.tp-play svg { width: 26px; height: 26px; margin-left: 3px; }
.tp-card:hover .tp-play, .tp-link:focus-visible .tp-play { opacity: 1; transform: scale(1); }
.tp-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-title { font-weight: 600; font-size: .95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tp-by { font-size: var(--fs-small); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-more { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: var(--space-7); }
.tp-count, .tp-note, .tp-empty { color: var(--ink-3); font-size: var(--fs-small); }
.tp-note { margin-top: var(--space-6); max-width: 70ch; }
.tp-h2 { font-family: var(--font-display); font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); text-transform: uppercase; margin-bottom: var(--space-5); }
.tp-modelcard { border: 1px solid var(--line-strong); border-radius: var(--r-panel); background: var(--surface); padding: var(--space-5); margin-bottom: var(--space-5); max-width: 70ch; display: grid; gap: 8px; }

/* Viewer */
.tp-view { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(10, 10, 12, .92); color: #f2f2ee; }
.tp-view::backdrop { background: rgba(0, 0, 0, .6); }
.tp-view[open] { display: grid; place-items: center; animation: tp-in .18s ease-out; }
@keyframes tp-in { from { opacity: 0; } to { opacity: 1; } }
.tp-view__in { display: grid; grid-template-columns: auto minmax(280px, 360px); gap: 88px; align-items: center; max-height: 100dvh; padding: 24px; }
.tp-stage { position: relative; }
.tp-frame { position: relative; height: min(86dvh, 820px); aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
.tp-frame iframe, .tp-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; opacity: 0; transition: opacity .25s; object-fit: contain; }
.tp-frame iframe.is-ready, .tp-frame video.is-ready { opacity: 1; }
.tp-frame--instagram iframe { background: #fff; }
.tp-spin { position: absolute; inset: 0; margin: auto; width: 36px; height: 36px; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; border-radius: 50%; animation: tp-spin .8s linear infinite; }
@keyframes tp-spin { to { transform: rotate(360deg); } }
.tp-nav { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.tp-nav:hover { background: rgba(255, 255, 255, .26); }
.tp-nav svg { width: 26px; height: 26px; }
.tp-prev { left: -60px; } .tp-next { right: -60px; }
.tp-side { position: relative; display: flex; flex-direction: column; gap: 10px; }
.tp-x { position: absolute; top: -8px; right: -8px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.tp-x:hover { background: rgba(255, 255, 255, .24); }
.tp-side__cat { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .08em; opacity: .7; padding-right: 48px; }
.tp-side__title { font-family: var(--font-body); font-size: 1.3rem; line-height: 1.3; font-weight: 700; text-transform: none; }
.tp-side__by { opacity: .75; font-size: var(--fs-small); }
.tp-model { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 12px; border-radius: 999px; background: rgba(91, 147, 255, .16); color: #b9cdff; font-weight: 600; font-size: var(--fs-small); }
.tp-model__dot { width: 8px; height: 8px; border-radius: 50%; background: #5B93FF; box-shadow: 0 0 8px #5B93FF; }
.tp-side__why { font-size: var(--fs-small); opacity: .75; }
.tp-create { margin-top: 6px; justify-content: center; }
.tp-steps { margin: 4px 0 0 1.2em; padding: 0; display: grid; gap: 4px; font-size: var(--fs-small); opacity: .85; }
.tp-side__links { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-small); }
.tp-side__links a, .linklike { color: inherit; opacity: .8; text-decoration: underline; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.tp-fine { font-size: .78rem; opacity: .6; }

/* Single template page */
.tp-one { padding-block: var(--space-6) var(--space-8); }
.tp-one__grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: var(--space-7); align-items: start; }
.tp-one__player { position: relative; aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: #000; box-shadow: var(--shadow-machine); }
.tp-one__player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tp-one__side { display: flex; flex-direction: column; gap: 12px; max-width: 46ch; }
.tp-one__title { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.8rem); }
.tp-one .tp-model { background: rgba(91, 147, 255, .12); color: var(--link, #2747c9); }

@media (max-width: 860px) {
  .tp-view__in { grid-template-columns: 1fr; grid-template-rows: auto auto; padding: 0; gap: 0; height: 100dvh; overflow-y: auto; align-content: start; width: 100%; }
  .tp-frame { height: 62dvh; width: auto; max-width: 100%; border-radius: 0 0 16px 16px; margin-inline: auto; }
  .tp-nav { top: auto; bottom: 12px; margin: 0; }
  .tp-prev { left: 12px; } .tp-next { right: 12px; }
  .tp-side { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tp-side__title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 1.1rem; }
  .tp-x { position: fixed; top: 10px; right: 10px; z-index: 5; background: rgba(0, 0, 0, .55); }
  .tp-view .tp-create { position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 6; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
  .tp-one__grid { grid-template-columns: 1fr; }
  .tp-one__player { max-width: 420px; width: 100%; margin-inline: auto; }
}
@media (max-width: 520px) {
  .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) 12px; }
  .tp-poster span { font-size: 1.05rem; }
  .tp-play { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tp-cover, .tp-play, .tp-frame iframe, .tp-view[open] { transition: none; animation: none; }
  .tp-card:hover .tp-cover { transform: none; }
}
