/* ==========================================================================
   LOVELY EVENTS & DECORATION — category.css
   Full-screen category pages (#/work/<categoryId>). Loaded after styles.css;
   reuses existing tokens (--color-*, --font-*, --dur-*) and several existing
   classes (.container, .btn, .btn-red, .btn-whatsapp, .eyebrow, .section,
   .section-dark, .section-title, .section-head, .section-head-rule,
   .gallery-empty, .gallery-count, .lightbox*, .media, .script) so the new
   pages match the rest of the site exactly.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Body-level state set by category.js
   -------------------------------------------------------------------------- */
body.cat-lock-scroll { overflow: hidden; height: 100%; }
/* Defensive: the overlay is already opaque and sits above everything, but
   explicitly hide the floating call/WhatsApp FABs too (see integration.md). */
body.cat-page-open .floating-contact { display: none !important; }

/* --------------------------------------------------------------------------
   Overlay shell
   -------------------------------------------------------------------------- */
.cat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: var(--color-primary);
  opacity: 0;
  transform: scale(.97);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.cat-overlay[hidden] { display: none; }
.cat-overlay.is-open { opacity: 1; transform: scale(1); }

.cat-overlay-scroll {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  outline: none;
}

/* Switcher + close button share one sticky flex row so the pill bar never
   scrolls underneath the (always-reachable) close button. */
.cat-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 10px 10px 10px 16px;
  background: rgba(11, 11, 12, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border-dark);
}
.cat-close {
  flex: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 243, 239, .08);
  color: #fff;
  border: 1px solid var(--color-border-gold);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.cat-close:hover { background: var(--color-secondary); transform: scale(1.05); }

/* --------------------------------------------------------------------------
   Category switcher (sticky pill bar)
   -------------------------------------------------------------------------- */
.cat-switcher {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: .55rem;
  padding: 4px 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.cat-switcher::-webkit-scrollbar { height: 6px; }
.cat-switcher::-webkit-scrollbar-thumb { background: var(--color-border-gold); border-radius: 999px; }
.cat-pill {
  flex: none;
  white-space: nowrap;
  min-height: 44px;
  padding: 0 1.1em;
  border-radius: 999px;
  border: 1px solid var(--color-border-gold);
  color: var(--color-text-muted);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
  display: inline-flex;
  align-items: center;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.cat-pill:hover { color: var(--color-text); border-color: var(--color-text); }
.cat-pill.is-active,
.cat-pill[aria-current="page"] { background: var(--color-secondary); color: #fff; border-color: var(--color-secondary); }

/* --------------------------------------------------------------------------
   Banner
   -------------------------------------------------------------------------- */
.cat-banner {
  position: relative;
  min-height: clamp(340px, 62vh, 640px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #141416;
}
.cat-banner-media, .cat-banner-img { position: absolute; inset: 0; }
.cat-banner-img { background: var(--media-color, #1c1c1e); }
.cat-banner-img picture, .cat-banner-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-banner-img img { animation: catKenburns 24s ease-in-out infinite alternate; }
@keyframes catKenburns { from { transform: scale(1); } to { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .cat-banner-img img { animation: none; } }
.cat-banner-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--media-color, #1c1c1e); color: rgba(245, 243, 239, .5);
}
.cat-banner-gradient {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,11,12,.35) 0%, rgba(11,11,12,.55) 45%, rgba(11,11,12,.94) 100%),
    linear-gradient(90deg, rgba(11,11,12,.5), rgba(11,11,12,.05) 45%, rgba(11,11,12,.05) 55%, rgba(11,11,12,.5));
}
.cat-banner-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-top: 4.5rem;
  padding-bottom: clamp(2rem, 3vw, 3rem);
}
.cat-banner-content .eyebrow { margin-bottom: .4rem; }
.cat-title {
  font-family: var(--font-heading);
  font-weight: 600;
  color: #fff;
  font-size: clamp(2.4rem, 1.7rem + 3.2vw, 4.4rem);
  line-height: 1.05;
  text-shadow: 0 6px 30px rgba(0, 0, 0, .55);
  outline: none;
}
.cat-flourish {
  display: block;
  width: 74px;
  height: 2px;
  margin: 1rem 0 1.2rem;
  background: linear-gradient(90deg, var(--color-accent), transparent);
  position: relative;
}
.cat-flourish::after {
  content: '';
  position: absolute; left: 0; top: 50%; width: 6px; height: 6px;
  transform: translate(-2px, -50%) rotate(45deg);
  background: var(--color-accent);
}
.cat-desc {
  max-width: 62ch;
  color: var(--color-text-muted);
  font-size: clamp(.98rem, .9rem + .3vw, 1.12rem);
  margin-bottom: 1.6rem;
}
.cat-banner-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

/* --------------------------------------------------------------------------
   Sections + masonry grids
   -------------------------------------------------------------------------- */
.cat-section .section-title { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.cat-badge {
  font-family: var(--font-body);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-accent);
  padding: .3em .7em;
  border-radius: 999px;
  vertical-align: middle;
}
.cat-credit { margin-top: .4rem; font-size: .8rem; color: var(--color-text-muted); }
.cat-credit a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }

.cat-grid { margin-top: 1.6rem; column-count: 2; column-gap: .9rem; }
@media (min-width: 700px) { .cat-grid { column-count: 3; } }
@media (min-width: 1100px) { .cat-grid { column-count: 4; } }

.cat-item {
  position: relative;
  display: block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: .9rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid transparent;
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.cat-item .media { border-radius: 0; }
.cat-item:hover, .cat-item:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent), 0 18px 34px rgba(0, 0, 0, .5);
}
.cat-item:hover .media img, .cat-item:focus-visible .media img { transform: scale(1.08); }
.cat-item-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(11, 11, 12, .35); opacity: 0; transition: opacity var(--dur-fast) var(--ease);
  color: #fff;
}
.cat-item:hover .cat-item-overlay, .cat-item:focus-visible .cat-item-overlay { opacity: 1; }
.cat-ref-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(11, 11, 12, .72);
  color: var(--color-accent);
  border: 1px solid var(--color-border-gold);
  font-size: .62rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  padding: .3em .6em; border-radius: 999px;
}

/* Staggered reveal, scoped to the overlay's own scroll container. */
.cat-reveal {
  opacity: 0;
  transform: translateY(18px) scale(.98);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.cat-reveal.in-view { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Responsive tweaks
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .cat-banner { min-height: 78vh; }
}

/* --------------------------------------------------------------------------
   Reduced motion: kill the open/close scale + stagger entirely (durations
   already collapse to ~.01s via the site's global --dur-fast/--dur-med
   override, this just removes the residual transform jump).
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cat-overlay, .cat-reveal { transform: none !important; }
}
