/* Gallery page: categories -> subcategories -> photos with text below.
   Loaded after app.css and reuses its colours, fonts, header and modal. */

/* 3 columns. The middle one is 0 wide until a category with subcategories is picked. */
/* a little more room under the floating menu than the homepage */

.view--gallery {
  --colw: 210px;
  display: grid;
  grid-template-columns: calc(var(--colw) + var(--gap)) 0px minmax(0, 1fr);
  transition: grid-template-columns .45s cubic-bezier(.2, .8, .2, 1);
}
.view--gallery.has-sub { grid-template-columns: calc(var(--colw) + var(--gap)) calc(var(--colw) + var(--gap)) minmax(0, 1fr); }
.gal__col { min-width: 0; min-height: 0; overflow: hidden; }
.gal__panel { width: var(--colw); height: 100%; display: flex; flex-direction: column; border-radius: var(--r); padding: 22px 16px; }
.gal__cats .gal__panel { background: var(--card); }
.gal__subs .gal__panel { background: var(--panel); }
.gal__panel .label { padding: 0 10px; }

/* column 1: categories */
.gal__list { list-style: none; margin: auto 0; padding: 0; display: flex; flex-direction: column; }
.gal__list li { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .35s ease, opacity .25s ease; }
.gal__list li.is-out { grid-template-rows: 0fr; opacity: 0; } /* the open category moves to column 2 */
.gal__cat { min-height: 0; overflow: hidden; display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 11px 10px; font-family: var(--alt); font-weight: 600; font-size: 1.125rem; line-height: 1.25; color: var(--ink); transition: background .2s; }
.gal__cat small { display: block; margin-top: 2px; font-family: var(--font); font-weight: 500; font-size: .75rem; color: var(--muted); }
.gal__cat:hover { background: var(--panel); }
.gal__cat[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.gal__cat[aria-pressed="true"] small { color: rgba(247, 242, 234, .7); }

/* column 2: chosen category on top, subcategories in the middle */
.gal__subhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; background: none; border: 0; padding: 0 4px 0 10px; text-align: left; font-family: var(--alt); font-weight: 700; font-size: 1.375rem; line-height: 1.2; }
.gal__subhead svg { flex: 0 0 auto; width: 30px; height: 30px; padding: 7px; margin-top: -2px; border-radius: 50%; background: var(--card); fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; transition: background .2s; }
.gal__subhead:hover svg { background: var(--ink); stroke: var(--paper); }
.gal__sublist { list-style: none; margin: auto 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.gal__sub { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; background: none; border: 0; padding: 9px 10px; text-align: left; font-family: var(--font); font-weight: 500; font-size: .9375rem; color: var(--ink); }
.gal__sub span { text-decoration: underline 2px transparent; text-underline-offset: 7px; transition: text-decoration-color .2s; }
.gal__sub:hover span { text-decoration-color: #cbbda6; }
.gal__sub[aria-pressed="true"] { font-weight: 700; }
.gal__sub[aria-pressed="true"] span { text-decoration-color: var(--ink); }
.gal__sub em { font-style: normal; font-size: .75rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* column 3: grid of photos with text below */
.gal__main { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.gal__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 18px var(--gap); min-height: 0; }
.gal__grid.is-big { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: calc(var(--gap) * 1.4); padding: 0 calc(var(--gap) * 1.5); }
.gcard { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; padding: 0; border: 0; background: none; text-align: left; animation: gin .4s ease both; animation-delay: calc(var(--i, 0) * 25ms); }
.gcard__img { min-height: 0; border-radius: 14px; background: var(--card); overflow: hidden; transition: background .25s, box-shadow .25s; }
.gcard__img img { width: 100%; height: 100%; object-fit: contain; padding: 9%; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.gcard:hover .gcard__img { background: #fff; box-shadow: 0 16px 28px -18px rgba(40, 28, 10, .35); }
.gcard:hover .gcard__img img { transform: scale(1.05); }
.gcard__txt { padding: 9px 2px 0; }
.gcard__name { display: block; font-family: var(--alt); font-weight: 600; font-size: .875rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard__cap { display: block; margin-top: 2px; font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-big .gcard__img { border-radius: var(--r); }
.is-big .gcard__txt { padding-top: 14px; }
.is-big .gcard__name { font-size: 1.0625rem; }
.is-big .gcard__cap { font-size: .8125rem; margin-top: 4px; }
.gcard--empty { visibility: hidden; animation: none; }
@keyframes gin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.gal__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; min-height: 52px; }
.gal__where { margin: 0; font-size: .8125rem; color: var(--muted); }
.gal__where b { color: var(--ink); font-weight: 600; }
.gal__pager { display: flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.gal__pager[hidden] { display: none; }
.gal__pager span { min-width: 44px; text-align: center; }
.gal__pager button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--card); transition: background .2s; }
.gal__pager button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.gal__pager button:disabled { opacity: .35; cursor: default; }
.gal__pager svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* medium screens */
@media (max-width: 1180px) and (min-width: 901px) {
  .view--gallery { --colw: 176px; }
  .gal__cat { font-size: 1rem; }
  .gal__subhead { font-size: 1.1875rem; }
}
/* short laptop screens: drop the second text line in the dense grid */
@media (max-height: 760px) and (min-width: 901px) {
  .gal__grid:not(.is-big) .gcard__cap { display: none; }
  .gal__grid { row-gap: 12px; }
}

/* tablets and phones: stacked, the page scrolls */
@media (max-width: 900px) {
  .view--gallery, .view--gallery.has-sub { display: flex; flex-direction: column; gap: 12px; }
  .gal__col, .gal__main { flex: 0 0 auto; overflow: visible; }
  .gal__panel { width: auto; height: auto; padding: 12px; }
  .gal__panel .label { display: none; }
  .gal__list { flex-direction: row; gap: 6px; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .gal__list::-webkit-scrollbar { display: none; }
  .gal__list li { flex: 0 0 auto; }
  .gal__list li.is-out { display: none; }
  .gal__cat { white-space: nowrap; font-size: .9375rem; padding: 9px 12px; }
  .gal__cat small { display: none; }
  .gal__subs { display: none; }
  .has-sub .gal__subs { display: block; }
  .gal__subhead { font-size: 1.125rem; align-items: center; width: 100%; padding: 0 0 0 4px; }
  .gal__sublist { flex-direction: row; flex-wrap: wrap; gap: 0 14px; margin-top: 6px; }
  .gal__sub { width: auto; padding: 8px 4px; font-size: .875rem; }
  .gal__grid, .gal__grid.is-big { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; gap: 16px 12px; padding: 0; }
  .gcard__img { aspect-ratio: 1; }
  .gcard__name { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .view--gallery, .gal__list li, .gcard, .gcard__img img { transition: none; animation: none; } }

/* WordPress integration */
.gal__sublist { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.gal__cat { overflow-wrap: anywhere; }
/* long product names: keep cards inside their column and cut the name with "…" */
.gal__main { min-width: 0; }
.gcard, .gcard__txt { min-width: 0; width: 100%; }
.gcard__name, .gcard__cap { max-width: 100%; }
