/*
 * /templates — Figma "07 Templates" (5845:54).
 * Hero, a full-bleed wall of the 18 real template cards in two rows that drift
 * in opposite directions, then the 15 preset colour themes.
 */

/* Skip link. No shared one exists yet; candidate for v3.css. */
.skip {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 100px;
  background: var(--k-button);
  color: #fff;
  font: 600 15px/1 var(--k-font-text);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--k-dur-ui) var(--k-ease);
}

.skip:focus-visible {
  transform: none;
}

/* `.v3 a { color: inherit }` in v3.css outranks `.v3-btn`, so link buttons
   lose their label colour. Restore it here until v3.css is fixed. */
.v3 a.v3-btn {
  color: #fff;
}

.v3 a.v3-btn.is-secondary {
  color: var(--k-ink);
}

/* ---------- hero ---------- */
.tplHero {
  padding-bottom: 0;
}

.tplHero .v3-stack {
  gap: 28px;
}

.tplHero .v3-h1 {
  max-width: 900px;
  font-size: clamp(38px, 4.4vw, 54px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.tplHero .v3-lead {
  max-width: 600px;
}

/* ---------- template wall ---------- */
.tplWall {
  --card-w: 244px;
  --card-h: 528px;
  --gap: 24px;
  --drift: 110s;

  display: grid;
  gap: var(--gap);
  overflow: hidden;
  padding: 56px 0 112px;
  background: var(--k-bg-2);
}

.tplWall:focus-visible {
  outline: 2px solid var(--k-green);
  outline-offset: -4px;
}

.tplRow {
  overflow: visible;
}

/* Two identical sets side by side; moving the track by half its width loops
   seamlessly. Each set carries a trailing gap so both halves are equal. */
.tplTrack {
  display: flex;
  width: max-content;
  will-change: transform;
}

.tplRow.is-left .tplTrack {
  margin-left: -60px;
  animation: tpl-drift-left var(--drift) linear infinite;
}

/* The second row starts offset by half a card, as in the design. */
.tplRow.is-right .tplTrack {
  margin-left: -186px;
  animation: tpl-drift-right var(--drift) linear infinite;
}

.tplSet {
  display: flex;
  gap: var(--gap);
  margin: 0;
  padding: 0 var(--gap) 0 0;
  list-style: none;
}

.tplCard {
  flex: none;
  width: var(--card-w);
  height: var(--card-h);
  overflow: hidden;
  border-radius: 20px;
  background: var(--k-bg-3);
  box-shadow: 0 8px 24px rgb(0 0 0 / 8%);
}

.tplCard img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Hold still while someone looks closely or tabs onto the wall. */
.tplWall:focus-within .tplTrack {
  animation-play-state: paused;
}

@media (hover: hover) and (pointer: fine) {
  .tplWall:hover .tplTrack {
    animation-play-state: paused;
  }
}

@keyframes tpl-drift-left {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

@keyframes tpl-drift-right {
  from { transform: translate3d(-50%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}

/* ---------- colour themes ---------- */
.tplThemes .v3-wrap {
  display: grid;
  gap: 40px;
  justify-items: start;
}

.tplThemesHeader {
  display: grid;
  gap: 12px;
}

.tplSwatches {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 28px 20px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tplSwatches li {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--k-ink-body);
  font: 500 15px/1.2 var(--k-font-text);
  text-align: center;
}

.tplSwatches img,
.tplCustomSwatch {
  width: 72px;
  height: 72px;
  border-radius: 100px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 6%);
}

.tplCustomSwatch {
  display: grid;
  place-items: center;
  border: 1.5px dashed #cfcfcf;
  background: #fff;
  box-shadow: none;
  color: var(--k-ink-3);
}

.tplCustomSwatch svg {
  width: 24px;
  height: 24px;
}

.tplNote {
  margin: 0;
  padding: 14px 24px;
  border-radius: 100px;
  background: var(--k-bg-2);
  color: var(--k-ink-body);
  font: 500 15px/1.2 var(--k-font-text);
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .tplSwatches {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .tplWall {
    --card-w: 196px;
    --card-h: 424px;
    --gap: 16px;
    --drift: 90s;

    padding: 48px 0 88px;
  }

  .tplRow.is-left .tplTrack {
    margin-left: -48px;
  }

  .tplRow.is-right .tplTrack {
    margin-left: -150px;
  }
}

@media (max-width: 640px) {
  .tplWall {
    --card-w: 152px;
    --card-h: 329px;
    --gap: 12px;
    --drift: 80s;

    padding: 40px 0 72px;
  }

  .tplCard {
    border-radius: 16px;
  }

  .tplRow.is-left .tplTrack {
    margin-left: -40px;
  }

  .tplRow.is-right .tplTrack {
    margin-left: -116px;
  }

  .tplSwatches {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px 12px;
  }

  .tplSwatches img,
  .tplCustomSwatch {
    width: 56px;
    height: 56px;
  }

  .tplSwatches li {
    font-size: 14px;
  }

  .tplNote {
    justify-self: stretch;
    text-align: center;
  }
}

/* Reduced motion: the wall stands still, still offset and full-bleed. */
@media (prefers-reduced-motion: reduce) {
  .tplRow.is-left .tplTrack,
  .tplRow.is-right .tplTrack {
    animation: none;
  }

  .skip {
    transition: none;
  }
}
