/**
 * Tangibles public UI — boutique gallery-shop (Phase G).
 * Loaded only on tangibles list/detail (via extra_css).
 * Do not reuse resource-card / resource-category-badge patterns here.
 */

/* -------------------------------------------------------------------------- */
/* Tokens                                                                      */
/* -------------------------------------------------------------------------- */
.tangibles-page {
  --tg-stone: #5c564e;
  --tg-stone-soft: #8a8378;
  --tg-stone-muted: #a39e95;
  --tg-surface: #f7f5f2;
  --tg-surface-2: #efece7;
  --tg-border: #e0dbd3;
  --tg-text: #2c2926;
  --tg-text-muted: #6b6560;
  --tg-chip-bg: #f0ede8;
  --tg-chip-border: #cfc8bc;
  --tg-chip-text: #4a453f;
  --tg-chip-active-bg: #3d3a36;
  --tg-chip-active-text: #f7f5f2;
  --tg-sold-bg: rgba(45, 42, 38, 0.88);
  --tg-radius: 0.75rem;
  --tg-radius-sm: 0.5rem;
  --tg-shadow: 0 0.25rem 1rem rgba(44, 41, 38, 0.08);
  --tg-shadow-hover: 0 0.5rem 1.25rem rgba(44, 41, 38, 0.12);
  --tg-space: 1.5rem;
  color: var(--tg-text);
}

/* -------------------------------------------------------------------------- */
/* List hero — contained banner (page container width, not full-bleed)         */
/* Light fabric photo + soft centre wash for type. Placeholder only.           */
/* -------------------------------------------------------------------------- */
.tangibles-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Medium-tall contained banner */
  min-height: clamp(15rem, 40vh, 22rem);
  margin: 0 0 1.5rem;
  overflow: hidden;
  color: var(--tg-text);
  background: var(--tg-surface-2);
  border-radius: var(--tg-radius);
  border: 1px solid var(--tg-border);
  box-shadow: var(--tg-shadow);
}

.tangibles-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Folds composition sits well slightly low-centre */
  object-position: 50% 45%;
  display: block;
}

.tangibles-hero__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Soft dark wash so white type stays readable on bright photos */
  background: radial-gradient(
    ellipse 75% 85% at 50% 50%,
    rgba(20, 18, 16, 0.55) 0%,
    rgba(20, 18, 16, 0.32) 50%,
    rgba(20, 18, 16, 0.12) 100%
  );
}

.tangibles-hero__copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  text-align: center;
}

.tangibles-hero__title {
  font-size: clamp(2.15rem, 4.5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 0.65rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 2px 12px rgba(0, 0, 0, 0.25);
  background: none;
  -webkit-text-fill-color: currentColor;
}

.tangibles-hero__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.55;
  margin: 0 auto;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* -------------------------------------------------------------------------- */
/* Coming Soon (light polish — still gated)                                    */
/* -------------------------------------------------------------------------- */
.tangibles-coming-soon {
  max-width: 28rem;
  margin: 4rem auto;
  text-align: center;
  padding: 2rem 1rem;
}

.tangibles-coming-soon h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--tg-text);
  margin-bottom: 1rem;
}

.tangibles-coming-soon p {
  color: var(--tg-text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.tangibles-coming-soon a {
  color: var(--tg-stone);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.tangibles-coming-soon a:hover {
  color: var(--tg-text);
}

/* -------------------------------------------------------------------------- */
/* Filters                                                                     */
/* -------------------------------------------------------------------------- */
.tangibles-filters {
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--tg-surface);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
}

/* Shared filter rows — flex avoids Bootstrap grid half-width drift */
.tangibles-filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.25rem;
}

.tangibles-filters__row--facets {
  margin-top: 0;
}

.tangibles-filters__type {
  flex: 1 1 12rem;
  min-width: 0;
}

.tangibles-filters__material {
  flex: 0 1 14rem;
  min-width: 10rem;
}

.tangibles-filters__material .form-select {
  border-color: var(--tg-border);
  background: #fff;
  font-size: 0.9rem;
  width: 100%;
  max-width: 16rem;
}

.tangibles-filters__meta {
  font-size: 0.9rem;
  color: var(--tg-text-muted);
  margin-top: 0.85rem;
  margin-bottom: 0;
}

.tangibles-filters__meta a {
  color: var(--tg-stone);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.tangibles-type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.tangibles-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--tg-chip-text);
  background: var(--tg-chip-bg);
  border: 1px solid var(--tg-chip-border);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tangibles-chip:hover {
  color: var(--tg-text);
  border-color: var(--tg-stone-soft);
  background: #e8e4dc;
}

.tangibles-chip.is-active {
  color: var(--tg-chip-active-text);
  background: var(--tg-chip-active-bg);
  border-color: var(--tg-chip-active-bg);
}

.tangibles-chip--static {
  cursor: default;
  pointer-events: none;
}

.tangibles-filters__toggle {
  color: var(--tg-stone);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.9rem;
}

.tangibles-filters__toggle:hover {
  color: var(--tg-text);
}

.tangibles-filters__toggle[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.tangibles-filters__toggle .bi-chevron-down {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* -------------------------------------------------------------------------- */
/* Grid                                                                        */
/* -------------------------------------------------------------------------- */
.tangibles-grid {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1.75rem;
}

/* -------------------------------------------------------------------------- */
/* Card — portrait photo-first                                                 */
/* -------------------------------------------------------------------------- */
.tangible-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.tangible-card:hover {
  box-shadow: var(--tg-shadow-hover);
  transform: translateY(-2px);
}

.tangible-card.is-sold {
  opacity: 0.82;
  filter: grayscale(0.28);
}

.tangible-card.is-sold:hover {
  transform: none;
  box-shadow: var(--tg-shadow);
}

/* Whole-card hit target; CTAs sit above it */
.tangible-card__hitarea {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.tangible-card__hitarea:focus-visible {
  outline: 2px solid var(--tg-stone);
  outline-offset: 2px;
}

.tangible-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--tg-surface-2);
  overflow: hidden;
}

.tangible-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tangible-card__media .tangible-card__img--secondary {
  opacity: 0;
  transition: opacity 0.45s ease;
}

/* Desktop hover second image; sold still peeks; reduced-motion keeps primary */
@media (hover: hover) and (min-width: 992px) {
  .tangible-card:hover .tangible-card__img--secondary {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tangible-card {
    transition: none;
  }

  .tangible-card:hover {
    transform: none;
  }

  .tangible-card__media .tangible-card__img--secondary {
    transition: none;
  }

  .tangible-card:hover .tangible-card__img--secondary {
    opacity: 0;
  }
}

.tangible-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-stone-muted);
  font-size: 2rem;
  background: var(--tg-surface-2);
}

.tangible-card__sold-label {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 2;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--tg-sold-bg);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.tangible-card__body {
  /* Do not set z-index on the body. A body stacking context at z-index:0 would
     sit under .tangible-card__hitarea (z-index:1), so CTAs could never receive
     clicks even with a higher z-index on .tangible-card__actions. Leave body
     unscoped so actions (z-index:2) compete at the card level above the link. */
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1rem 1.1rem 1.15rem;
  gap: 0.4rem;
}

.tangible-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--tg-text);
  margin: 0;
}

.tangible-card.is-sold .tangible-card__title {
  color: var(--tg-text-muted);
}

.tangible-card__summary {
  font-size: 0.875rem;
  color: var(--tg-text-muted);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

/* Markdown may emit block elements; keep card clamp tight. */
.tangible-card__summary > :first-child {
  margin-top: 0;
}
.tangible-card__summary > :last-child {
  margin-bottom: 0;
}
.tangible-card__summary p {
  margin: 0;
}

.tangible-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.tangible-card__price {
  font-weight: 600;
  font-size: 1rem;
  color: var(--tg-text);
}

.tangible-card__price.is-tba {
  font-weight: 500;
  color: var(--tg-stone-muted);
  font-size: 0.9rem;
}

.tangible-card.is-sold .tangible-card__price {
  color: var(--tg-text-muted);
}

/* Must sit above .tangible-card__hitarea so HTMX Add to basket / View work. */
.tangible-card__actions {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-top: 0.35rem;
}

.tangible-card__actions .btn {
  font-size: 0.875rem;
}

/* -------------------------------------------------------------------------- */
/* Empty states                                                                */
/* -------------------------------------------------------------------------- */
.tangibles-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--tg-text-muted);
  background: var(--tg-surface);
  border: 1px dashed var(--tg-border);
  border-radius: var(--tg-radius);
}

.tangibles-empty h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--tg-stone);
  margin-bottom: 0.5rem;
}

.tangibles-empty p {
  margin-bottom: 0.75rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.tangibles-empty a {
  color: var(--tg-stone);
}

/* -------------------------------------------------------------------------- */
/* Detail page                                                                 */
/* -------------------------------------------------------------------------- */
.tangible-detail {
  padding-bottom: 2.5rem;
}

/*
 * Override legacy custom.css .tangible-gallery { height: 280px; overflow: hidden }
 * which clipped the thumbnail strip (and squashed the main image into a short box).
 * tangibles.css is loaded after custom.css on list/detail templates.
 */
.tangibles-page .tangible-gallery,
.tangible-detail .tangible-gallery {
  position: relative;
  height: auto;
  max-height: none;
  overflow: visible;
  border-radius: 0;
  box-shadow: none;
}

.tangibles-page .tangible-gallery__main,
.tangible-detail .tangible-gallery__main {
  position: relative;
  border-radius: var(--tg-radius);
  overflow: hidden;
  /* White letterbox when photo doesn't fill the frame (object-fit: contain) */
  background: #fff;
  box-shadow: var(--tg-shadow);
  border: 1px solid var(--tg-border);
  /* Natural product photo frame — less aggressive than forced 4:5 cover */
  aspect-ratio: 1 / 1;
  max-height: min(75vh, 560px);
  width: 100%;
}

.tangibles-page .tangible-gallery__main img,
.tangible-detail .tangible-gallery__main img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tangibles-page .tangible-gallery.is-sold .tangible-gallery__main,
.tangible-detail .tangible-gallery.is-sold .tangible-gallery__main {
  filter: grayscale(0.25);
  opacity: 0.9;
}

.tangible-gallery__sold-label {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 3;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--tg-sold-bg);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.tangibles-page .tangible-gallery__thumbs,
.tangible-detail .tangible-gallery__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.tangibles-page .tangible-gallery__thumb,
.tangible-detail .tangible-gallery__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 4.75rem;
  height: 4.75rem;
  min-width: 4.75rem;
  min-height: 4.75rem;
  padding: 0;
  margin: 0;
  border: 2px solid var(--tg-chip-border);
  border-radius: var(--tg-radius-sm);
  overflow: hidden;
  background: var(--tg-surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* Reset Bootstrap/reboot button look */
  appearance: none;
  -webkit-appearance: none;
  line-height: 0;
  color: inherit;
}

/* Don't let legacy `.tangible-gallery img { height:100% }` blow thumb imgs up */
.tangibles-page .tangible-gallery__thumb img,
.tangible-detail .tangible-gallery__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.tangibles-page .tangible-gallery__thumb:hover,
.tangible-detail .tangible-gallery__thumb:hover {
  border-color: var(--tg-stone-soft);
}

.tangibles-page .tangible-gallery__thumb:focus-visible,
.tangible-detail .tangible-gallery__thumb:focus-visible {
  outline: 2px solid var(--tg-stone);
  outline-offset: 2px;
}

.tangibles-page .tangible-gallery__thumb[aria-current="true"],
.tangible-detail .tangible-gallery__thumb[aria-current="true"] {
  border-color: var(--tg-stone);
  box-shadow: 0 0 0 1px var(--tg-stone);
}

.tangible-detail__info {
  background: #fff;
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
  padding: 1.5rem 1.5rem 1.35rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tangible-detail__info.is-sold {
  opacity: 0.95;
}

.tangible-detail__title {
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--tg-text);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.tangible-detail__staff {
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}

.tangible-detail__staff a {
  color: var(--tg-stone-soft);
  text-decoration: none;
}

.tangible-detail__staff a:hover {
  color: var(--tg-stone);
  text-decoration: underline;
}

.tangible-detail__price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.tangible-detail__price {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--tg-text);
  letter-spacing: -0.01em;
}

.tangible-detail__price.is-tba {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--tg-stone-muted);
}

.tangible-detail__sold-state {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tg-stone);
}

.tangible-detail__materials {
  font-size: 0.95rem;
  color: var(--tg-text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.tangible-detail__materials strong {
  font-weight: 600;
  color: var(--tg-stone);
}

.tangible-detail__meta {
  font-size: 0.875rem;
  color: var(--tg-stone-muted);
  margin-bottom: 1rem;
}

.tangible-detail__summary {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--tg-text);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tangible-detail__summary > :first-child {
  margin-top: 0;
}
.tangible-detail__summary > :last-child {
  margin-bottom: 0;
}

.tangible-detail__cta .btn {
  font-weight: 500;
}

.tangible-detail__sold-note {
  font-size: 0.875rem;
  color: var(--tg-text-muted);
  text-align: center;
  margin-top: 0.65rem;
  margin-bottom: 0;
}

.tangible-detail__description {
  margin-top: 2.5rem;
  padding: 1.5rem 1.6rem 1.45rem;
  background: var(--tg-surface);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  box-shadow: var(--tg-shadow);
}

.tangible-detail__description h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--tg-stone);
  margin: 0 0 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--tg-border);
}

.tangible-detail__description-body {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--tg-text);
  max-width: 48rem;
}

.tangible-detail__description-body p:last-child {
  margin-bottom: 0;
}

/* Related strip */
.tangibles-related {
  margin-top: 3rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--tg-border);
}

.tangibles-related h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--tg-text);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

/* Pagination soft */
.tangibles-page .pagination .page-link {
  color: var(--tg-stone);
  border-color: var(--tg-border);
}

.tangibles-page .pagination .page-item.active .page-link {
  background-color: var(--tg-chip-active-bg);
  border-color: var(--tg-chip-active-bg);
  color: #fff;
}

.tangibles-page .pagination .page-link:hover {
  background-color: var(--tg-surface);
  color: var(--tg-text);
}

/* Staff add button quieter */
.tangibles-staff-actions .btn {
  border-color: var(--tg-border);
  color: var(--tg-stone);
}

.tangibles-staff-actions .btn:hover {
  background: var(--tg-surface);
  border-color: var(--tg-stone-soft);
  color: var(--tg-text);
}
