/* =========================================================
   BAM'S WEBSITE BUILDER — TEMPLATES PAGE ONLY
   Safe, isolated styles for templates.html
========================================================= */

.templates-page{background:#090909;color:#fff;min-height:100vh}.templates-hero{padding:clamp(80px,10vw,140px) 24px 70px;text-align:center;background:radial-gradient(circle at top,rgba(212,166,55,.22),transparent 45%),#080808;border-bottom:1px solid rgba(212,166,55,.25)}.templates-wrap{width:min(1200px,100%);margin:auto}.templates-eyebrow,.template-category{color:#f0c45a;font-weight:800;letter-spacing:.13em;text-transform:uppercase;font-size:.75rem}.templates-hero h1{font-size:clamp(2.5rem,6vw,4.7rem);line-height:1.04;margin:12px auto;max-width:900px}.templates-hero h1 span{color:#d4a637}.templates-hero p{max-width:720px;margin:18px auto;color:#bbb;line-height:1.8}.template-benefits{display:flex;justify-content:center;flex-wrap:wrap;gap:12px;margin-top:28px}.template-benefits span{padding:10px 14px;border:1px solid rgba(212,166,55,.32);border-radius:999px;background:rgba(255,255,255,.03)}.templates-content{padding:70px 24px}.template-heading{text-align:center;margin-bottom:32px}.template-heading h2{font-size:clamp(2rem,4vw,3rem);margin:8px 0}.template-filters{display:flex;justify-content:center;flex-wrap:wrap;gap:10px;margin:0 0 34px}.template-filter{border:1px solid rgba(212,166,55,.28);background:#121212;color:#fff;padding:10px 16px;border-radius:999px;cursor:pointer}.template-filter.active,.template-filter:hover{background:#d4a637;color:#111}.template-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px}.template-card{position:relative;border:1px solid rgba(212,166,55,.22);border-radius:18px;overflow:hidden;background:linear-gradient(145deg,#101010,#171717);box-shadow:0 15px 45px rgba(0,0,0,.24)}.template-card:hover{transform:translateY(-5px);border-color:rgba(212,166,55,.55)}.template-badge{position:absolute;z-index:2;top:12px;left:12px;background:#d4a637;color:#111;padding:7px 10px;border-radius:999px;font-size:.68rem;font-weight:900;text-transform:uppercase}.template-preview{height:190px;background:#0d0d0d;display:grid;place-items:center;overflow:hidden;border-bottom:1px solid rgba(212,166,55,.2)}.template-preview img{width:100%;height:100%;object-fit:cover}.template-card-body{padding:22px}.template-card-body h2{margin:6px 0 14px}.template-card-body ul{list-style:none;padding:0;margin:0;display:grid;gap:8px;color:#bbb;font-size:.92rem}.template-card-body li::before{content:'✓';color:#d4a637;margin-right:8px;font-weight:900}.template-price{display:flex;flex-direction:column;margin:20px 0 15px}.template-price span{font-size:.7rem;color:#aaa;text-transform:uppercase}.template-price strong{font-size:1.35rem;color:#f0c45a}.template-actions{display:grid;grid-template-columns:1fr 1.25fr;gap:9px}.template-actions a{display:flex;align-items:center;justify-content:center;min-height:44px;border-radius:8px;text-decoration:none;font-weight:900;font-size:.82rem}.template-demo{border:1px solid rgba(212,166,55,.4);color:#fff}.template-select{background:#d4a637;color:#111}.template-process{padding:70px 24px;background:#0e0e0e;border-top:1px solid rgba(212,166,55,.2)}.process-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin-top:32px}.process-step{padding:25px;border:1px solid rgba(212,166,55,.2);border-radius:16px;background:#121212}.process-step strong{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:#d4a637;color:#111;margin-bottom:14px}.payment-box{margin-top:42px;padding:30px;border:1px solid rgba(212,166,55,.32);border-radius:18px;background:linear-gradient(135deg,rgba(212,166,55,.12),#111);text-align:center}.payment-options{display:flex;justify-content:center;gap:12px;flex-wrap:wrap;margin-top:20px}.payment-options a{padding:13px 20px;border-radius:9px;text-decoration:none;font-weight:900}.pay-deposit{background:#d4a637;color:#111}.pay-full{border:1px solid rgba(212,166,55,.5);color:#fff}@media(max-width:1050px){.template-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:700px){.template-grid,.process-grid{grid-template-columns:1fr}.template-actions{grid-template-columns:1fr}}

.template-price small{margin-top:3px;color:#8f8f8f;font-size:.72rem}
.template-preview{position:relative;background:linear-gradient(135deg,#171717,#080808)}
.template-preview img{display:block}
.template-preview .industry-logo-overlay{display:none!important}
.template-demo,.template-select,.pay-deposit,.pay-full{transition:transform .2s ease,box-shadow .2s ease,background .2s ease}
.template-demo:hover,.template-select:hover,.pay-deposit:hover,.pay-full:hover{transform:translateY(-2px)}
@media(max-width:1150px){.desktop-navigation{gap:14px}.desktop-navigation a{font-size:.84rem}}

.template-select{position:relative;z-index:2;cursor:pointer;touch-action:manipulation}
.template-select.is-loading{opacity:.82;pointer-events:none}
.template-select.is-loading::after{content:" …";letter-spacing:.08em}

/* A consistent action area for every template, including generated previews. */
.templates-page .template-card { display:flex; flex-direction:column; }
.templates-page .template-card[hidden] { display:none; }
.templates-page .template-card-body { display:flex; flex-direction:column; flex:1; min-width:0; }
.templates-page .template-card-body > ul { flex:1; align-content:start; }
.templates-page .template-actions {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:10px;
  margin-top:auto;
}
.templates-page .template-actions > a,
.templates-page .template-actions > button {
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-width:0;
  min-height:48px;
  margin:0;
  padding:12px 16px;
  border:1px solid rgba(214,173,80,.45);
  border-radius:10px;
  font-family:inherit;
  font-size:.875rem;
  font-weight:700;
  line-height:1.4;
  letter-spacing:0;
  text-align:center;
  text-decoration:none;
  text-transform:none;
  cursor:pointer;
  touch-action:manipulation;
  transition:background .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.templates-page .template-actions > .template-demo { background:rgba(255,255,255,.035); color:#fff; }
.templates-page .template-actions > .template-select { background:#d6ad50; border-color:#d6ad50; color:#111; }
.templates-page .template-actions > .template-personal-preview { background:transparent; color:#f4c15d; grid-column:1 / -1; }
.templates-page .template-actions > :hover { transform:none; border-color:#f4c15d; background:rgba(214,173,80,.12); }
.templates-page .template-actions > .template-select:hover { background:#ecc771; color:#111; box-shadow:0 4px 14px rgba(214,173,80,.16); }
.templates-page .template-actions > :focus-visible { outline:3px solid #f4c15d; outline-offset:3px; }
html[data-theme=light] .templates-page .template-actions > .template-demo,
html[data-theme=light] .templates-page .template-actions > .template-personal-preview { background:#fffaf0; border-color:#a58235; color:#654800; }
html[data-theme=light] .templates-page .template-actions > .template-select { background:#d6ad50; border-color:#a58235; color:#111!important; }
html[data-theme=light] .templates-page .template-actions > :hover { background:#f3e4bd; }
html[data-theme=light] .templates-page .template-actions > .template-select:hover { background:#ecc771; }
html[data-theme=light] .templates-page .template-actions > :focus-visible { outline-color:#765300; }
@media(prefers-reduced-motion:reduce) {
  .templates-page .template-actions > a,.templates-page .template-actions > button { transition:none; }
}

/* Gallery spacing and hierarchy, scoped to the Templates page. */
.templates-page .templates-hero { padding:clamp(64px,8vw,104px) 24px 52px; }
.templates-page .templates-hero h1 { max-width:820px; font-size:clamp(2.25rem,5vw,4rem); line-height:1.12; }
.templates-page .templates-hero h1 span { display:block; }
.templates-page .template-benefits { gap:8px 20px; }
.templates-page .template-benefits span { padding:0; border:0; background:none; font-size:.875rem; }
.templates-page .templates-content { padding:48px 24px 64px; }
.templates-page .template-heading { margin-bottom:24px; }
.templates-page .template-filters { gap:8px; margin-bottom:16px; }
.templates-page .template-filter { min-height:44px; padding:10px 16px; font:inherit; font-size:.875rem; }
.templates-page .template-filter:focus-visible { outline:3px solid #f4c15d; outline-offset:3px; }
.templates-page .template-filter-summary { margin:0 0 24px; color:#bbb; font-size:.875rem; text-align:center; }
.templates-page .template-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; align-items:stretch; }
.templates-page .template-card { transition:border-color .2s ease; }
.templates-page .template-card:hover { transform:none; }
.templates-page .template-preview { height:220px; }
.templates-page .template-preview:not(.industry-photo-preview) img { object-fit:contain; padding:20px; box-sizing:border-box; }
.templates-page .template-card-body { padding:24px; gap:16px; }
.templates-page .template-card-body > * { margin:0; }
.templates-page .template-card-body h2 { font-size:1.4rem; line-height:1.25; overflow-wrap:anywhere; }
.templates-page .template-category { line-height:1.5; letter-spacing:.08em; }
.templates-page .template-card-body > p:not(.template-category):not(.template-price) { color:#bbb; line-height:1.6; font-size:.92rem; }
.templates-page .template-card-body li { line-height:1.55; }
.templates-page .template-price { gap:4px; }
.templates-page .template-actions { padding-top:4px; }
.templates-page .payment-box { margin-top:48px; padding:32px; }
.templates-page .payment-box > p:not(.templates-eyebrow) { max-width:65ch; margin:16px auto; line-height:1.7; }
.templates-page .process-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.templates-page .process-step p { margin:12px 0 0; line-height:1.6; color:#bbb; }
.templates-page .personal-preview-intro { width:min(1200px,calc(100% - 48px)); margin:32px auto 0; padding:24px; box-sizing:border-box; }
.templates-page .personal-preview-intro > p { max-width:80ch; margin:12px 0 20px; }
html[data-theme=light] .templates-page :is(.template-filter-summary,.template-card-body > p:not(.template-category):not(.template-price),.process-step p) { color:#514632; }
@media(max-width:1000px) {
  .templates-page .template-grid,.templates-page .process-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:620px) {
  .templates-page .templates-hero { padding:56px 20px 36px; }
  .templates-page .templates-content,.templates-page .template-process { padding:36px 20px; }
  .templates-page .template-grid,.templates-page .process-grid { grid-template-columns:minmax(0,1fr); gap:20px; }
  .templates-page .template-filters { justify-content:flex-start; }
  .templates-page .template-filter { flex:0 1 auto; max-width:100%; }
  .templates-page .template-preview { height:220px; }
  .templates-page .personal-preview-intro { width:calc(100% - 40px); padding:20px; }
  .templates-page .preview-url-row input { min-width:0; }
  .templates-page .payment-box { padding:24px 20px; }
  .templates-page .payment-options { flex-direction:column; }
}
@media(prefers-reduced-motion:reduce) { .templates-page .template-card { transition:none; } }


/* November 2026: polished, consistent template gallery */
.templates-page .templates-wrap{width:min(1180px,100%)}
.templates-page .templates-hero{padding:clamp(64px,8vw,100px) 20px 48px;background:radial-gradient(ellipse at 50% 0%,rgba(212,166,55,.13),transparent 62%),#0b0b0b}
.templates-page .templates-hero h1{letter-spacing:-.035em;text-wrap:balance}
.templates-page .templates-hero> .templates-wrap > p:not(.templates-eyebrow){line-height:1.65}
.templates-page .templates-content{padding:52px 20px 80px}
.templates-page .template-heading h2{letter-spacing:-.025em}
.templates-page .template-filters{justify-content:center;gap:9px;margin-bottom:26px}
.templates-page .template-filter{border:1px solid rgba(212,166,55,.25);border-radius:12px;padding:10px 15px;background:#171717;line-height:1.25;transition:background .2s,border-color .2s,color .2s}
.templates-page .template-filter.active{background:#d4a637;color:#111;border-color:#d4a637;font-weight:750}
.templates-page .template-filter:not(.active):hover{background:#242017;border-color:#d4a637;color:#f4c15d}
.templates-page .template-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.templates-page .template-card{border-radius:16px;background:#151515;border:1px solid rgba(212,166,55,.18);box-shadow:0 8px 24px rgba(0,0,0,.13);min-width:0}
.templates-page .template-card:hover{border-color:rgba(212,166,55,.5);box-shadow:0 14px 32px rgba(0,0,0,.2)}
.templates-page .template-preview{height:auto;aspect-ratio:16/10;min-height:0;overflow:hidden}
.templates-page .template-preview.industry-photo-preview{min-height:0}
.templates-page .template-preview img{width:100%;height:100%;object-fit:cover}
.templates-page .template-card-body{padding:20px;gap:12px}
.templates-page .template-card-body h2{font-size:1.22rem;line-height:1.3;letter-spacing:-.012em}
.templates-page .template-card-body ul{font-size:.87rem;gap:6px}
.templates-page .template-category{font-size:.68rem;letter-spacing:.07em}
.templates-page .template-badge{top:12px;left:12px;border-radius:7px;padding:7px 10px;font-size:.65rem}
.templates-page .template-price{margin-top:4px}
.templates-page .template-actions{gap:8px;padding-top:8px}
.templates-page .template-actions>a,.templates-page .template-actions>button{min-height:44px;border-radius:9px;font-size:.85rem}
.templates-page .template-process{padding:64px 20px}
.templates-page .process-step{border-radius:14px}
@media(max-width:1000px){.templates-page .template-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){
 .templates-page .templates-hero{padding:52px 18px 36px}
 .templates-page .templates-hero h1{font-size:clamp(2rem,9vw,2.8rem)}
 .templates-page .templates-content{padding:36px 16px 56px}
 .templates-page .template-filters{justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;padding:2px 2px 12px;margin-bottom:16px;-webkit-overflow-scrolling:touch}
 .templates-page .template-filter{flex:0 0 auto;scroll-snap-align:start;white-space:nowrap}
 .templates-page .template-grid{grid-template-columns:minmax(0,1fr);gap:18px}
 .templates-page .template-card-body{padding:18px;gap:11px}
 .templates-page .template-preview{aspect-ratio:16/10;height:auto}
 .templates-page .template-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
 .templates-page .template-actions>.template-personal-preview{grid-column:1/-1}
 .templates-page .template-actions>a,.templates-page .template-actions>button{padding:10px 8px;font-size:.8rem;overflow-wrap:anywhere}
}
@media(max-width:360px){.templates-page .template-actions{grid-template-columns:1fr}}
html[data-theme=light] .templates-page .template-card{background:#fff;border-color:#d9c8a3;box-shadow:0 6px 20px rgba(43,31,8,.07)}
html[data-theme=light] .templates-page .template-filter:not(.active){background:#fff;color:#3b3020;border-color:#d9c8a3}
html[data-theme=light] .templates-page .template-filter:not(.active):hover{background:#f7ecd5}
html[data-theme=light] .templates-page .template-card-body h2{color:#221a0d}

/* Category dropdown for the template catalog. */
.templates-page select.template-catalog-search{appearance:auto;cursor:pointer;max-width:420px;font-weight:650}
.templates-page select.template-catalog-search option{background:#171717;color:#fff}
html[data-theme=light] .templates-page select.template-catalog-search option{background:#fff;color:#241c10}
@media(max-width:760px){.templates-page select.template-catalog-search{max-width:none}}

/* Single clean category selector; suppress legacy duplicate filter controls. */
.templates-page .template-filters[hidden]{display:none!important}
.templates-page .template-catalog-search-row{display:flex;align-items:center;justify-content:space-between;gap:16px;max-width:100%;margin:0 0 28px;padding:18px 22px;border:1px solid rgba(212,166,55,.26);border-radius:16px;background:rgba(212,166,55,.045)}
.templates-page .template-catalog-label{font-size:1rem;font-weight:750;letter-spacing:.01em}
.templates-page select.template-catalog-search{width:min(100%,380px);min-height:48px;padding:10px 16px;border:1px solid rgba(212,166,55,.55);border-radius:10px;background:#171717;color:#fff;font:inherit;cursor:pointer}
.templates-page .template-card[hidden]{display:none!important}
@media(max-width:620px){.templates-page .template-catalog-search-row{flex-direction:column;align-items:stretch;padding:16px}.templates-page select.template-catalog-search{width:100%;max-width:none}}
@media(prefers-reduced-motion:reduce){.templates-page .template-card{transition:none!important}}

/* Compact industry groups keep near-identical demos out of the main gallery. */
.templates-page .template-demo-collection{min-width:0;align-self:start;border:1px solid rgba(212,166,55,.3);border-radius:16px;background:linear-gradient(145deg,#171717,#101010);overflow:hidden}
.templates-page .template-demo-collection[hidden]{display:none!important}
.templates-page .template-demo-collection>summary{cursor:pointer;display:flex;flex-direction:column;justify-content:center;gap:12px;min-height:170px;padding:24px;list-style:none}
.templates-page .template-demo-collection>summary::-webkit-details-marker{display:none}
.templates-page .template-demo-collection>summary:focus-visible{outline:3px solid #d4a637;outline-offset:-4px}
.templates-page .template-collection-name{font-size:1.3rem;font-weight:800;line-height:1.3;color:#f0c45a}
.templates-page .template-collection-count{font-size:.88rem;color:#ddd}
.templates-page .template-demo-collection[open]{grid-column:1/-1}
.templates-page .template-demo-collection[open]>summary{min-height:0;padding:20px 24px;border-bottom:1px solid rgba(212,166,55,.22)}
.templates-page .template-collection-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;padding:20px}
.templates-page .template-collection-grid .template-card{min-width:0}
html[data-theme=light] .templates-page .template-demo-collection{background:#fffaf0;border-color:#d9c8a3}
html[data-theme=light] .templates-page .template-collection-name{color:#6c4900}
html[data-theme=light] .templates-page .template-collection-count{color:#514632}
@media(max-width:600px){.templates-page .template-collection-grid{grid-template-columns:minmax(0,1fr);padding:14px}}

/* Full source website vs personalized concept preview. */
.personal-preview-dialog .preview-view-switch{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}
.personal-preview-dialog .preview-view-switch button{cursor:pointer;border:1px solid rgba(212,166,55,.45);border-radius:9px;padding:11px 16px;background:#1b1b1b;color:#fff;font:inherit;font-weight:700}
.personal-preview-dialog .preview-view-switch button[aria-pressed=true]{background:#d4a637;color:#111}
.personal-preview-dialog .preview-view-switch button:disabled{opacity:.5;cursor:not-allowed}
.personal-preview-dialog .preview-original-warning{font-size:.9rem;line-height:1.6;margin:8px 0;color:inherit}
.personal-preview-dialog .preview-original-frame{width:100%;height:min(72vh,800px);min-height:420px;border:1px solid rgba(212,166,55,.3);border-radius:10px;background:#fff}
.personal-preview-dialog .preview-original-frame[hidden]{display:none!important}
html[data-theme=light] .personal-preview-dialog .preview-view-switch button:not([aria-pressed=true]){background:#fff;color:#241c10}
@media(max-width:600px){.personal-preview-dialog .preview-view-switch button{flex:1 1 100%}.personal-preview-dialog .preview-original-frame{min-height:460px}}

/* Refined compact collections: visual previews instead of empty label-only tiles. */
.templates-page .template-demo-collection{position:relative;min-height:0;border-radius:16px;background:#151515;border:1px solid rgba(212,166,55,.22);box-shadow:0 8px 24px rgba(0,0,0,.13);transition:border-color .2s,transform .2s,box-shadow .2s}
.templates-page .template-demo-collection:not([open]):hover{transform:translateY(-3px);border-color:rgba(212,166,55,.55);box-shadow:0 16px 32px rgba(0,0,0,.22)}
.templates-page .template-demo-collection>summary{position:relative;display:flex;flex-direction:column;justify-content:flex-end;gap:5px;min-height:0;aspect-ratio:16/10;padding:18px 20px 18px;overflow:hidden;background:linear-gradient(0deg,rgba(0,0,0,.91) 0%,rgba(0,0,0,.28) 70%),linear-gradient(135deg,#333,#121212);isolation:isolate}
.templates-page .template-demo-collection>summary::before{content:"";position:absolute;inset:0;background-image:var(--collection-cover);background-size:cover;background-position:center;opacity:.74;z-index:-1;transition:transform .3s}
.templates-page .template-demo-collection:not([open]):hover>summary::before{transform:scale(1.04)}
.templates-page .template-demo-collection>summary::after{content:"+";position:absolute;top:14px;right:14px;display:grid;place-items:center;width:34px;height:34px;border:1px solid rgba(255,255,255,.5);border-radius:50%;background:rgba(0,0,0,.55);color:#fff;font-size:1.4rem;line-height:1}
.templates-page .template-demo-collection[open]>summary::after{content:"−"}
.templates-page .template-collection-name{font-size:clamp(1.15rem,2vw,1.45rem);font-weight:800;color:#fff;text-shadow:0 2px 10px #000;letter-spacing:-.02em}
.templates-page .template-collection-count{font-size:.85rem;color:#f3d28b;text-shadow:0 2px 8px #000;font-weight:650}
.templates-page .template-demo-collection[open]{grid-column:1/-1}
.templates-page .template-demo-collection[open]>summary{aspect-ratio:auto;min-height:110px}
.templates-page .template-collection-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch;gap:20px;padding:20px}
.templates-page .template-collection-grid .template-card{height:100%}
html[data-theme=light] .templates-page .template-demo-collection{background:#fff;border-color:#d9c8a3}
html[data-theme=light] .templates-page .template-collection-name{color:#fff}
html[data-theme=light] .templates-page .template-collection-count{color:#ffe7a4}
@media(max-width:650px){.templates-page .template-collection-grid{grid-template-columns:1fr;gap:14px;padding:14px}.templates-page .template-demo-collection>summary{padding:18px}}

/* 2026 catalog refresh: consistent editorial gallery on desktop and mobile. */
.templates-page .templates-wrap{width:min(1240px,100%)}
.templates-page .templates-hero{padding:clamp(58px,7vw,96px) 20px 46px;background:radial-gradient(ellipse at 50% 0,rgba(212,166,55,.1),transparent 62%),#0c0c0c}
.templates-page .templates-content{padding:clamp(30px,5vw,64px) 20px 88px}
.templates-page .template-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;align-items:start}
.templates-page .template-card,.templates-page .template-demo-collection{width:100%;min-width:0;border:1px solid rgba(212,166,55,.18);border-radius:16px;background:#161616;box-shadow:0 8px 28px rgba(0,0,0,.14);overflow:hidden}
.templates-page .template-card{display:flex;flex-direction:column;align-self:stretch;transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease}
.templates-page .template-card:hover{transform:translateY(-3px);border-color:rgba(212,166,55,.42);box-shadow:0 16px 36px rgba(0,0,0,.24)}
.templates-page .template-preview{aspect-ratio:16/10;min-height:0;height:auto;overflow:hidden}
.templates-page .template-preview img{width:100%;height:100%;object-fit:cover}
.templates-page .template-card-body{display:flex;flex:1;flex-direction:column;gap:10px;padding:19px}
.templates-page .template-card-body h2{font-size:1.18rem;line-height:1.3;margin:0;letter-spacing:-.02em}
.templates-page .template-card-body ul{display:none}
.templates-page .template-category{font-size:.68rem;letter-spacing:.085em}
.templates-page .template-price{margin-top:auto;display:flex;align-items:baseline;gap:7px;flex-wrap:wrap}
.templates-page .template-price strong{font-size:1.2rem}
.templates-page .template-price span,.templates-page .template-price small{font-size:.76rem}
.templates-page .template-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-top:8px;margin-top:0}
.templates-page .template-actions>a,.templates-page .template-actions>button{min-width:0;min-height:42px;padding:10px 8px;font-size:.79rem;line-height:1.25;overflow-wrap:anywhere}
.templates-page .template-actions>.template-personal-preview{grid-column:1/-1}
.templates-page .template-demo-collection{align-self:start;transition:border-color .2s,box-shadow .2s}
.templates-page .template-demo-collection>summary{aspect-ratio:16/10;min-height:0;display:flex;flex-direction:column;justify-content:flex-end;gap:7px;padding:20px;cursor:pointer}
.templates-page .template-demo-collection[open]{grid-column:1/-1}
.templates-page .template-demo-collection[open]>summary{aspect-ratio:auto;min-height:90px}
.templates-page .template-collection-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;padding:22px}
.templates-page .template-catalog-search-row{margin-bottom:30px;padding:16px 20px;border-radius:13px}
.templates-page .template-filter-summary{margin:0 0 20px;color:#bcbcbc}
html[data-theme=light] .templates-page .template-card,html[data-theme=light] .templates-page .template-demo-collection{background:#fff;border-color:#e3d9c6}
@media(max-width:980px){.templates-page .template-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}}
@media(max-width:640px){.templates-page .templates-hero{padding:50px 18px 36px}.templates-page .templates-content{padding:28px 15px 58px}.templates-page .template-grid{grid-template-columns:minmax(0,1fr);gap:18px}.templates-page .template-card-body{padding:17px}.templates-page .template-catalog-search-row{padding:14px;gap:10px}.templates-page .template-collection-grid{grid-template-columns:minmax(0,1fr);gap:14px;padding:14px}.templates-page .template-demo-collection>summary{padding:18px}.templates-page .template-actions>a,.templates-page .template-actions>button{min-height:44px}}
@media(prefers-reduced-motion:reduce){.templates-page .template-card,.templates-page .template-demo-collection{transition:none!important}}

/* Compact collections: expanding a category must not create a full-width gallery row. */
.templates-page .template-demo-collection,
.templates-page .template-demo-collection[open]{grid-column:auto!important;align-self:start;min-width:0}
.templates-page .template-demo-collection>summary,
.templates-page .template-demo-collection[open]>summary{aspect-ratio:auto;min-height:108px;padding:18px 20px;gap:5px;background:linear-gradient(90deg,rgba(0,0,0,.85),rgba(0,0,0,.36)),linear-gradient(135deg,#242424,#101010)}
.templates-page .template-demo-collection>summary::before{background-position:center;opacity:.5}
.templates-page .template-demo-collection[open]>summary{border-bottom:1px solid rgba(212,166,55,.22)}
.templates-page .template-collection-grid,
.templates-page .template-demo-collection[open] .template-collection-grid{display:grid;grid-template-columns:minmax(0,1fr)!important;gap:12px;padding:12px}
.templates-page .template-collection-grid .template-card{width:100%;height:auto}
.templates-page .template-collection-grid .template-preview{aspect-ratio:16/8}
.templates-page .template-collection-grid .template-card-body{padding:14px}
.templates-page .template-collection-grid .template-card-body h2{font-size:1rem}
.templates-page .template-collection-grid .template-price{margin-top:2px}
.templates-page .template-collection-grid .template-actions{gap:6px}
.templates-page .template-collection-grid .template-actions>a,
.templates-page .template-collection-grid .template-actions>button{font-size:.75rem;padding:9px 6px}
@media(max-width:640px){.templates-page .template-demo-collection>summary,.templates-page .template-demo-collection[open]>summary{min-height:96px;padding:16px}.templates-page .template-collection-grid{padding:10px;gap:10px}}

/* Gap-free gallery: variable-height cards stack tightly without empty grid rows. */
.templates-page .template-grid{display:block!important;columns:3 280px;column-gap:20px}
.templates-page .template-grid>.template-card,
.templates-page .template-grid>.template-demo-collection{display:inline-flex;flex-direction:column;vertical-align:top;width:100%;max-width:100%;margin:0 0 20px;break-inside:avoid;page-break-inside:avoid}
.templates-page .template-grid>.template-demo-collection{display:inline-block}
.templates-page .template-grid>.template-card[hidden],
.templates-page .template-grid>.template-demo-collection[hidden]{display:none!important}
.templates-page .template-demo-collection[open]{grid-column:auto!important}
.templates-page .template-collection-grid{display:grid!important;grid-template-columns:minmax(0,1fr)!important}
@media(max-width:980px){.templates-page .template-grid{columns:2 260px}}
@media(max-width:640px){.templates-page .template-grid{columns:1;column-gap:0}.templates-page .template-grid>.template-card,.templates-page .template-grid>.template-demo-collection{margin-bottom:16px}}
