.template-showcase-width { width: 90%; max-width: 1240px; margin: 0 auto; }
.home-templates { padding: 72px 0; }
.home-templates__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.home-templates__heading > div { max-width: 680px; }
.home-templates h2 { margin: 12px 0 16px; font-size: clamp(30px,3.5vw,44px); font-weight: 650; line-height: 1.15; letter-spacing: -.03em; color: #1d1d1f; }
.home-templates__hint { display: none; }
.home-templates__heading p { color: #62626b; font-size: 17px; line-height: 1.6; margin: 0; }
.home-templates__heading > a { flex-shrink: 0; white-space: nowrap; margin-bottom: 4px; }
.home-templates__grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 18px; }
.template-tile { min-width: 0; }
body .template-tile__link { display: block; color: #1d1d1f; text-decoration: none !important; }
.template-tile__image { height: 240px; padding: 20px 16px; display: flex; align-items: center; justify-content: center; background: #f4f5f8; border-radius: 18px; overflow: hidden; transition: background .2s; }
.template-tile__image img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; transform: none; transition: transform .25s ease; }
.template-tile__copy { padding: 14px 2px 0; }
.template-tile__category { display: block; color: #62626b; font-size: 12px; margin-bottom: 5px; }
.template-tile h3 { margin: 0 0 3px; font-size: 16px; font-weight: 600; line-height: 1.35; }
.template-tile__format { font-size: 13px; color: #62626b; }
.template-tile__link:hover .template-tile__image { background: #eceef3; }
.template-tile__link:hover img { transform: scale(1.025); }
.template-tile__link:focus-visible { outline: 2px solid var(--app-tint); outline-offset: 5px; border-radius: 18px; }
.template-catalog { padding: 145px 0 32px; }
.template-catalog__heading { max-width: 750px; margin: 0 auto 44px; text-align: center; }
.template-catalog__heading h1 { margin: 12px 0 20px; font-size: clamp(34px,4vw,52px); font-weight: 650; line-height: 1.1; letter-spacing: -.035em; }
.template-catalog__heading p { color: #62626b; font-size: 18px; line-height: 1.65; margin-bottom: 20px; }
.template-catalog__filters { display: flex; gap: 20px; align-items: flex-end; margin-bottom: 24px; }
.template-catalog__filters > div:first-child { flex: 1; }
.template-catalog__filters > div:nth-child(2) { width: 260px; }
.template-catalog__filters label { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.template-catalog__filters :is(input,select) { display: block; width: 100%; height: 50px; border: 0; border-radius: 12px; background: #f4f5f8; padding: 12px 16px; color: #1d1d1f; font: inherit; font-size: 16px; }
.template-catalog__filters select { padding-right: 32px; }
.template-catalog__filters :is(input,select):focus-visible { outline: 2px solid var(--app-tint); outline-offset: 2px; }
.template-catalog__filters.has-js .template-filter-submit { display: none; }
.template-catalog__results { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; min-height: 24px; }
.template-catalog__results p { margin: 0; color: #62626b; font-size: 14px; }
.template-catalog__results button { padding: 0; color: #1d1d1f; font: inherit; font-size: 14px; border: 0; background: none; cursor: pointer; }
.template-catalog__results button:hover { color: var(--app-tint); text-decoration: underline; }
.template-catalog__grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 32px 24px; }
.template-catalog__grid .template-tile__image { height: 300px; padding: 24px; }
.template-catalog [hidden] { display: none !important; }
.template-catalog__empty { padding: 64px 16px; text-align: center; background: #f4f5f8; border-radius: 20px; }
.template-catalog__empty h2 { font-size: 24px; font-weight: 600; margin-bottom: 12px; }
.template-show-more { display: flex; margin: 36px auto 0; min-height: 50px; padding: 12px 24px; background: #1d1d1f; color: #fff; border: 0; }
.template-show-more:hover { background: #363638; color: #fff; }
.template-catalog__note { margin: 32px 0 0; text-align: center; color: #62626b; font-size: 13px; }
.template-catalog__custom { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin-top: 56px; padding: 32px; border-radius: 22px; background: #f4f5f8; }
.template-catalog__custom h2 { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; margin-bottom: 12px; }
.template-catalog__custom p { margin: 0; color: #62626b; line-height: 1.6; max-width: 650px; }
.template-catalog__custom a { flex-shrink: 0; white-space: nowrap; }
.template-preview { width: min(640px,calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 24px; margin: auto; border: 0; border-radius: 24px; background: #fff; color: #1d1d1f; overflow: auto; }
.template-preview::backdrop { background: #17131db3; }
.template-preview__header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.template-preview__header p { color: #62626b; font-size: 13px; margin: 0 0 5px; }
.template-preview__header h2 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 600; }
.template-preview__close { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: #f4f5f8; color: #1d1d1f; cursor: pointer; }
.template-preview__close:hover { background: #e8e9ef; }
.template-preview__image { display: flex; align-items: center; justify-content: center; height: min(50dvh,460px); padding: 20px; border-radius: 16px; background: #f4f5f8; }
.template-preview__image img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.template-preview__tabs { margin: 16px auto 0; }
.template-preview__detail { color: #62626b; text-align: center; font-size: 14px; margin: 16px 0 20px; }
.template-preview__actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 20px; }
.template-preview__actions .button { min-height: 50px; padding: 12px 24px; gap: 10px; }
.template-preview__actions .button svg { display: block; width: 18px; height: 22px; }
.template-selected { text-align: center; margin-bottom: 40px; }
.template-selected img { display: block; max-height: 550px; width: auto; max-width: 100%; margin: 20px auto; }
@media(max-width:1000px) {
 .home-templates__grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
 .home-templates__heading { align-items: flex-start; flex-direction: column; gap: 20px; }
 .template-catalog__grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(max-width:700px) {
 .home-templates { padding: 48px 0; }
 .home-templates__grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 16px) / 2); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 0 16px; scrollbar-width: thin; }
 .home-templates__hint { display: block; margin: 12px 0 0; font-size: 13px; color: #62626b; }
 .home-templates__grid .template-tile { scroll-snap-align: start; }
 .template-catalog { padding-top: 125px; }
 .template-catalog__heading { margin-bottom: 32px; }
 .template-catalog__heading p { font-size: 17px; }
 .template-catalog__filters { flex-wrap: wrap; gap: 16px; }
 .template-catalog__filters > div:first-child, .template-catalog__filters > div:nth-child(2) { flex: 0 0 100%; width: 100%; }
 .template-catalog__grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 16px; }
 .template-catalog__grid .template-tile__image { height: 230px; padding: 16px; }
 .template-catalog__custom { flex-direction: column; align-items: flex-start; padding: 24px; gap: 20px; }
 .template-preview { padding: 18px; }
 .template-preview__header h2 { font-size: 23px; }
}
@media(prefers-reduced-motion:reduce) { .template-tile__image, .template-tile__image img { transition: none; } }

/* Keep this message panel visible against the gallery’s white page canvas. */
body.templates-page .template-catalog > .template-catalog__custom { background: var(--public-panel-bg,#f4f5f8) !important; }
