/* ======================================
   Gallery modal‐carousel image constraints
   ====================================== */
.gallery-shell {
  max-width: 1480px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.gallery-shell.has-sidebar {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.gallery-shell.no-sidebar {
  display: block;
  max-width: 1220px;
}

.gallery-sidebar {
  position: sticky;
  top: 1rem;
  background: #f9f1e3;
  border-radius: 8px;
  padding: 1rem;
}

.gallery-sidebar h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: #865507;
}

.gallery-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery-sidebar li + li {
  margin-top: 0.5rem;
}

.gallery-sidebar a {
  display: block;
  text-decoration: none;
  color: #333;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.gallery-sidebar a:hover,
.gallery-sidebar a:focus {
  background-color: rgba(200, 133, 24, 0.15);
}

.gallery-main {
  min-width: 0;
}

.gallery-main > .container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.gallery-admin {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-toolbar h1 {
  margin: 0;
  color: #2f220e;
  font-family: var(--font-title);
  font-size: 2rem;
}

.gallery-eyebrow {
  margin: 0 0 0.2rem;
  color: #865507;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.gallery-filter-panel {
  background: rgba(255, 248, 234, 0.92);
  border: 1px solid rgba(136, 86, 7, 0.22);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(136, 86, 7, 0.12);
}

.gallery-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(140px, auto) auto;
  gap: 0.85rem;
  align-items: end;
}

.gallery-field,
.gallery-check-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: #3f300f;
  font-size: 0.9rem;
  font-weight: 700;
}

.gallery-check-field {
  min-height: 42px;
  flex-direction: row;
  align-items: center;
}

.gallery-field select,
.gallery-field input {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(74, 46, 0, 0.28);
  border-radius: 6px;
  background: #ffffff;
  color: #251b09;
  font: inherit;
}

.gallery-field select[multiple] {
  min-height: 40px;
  max-height: 84px;
}

.gallery-filter-actions .btn,
.gallery-secondary-action,
.gallery-small-action {
  border-radius: 8px;
  white-space: nowrap;
}

.gallery-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 1rem;
}

.gallery-item-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  background: #fffaf0;
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
}

.gallery-card-media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f9f1e3;
}

.gallery-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0.35rem;
  object-fit: contain;
  object-position: center;
}

.gallery-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.9rem;
}

.gallery-card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.gallery-card-title-row h2 {
  margin: 0;
  color: #2f220e;
  font-size: 1.05rem;
  line-height: 1.25;
}

.gallery-card-title-row strong {
  color: #865507;
  font-size: 0.98rem;
}

.gallery-card-body p {
  margin: 0;
  color: #5f5140;
  font-size: 0.9rem;
}

.gallery-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.gallery-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #f2eadc;
  color: #433016;
  font-size: 0.78rem;
  font-weight: 700;
}

.gallery-badge.is-available,
.gallery-badge.is-active {
  background: #e5f4df;
  color: #28551f;
}

.gallery-badge.is-archived,
.gallery-badge.is-muted {
  background: #ece7df;
  color: #5a5147;
}

.gallery-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.9rem 0.9rem;
}

.gallery-card-actions form {
  margin: 0;
}

.gallery-small-action {
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(136, 86, 7, 0.28);
  background: #fff4dc;
  color: #704400;
  box-shadow: none;
  font-size: 0.85rem;
}

.gallery-small-action.is-warning {
  background: #fff1c7;
  color: #6b4600;
}

.gallery-small-action.is-success {
  background: #e6f4dc;
  color: #28551f;
}

.gallery-small-action.is-danger {
  background: #f8e1dc;
  color: #7f2416;
}

.gallery-empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  background: rgba(255, 248, 234, 0.9);
  border: 1px dashed rgba(136, 86, 7, 0.28);
  border-radius: 8px;
}

.gallery-pagination ul {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-pagination a,
.gallery-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(136, 86, 7, 0.22);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.9);
}

.gallery-pagination a.is-current {
  background: #865507;
  color: #ffffff;
}

.gallery-detail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1.25rem;
}

.gallery-detail-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-detail-header h1 {
  margin: 0;
  color: #2f220e;
  font-family: var(--font-title);
  font-size: 1.8rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.gallery-detail-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 1.25rem;
  align-items: start;
}

.gallery-detail.is-public-detail .gallery-detail-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 360px);
}

.gallery-detail.is-public-detail .gallery-detail-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.gallery-detail-media {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 0.8rem;
}

.gallery-detail-media img {
  display: block;
  width: 100%;
  height: clamp(220px, 42vw, 420px);
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  object-fit: contain;
  object-position: center;
  background: #f9f1e3;
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
}

.gallery-detail-panel,
.gallery-detail-notes section {
  min-width: 0;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
}

.gallery-detail-panel {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.gallery-price-line {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(136, 86, 7, 0.16);
}

.gallery-price-line span {
  color: #5f5140;
  font-weight: 700;
}

.gallery-price-line strong {
  color: #865507;
  font-size: 1.25rem;
  white-space: nowrap;
}

.gallery-meta-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.gallery-meta-list div {
  display: grid;
  gap: 0.15rem;
}

.gallery-meta-list dt {
  color: #6b5b46;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.gallery-meta-list dd {
  margin: 0;
  color: #2f220e;
  overflow-wrap: anywhere;
}

.gallery-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gallery-public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gallery-public-actions .btn {
  width: 100%;
  justify-content: center;
}

.gallery-detail-actions form {
  margin: 0;
}

.gallery-detail-notes {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.gallery-detail-notes section {
  margin: 0;
  max-width: none;
  padding: 1rem;
  text-align: left;
}

.gallery-detail-notes h2 {
  margin: 0 0 0.5rem;
  color: #865507;
  font-size: 1.15rem;
}

.gallery-detail-notes p {
  margin: 0;
  color: #2f220e;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.gallery-preorder-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 1rem;
  text-align: left;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
}

.gallery-preorder-panel h2 {
  margin: 0;
  color: #2f220e;
  font-family: var(--font-title);
  font-size: 1.45rem;
}

.gallery-preorder-note {
  margin: 0.45rem 0 0;
  color: #5f5140;
  line-height: 1.45;
}

.gallery-preorder-form {
  display: grid;
  gap: 0.9rem;
}

.gallery-muted-line {
  margin: 0;
  color: #5f5140;
  overflow-wrap: anywhere;
}

.artisan-profile-page {
  display: grid;
  gap: 1.25rem;
}

.artisan-hero {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
  text-align: left;
}

.artisan-photo-frame {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(136, 86, 7, 0.22);
  border-radius: 8px;
  background: #fff8ea;
  box-shadow: 0 6px 14px rgba(136, 86, 7, 0.14);
}

.artisan-photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artisan-photo-frame.is-edit-preview {
  max-width: 220px;
}

.artisan-hero-copy {
  min-width: 0;
}

.artisan-hero-copy h1 {
  margin: 0;
  color: #2f220e;
  font-family: var(--font-title);
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.05;
}

.artisan-hero-copy p {
  max-width: 780px;
  margin: 0.75rem 0 0;
  color: #3f300f;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.artisan-contact-line,
.artisan-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.artisan-contact-line a {
  color: #704400;
  font-weight: 700;
}

.gallery-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.gallery-section-header h2 {
  margin: 0;
}

.artisan-card-link,
.artisan-mini-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #704400;
  font-weight: 700;
  text-decoration: none;
}

.artisan-card-link {
  margin-top: 0.25rem;
}

.artisan-card-link img,
.artisan-mini-link img {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 50%;
  object-fit: cover;
  background: #fff8ea;
}

.artisan-mini-link img {
  width: 46px;
  height: 46px;
}

.artisan-edit-layout {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.gallery-form-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.gallery-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-form-header h1 {
  margin: 0;
  color: #2f220e;
  font-family: var(--font-title);
  font-size: 1.8rem;
  line-height: 1.15;
}

.gallery-item-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1080px;
}

.gallery-form-section {
  margin: 0;
  max-width: none;
  padding: 1rem;
  text-align: left;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
}

.gallery-form-section h2 {
  margin: 0 0 0.85rem;
  color: #865507;
  font-size: 1.15rem;
}

.gallery-form-help {
  margin: -0.35rem 0 0.9rem;
  color: #5f5140;
  font-size: 0.92rem;
  line-height: 1.45;
}

.gallery-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.gallery-form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-form-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-form-field,
.gallery-image-upload {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.35rem;
  color: #3f300f;
  font-size: 0.9rem;
  font-weight: 700;
}

.gallery-form-check {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 0.5rem;
  color: #3f300f;
  font-weight: 700;
}

.gallery-form-field input,
.gallery-form-field select,
.gallery-form-field textarea,
.gallery-image-upload input {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(74, 46, 0, 0.28);
  border-radius: 6px;
  background: #ffffff;
  color: #251b09;
  font: inherit;
}

.gallery-form-field textarea {
  resize: vertical;
}

.gallery-form-field select[multiple] {
  min-height: 92px;
}

.gallery-image-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}

.gallery-image-upload {
  padding: 0.85rem;
  background: #fff8ea;
  border: 1px solid rgba(136, 86, 7, 0.16);
  border-radius: 8px;
}

.gallery-photo-input {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: -1px;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0 !important;
  white-space: nowrap;
}

.gallery-photo-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.gallery-photo-action {
  justify-content: center;
  width: 100%;
  min-height: 44px;
}

.gallery-photo-filename {
  display: block;
  min-height: 1.25rem;
  color: #5f5140;
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.gallery-camera-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(37, 27, 9, 0.72);
}

.gallery-camera-panel[hidden] {
  display: none;
}

.gallery-camera-card {
  display: grid;
  width: min(720px, 100%);
  gap: 0.85rem;
  padding: 1rem;
  background: #fff8ea;
  border: 1px solid rgba(136, 86, 7, 0.3);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(37, 27, 9, 0.35);
}

.gallery-camera-video {
  display: block;
  width: 100%;
  max-height: min(62vh, 520px);
  background: #251b09;
  border-radius: 8px;
}

.gallery-camera-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.gallery-form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.gallery-inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 0.9rem;
  align-items: end;
}

.gallery-inline-form.three-columns {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
}

.gallery-inline-form .btn {
  min-height: 40px;
}

.gallery-manager-list {
  display: grid;
  gap: 0.75rem;
}

.gallery-manager-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(74, 46, 0, 0.1);
}

.gallery-manager-row h2 {
  margin: 0;
  color: #2f220e;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.gallery-manager-row p {
  margin: 0.2rem 0 0;
  color: #6b5b46;
  font-size: 0.88rem;
}

.gallery-manager-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.gallery-manager-actions form {
  margin: 0;
}

.preorder-row {
  align-items: stretch;
}

.preorder-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) minmax(260px, auto);
  gap: 0.85rem;
  align-items: end;
}

.preorder-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preorder-status-form {
  display: grid;
  min-width: 180px;
  gap: 0.5rem;
  align-content: center;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.dashboard-card {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: center;
  text-decoration: none;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid rgba(136, 86, 7, 0.2);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 6px 16px rgba(74, 46, 0, 0.12);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-card:hover,
.dashboard-card:focus {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(74, 46, 0, 0.16);
}

.dashboard-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #865507;
}

.dashboard-card p {
  margin: 0;
  color: #2f220e;
  font-size: 1.55rem;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .gallery-detail-layout,
  .gallery-detail.is-public-detail .gallery-detail-layout,
  .gallery-detail-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .gallery-shell,
  .gallery-shell.has-sidebar,
  .gallery-shell.no-sidebar {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }

  .gallery-sidebar {
    position: static;
  }

  .gallery-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-form-grid.three-columns {
    grid-template-columns: 1fr;
  }

  .preorder-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-inline-form,
  .gallery-inline-form.three-columns {
    grid-template-columns: 1fr;
  }

  .artisan-hero,
  .artisan-edit-layout {
    grid-template-columns: 1fr;
  }

  .artisan-photo-frame,
  .artisan-photo-frame.is-edit-preview {
    max-width: 240px;
  }
}

@media (max-width: 620px) {
  .gallery-toolbar,
  .gallery-detail-header,
  .gallery-form-header {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-filter-grid,
  .gallery-card-grid,
  .gallery-form-grid.two-columns,
  .gallery-image-upload-grid {
    grid-template-columns: 1fr;
  }

  .gallery-photo-actions {
    grid-template-columns: 1fr;
  }

  .gallery-manager-row {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-manager-actions {
    justify-content: flex-start;
  }

  .preorder-filter-grid {
    grid-template-columns: 1fr;
  }

  .artisan-photo-frame,
  .artisan-photo-frame.is-edit-preview {
    max-width: none;
  }

  .artisan-profile-actions .btn,
  .artisan-contact-line a {
    width: 100%;
  }
}

.carousel-inner img {
  max-height: 400px;     /* cap the height so it never overflows */
  width: auto;           /* maintain aspect ratio */
  margin: 0 auto;        /* center narrower images */
  object-fit: contain;   /* no stretching */
}

.carousel-item {
  text-align: center;    /* ensure the img container is centered */
}
