/* Immediate native positions keep GSAP's pin measurements stable during resize. */
html.public-home-document {
  scroll-behavior: auto;
}

/* The four examples form one horizontal story; native scrolling is the fallback. */
.template-section {
  overflow: clip;
  background: #fff;
}

.gallery-heading {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: end;
  gap: 2rem;
  margin-bottom: 2rem;
}

.gallery-heading h2 {
  margin-bottom: 0;
}

.gallery-heading>p {
  max-width: 44ch;
  margin: 0 0 .25rem auto;
  color: var(--muted);
}

.gallery-viewport {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--mist);
  border-radius: 1.75rem;
}

.public-site .template-section .template-options {
  display: flex;
  gap: 1.5rem;
}

.public-site .template-section .template-option {
  flex: 0 0 91%;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  align-items: stretch;
  scroll-snap-align: start;
  background: #f3f6fc;
  border-radius: 1.75rem;
  overflow: hidden;
}

.template-section .template-art {
  height: 23rem;
  border-radius: 0;
}

.template-section .template-option-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

.template-section .template-option-copy h3 {
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  max-width: 17ch;
}

.template-section .template-example-name {
  margin: 0 0 .75rem;
  font-size: .75rem;
}

.template-section .template-option-copy>p:not(.template-example-name) {
  font-size: .9375rem;
}

.template-use {
  margin-block: .5rem 1.5rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
}

.template-section .template-option-copy .btn {
  margin-top: auto;
  font-size: .875rem;
}

.gallery-toolbar,
.gallery-controls {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.gallery-toolbar {
  justify-content: space-between;
  padding-top: 1.25rem;
}

.gallery-controls[hidden] {
  display: none;
}

.gallery-instruction,
.gallery-position {
  margin: 0;
  font-size: .8rem;
  color: var(--muted);
}

.gallery-position {
  margin-right: .5rem;
  font-variant-numeric: tabular-nums;
}

.gallery-step {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transition: background .2s, color .2s;
}

.gallery-step:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.gallery-step:disabled {
  opacity: .35;
  box-shadow: none;
}

.gallery-pin-hint,
[data-scroll-pinned] .gallery-scroll-hint {
  display: none;
}

[data-scroll-pinned] .gallery-pin-hint {
  display: inline;
}

[data-scroll-pinned] .gallery-viewport {
  overflow-x: hidden;
  scroll-snap-type: none;
}

@media (max-width: 767.98px) {
  .gallery-heading {
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-bottom: 1.25rem;
  }

  .gallery-heading .eyebrow {
    margin-bottom: .75rem;
    font-size: .7rem;
  }

  .gallery-heading>p {
    margin-left: 0;
    font-size: .875rem;
  }

  .public-site .template-section .template-option {
    flex-basis: 90%;
    grid-template-columns: 1fr;
  }

  .template-section .template-art {
    height: clamp(10rem, 26svh, 15rem);
    padding-top: 1.25rem;
  }

  .template-section .template-art .sample-page {
    width: 15rem;
    transform: scale(.65) rotate(-6deg);
    transform-origin: center top;
  }

  .template-section .template-option:nth-child(even) .sample-page {
    transform: scale(.65) rotate(6deg);
  }

  .template-section .template-art-label {
    top: .75rem;
    left: 1rem;
    font-size: .6rem;
  }

  .template-section .template-art-mark {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.2rem;
  }

  .template-section .template-option-copy {
    padding: 1.25rem;
  }

  .template-section .template-option-copy h3 {
    margin-bottom: .5rem;
    font-size: 1.5rem;
  }

  .template-section .template-option-copy>p:not(.template-example-name) {
    margin-bottom: 1rem;
    font-size: .875rem;
    line-height: 1.5;
  }

  .template-section .template-example-name {
    margin-bottom: .5rem;
    font-size: .65rem;
  }

  .template-section .template-use {
    display: none;
  }

  .template-section .template-option-copy .btn {
    min-height: 44px;
    padding: .6rem 1rem;
    font-size: .8125rem;
  }

  .gallery-toolbar {
    padding-top: 1rem;
  }

  .gallery-instruction {
    max-width: 11ch;
  }

  .gallery-controls {
    gap: .5rem;
  }
}

/* Leave room for the title, complete card and controls on shorter phones. */
@media (max-width: 767.98px) and (max-height: 820px),
(max-width: 359.98px) {

  .gallery-heading .eyebrow,
  .gallery-heading>p,
  .template-section .template-example-name {
    display: none;
  }

  .gallery-heading {
    margin-bottom: 1rem;
  }

  .gallery-heading h2 {
    font-size: 1.75rem;
  }

  .template-section .template-art {
    height: clamp(5rem, 17svh, 8rem);
  }

  .template-section .template-option-copy {
    padding: 1rem;
  }

  .template-section .template-option-copy h3 {
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-step {
    transition: none;
  }
}
