/* Ignite Builder · Pre-built templates (ticker)
   Scoped to its section; needs css/ignite-base.css loaded first. */

/* ==================================================================
   SECTION · Ignite Builder / Pre-built templates
   Scope: everything below is namespaced under .ib-tpl
   A ticker of template cards (503 x 300) that loops right-to-left.
   Each card always shows its name chip. Hover/focus a card: the ticker pauses,
   the card lifts 16px with a shadow and "Get started" slides in; others dim to 40%.
   JS clones the card set once so the loop is seamless (.is-ticking).
   ================================================================== */
.ib-tpl {
    --ib-stone-50: #fafaf9;
    --ib-stone-100: #f5f5f4;
    --ib-stone-200: #e7e5e4;
    --ib-stone-300: #d6d3d1;
    --ib-stone-400: #78716c;
    --ib-stone-500: #57534e;
    --ib-stone-700: #1c1917;
    --ib-line: rgba(120, 113, 108, .3);
    --ib-blue: #436df8;
    --ib-blue-ink: #1348f6;
    --ib-red: #ff2b3a;
    --ib-font-display: "ClashDisplay-Variable", "Arial Narrow", system-ui, sans-serif;
    --ib-font-body: "ClashGrotesk-Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
    --ib-font-mono: "Geist Mono", sans-serif;
    --ib-pad-x: clamp(16px, 7.8vw, 112px);
}
.ib-tpl { background: var(--ib-stone-100); color: var(--ib-stone-700); font-family: var(--ib-font-body); overflow: hidden; --ib-tpl-w: 503px; --ib-tpl-h: 300px; --ib-tpl-gap: 32px; --ib-tpl-speed: 76s; }
.ib-tpl *, .ib-tpl *::before, .ib-tpl *::after { box-sizing: border-box; }
.ib-tpl img { display: block; max-width: none; }
.ib-tpl__inner { padding-block: 144px 120px; display: flex; flex-direction: column; gap: 64px; }
.ib-tpl__title { margin: 0; padding-inline: max(var(--ib-pad-x), env(safe-area-inset-left, 0px)) max(var(--ib-pad-x), env(safe-area-inset-right, 0px)); text-align: center; font: 500 clamp(28px, 3.06vw, 44px)/1.2727 var(--ib-font-display); letter-spacing: -0.01em; text-transform: uppercase; color: var(--ib-stone-700); text-wrap: balance; }

/* room above/below the row so a lifted card and its shadow aren't clipped */
.ib-tpl__viewport { position: relative; margin-block: -24px -56px; padding-block: 24px 56px; overflow-x: auto; scrollbar-width: none; }
.ib-tpl__viewport::-webkit-scrollbar { display: none; }
.ib-tpl__track { display: flex; width: max-content; padding-left: max(var(--ib-pad-x), env(safe-area-inset-left, 0px)); }
.ib-tpl__set { display: flex; gap: var(--ib-tpl-gap); padding-right: var(--ib-tpl-gap); margin: 0; list-style: none; }
.ib-tpl__set > li { display: block; }

/* ticker (JS adds .is-ticking after duplicating the set) */
.ib-tpl__viewport.is-ticking { overflow: hidden; }
.is-ticking .ib-tpl__track { padding-left: 0; animation: ib-tpl-marquee var(--ib-tpl-speed) linear infinite; will-change: transform; }
.is-ticking:hover .ib-tpl__track,
.is-ticking:focus-within .ib-tpl__track,
.ib-tpl.is-offscreen .ib-tpl__track { animation-play-state: paused; }
@keyframes ib-tpl-marquee { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

/* ---------- Card ---------- */
.ib-tpl-card { position: relative; display: block; width: var(--ib-tpl-w); height: var(--ib-tpl-h); border: 1px solid var(--ib-stone-300); border-radius: 6px; overflow: hidden; background: var(--ib-stone-50); color: inherit; text-decoration: none; transition: transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s ease, opacity .3s ease; }
.ib-tpl-card__shot { position: absolute; left: -1px; top: -1px; width: calc(100% + 2px); height: 100%; object-fit: cover; }
/* bottom shade (Figma: image, flipped, 60%) */
.ib-tpl-card__shade { position: absolute; left: -1px; right: -1px; bottom: -1px; height: 96px; background: url("../../gfx/card-shade.png") center / 100% 100% no-repeat; transform: scaleY(-1); opacity: .6; }
.ib-tpl-card__meta { position: absolute; left: 19px; right: 19px; bottom: 19px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ib-tpl-chip { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 4px 8px; border-radius: 2px; background: var(--ib-stone-50); font: 400 14px/20px var(--ib-font-mono); color: var(--ib-stone-400); text-transform: uppercase; white-space: nowrap; color: var(--ib-stone-500); }
.ib-tpl-chip img { width: 16px; height: 16px; flex: none; }
.ib-tpl-chip b { font-weight: 700; }
/* the name chip is always shown; "Get started" slides in on hover / focus */
.ib-tpl-chip--cta { font-weight: 500; color: var(--ib-stone-400); opacity: 0; transform: translateX(-6px); transition: opacity .3s ease, transform .4s cubic-bezier(.2,.7,.2,1); }
.ib-tpl-chip--cta span { text-decoration: underline dotted; text-decoration-thickness: 8%; text-underline-offset: 3px; text-decoration-skip-ink: none; }

/* hover / keyboard focus */
.ib-tpl-card:hover, .ib-tpl-card:focus-visible { transform: translateY(-16px); box-shadow: 0 58.083px 23.48px rgba(0,0,0,.01), 0 32.749px 19.773px rgba(0,0,0,.03), 0 14.83px 14.83px rgba(0,0,0,.04), 0 3.707px 8.033px rgba(0,0,0,.05); outline: none; }
.ib-tpl-card:hover .ib-tpl-chip--cta, .ib-tpl-card:focus-visible .ib-tpl-chip--cta { opacity: 1; transform: none; }
.ib-tpl-card:focus-visible { box-shadow: 0 0 0 2px var(--ib-stone-100), 0 0 0 4px var(--ib-blue), 0 14.83px 14.83px rgba(0,0,0,.04); }
.ib-tpl__track:has(.ib-tpl-card:hover) .ib-tpl-card:not(:hover),
.ib-tpl__track:has(.ib-tpl-card:focus-visible) .ib-tpl-card:not(:focus-visible) { opacity: .4; }

/* touch screens: no hover, so the name + CTA are always shown */
@media (hover: none) {
  .ib-tpl-chip--cta { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .ib-tpl { --ib-tpl-w: 420px; --ib-tpl-h: 250px; --ib-tpl-gap: 24px; --ib-tpl-speed: 60s; }
  .ib-tpl__inner { padding-block: 96px 88px; gap: 48px; }
}
@media (max-width: 767px) {
  .ib-tpl { --ib-tpl-w: 300px; --ib-tpl-h: 179px; --ib-tpl-gap: 16px; --ib-tpl-speed: 43s; }
  .ib-tpl__inner { padding-block: 64px; gap: 32px; }
  .ib-tpl-card__meta { left: 10px; right: 10px; bottom: 10px; gap: 6px; }
  .ib-tpl-chip { height: 26px; padding: 3px 6px; font-size: 11px; line-height: 16px; gap: 3px; }
  .ib-tpl-chip img { width: 13px; height: 13px; }
}
/* reduced motion: no ticker, the row scrolls sideways instead */
@media (prefers-reduced-motion: reduce) {
  .ib-tpl__viewport.is-ticking { overflow-x: auto; scroll-snap-type: x mandatory; }
  .is-ticking .ib-tpl__track { animation: none; padding-left: max(var(--ib-pad-x), env(safe-area-inset-left, 0px)); }
  .is-ticking .ib-tpl__set[aria-hidden="true"] { display: none; }
  .ib-tpl__set > li { scroll-snap-align: start; scroll-margin-left: var(--ib-pad-x); }
  .ib-tpl-card, .ib-tpl-chip--cta { transition: none; }
}
