/* catalogue.css — the private catalogue: filters, selectable cards, shortlist tray (S315).
 *
 * Everything a script toggles at runtime lives here as plain CSS, NOT as Tailwind
 * utilities: Tailwind only scans the BUILT html (tailwind.config content glob), so a
 * class that only ever exists at runtime would be purged out of app.css.
 */

.cat {
  --cat-gold: #e6c479;
  --cat-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hero fills the screen. svh (not vh) so mobile browsers don't overshoot by the height
   of their own address bar; vh stays as the fallback for older engines. */
.cat-hero {
  min-height: 100vh;
  min-height: 100svh;
}

/* ── Filter bar ─────────────────────────────────────────────────────────────── */
/* A band of black between the hero and the bar, so the pills don't sit straight on
   the photograph. It scrolls away, so the STUCK bar stays compact. */
.cat-filters__lead {
  height: 3.5rem;
  background: #000;
}
@media (min-width: 768px) {
  .cat-filters__lead {
    height: 5rem;
  }
}

/* Sticks under the scrolled header (h-20 = 80px). Near-opaque: at 0.82 the card titles
   scrolling underneath read straight through the bar. */
.cat-filters {
  position: sticky;
  top: 5rem;
  z-index: 30;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
/* No backdrop-filter support = no blur to hide behind, so go fully solid. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .cat-filters {
    background: #000;
  }
}

.cat-filters__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.05rem 0;
}
.cat-filters__row + .cat-filters__row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.cat-filters__label {
  flex: 0 0 auto;
  min-width: 4.5rem;
  font-family: Cinzel, serif;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cat-gold);
}

/* The pill strip scrolls sideways on narrow screens instead of wrapping into a wall. */
.cat-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px;
  margin: -2px;
}
.cat-pills::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex: 0 0 auto;
  padding: 0.55rem 1.1rem;
  font-family: Inter, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #c9c9c9;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.35s var(--cat-ease), border-color 0.35s var(--cat-ease),
    background-color 0.35s var(--cat-ease);
}
.cat-pill:hover {
  color: #fff;
  border-color: rgba(230, 196, 121, 0.55);
}
.cat-pill[aria-pressed='true'] {
  color: #000;
  background: var(--cat-gold);
  border-color: var(--cat-gold);
}

.cat-filters__count {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 1rem;
  font-family: Inter, sans-serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b8b8b;
  white-space: nowrap;
}

/* ── Mobile dropdowns ───────────────────────────────────────────────────────── */
/* A swipeable pill strip hides half its options behind a gesture nobody can see.
   Below the tablet break the same filters become dropdowns: everything is one tap
   away, and the sticky bar stays two rows tall. */
.cat-filters__mobile {
  display: none;
}

.cat-select {
  position: relative;
  min-width: 0;
}

.cat-select__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.35s var(--cat-ease), background-color 0.35s var(--cat-ease);
}
.cat-select__btn:focus-visible {
  outline: 2px solid var(--cat-gold);
  outline-offset: 2px;
}
.cat-select.is-open .cat-select__btn,
.cat-select.is-set .cat-select__btn {
  border-color: rgba(230, 196, 121, 0.6);
  background: rgba(230, 196, 121, 0.06);
}

.cat-select__text {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.cat-select__label {
  font-family: Cinzel, serif;
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cat-gold);
}
.cat-select__value {
  font-family: Inter, sans-serif;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-select__chev {
  flex: 0 0 auto;
  width: 11px;
  height: 8px;
  color: var(--cat-gold);
  transition: transform 0.4s var(--cat-ease);
}
.cat-select.is-open .cat-select__chev {
  transform: rotate(180deg);
}

.cat-select__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #0c0c0c;
  border: 1px solid rgba(230, 196, 121, 0.4);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.9);
  max-height: 58vh;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  /* visibility (not just opacity) — otherwise the closed menu's options stay in the
     tab order and a keyboard visitor tabs into an invisible list. */
  visibility: hidden;
  transition: opacity 0.28s var(--cat-ease), transform 0.28s var(--cat-ease),
    visibility 0s linear 0.28s;
}
.cat-select.is-open .cat-select__menu {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.28s var(--cat-ease), transform 0.28s var(--cat-ease),
    visibility 0s;
}

.cat-select__opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.7rem;
  font-family: Inter, sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #c9c9c9;
  cursor: pointer;
  transition: color 0.25s var(--cat-ease), background-color 0.25s var(--cat-ease);
}
.cat-select__opt:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.cat-select__opt[aria-selected='true'] {
  color: var(--cat-gold);
}
/* The tick that marks the live option. */
.cat-select__opt[aria-selected='true']::after {
  content: '';
  flex: 0 0 auto;
  width: 12px;
  height: 6px;
  border-left: 1.5px solid var(--cat-gold);
  border-bottom: 1.5px solid var(--cat-gold);
  transform: rotate(-45deg) translateY(-2px);
}

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem 2rem;
}
@media (min-width: 640px) {
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Filter cross-fade. is-fading carries the visual state; is-hidden pulls the card out
   of the grid — the script separates them in time so the relayout happens while the
   grid is faded down, instead of snapping under the visitor. */
.cat-card {
  opacity: 1;
  transform: none;
  transition: opacity 0.42s var(--cat-ease), transform 0.42s var(--cat-ease);
}
.cat-card.is-fading {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
}
.cat-card.is-hidden {
  display: none;
}

/* Cards stretch to the tallest in their row, and the body is a column, so the rule +
   Select can be pushed to a shared baseline (see .cat-card__grow). Otherwise a card
   with no features line floats its footer up and the row reads ragged. */
.cat-card {
  display: flex;
  min-width: 0;
}
.cat-card__btn {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cat-card__grow {
  display: block;
  flex: 1 1 auto;
  min-height: 1.5rem; /* the minimum air between the last line and the rule */
}
.cat-card__btn:focus-visible {
  outline: 2px solid var(--cat-gold);
  outline-offset: 4px;
}

.cat-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #141414;
}
/* A hairline inset keeps the darker night shots from dissolving into the black page. */
.cat-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  pointer-events: none;
  transition: box-shadow 0.45s var(--cat-ease);
}
.cat-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1200ms var(--cat-ease), filter 600ms var(--cat-ease);
}
.cat-card__btn:hover .cat-card__media img,
.cat-card__btn:focus-visible .cat-card__media img {
  transform: scale(1.05);
}

.cat-card.is-selected .cat-card__media::after {
  box-shadow: inset 0 0 0 2px var(--cat-gold);
}

/* Select mark: a quiet square (the brand carries no radius anywhere) holding a thin
 * plus, which becomes a gold tile stamped with a dark tick once the card is chosen.
 * The plus is drawn in CSS so the markup stays a single svg. */
.cat-card__mark {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 10, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0.85;
  transition: opacity 0.4s var(--cat-ease), background-color 0.4s var(--cat-ease),
    border-color 0.4s var(--cat-ease), transform 0.4s var(--cat-ease);
}
.cat-card__mark::before,
.cat-card__mark::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  transition: opacity 0.3s var(--cat-ease);
}
.cat-card__mark::before {
  width: 11px;
  height: 1px;
}
.cat-card__mark::after {
  width: 1px;
  height: 11px;
}
.cat-card__btn:hover .cat-card__mark {
  opacity: 1;
  border-color: var(--cat-gold);
  background: rgba(10, 10, 10, 0.5);
}
.cat-card__mark svg {
  width: 15px;
  height: 15px;
  stroke: #0a0a0a;
  stroke-width: 2.5;
  fill: none;
  opacity: 0;
  transform: scale(0.3) rotate(-30deg);
  transition: opacity 0.35s var(--cat-ease), transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cat-card.is-selected .cat-card__mark {
  opacity: 1;
  background: var(--cat-gold);
  border-color: var(--cat-gold);
  transform: scale(1.06);
}
.cat-card.is-selected .cat-card__mark::before,
.cat-card.is-selected .cat-card__mark::after {
  opacity: 0;
}
.cat-card.is-selected .cat-card__mark svg {
  opacity: 1;
  transform: none;
}

/* Once three are chosen, the rest step back rather than disappear. */
.cat-card.is-muted .cat-card__media img {
  filter: grayscale(0.55) brightness(0.62);
}
.cat-card.is-muted .cat-card__mark {
  opacity: 0.25;
}
.cat-card.is-muted .cat-card__body {
  opacity: 0.5;
}

/* Vertical rhythm under the image. The eyebrow must not crowd the photograph:
   it gets a full step of air, and each block below steps down in weight.
   display:block is load-bearing — this is a <span> (the card is a <button>, so its
   contents must be phrasing content), and vertical padding on an inline box paints
   but does not push layout. Without it the eyebrow sits ON the photograph. */
.cat-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding-top: 1.75rem;
  transition: opacity 0.4s var(--cat-ease);
}
.cat-card__eyebrow {
  display: block;
  font-family: Cinzel, serif;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--cat-gold);
  margin-bottom: 0.9rem;
}
.cat-card__title {
  display: block;
  font-family: Cinzel, serif;
  font-size: 19px;
  line-height: 1.32;
  color: #fff;
  overflow-wrap: anywhere;
  transition: color 0.35s var(--cat-ease);
}
.cat-card__btn:hover .cat-card__title,
.cat-card.is-selected .cat-card__title {
  color: var(--cat-gold);
}
.cat-card__meta {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #c9c9c9;
  margin-top: 0.75rem;
}
.cat-card__features {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #8b8b8b;
  margin-top: 0.55rem;
  line-height: 1.65;
}
.cat-card__foot {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.cat-card__action {
  font-family: Inter, sans-serif;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8b8b8b;
  transition: color 0.35s var(--cat-ease);
}
.cat-card__btn:hover .cat-card__action {
  color: var(--cat-gold);
}
.cat-card.is-selected .cat-card__action {
  color: var(--cat-gold);
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.cat-empty {
  display: none;
  padding: 5rem 0;
  text-align: center;
}
.cat-empty.is-on {
  display: block;
}

/* ── Shortlist tray ─────────────────────────────────────────────────────────── */
.cat-tray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  background: rgba(8, 8, 8, 0.93);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  border-top: 1px solid rgba(230, 196, 121, 0.35);
  transform: translateY(115%);
  transition: transform 0.6s var(--cat-ease);
}
.cat-tray.is-open {
  transform: none;
}
.cat-tray__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
}
.cat-tray__slots {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-tray__slots::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.4rem 0.4rem 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: cat-chip-in 0.5s var(--cat-ease) both;
}
@keyframes cat-chip-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
}
.cat-chip__thumb {
  width: 52px;
  height: 39px;
  object-fit: cover;
  flex: 0 0 auto;
}
.cat-chip__name {
  font-family: Inter, sans-serif;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
  max-width: 15ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-chip__drop {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: #8b8b8b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s;
}
.cat-chip__drop:hover {
  color: var(--cat-gold);
}

.cat-tray__meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.cat-tray__count {
  font-family: Inter, sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8b8b8b;
  white-space: nowrap;
}
.cat-tray__count b {
  color: var(--cat-gold);
  font-weight: 400;
}
.cat-tray__cta {
  flex: 0 0 auto;
  display: inline-block;
  padding: 1rem 2.25rem;
  background: var(--cat-gold);
  color: #000;
  font-family: Inter, sans-serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.35s var(--cat-ease);
}
.cat-tray__cta:hover {
  background: #fff;
}

/* Keep the last row of cards clear of the tray once it is up. */
.cat-tray-spacer {
  height: 0;
  transition: height 0.6s var(--cat-ease);
}
.cat-tray-spacer.is-on {
  height: 108px;
}

@media (max-width: 767px) {
  .cat-tray__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }
  .cat-tray__slots {
    order: 1;
  }
  /* The count and the CTA are both nowrap, so side by side their min-content width
     blows past a 375px gutter. Stack them: the button owns the full width. */
  .cat-tray__meta {
    order: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }
  .cat-tray__count {
    text-align: center;
  }
  .cat-tray__cta {
    width: 100%;
    text-align: center;
    padding: 1rem;
    white-space: normal;
  }
  .cat-chip__name {
    max-width: 10ch;
  }
  .cat-tray-spacer.is-on {
    height: 215px;
  }

  /* Dropdowns replace the pill strips entirely — no horizontal swiping. */
  .cat-filters__row {
    display: none;
  }
  .cat-filters__mobile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    padding: 0.85rem 0;
  }
  /* A third filter (budget, once it lands) takes the full width beneath the first two. */
  .cat-filters__mobile .cat-select:nth-child(3) {
    grid-column: 1 / -1;
  }
}

/* ── The thumbnail that flies into the tray on select ───────────────────────── */
.cat-flyer {
  position: fixed;
  z-index: 80;
  object-fit: cover;
  pointer-events: none;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .cat-card__media img,
  .cat-card__mark,
  .cat-card__mark svg,
  .cat-tray,
  .cat-tray-spacer {
    transition: none !important;
  }
  .cat-chip {
    animation: none !important;
  }
  .cat-tray {
    transform: none;
    display: none;
  }
  .cat-tray.is-open {
    display: block;
  }
}
