/* ==================================================================
   Gallery — filterable grid + lightbox
================================================================== */
.gallery {
  position: relative;
  background: var(--espresso-950);
  padding: clamp(5rem, 12vh, 9rem) 0 clamp(5rem, 13vh, 9rem);
}
.gallery::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 88% 6%, rgba(142, 66, 49, 0.14), transparent 70%),
    radial-gradient(55% 45% at 8% 92%, rgba(69, 54, 42, 0.30), transparent 72%);
}
.gallery__inner {
  position: relative;
  width: min(100% - 3rem, 1360px);
  margin: 0 auto;
}
.gallery__head {
  text-align: center;
  max-width: 44rem;
  margin: 0 auto clamp(2.5rem, 5vh, 3.5rem);
}
.gallery__title {
  margin-top: 1.1rem;
  font-size: clamp(2.4rem, 5.6vw, 4.4rem);
  font-weight: 500;
  color: var(--cream);
}
.gallery__intro {
  margin: 1.5rem 0 0;
  font-size: clamp(0.98rem, 1.3vw, 1.08rem);
  line-height: 1.8;
  color: rgba(246, 241, 230, 0.72);
}

/* --- Category chips ------------------------------------------------
   The old Collections cards and the filter bar, folded into one
   control: a cover photograph, the category name, and how many
   pieces sit behind it.
------------------------------------------------------------------ */
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: clamp(1.5rem, 3vh, 2.2rem);
}
@media (max-width: 1100px) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; } }

.chip {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  text-align: left;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(30, 23, 18, 0.45);
  transition: border-color 0.4s var(--ease-soft), background-color 0.4s var(--ease-soft);
}
.chip:hover { border-color: rgba(232, 210, 140, 0.5); }
.chip[aria-pressed="true"] {
  border-color: var(--gold-500);
  background: rgba(212, 175, 55, 0.12);
}

.chip__frame {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  background: var(--espresso-900);
  border: 1px solid rgba(212, 175, 55, 0.18);
}
.chip__img { width: 100%; height: 100%; object-fit: cover; }
.chip__mark { font-size: 1rem; color: var(--gold-400); }

.chip__text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.chip__name {
  font-size: 0.78rem;
  line-height: 1.25;
  color: rgba(246, 241, 230, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip[aria-pressed="true"] .chip__name { color: var(--gold-200); }
.chip__n {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(232, 210, 140, 0.6);
  font-variant-numeric: tabular-nums;
}

/* The chosen category explains itself */
.gallery__blurb {
  margin: 0 0 clamp(1.5rem, 3vh, 2.2rem);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.6;
  color: rgba(246, 241, 230, 0.72);
  min-height: 2.4em;
  text-wrap: balance;
}

/* --- The grid is held to a window -----------------------------------
   Masonry makes tall photographs run a long way down, so the grid is
   capped at a height and faded out. "See more" lifts the cap. The
   wrapper carries the cap because a ::after on a multi-column element
   would be laid into the columns themselves.
------------------------------------------------------------------ */
.gridwrap { position: relative; }
.gridwrap.is-capped { max-height: 72vh; overflow: hidden; }
.gridwrap.is-capped::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 11rem;
  background: linear-gradient(180deg, transparent, var(--espresso-950) 88%);
  pointer-events: none;
}
@media (max-width: 560px) {
  .gridwrap.is-capped { max-height: 62vh; }
  .gridwrap.is-capped::after { height: 8rem; }
}

/* --- Grid --------------------------------------------------------- */
.grid {
  columns: 3;
  column-gap: clamp(0.85rem, 1.6vw, 1.4rem);
}
@media (max-width: 1000px) { .grid { columns: 2; } }
@media (max-width: 560px)  { .grid { columns: 2; column-gap: 0.6rem; } }
@media (max-width: 330px)  { .grid { columns: 1; } }

.piece {
  position: relative;
  display: block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: clamp(0.85rem, 1.6vw, 1.4rem);
  overflow: hidden;
  background: var(--espresso-900);
  border: 1px solid rgba(212, 175, 55, 0.16);
  cursor: pointer;
  text-align: left;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out),
              border-color 0.5s var(--ease-soft);
}
.piece.is-in { opacity: 1; transform: none; }
.piece.is-hidden { display: none; }
.piece:hover { border-color: rgba(232, 210, 140, 0.5); }

.piece__img {
  width: 100%;
  height: auto;   /* overrides the height attribute; the ratio is kept */
  display: block;
  transition: transform 1.3s var(--ease-out), filter 0.6s var(--ease-soft);
  filter: saturate(0.92) contrast(1.03);
}
.piece:hover .piece__img { transform: scale(1.045); }

.piece__cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.6rem 1.1rem 1rem;
  background: linear-gradient(180deg, transparent, rgba(12, 9, 7, 0.92));
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--ease-soft), transform 0.5s var(--ease-out);
}
.piece:hover .piece__cap,
.piece:focus-visible .piece__cap { opacity: 1; transform: none; }
.piece__name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
  line-height: 1.3;
}
.piece__cat {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: rgba(232, 210, 140, 0.8);
}

@media (prefers-reduced-motion: reduce) {
  .piece { opacity: 1; transform: none; }
}

/* --- Lightbox ----------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(5, 16, 11, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease-soft), visibility 0.45s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
  width: 100%;
  max-width: 1180px;
  max-height: 100%;
}
.lightbox__figure {
  display: grid;
  place-items: center;
  min-height: 0;
}
.lightbox__img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border: 1px solid rgba(212, 175, 55, 0.25);
  background: var(--espresso-900);
}

.lightbox__meta { color: var(--cream); }
.lightbox__cat {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--gold-300);
}
.lightbox__name {
  margin: 0.9rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 400;
  line-height: 1.2;
}
.lightbox__desc {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  line-height: 1.75;
  color: rgba(246, 241, 230, 0.72);
}
.lightbox__rule {
  height: 1px;
  margin: 1.5rem 0;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.6), transparent);
}
.lightbox__count {
  font-size: 0.67rem;
  letter-spacing: 0.24em;
  color: rgba(246, 241, 230, 0.4);
}
.lightbox .btn { margin-top: 1.4rem; }

.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border: 1px solid rgba(232, 210, 140, 0.35);
  color: var(--gold-200);
  background: rgba(16, 12, 10, 0.6);
  transition: background-color 0.4s, color 0.4s, border-color 0.4s;
}
.lightbox__close:hover,
.lightbox__nav:hover { background: var(--gold-500); color: var(--espresso-950); border-color: var(--gold-500); }
.lightbox__close { top: clamp(0.85rem, 2.4vw, 1.6rem); right: clamp(0.85rem, 2.4vw, 1.6rem); }
.lightbox__nav--prev { left: clamp(0.5rem, 1.6vw, 1.2rem); top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: clamp(0.5rem, 1.6vw, 1.2rem); top: 50%; transform: translateY(-50%); }
.lightbox__close svg, .lightbox__nav svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.4; }

@media (max-width: 860px) {
  /* A phone cannot hold a plate, a description and three controls in
     one screen, so the stage becomes a sheet that scrolls inside the
     lightbox. The lightbox keeps its own full-bleed ground and gives
     up a strip at the foot; the arrows live in that strip. Floating
     them over the sheet instead — which is what the desktop layout
     effectively does — lands them on top of a control. */
  .lightbox {
    place-items: start center;
    overflow: hidden;
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
  }
  .lightbox__stage {
    grid-template-columns: 1fr;
    align-content: start;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  /* Smaller plate and a tighter rhythm on a phone: between them they
     buy back the height the three controls need, so most pieces fit
     the screen outright and only the wordiest have to be scrolled. */
  .lightbox__img { max-height: 36vh; }
  .lightbox__name { margin-top: 0.6rem; }
  .lightbox__desc { margin-top: 0.7rem; line-height: 1.6; }
  .lightbox__rule { margin: 1rem 0; }
  .lightbox__actions { margin-top: 1rem; }
  .lightbox .btn { padding: 0.9em 1.4em; letter-spacing: 0.16em; }
  /* The sheet's own scrollbar reads as a stray line down the artwork;
     the clipped edge and the arrows are affordance enough. */
  .lightbox__stage { scrollbar-width: none; }
  .lightbox__stage::-webkit-scrollbar { width: 0; height: 0; }
  /* The close sits over the top of the plate, as it always has. */
  .lightbox__close,
  .lightbox__nav {
    position: fixed;
    background: var(--espresso-900);
    box-shadow: 0 2px 14px rgba(5, 4, 3, 0.55);
  }
  .lightbox__nav {
    top: auto;
    bottom: calc(1.1rem + env(safe-area-inset-bottom));
    transform: none;
  }
  .lightbox__nav--prev { left: 50%; margin-left: -56px; }
  .lightbox__nav--next { right: 50%; margin-right: -56px; }
  .lightbox__meta { padding-bottom: 1.25rem; }
}
}


/* --- Progressive disclosure ---------------------------------------
   34 pieces in a single mobile column is an enormous scroll, so the
   grid opens with one screenful and grows on request.
------------------------------------------------------------------ */
.piece.is-over { display: none; }

.more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  margin-top: clamp(2rem, 4vh, 3rem);
}
.more__count {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: rgba(246, 241, 230, 0.45);
  font-variant-numeric: tabular-nums;
}
.more__btn[hidden] { display: none; }

@media (max-width: 560px) {
  .gallery { padding-top: clamp(3.2rem, 7vh, 4.5rem); padding-bottom: clamp(3rem, 6vh, 4rem); }
  .gallery__head { margin-bottom: 1.8rem; }
  .filters { margin-bottom: 1.4rem; }
  .chip { grid-template-columns: 38px minmax(0, 1fr); gap: 0.55rem; padding: 0.4rem 0.5rem 0.4rem 0.4rem; }
  .chip__frame { width: 38px; height: 38px; }
  .chip__name { font-size: 0.7rem; }
  .chip__n { font-size: 0.66rem; letter-spacing: 0.12em; }
  .gallery__blurb { font-size: 0.95rem; margin-bottom: 1.4rem; min-height: 0; }
  .piece__cap { padding: 1.6rem 0.7rem 0.7rem; }
  .piece__name { font-size: 0.86rem; }
  .piece__cat { font-size: 0.66rem; letter-spacing: 0.18em; }
}

/* ==================================================================
   Studio — the owner's add-a-photo panel. Hidden entirely unless the
   published page grants this viewer write access.
================================================================== */
.studio[hidden] { display: none; }
.studio {
  margin-top: clamp(2.5rem, 6vh, 4rem);
  padding: clamp(1.5rem, 3.5vw, 2.4rem);
  border: 1px solid rgba(212, 175, 55, 0.28);
  background: rgba(30, 23, 18, 0.55);
}
.studio__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.studio__title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 500;
  color: var(--cream);
}
.studio__hint {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(232, 210, 140, 0.7);
}

.studio__grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: start;
}
@media (max-width: 640px) { .studio__grid { grid-template-columns: 1fr; } }

.studio__drop {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 1px dashed rgba(212, 175, 55, 0.4);
  background: rgba(16, 12, 10, 0.5);
  overflow: hidden;
}
.studio__drop img { width: 100%; height: 100%; object-fit: cover; }
.studio__drop:empty::after {
  content: "No photo chosen";
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(232, 210, 140, 0.4);
}

.studio__fields { display: grid; gap: 0.9rem; }
.studio__fields .field label { color: var(--gold-300); }
.studio__fields input,
.studio__fields select,
.studio__fields textarea {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--cream);
  padding: 0.75em 0.9em;
  background: rgba(16, 12, 10, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.studio__fields textarea { min-height: 4.5rem; resize: vertical; }
.studio__fields input:focus,
.studio__fields select:focus,
.studio__fields textarea:focus {
  outline: none;
  border-color: var(--gold-400);
}
.studio__fields input[type="file"] { padding: 0.6em; font-size: 0.78rem; }
.studio__row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
@media (max-width: 520px) { .studio__row2 { grid-template-columns: 1fr; } }

.studio__status {
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(246, 241, 230, 0.7);
  min-height: 1.2em;
}
.studio__status.is-error { color: var(--gold-300); }

.studio__list { list-style: none; margin: 1.75rem 0 0; padding: 1.5rem 0 0; display: grid; gap: 0.6rem; border-top: 1px solid rgba(212, 175, 55, 0.18); }
.studio__empty { margin: 0; font-size: 0.85rem; color: rgba(246, 241, 230, 0.5); }
.studio__row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
}
.studio__row img { width: 44px; height: 44px; object-fit: cover; border: 1px solid rgba(212, 175, 55, 0.25); }
.studio__row-name { font-size: 0.9rem; color: rgba(246, 241, 230, 0.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio__remove {
  padding: 0.5em 0.9em;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(246, 241, 230, 0.7);
  border: 1px solid rgba(246, 241, 230, 0.25);
  transition: color 0.35s, border-color 0.35s;
}
.studio__remove:hover { color: var(--brick-500); border-color: var(--brick-500); }
.studio__remove:disabled { opacity: 0.4; pointer-events: none; }

/* --- Closing note -------------------------------------------------- */
.gallery__note {
  margin: clamp(2.5rem, 6vh, 4rem) auto 0;
  max-width: 40rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.7;
  color: rgba(246, 241, 230, 0.72);
}
.gallery__note a {
  color: var(--gold-300);
  border-bottom: 1px solid rgba(232, 210, 140, 0.4);
  padding-bottom: 1px;
  transition: color 0.4s, border-color 0.4s;
}
.gallery__note a:hover { color: var(--cream); border-color: var(--cream); }
@media (max-width: 560px) {
  .gallery__note { margin-top: 2rem; font-size: 0.98rem; }
}

/* --- Price ---------------------------------------------------------
   A real price reads as brass and confident; an unpriced piece says so
   quietly, so the two never look like the same kind of statement.
------------------------------------------------------------------ */
.lightbox__price {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 500;
  color: var(--gold-300);
  font-variant-numeric: tabular-nums;
}
.lightbox__price.is-enquiry {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: rgba(246, 241, 230, 0.55);
}

.lightbox__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  margin-top: 1.4rem;
}
.lightbox__actions .btn { margin-top: 0; }
