/* Public template gallery and its homepage section. */

/* The homepage uses the core layout, so the gallery's colours are mapped to the core tokens there. */
.tg-home { --site-primary: var(--accent); --site-secondary: var(--accent-2); --site-text: var(--fg); --site-muted: var(--muted); --site-border: var(--border); --site-alt: var(--bg-soft); --site-surface: var(--card); --site-link: var(--accent); --site-radius: var(--radius); margin: 3rem 0; }
html:has(.tg-home) { overflow-x: clip; } /* the homepage hero's wide background glow must not add a sideways scroll */
.tg-home__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1.5rem; }
.tg-home__more { margin-top: 1.75rem; text-align: center; }
.tg-home__empty { padding: 2rem 1rem; color: var(--muted); text-align: center; background: var(--bg-soft); border-radius: var(--radius); }
.tg-home .tg-card__preview { display: none; }
.tg-home .tg-card__title { margin-top: 4px; }

.tg-hero { padding: clamp(48px, 8vw, 88px) 0; color: #fff; text-align: center; background: linear-gradient(135deg, var(--site-primary), color-mix(in srgb, var(--site-primary) 55%, var(--site-secondary))); }
.tg-hero h1 { margin-bottom: .4em; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
.tg-hero p { max-width: 640px; margin: 0 auto; font-size: clamp(1rem, 2vw, 1.2rem); opacity: .95; }
.tg-page { padding-top: 32px; padding-bottom: 56px; }

.tg-filters { display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.tg-filters label { display: block; margin-bottom: 4px; font-size: .85rem; font-weight: 600; }
.tg-filters .form-control, .tg-filters .form-select { min-height: 44px; color: var(--site-text); background-color: var(--site-surface, #fff); border-color: var(--site-border); }

.tg-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.tg-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; color: var(--site-text); font-size: .9rem; font-weight: 600; text-decoration: none; border: 1px solid var(--site-border); border-radius: 999px; }
.tg-pill span { color: var(--site-muted); font-size: .78rem; }
.tg-pill:hover { color: var(--site-primary); border-color: var(--site-primary); }
.tg-pill.is-active { color: #fff; background: var(--site-primary); border-color: var(--site-primary); }
.tg-pill.is-active span { color: rgba(255, 255, 255, .85); }

.tg-card { display: flex; flex-direction: column; width: 100%; overflow: hidden; background: var(--site-surface, #fff); border: 1px solid var(--site-border); border-radius: var(--site-radius); transition: transform .18s ease, box-shadow .18s ease; }
.tg-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(15, 23, 42, .14); }
.tg-card--featured { border-color: var(--site-secondary); box-shadow: 0 0 0 1px var(--site-secondary); }
.tg-card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--site-alt); }
.tg-card__media > a:first-child { display: block; width: 100%; height: 100%; }
.tg-card__media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .3s ease; }
.tg-card:hover .tg-card__media img { transform: scale(1.04); }
.tg-card__placeholder { display: grid; place-items: center; width: 100%; height: 100%; min-height: 220px; color: #fff; font-size: 3rem; font-weight: 800; background: linear-gradient(135deg, var(--site-primary), var(--site-secondary)); }
.tg-card__flags { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tg-card__flags--static { position: static; margin-bottom: 10px; }
.tg-flag { padding: 3px 10px; font-size: .75rem; font-weight: 700; border-radius: 999px; }
.tg-flag--featured { color: #451a03; background: #fbbf24; }
.tg-flag--popular { color: #fff; background: #be123c; }
.tg-card__preview { position: absolute; right: 10px; bottom: 10px; padding: 6px 12px; color: #fff; font-size: .82rem; font-weight: 600; text-decoration: none; background: rgba(15, 23, 42, .82); border-radius: 6px; }
.tg-card__preview:hover, .tg-card__preview:focus-visible { color: #fff; background: #0f172a; }
.tg-card__body { display: flex; flex: 1; flex-direction: column; padding: 16px 18px 18px; }
.tg-card__category { color: var(--site-primary); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
html[data-theme=dark] .tg-card__category { color: var(--site-link); }
.tg-card__title { margin: 4px 0 6px; font-size: 1.15rem; }
.tg-card__title a { color: var(--site-text); text-decoration: none; }
.tg-card__title a:hover { color: var(--site-primary); }
.tg-card__text { margin-bottom: 8px; color: var(--site-muted); font-size: .92rem; }
.tg-card__tech { margin-bottom: 8px; color: var(--site-muted); font-size: .8rem; }
.tg-price { margin: auto 0 12px; font-size: 1.1rem; }
.tg-price small { color: var(--site-muted); font-size: .78rem; }
.tg-price--large { margin: 12px 0 16px; font-size: 1.6rem; }

.tg-actions { display: grid; gap: 8px; }
.tg-order-label { margin: 2px 0 0; color: var(--site-muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.tg-order { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tg-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; color: #fff; font: inherit; font-size: .92rem; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; border: 0; border-radius: 8px; }
.tg-btn:hover { color: #fff; filter: brightness(1.08); }
.tg-btn:focus-visible, .tg-pill:focus-visible, .tg-thumb:focus-visible, .tg-card__preview:focus-visible { outline: 3px solid color-mix(in srgb, var(--site-primary) 55%, #fff); outline-offset: 2px; }
.tg-btn--demo, .tg-btn--search { background: var(--site-primary); }
.tg-btn--whatsapp { background: #128c4a; }
.tg-btn--email { background: #334155; }
.tg-btn--off { color: var(--site-muted); cursor: default; background: var(--site-alt); border: 1px dashed var(--site-border); }
.tg-btn--off:hover { color: var(--site-muted); filter: none; }

.tg-btn--preview { color: var(--site-primary); background: transparent; box-shadow: inset 0 0 0 2px var(--site-primary); }
.tg-btn--preview:hover { color: #fff; background: var(--site-primary); filter: none; }
html[data-theme=dark] .tg-btn--preview { color: var(--site-link); box-shadow: inset 0 0 0 2px var(--site-link); }
html[data-theme=dark] .tg-btn--preview:hover { color: #fff; background: var(--site-primary); }

/* A scaled, non-interactive picture of the real template. template-gallery.js fits it to its box. */
.tg-frame { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: #fff; }
.tg-frame iframe { display: block; width: 1280px; height: 800px; border: 0; transform: scale(var(--tg-scale, .3)); transform-origin: 0 0; }
.tg-detail__main--live { position: relative; aspect-ratio: 16 / 10; }
.tg-detail__main--live > a { position: absolute; inset: 0; z-index: 1; }

/* Preview viewer */
.tg-viewer { display: flex; flex-direction: column; height: 100vh; height: 100dvh; margin: 0; color: #e2e8f0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif; background: #0f172a; }
.tg-viewer__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 16px; background: #1e293b; border-bottom: 1px solid #334155; }
.tg-viewer__bar h1 { flex: 1 1 160px; min-width: 0; margin: 0; overflow: hidden; font-size: 1rem; white-space: nowrap; text-overflow: ellipsis; }
.tg-viewer__bar a { color: #e2e8f0; font-size: .875rem; text-decoration: none; }
.tg-viewer__bar a:hover { text-decoration: underline; }
.tg-viewer__devices { display: inline-flex; overflow: hidden; border: 1px solid #475569; border-radius: 8px; }
.tg-viewer__devices button { min-height: 36px; padding: 4px 12px; color: #e2e8f0; font: inherit; font-size: .85rem; cursor: pointer; background: transparent; border: 0; }
.tg-viewer__devices button[aria-pressed=true] { color: #0f172a; font-weight: 700; background: #e2e8f0; }
.tg-viewer__devices button:focus-visible, .tg-viewer__bar a:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.tg-viewer__links { display: flex; align-items: center; gap: 12px; }
.tg-viewer__bar .tg-viewer__order { padding: 7px 14px; color: #fff; font-weight: 600; background: #128c4a; border-radius: 6px; }
.tg-viewer__stage { display: flex; flex: 1; justify-content: center; min-height: 0; overflow: auto; }
.tg-viewer__screen { flex: 0 1 100%; max-width: 100%; height: 100%; background: #fff; }
.tg-viewer__screen[data-device=tablet] { flex-basis: 768px; }
.tg-viewer__screen[data-device=mobile] { flex-basis: 375px; }
.tg-viewer__screen iframe { display: block; width: 100%; height: 100%; border: 0; }

.tg-empty { padding: 56px 16px; text-align: center; background: var(--site-alt); border-radius: var(--site-radius); }
.tg-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 40px; padding: 24px; background: var(--site-alt); border: 1px solid var(--site-border); border-radius: var(--site-radius); }
.tg-contact h2 { margin-bottom: 4px; font-size: 1.3rem; }
.tg-contact p { margin: 0; color: var(--site-muted); }
.tg-contact__links { display: flex; flex-wrap: wrap; gap: 8px; }

.tg-detail__main { display: block; overflow: hidden; background: var(--site-alt); border: 1px solid var(--site-border); border-radius: var(--site-radius); }
.tg-detail__main img { display: block; width: 100%; height: auto; }
.tg-thumbs { display: flex; gap: 8px; margin-top: 10px; padding-bottom: 4px; overflow-x: auto; }
.tg-thumb { flex: 0 0 96px; height: 64px; padding: 0; overflow: hidden; cursor: pointer; background: none; border: 2px solid var(--site-border); border-radius: 6px; }
.tg-thumb.is-active { border-color: var(--site-primary); }
.tg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tg-panel { padding: 22px; background: var(--site-surface, #fff); border: 1px solid var(--site-border); border-radius: var(--site-radius); }
.tg-panel h1 { margin: 4px 0 10px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.tg-facts { display: grid; gap: 10px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--site-border); }
.tg-facts dt { color: var(--site-muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.tg-facts dd { margin: 0; }
.tg-section { margin-top: 40px; }
.tg-prose { max-width: 820px; white-space: pre-line; overflow-wrap: anywhere; }
.tg-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; margin: 0; padding: 0; list-style: none; }
.tg-features li { position: relative; padding-left: 24px; }
.tg-features li::before { position: absolute; left: 0; color: #16a34a; font-weight: 800; content: "✓"; }

.tg-modal .modal-content { color: var(--site-text); background: var(--site-surface, #fff); }
.tg-modal img { display: block; width: 100%; height: auto; }
html[data-theme=dark] .tg-modal .btn-close { filter: invert(1); }

@media (max-width: 720px) {
    .tg-filters { grid-template-columns: minmax(0, 1fr) auto; }
    .tg-filters__search { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    .tg-card, .tg-card__media img { transition: none; }
    .tg-card:hover { transform: none; }
    .tg-card:hover .tg-card__media img { transform: none; }
}
