/**
 * In Madra - Lookbook Page Stylesheet
 *
 * Spec source: Figma "Lookbook / Index"
 *   - Desktop 1440: node 633:14315 (filter drawer state: 649:8753)
 *   - Mobile 375:   node 725:20771
 *
 * Typography is Stack Sans Text throughout, ink #121212.
 * Editorial grid: 3 cols / 2px gap (desktop), 2 cols / 2px gap (mobile).
 * Photo layouts: portrait (1 col), wide (2 cols), framed (pink border).
 * Filter = right-side drawer with collection checkboxes, synced to ?col=a,b.
 *
 * @package InMadra
 */

/* ==========================================================================
   1. Page Shell & Tokens
   ========================================================================== */
.im-lookbook-page {
  --lb-ink: #121212;
  --lb-paper: #FFFFFF;
  --lb-font: var(--im-font-body, "Stack Sans Text", sans-serif);
  --lb-edge: 12px;          /* page side padding (Figma x=12) */
  --lb-gap: 2px;            /* grid gutter */

  background-color: var(--lb-paper);
  color: var(--lb-ink);
  font-family: var(--lb-font);
}

body:has(.im-lookbook-page) .im-site-header,
.page-template-page-lookbook .im-site-header {
  background-color: #FFFFFF !important;
}

/* ==========================================================================
   2. Page Head — breadcrumb / divider / title row
   ========================================================================== */
.im-lb-head {
  padding: 12px var(--lb-edge) 0;          /* navbar bottom → breadcrumb = 12px */
}

/* Breadcrumb: 10/16, uppercase, gap 8 */
.im-lb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--lb-font);
  font-size: 10px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--lb-ink);
}

.im-lb-bc-link {
  color: rgba(18, 18, 18, 0.5);
  text-decoration: none;
  transition: color 0.2s ease;
}
.im-lb-bc-link:hover { color: var(--lb-ink); }

.im-lb-bc-sep {
  color: rgba(18, 18, 18, 0.2);
}

.im-lb-bc-current {
  color: var(--lb-ink);
}

/* 1px full-width rule, 12px under breadcrumb (Figma opacity: 0.05 / subtle hairline) */
.im-lb-divider {
  height: 1px;
  margin-top: 12px;
  background-color: rgba(18, 18, 18, 0.08);
}

/* Title row: centred title, filter trigger on the right. 48px above & below */
.im-lb-title-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 32px;
  margin-top: 48px;
}

.im-lb-title {
  grid-column: 2;
  margin: 0;
  font-family: var(--lb-font);
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
  letter-spacing: 0;
  font-style: normal;
  text-transform: none;
  text-align: center;
  color: var(--lb-ink);
}

/* "COLLECTIONS" trigger: 10/16 medium, uppercase, 1px underline (1px gap) */
.im-lb-filter-trigger {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 0 1px;
  margin: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--lb-ink);
  border-radius: 0;
  font-family: var(--lb-font);
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--lb-ink);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.im-lb-filter-trigger:hover { opacity: 0.6; }
.im-lb-filter-trigger:focus-visible {
  outline: 1px solid var(--lb-ink);
  outline-offset: 3px;
}
.im-lb-filter-trigger-count[hidden] { display: none; }

/* ==========================================================================
   3. Gallery Grid
   ========================================================================== */
.im-lb-gallery {
  padding: 48px var(--lb-edge) 160px;      /* title row → grid 48px; grid → footer 160px */
}

.im-lb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: var(--lb-gap);
  align-items: start;
}

.im-lb-photo {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #EDE9E3;
  aspect-ratio: 471 / 707;                 /* Figma portrait cell (2:3) */
  animation: im-lb-fade-in 0.45s ease both;
}

.im-lb-photo--portrait,
.im-lb-photo--framed { grid-column: span 1; }

.im-lb-photo--wide {
  grid-column: span 2;
  aspect-ratio: 943 / 707;                 /* 2 cols + gutter, same row height */
}

.im-lb-photo.is-hidden { display: none; }

@keyframes im-lb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.im-lb-photo-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.im-lb-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.im-lb-photo:hover .im-lb-photo-img { transform: scale(1.03); }

/* Framed layout (pink artistic border) */
.im-lb-frame-border {
  height: 100%;
  padding: 10px;
  background: #E8D4CC;
}

/* ==========================================================================
   4. Shop the Look Overlay
   ========================================================================== */
.im-lb-shop-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 32px 12px 12px;
  background: linear-gradient(to top, rgba(18, 18, 18, 0.6) 0%, rgba(18, 18, 18, 0) 100%);
  font-family: var(--lb-font);
  color: #F1F1F1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.im-lb-photo:hover .im-lb-shop-overlay,
.im-lb-photo:focus-within .im-lb-shop-overlay {
  opacity: 1;
  transform: translateY(0);
}

.im-lb-shop-name {
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  text-transform: uppercase;
}

.im-lb-shop-price {
  font-size: 10px;
  font-weight: 300;
  line-height: 16px;
}

.im-lb-shop-btn {
  margin-top: 6px;
  padding-bottom: 1px;
  border-bottom: 1px solid currentColor;
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  text-transform: uppercase;
  color: #F1F1F1;
  text-decoration: none;
}
.im-lb-shop-btn:hover { opacity: 0.7; color: #F1F1F1; }

/* ==========================================================================
   5. Empty State
   ========================================================================== */
.im-lb-empty-state {
  padding: 80px 16px;
  text-align: center;
  font-family: var(--lb-font);
}

.im-lb-empty-state h2 {
  margin: 0 0 8px;
  font-family: var(--lb-font);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--lb-ink);
}

.im-lb-empty-state p {
  margin: 0 0 24px;
  font-size: 12px;
  font-weight: 300;
  line-height: 20px;
  color: var(--lb-ink);
}

.im-lb-empty-cta {
  display: inline-block;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--lb-ink);
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  text-transform: uppercase;
  color: var(--lb-ink);
  text-decoration: none;
}

/* ==========================================================================
   6. Collections Filter Drawer (Figma 649:8753)
   ========================================================================== */
html.im-lb-scroll-lock { overflow: hidden; }

.im-lb-drawer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  visibility: hidden;
  pointer-events: none;
}
.im-lb-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.im-lb-drawer-overlay {
  position: absolute;
  inset: 0;
  background: #000000;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.im-lb-drawer.is-open .im-lb-drawer-overlay { opacity: 0.4; }

.im-lb-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100%;
  background: #FFFFFF;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--im-font-body, "Stack Sans Text", sans-serif);
  color: #121212;
}
.im-lb-drawer.is-open .im-lb-drawer-panel { transform: translateX(0); }

.im-lb-drawer-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  padding: 12px 16px;
  margin: 0;
}

/* Title 12/20 + close; 1px rule 12px below */
.im-lb-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #121212;
}

.im-lb-drawer-title {
  margin: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0;
  color: #121212;
}

.im-lb-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: -4px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.im-lb-drawer-close:hover { opacity: 0.6; }

/* Checkbox list: 10/16 light, 8px row gap, 12px square box */
.im-lb-drawer-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-y: auto;
}

.im-lb-drawer-list .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.im-lb-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 300;
  line-height: 16px;
  color: #121212;
}

.im-lb-check-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.im-lb-check-box {
  position: relative;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  background: #FFFFFF;
  border: 1px solid #121212;
  transition: background-color 0.15s ease;
}
.im-lb-check-box::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0px;
  width: 4px;
  height: 7px;
  border: solid #FFFFFF;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
  opacity: 0;
}
.im-lb-check-input:checked + .im-lb-check-box { background: #121212; }
.im-lb-check-input:checked + .im-lb-check-box::after { opacity: 1; }
.im-lb-check-input:focus-visible + .im-lb-check-box {
  outline: 1px solid #121212;
  outline-offset: 2px;
}
.im-lb-check:hover .im-lb-check-label { opacity: 0.6; }

/* Apply: full width, 40px, #121212, 12/20 */
.im-lb-drawer-foot { margin-top: auto; }

.im-lb-drawer-apply {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  padding: 8px 16px;
  background: #121212;
  border: 0;
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0;
  text-transform: none;
  color: #F1F1F1;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.im-lb-drawer-apply:hover { opacity: 0.85; }

/* ==========================================================================
   8. Responsive
   ========================================================================== */
@media (max-width: 767px) {
  .im-lookbook-page { --lb-edge: 8px; }

  /* Breadcrumb 8/12, gap 4, rule 8px below */
  .im-lb-breadcrumb {
    gap: 4px;
    font-size: 8px;
    line-height: 12px;
  }
  .im-lb-divider { margin-top: 8px; }

  /* Title 16/24, 32px spacing */
  .im-lb-title-row { margin-top: 32px; }
  .im-lb-title {
    font-size: 16px;
    line-height: 24px;
  }

  /* Grid: 2 cols, hugs the screen (2px edge), 32px below title */
  .im-lb-gallery { padding: 32px 2px 80px; }
  .im-lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .im-lb-photo { aspect-ratio: 184 / 277; }
  .im-lb-photo--wide {
    grid-column: span 2;
    aspect-ratio: 371 / 185;
  }
  .im-lb-frame-border { padding: 6px; }

  /* Touch: overlay always visible */
  .im-lb-shop-overlay {
    opacity: 1;
    transform: none;
    padding: 24px 8px 8px;
  }

  .im-lb-drawer-panel { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .im-lb-photo,
  .im-lb-photo-img,
  .im-lb-drawer-panel,
  .im-lb-drawer-overlay,
  .im-lb-shop-overlay {
    animation: none;
    transition: none;
  }
}
