/* Homepage gallery only. Native A4 images and existing template links. */
.home-redesign .cvd-template-gallery{padding:24px 0 36px;background:#fff;color:var(--cvd-ink)}
.cvd-template-gallery .gallery-heading{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:22px}
.cvd-template-gallery .gallery-heading h2{font-size:32px;line-height:1.2;letter-spacing:-.7px;margin:0;color:var(--cvd-ink);font-weight:700}
.cvd-template-gallery .gallery-heading h2 span{color:var(--cvd-green)}
.cvd-template-gallery .gallery-heading p{margin:9px 0 0;color:var(--cvd-muted);font-size:16px;line-height:1.5}
.cvd-template-gallery .gallery-all{display:inline-flex;align-items:center;justify-content:center;padding:13px 21px;border:1px solid #dce3eb;border-radius:28px;color:var(--cvd-ink);font-size:14px;white-space:nowrap}
.cvd-template-gallery .gallery-filters{display:flex;gap:10px;overflow-x:auto;padding:2px 2px 6px;margin-bottom:20px;scrollbar-width:none}
.cvd-template-gallery .gallery-filters button{flex-shrink:0;min-height:42px;padding:10px 21px;border:1px solid #e0e6ee;border-radius:24px;background:#f6f8fb;color:var(--cvd-ink);font:inherit;font-size:13px;cursor:pointer;transition:background .18s,color .18s}
.cvd-template-gallery .gallery-filters button[aria-pressed=true]{color:#fff;background:var(--cvd-green);border-color:var(--cvd-green)}
.cvd-template-gallery .gallery-stage{position:relative;overflow:hidden;padding:8px 50px 0;touch-action:pan-y;outline:none}
.cvd-template-gallery .gallery-track{display:flex;gap:24px;overflow-x:auto;scrollbar-width:none;padding:12px 6px 22px}
.cvd-template-gallery .gallery-card{flex:0 0 30%;min-width:0;text-align:center}
.cvd-template-gallery .gallery-paper{position:relative;border:1px solid #e6ebed;border-radius:18px;background:white;overflow:hidden;box-shadow:0 5px 20px #122f250a}
.cvd-template-gallery .gallery-paper>a{display:block;aspect-ratio:210/297}
.cvd-template-gallery .gallery-paper img{display:block;width:100%;height:100%;object-fit:contain;object-position:center;border-radius:17px}
.cvd-template-gallery .gallery-actions{display:flex;gap:8px;padding:12px 14px 14px}
.cvd-template-gallery .gallery-actions button,.cvd-template-gallery .gallery-use{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 16px;border:1px solid #dce3eb;border-radius:24px;font:inherit;font-size:13px;color:var(--cvd-ink);background:#fff;cursor:pointer;text-decoration:none}
.cvd-template-gallery .gallery-use{flex:1;background:var(--cvd-green);border-color:var(--cvd-green);color:white;font-weight:600}
.cvd-template-gallery .gallery-use:hover{background:var(--cvd-dark-green)}
.cvd-template-gallery .gallery-card h3{margin:10px 0 4px;font-size:17px;line-height:1.3;font-weight:700;color:var(--cvd-ink)}
.cvd-template-gallery .gallery-description{margin:0;color:var(--cvd-muted);font-size:13px;line-height:1.5}
.cvd-template-gallery .gallery-arrow{position:absolute;top:44%;z-index:8;display:none;width:48px;height:48px;padding:0;border:1px solid #e8edf0;border-radius:50%;background:white;color:var(--cvd-ink);box-shadow:0 4px 14px #122f2510;font:32px/1 Arial;cursor:pointer}
.cvd-template-gallery .gallery-arrow:hover{color:var(--cvd-green);border-color:#b8dccb}
.cvd-template-gallery .gallery-prev{left:10px}.cvd-template-gallery .gallery-next{right:10px}
.cvd-template-gallery .gallery-dots{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin:16px 0 0}
.cvd-template-gallery .gallery-dots button{padding:12px 0;border:0;background:transparent;width:32px;cursor:pointer}
.cvd-template-gallery .gallery-dots button:after{content:"";display:block;height:5px;border-radius:6px;background:#dce2e9}
.cvd-template-gallery .gallery-dots button[aria-current=true]:after{background:var(--cvd-green)}
.cvd-template-gallery :is(button,a):focus-visible{outline:3px solid #177a32;outline-offset:3px}
.cvd-template-gallery.is-enhanced .gallery-arrow{display:block}
.cvd-template-gallery.is-enhanced .gallery-track{position:relative;display:block;height:calc(var(--gallery-card-width)*1.4143 + 128px);overflow:visible;padding:0}
.cvd-template-gallery.is-enhanced .gallery-card{position:absolute;left:50%;top:0;width:var(--gallery-card-width);transform:translateX(calc(-50% + var(--offset)*98%)) scale(var(--scale));transform-origin:50% 40%;opacity:var(--opacity);z-index:var(--layer);transition:transform .38s ease,opacity .3s ease;pointer-events:none}
.cvd-template-gallery.is-enhanced .gallery-card.is-visible{pointer-events:auto}
.cvd-template-gallery.is-enhanced .gallery-card.is-active .gallery-paper{border-color:#d4eadf;box-shadow:0 8px 28px #009b521b}
.cvd-template-gallery.is-enhanced .gallery-card:not(.is-active) .gallery-actions{display:none}
.cvd-template-gallery.is-enhanced .gallery-card:not(.is-active) .gallery-paper{margin-bottom:0}
.cvd-template-gallery .gallery-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.cvd-gallery-dialog{width:min(780px,94vw);max-height:94dvh;padding:18px;border:1px solid #dce3eb;border-radius:20px;background:white;color:var(--cvd-ink)}
.cvd-gallery-dialog::backdrop{background:#12203980}
.cvd-gallery-dialog header{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:12px}
.cvd-gallery-dialog h2{margin:0;font:600 18px/1.4 "Open Sans",Arial}
.cvd-gallery-dialog button{border:1px solid #dce3eb;border-radius:50%;background:#f6f8fb;font-size:24px;width:44px;height:44px;cursor:pointer}
.cvd-gallery-dialog img{display:block;width:auto;max-width:100%;height:auto;max-height:calc(94dvh - 100px);object-fit:contain;margin:0 auto}
@media(max-width:1024px) and (min-width:768px){.cvd-template-gallery .gallery-heading h2{font-size:28px}.cvd-template-gallery.is-enhanced .gallery-card{width:var(--gallery-card-width)}.cvd-template-gallery.is-enhanced .gallery-track{height:calc(var(--gallery-card-width)*1.4143 + 128px)}}
@media(max-width:767px){.home-redesign .cvd-template-gallery{padding:24px 0 34px}.cvd-template-gallery .gallery-heading{align-items:flex-start;gap:14px;flex-direction:column}.cvd-template-gallery .gallery-heading h2{font-size:27px}.cvd-template-gallery .gallery-heading p{font-size:14px}.cvd-template-gallery .gallery-all{padding:10px 16px;font-size:13px}.cvd-template-gallery .gallery-filters{margin:0 -20px 16px;padding:4px 20px 8px;gap:8px}.cvd-template-gallery .gallery-filters button{padding:10px 16px}.cvd-template-gallery .gallery-stage{padding:4px 0 0;overflow:visible}.cvd-template-gallery .gallery-card{flex-basis:86%}.cvd-template-gallery.is-enhanced .gallery-track{height:calc(var(--gallery-card-width)*1.4143 + 128px);overflow:visible}.cvd-template-gallery.is-enhanced .gallery-card{width:var(--gallery-card-width);transform:translateX(calc(-50% + var(--offset)*104%)) scale(var(--scale));transform-origin:50% 35%}.cvd-template-gallery.is-enhanced .gallery-stage{overflow:hidden;margin:0 -20px;padding:4px 20px 0}.cvd-template-gallery .gallery-arrow{width:36px;height:36px;font-size:25px;top:40%}.cvd-template-gallery .gallery-prev{left:4px}.cvd-template-gallery .gallery-next{right:4px}.cvd-template-gallery .gallery-actions{gap:6px;padding:10px}.cvd-template-gallery .gallery-actions button,.cvd-template-gallery .gallery-use{font-size:13px;padding:10px 10px}.cvd-template-gallery .gallery-dots{gap:6px;margin-top:12px}.cvd-template-gallery .gallery-dots button{width:24px}}
@media(prefers-reduced-motion:reduce){.cvd-template-gallery *{transition:none!important;scroll-behavior:auto!important}}

/* Reserve enhanced geometry before JS initialization to avoid gallery layout shifts. */
.cvd-template-gallery .gallery-track{height:calc(var(--gallery-card-width)*1.4143 + 128px)}
@media(max-width:1024px) and (min-width:768px){.cvd-template-gallery .gallery-track{height:calc(var(--gallery-card-width)*1.4143 + 128px)}}
@media(max-width:767px){.cvd-template-gallery .gallery-track{height:calc(var(--gallery-card-width)*1.4143 + 128px)}}

.cvd-template-gallery .gallery-dots{min-height:29px}

/* One shared real width reserves the same space before and after initialization. */
.cvd-template-gallery{--gallery-card-width:clamp(292px,31.2vw,376px)}
.cvd-template-gallery .gallery-use{min-height:46px;height:46px;font-size:14px;line-height:1.2;font-weight:700;white-space:nowrap;min-width:0;transition:background .18s,box-shadow .18s,transform .18s}
.cvd-template-gallery .gallery-use:hover{transform:translateY(-1px);box-shadow:0 4px 12px #009b5226}
.cvd-template-gallery.is-enhanced .gallery-card:not(.is-active) .gallery-paper{border-color:#d7e1e6;box-shadow:0 5px 18px #122f2512}
.cvd-template-gallery.is-empty .gallery-track{height:80px}
.cvd-template-gallery.is-empty .gallery-status{position:static;width:auto;height:auto;clip-path:none;overflow:visible;text-align:center;color:var(--cvd-muted)}
@media(min-width:768px) and (max-width:1024px){.cvd-template-gallery{--gallery-card-width:292px}}
@media(max-width:767px){.cvd-template-gallery{--gallery-card-width:min(366px,calc(100vw - 64px))}.cvd-template-gallery .gallery-use{font-size:14px;padding:10px}.cvd-template-gallery .gallery-card h3{margin-top:10px}}
