/* Gallery: led by photos, for shops whose products sell on sight. A wide storefront photo with the shop's name on
   it, then large picture cards for the shelves and the products. Arranges and dresses only.

   The hero is one grid: the photo fills rows 1 and 2, the name sits at the foot of row 2 on a dark scrim, and the
   rest of the hero's text (the open sign, address, phone, buttons) follows underneath. */

[data-layout="gallery"] .hero { padding-block: 0 20px; }
[data-layout="gallery"] .hero-inner { max-width: 1200px; padding-left: 0; padding-right: 0; gap: 16px 0; }
[data-layout="gallery"] .hero-text { display: contents; }
[data-layout="gallery"] .hero-photo { grid-row: 1 / 3; grid-column: 1; aspect-ratio: auto; min-height: clamp(240px, 58vw, 480px); border-radius: 0; padding: 0; }
[data-layout="gallery"] .hero-photo > span { display: none; }
[data-layout="gallery"] .hero-photo::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, .62) 45%, rgba(0, 0, 0, 0) 85%); }
[data-layout="gallery"] .hero h1 { grid-row: 2; grid-column: 1; align-self: end; position: relative; z-index: 2; color: var(--scrim-ink); text-shadow: 0 1px 12px rgba(0, 0, 0, .55); font-size: clamp(2.1rem, 1.3rem + 4vw, 4rem); padding: 0 max(16px, env(safe-area-inset-left, 0px)) 18px; }
[data-layout="gallery"] .hero-text > :not(h1) { margin-left: max(16px, env(safe-area-inset-left, 0px)); margin-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
/* Stretched by the grid rather than width:100%, so the side margins never push it past the screen. */
[data-layout="gallery"] .hero .sign { width: auto; }
/* From 760px up the hero's words start where every other section's content starts (.inner: 1080px wide, 16px in),
   while the photo stays the hero's full width. 100% is the hero's own width (up to 1200px). */
@media (min-width: 760px) {
  [data-layout="gallery"] .hero h1 { padding: 0 var(--hero-side) 24px; }
  [data-layout="gallery"] .hero-text > :not(h1) { margin-left: var(--hero-side); margin-right: var(--hero-side); }
  [data-layout="gallery"] .hero-inner { --hero-side: max(16px, env(safe-area-inset-left, 0px), calc((100% - 1080px) / 2 + 16px)); }
}

/* Shelves: large picture cards, two across on a phone. A shelf with no picture is a tall card in the shop's colour. */
[data-layout="gallery"] .shelves { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
[data-layout="gallery"] .shelf .ph { aspect-ratio: 1; }
[data-layout="gallery"] .shelf .txt { padding: 10px 12px 12px; }
[data-layout="gallery"] .shelf h3 { font-size: 1rem; }
[data-layout="gallery"] .shelf p { font-size: .88rem; }
@media (min-width: 760px) {
  [data-layout="gallery"] .shelves { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  [data-layout="gallery"] .shelf h3 { font-size: 1.15rem; }
  [data-layout="gallery"] .shelf p { font-size: .95rem; }
}

/* Products: big square photos, two across on a phone. */
[data-layout="gallery"] .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
[data-layout="gallery"] .item { border: 0; background: transparent; border-radius: 0; }
[data-layout="gallery"] .item .ph { aspect-ratio: 1; border-radius: var(--radius); }
[data-layout="gallery"] .item .txt { padding: 8px 2px 4px; }
[data-layout="gallery"] .item.plain { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--ground); }
[data-layout="gallery"] .item.plain .txt { padding: 12px; }
@media (min-width: 760px) {
  [data-layout="gallery"] .items { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
}

/* Photos of the shop come straight after the shelves and get room. */
[data-layout="gallery"] #gallery h2 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); }

/* A category's page: its photo across the top gets room, as photos lead here. */
[data-layout="gallery"] .cat-photo img { aspect-ratio: 16 / 9; }

/* The product page's photos lead: bigger thumbnails. */
[data-layout="gallery"] .pp-thumbs .th { width: 76px; height: 76px; }

/* A page the owner writes: photos lead here, so a photo block gets the room, its caption close under it. */
[data-layout="gallery"] .blk-photo img { aspect-ratio: 4 / 3; object-fit: cover; }
[data-layout="gallery"] .blk figcaption { font-style: italic; }

/* The checkout page: photos lead, so each line's photo is a little larger. */
[data-layout="gallery"] .co-line { grid-template-columns: 72px minmax(0, 1fr) auto; }
[data-layout="gallery"] .co-line.nopic { grid-template-columns: minmax(0, 1fr) auto; }
[data-layout="gallery"] .co-line .co-ph { width: 72px; height: 72px; border-radius: var(--radius); }
