.wreath-gallery {
  background: #fdfcf8;
}

.wreath-gallery main {
  max-width: 880px;
}

.gallery-heading {
  --heading-photo-width: 34%;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 16px clamp(12px, 3vw, 32px);
  min-height: 104px;
  margin-bottom: 16px;
  border: 1px solid #d5dfcb;
  border-radius: 20px;
  background: linear-gradient(110deg, #eff3e7 32%, #fbf8ee 76%, #edf2e6);
  text-align: center;
}

.gallery-heading::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: var(--heading-photo-width);
  border-radius: inherit;
  background: url("/assets/wreath-photo.webp") center 23% / cover;
  -webkit-mask-image: linear-gradient(90deg, #000 22%, transparent);
  mask-image: linear-gradient(90deg, #000 22%, transparent);
}

.gallery-heading h1 {
  grid-column: 2;
  color: #33492c;
  font-size: clamp(27px, 4vw, 42px);
  letter-spacing: -.035em;
  line-height: 1.1;
}

.gallery-brand {
  justify-self: end;
  display: block;
  width: clamp(42px, 9vw, 68px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 3px;
  border: 1px solid #d8e2d1;
  border-radius: 50%;
  background: #fdfcf8;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-bottom: 16px;
}

.gallery-years,
.gallery-types {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.gallery-filters:has([hidden] + [hidden]) {
  display: none;
}

.gallery-years button {
  min-width: 44px;
  padding: 4px 7px;
}

.gallery-calendar {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 29px;
  padding: 7px 3px 0;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.gallery-calendar::before {
  content: "";
  position: absolute;
  inset: 6px 0 auto;
  border-top: 1px solid currentColor;
}

.gallery-calendar::after {
  content: "";
  position: absolute;
  top: -3px;
  inset-inline: 7px;
  height: 5px;
  border-inline: 1px solid currentColor;
}

.gallery-types button {
  background: var(--type-background);
  border-color: var(--type-border);
  color: var(--type-ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 5px 8px;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.gallery-types {
  align-items: center;
}

.gallery-types [data-type="round"] {
  --type-background: #eef4e8;
  --type-border: #c6d5bb;
  --type-ink: #3c5534;
  --type-selected: #dce9d2;
  --type-selected-border: #819b72;
}

.gallery-types [data-type="candy-cane"] {
  --type-background: #fbefed;
  --type-border: #e6c8c2;
  --type-ink: #783f3c;
  --type-selected: #f1dcd8;
  --type-selected-border: #b77f76;
}

.gallery-types [data-type="trio"] {
  --type-background: #eff1f8;
  --type-border: #cbd2e5;
  --type-ink: #444f72;
  --type-selected: #dfe5f3;
  --type-selected-border: #8290b1;
}

.gallery-types button:hover,
.gallery-types button[aria-pressed="true"] {
  background: var(--type-selected);
  border-color: var(--type-selected-border);
}

.gallery-types button[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px var(--type-selected-border);
  font-weight: 600;
}

.gallery-types svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-years button[aria-pressed="true"] {
  background: #e4eddc;
  border-color: #9fb291;
  color: #405734;
  font-weight: 600;
}

.gallery-card {
  padding: clamp(12px, 3vw, 24px);
  margin: 0;
}

.gallery-empty {
  margin: 0;
  padding: 24px 8px;
  text-align: center;
}

.gallery-stage {
  display: grid;
  place-items: center;
  height: clamp(224px, 62vh, 600px);
  border-radius: 12px;
  overflow: clip;
  touch-action: pan-y pinch-zoom;
  background: var(--pale);
  border: 1px solid var(--border);
}

.gallery-stage img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.gallery-error {
  margin: 0;
}

.gallery-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px 12px;
  padding-top: 16px;
}

.gallery-controls .secondary {
  white-space: nowrap;
  padding-inline: clamp(9px, 2vw, 18px);
  gap: 6px;
}

#gallery-prev { justify-self: start; }
#gallery-next { justify-self: end; }

.gallery-controls .gallery-count {
  margin: 0;
  white-space: nowrap;
  text-align: center;
}

.gallery-controls .gallery-play {
  grid-column: 1 / -1;
  justify-self: center;
  min-height: 44px;
}

.gallery-admin-pill,
.gallery-admin-pill:hover {
  display: flex;
  margin: 12px auto 0;
  min-width: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
}

.gallery-admin-pill span {
  margin: 0;
  padding: 3px 9px;
  background: var(--pale);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.gallery-admin-pill:hover span {
  background: #e4eddc;
}

#gallery-login input {
  max-width: 14rem;
}

#gallery-edit-preview {
  display: block;
  max-width: 100%;
  height: 140px;
  object-fit: contain;
  margin: 16px auto;
  border-radius: 10px;
}

#gallery-edit-alt {
  margin-bottom: 12px;
}

.gallery-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-editor-actions .gallery-delete {
  color: #853e34;
  background: #fbf1ed;
  border-color: #e8cfc6;
}

.gallery-confirm {
  margin-top: 12px;
  padding: 12px;
  background: #fbf1ed;
  border: 1px solid #e8cfc6;
  border-radius: 10px;
}

#gallery-logout {
  margin-top: 12px;
}

#gallery-crop-canvas {
  display: block;
  max-width: 100%;
  max-height: 42dvh;
  width: auto;
  height: auto;
  margin: 0 auto 12px;
  cursor: crosshair;
  touch-action: none;
}

.gallery-crop-sliders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.gallery-crop-sliders input {
  padding: 0;
  border: 0;
  background: transparent;
  margin: 0;
  accent-color: var(--sage-dark);
}

@media (max-width: 520px) {
  .wreath-gallery main {
    padding-inline: 14px;
  }

  .gallery-heading {
    --heading-photo-width: 25%;
  }

  .gallery-stage {
    height: clamp(224px, 55vh, 460px);
  }
}

@media (orientation: landscape) and (min-width: 740px) {
  .wreath-gallery {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100vh;
    height: 100dvh;
  }

  .wreath-gallery main {
    display: flex;
    flex-direction: column;
    width: min(100%, 1440px);
    max-width: none;
    min-height: 0;
    margin: 0 auto;
    padding: 8px 24px 6px;
  }

  .gallery-heading {
    min-height: 76px;
    padding-block: 8px;
    margin-bottom: 8px;
    border-radius: 14px;
  }

  .gallery-brand {
    width: 54px;
  }

  .gallery-filters {
    margin-bottom: 6px;
  }

  .gallery-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 8px 12px;
  }

  .gallery-stage {
    flex: 1;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    min-height: 0;
    height: auto;
  }

  .gallery-controls {
    grid-template-columns: auto 1fr auto auto;
    padding-top: 6px;
  }

  .gallery-controls .gallery-play {
    grid-column: auto;
    min-width: 104px;
  }

  .wreath-gallery footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(100%, 1392px);
    max-width: none;
    padding: 3px 16px 4px;
  }

  .wreath-gallery footer span,
  .gallery-admin-pill,
  .gallery-admin-pill:hover {
    margin: 0;
  }
}
