/* =========================================================
   UR Invited — Catalog page
   Self-contained styles. Mobile-first (tested at 393px).
   Design tokens mirror the landing site (style.css :root).
   ========================================================= */

:root {
  --c-bg: #faf6ee;
  --c-surface: #fdfaf3;
  --c-surface-2: #ffffff;
  --c-offset: #f3ecdc;
  --c-border: #d9cdb1;
  --c-divider: #e6dec9;
  --c-text: #1f2433;
  --c-text-muted: #6f6a5e;
  --c-text-faint: #b6ad97;
  --c-text-inverse: #fdfaf3;
  --c-primary: #2c6fb8;
  --c-primary-hover: #20528b;
  --c-accent: #c4912b;
  --c-accent-hover: #a4731c;

  --font-display: 'Boska', 'Cormorant Garamond', Georgia, serif;
  --font-body: 'General Sans', 'Inter', 'Helvetica Neue', sans-serif;

  --r-md: 0.5rem;
  --r-lg: 0.875rem;
  --r-xl: 1.25rem;
  --r-2xl: 1.75rem;
  --r-full: 9999px;

  --shadow-card: 0 1px 2px rgba(20, 30, 60, 0.05), 0 8px 24px rgba(20, 30, 60, 0.08);
  --shadow-lift: 0 12px 40px rgba(20, 30, 60, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.cat-container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ---------- Header / nav ---------- */
.cat-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-divider);
}
.cat-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
}
.cat-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--c-text);
}
.cat-logo svg { color: var(--c-accent); }
.cat-nav {
  display: none;
  gap: 1.25rem;
  align-items: center;
}
.cat-nav a {
  text-decoration: none;
  color: var(--c-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.cat-nav a:hover, .cat-nav a[aria-current="page"] { color: var(--c-text); }
.cat-header__actions { display: flex; align-items: center; gap: 0.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn--primary { background: var(--c-primary); color: var(--c-text-inverse); }
.btn--primary:hover { background: var(--c-primary-hover); }
.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn--ghost:hover { background: var(--c-offset); }
.btn:active { transform: translateY(1px); }

/* ---------- Hero ---------- */
.cat-hero {
  text-align: center;
  padding-block: 2.25rem 1.5rem;
}
.cat-hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 1.2rem + 4vw, 3.25rem);
  line-height: 1.05;
  margin: 0 0 0.5rem;
}
.cat-hero p {
  color: var(--c-text-muted);
  max-width: 36ch;
  margin: 0 auto 1.25rem;
  font-size: 1rem;
}
.cat-search {
  position: relative;
  max-width: 420px;
  margin-inline: auto;
}
.cat-search input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  background: var(--c-surface-2);
  font: inherit;
  font-size: 0.95rem;
  color: var(--c-text);
}
.cat-search input:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 1px;
  border-color: transparent;
}
.cat-search svg {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-faint);
  pointer-events: none;
}

/* ---------- Category tabs ---------- */
.cat-tabs-wrap {
  position: sticky;
  top: 56px;
  z-index: 30;
  background: var(--c-bg);
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--c-divider);
}
.cat-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: 0 0 auto;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border-radius: var(--r-full);
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cat-tab:hover { background: var(--c-offset); color: var(--c-text); }
.cat-tab.is-active {
  background: var(--c-text);
  color: var(--c-text-inverse);
  border-color: var(--c-text);
}
.cat-tab__count {
  display: inline-block;
  margin-left: 0.35rem;
  opacity: 0.6;
  font-weight: 500;
}

/* Coming-soon categories: dimmed tab + tiny "Soon" pill instead of (0). Keeps
   the catalog feeling alive without lying about availability. */
.cat-tab.is-coming-soon {
  opacity: 0.55;
  font-weight: 500;
  border-style: dashed;
  cursor: pointer;
}
.cat-tab.is-coming-soon:hover { opacity: 0.85; }
.cat-tab.is-coming-soon.is-active {
  opacity: 1;
  border-style: solid;
}
.cat-tab__soon {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--r-full);
  background: var(--c-offset);
  color: var(--c-text-muted);
  vertical-align: 1px;
}

/* ---------- Grid ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding-block: 1.75rem 3rem;
}
@media (min-width: 600px) { .cat-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; } }
@media (min-width: 920px) { .cat-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 720px) { .cat-nav { display: flex; } }

.cat-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-divider);
  border-radius: var(--r-2xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform .2s ease, box-shadow .2s ease, opacity .25s ease;
  animation: cardIn .35s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cat-card.is-hidden { display: none; }
@media (hover: hover) {
  .cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
}

/* Stage holds the thumb + a lazily-mounted scaled iframe preview */
.cat-card__stage {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--c-offset);
  overflow: hidden;
}
.cat-card__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .3s ease;
}
.cat-card__preview {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  background: #000;
}
/* The iframe is rendered at phone resolution then scaled to fill the stage. */
.cat-card__preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 393px;
  height: 698px; /* 393 * 16/9 ≈ 698 */
  border: 0;
  transform-origin: top left;
  pointer-events: none;
}
.cat-card.is-previewing .cat-card__preview.is-ready { opacity: 1; }
.cat-card.is-previewing .cat-card__thumb { opacity: 0; }

.cat-card__live-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  background: rgba(20, 30, 60, 0.62);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-full);
  opacity: 0;
  transition: opacity .25s ease;
}
.cat-card.is-previewing .cat-card__live-badge { opacity: 1; }

.cat-card__body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.cat-card__name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.1;
}
.cat-card__tagline {
  color: var(--c-text-muted);
  font-size: 0.9rem;
  margin: 0;
}
.cat-card__badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.15rem; }
.cat-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--c-offset);
  color: var(--c-text-muted);
  border-radius: var(--r-full);
  padding: 0.2rem 0.55rem;
}
.cat-card__price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(29, 36, 56, 0.12);
}
.cat-card__price-amount {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-style: italic;
  color: #1d2438;
  letter-spacing: -0.01em;
  line-height: 1;
}
.cat-card__price-note {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  letter-spacing: 0.01em;
}
.cat-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.6rem;
}
.cat-card__actions .btn { flex: 1; justify-content: center; }

/* ---------- Coming soon card ---------- */
.cat-soon {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, var(--c-surface-2), var(--c-offset));
  border: 1px dashed var(--c-border);
  border-radius: var(--r-2xl);
  padding: 2rem 1.5rem;
  text-align: center;
}
.cat-soon h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 0.4rem;
}
.cat-soon p { color: var(--c-text-muted); margin: 0 auto 1.1rem; max-width: 44ch; }
.cat-soon__form {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin-inline: auto;
  flex-wrap: wrap;
  justify-content: center;
}
.cat-soon__form input {
  flex: 1;
  min-width: 200px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  background: var(--c-surface-2);
  font: inherit;
  font-size: 0.95rem;
}
.cat-soon__form input:focus { outline: 2px solid var(--c-primary); outline-offset: 1px; border-color: transparent; }
.cat-soon__msg { margin-top: 0.75rem; font-size: 0.9rem; min-height: 1.2em; color: var(--c-accent-hover); font-weight: 600; }

/* ---------- Full-screen preview modal ---------- */
.cat-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 18, 30, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
}
.cat-modal.is-open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.cat-modal__frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 430px;
  max-height: 100dvh;
  background: #000;
}
@media (min-width: 480px) {
  .cat-modal__frame {
    height: 92dvh;
    max-height: 920px;
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lift);
  }
}
.cat-modal__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.cat-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--r-full);
  border: 0;
  background: rgba(15, 18, 30, 0.7);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.cat-modal__close:hover { background: rgba(15, 18, 30, 0.9); }
.cat-modal__cta {
  position: absolute;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 2;
  box-shadow: var(--shadow-lift);
}

body.cat-modal-open { overflow: hidden; }

/* ---------- Footer ---------- */
.cat-footer {
  border-top: 1px solid var(--c-divider);
  background: var(--c-surface);
}
.cat-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-block: 1.75rem;
  text-align: center;
  color: var(--c-text-muted);
  font-size: 0.9rem;
}
.cat-footer__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; justify-content: center; }
.cat-footer__links a { text-decoration: none; color: var(--c-text-muted); }
.cat-footer__links a:hover { color: var(--c-text); }

.cat-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--c-text-muted);
  padding: 2.5rem 1rem;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Scene-preview strip (Sprint 4.1) ---------- */
.cat-card__strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.04), transparent);
}
.cat-card__strip-frame {
  display: block;
  aspect-ratio: 3 / 4;
  background-size: cover;
  background-position: center;
  background-color: #efeae0;
  border-radius: 4px;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cat-card:hover .cat-card__strip-frame:nth-child(1) { transform: translateY(-2px) rotate(-1deg); }
.cat-card:hover .cat-card__strip-frame:nth-child(2) { transform: translateY(-2px) rotate(0.5deg); }
.cat-card:hover .cat-card__strip-frame:nth-child(3) { transform: translateY(-2px) rotate(-0.3deg); }
.cat-card:hover .cat-card__strip-frame:nth-child(4) { transform: translateY(-2px) rotate(0.8deg); }

@media (prefers-reduced-motion: reduce) {
  .cat-card__strip-frame { transition: none; }
  .cat-card:hover .cat-card__strip-frame { transform: none; }
}
