/* ==========================================================================
   Instagram Shoppable Feed — storefront

   Styled to sit with the NopNoor theme's own home page sections: the same
   centred 30px Manrope titles, the theme's gold (--primary) as the only accent,
   near-square corners like the product cards, and the theme's text colour.

   Mobile first. The rail scrolls natively so a finger drag needs no JavaScript,
   and the viewer is a single column on phones: media on top, the products
   mapped to that post underneath.
   ========================================================================== */

.isf-feed,
.isf-viewer {
  --isf-accent: var(--primary, #c6a87a);
  --isf-ink: #1c1c1c;
  --isf-muted: #6b6b6b;
  --isf-line: #e7e2da;
  --isf-soft: #faf7f2;
  --isf-radius: 6px;
  --isf-gap: 12px;
  font-family: inherit;
}

.isf-feed {
  margin: 48px 0 56px;
  color: var(--isf-ink);
}

/* --- heading: the theme's section title --- */
.isf-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 22px;
  text-align: center;
}

.isf-heading {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--isf-ink);
}

.isf-handle {
  color: var(--isf-muted);
  font-size: 14px;
  text-decoration: none;
  transition: color .2s ease;
}

.isf-handle:hover { color: var(--isf-accent); }

.isf-head-nav {
  position: absolute;
  right: 0;
  bottom: 2px;
  display: none;
  gap: 8px;
}

.isf-arrow {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--isf-line);
  border-radius: 50%;
  color: var(--isf-ink);
  background: #fff;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}

.isf-arrow:hover { border-color: var(--isf-accent); color: var(--isf-accent); }

/* --- rail --- */
.isf-track {
  display: flex;
  gap: var(--isf-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.isf-track::-webkit-scrollbar { display: none; }

/* Two and a bit tiles on a phone, so the next one peeks in and says "swipe". */
.isf-card {
  flex: 0 0 calc((100% - var(--isf-gap)) / 2.25);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  scroll-snap-align: start;
  text-align: left;
}

.isf-media-wrap {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  border-radius: var(--isf-radius);
  overflow: hidden;
  background: var(--isf-soft);
}

.isf-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.isf-card:hover .isf-media { transform: scale(1.04); }

/* Reel / album mark, top right as Instagram itself places it. */
.isf-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

/* "Shop the look": only on posts that have products linked to them. */
.isf-card__shop {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .94);
  color: var(--isf-ink);
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: none;
}

.isf-progress {
  position: relative;
  height: 2px;
  margin: 18px auto 0;
  max-width: 240px;
  border-radius: 999px;
  background: var(--isf-line);
}

.isf-progress-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--isf-accent);
  transition: left .1s linear;
}

.isf-follow {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.isf-follow__button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1.5px solid var(--isf-accent);
  border-radius: 6px;
  color: var(--isf-accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

.isf-follow__button:hover { background: var(--isf-accent); color: #fff; }

@media (max-width: 575.98px) {
  .isf-feed { margin: 32px 0 40px; }
  .isf-heading { font-size: 22px; }
}

@media (min-width: 768px) {
  .isf-card { flex-basis: calc((100% - 3 * var(--isf-gap)) / 3.4); }
  .isf-head-nav { display: flex; }
}

@media (min-width: 1200px) {
  .isf-card { flex-basis: calc((100% - 4 * var(--isf-gap)) / 5); }
}

/* ==========================================================================
   Viewer
   ========================================================================== */
.isf-viewer {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 15, 15, .72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.isf-viewer[hidden] { display: none; }

.isf-viewer__sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(400px, 100%);
  height: min(88dvh, 800px);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.isf-viewer__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  cursor: pointer;
}

.isf-viewer__close:hover { background: rgba(0, 0, 0, .65); }

/* The media takes whatever height the shop strip leaves, so products are visible
   without scrolling. A dark stage, so a reel letterboxes into black, not into white
   bars that make the controls on top of it invisible. */
.isf-viewer__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 200px;
  width: 100%;
  background: #0f0f0f;
  overflow: hidden;
}

.isf-viewer__video,
.isf-viewer__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0f0f0f;
}

.isf-viewer__video[hidden],
.isf-viewer__image[hidden] { display: none; }

.isf-sound,
.isf-nav {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  cursor: pointer;
}

.isf-sound:hover,
.isf-nav:hover { background: rgba(0, 0, 0, .65); }

.isf-sound { right: 12px; bottom: 12px; width: 36px; height: 36px; z-index: 2; }

.isf-nav { top: 50%; width: 38px; height: 38px; transform: translateY(-50%); }
.isf-nav--prev { left: 10px; }
.isf-nav--next { right: 10px; }
.isf-nav[hidden] { display: none; }

.isf-counter {
  position: absolute;
  left: 12px;
  bottom: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 12px;
}

/* --- shop strip --- */
.isf-shop {
  flex: 0 0 auto;
  max-height: 58%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  background: #fff;
}

.isf-shop__title {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--isf-ink);
}

.isf-shop__title[hidden] { display: none; }

.isf-shop__row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.isf-shop__row:empty { display: none; }

.isf-product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--isf-line);
  border-radius: var(--isf-radius);
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color .2s ease;
}

.isf-product:hover { border-color: var(--isf-accent); }

.isf-product__media {
  flex: 0 0 60px;
  width: 60px;
  aspect-ratio: 3 / 4;
  border-radius: 4px;
  overflow: hidden;
  background: var(--isf-soft);
}

.isf-product__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.isf-product__body { flex: 1 1 auto; min-width: 0; }

.isf-product__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--isf-ink);
}

.isf-product__prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}

.isf-product__price { font-size: 14.5px; font-weight: 700; color: var(--isf-ink); }

.isf-product__old { font-size: 12.5px; color: var(--isf-muted); text-decoration: line-through; }

.isf-product__go {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--isf-accent);
  color: #fff;
}

.isf-iglink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 9px 16px;
  border: 1px solid var(--isf-line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--isf-ink);
  text-decoration: none;
}

.isf-iglink:hover { border-color: var(--isf-accent); color: var(--isf-accent); }

/* --- wider screens: media and shop strip side by side --- */
@media (min-width: 900px) {
  .isf-viewer__sheet {
    flex-direction: row;
    width: min(900px, 94vw);
    height: min(84dvh, 720px);
  }

  .isf-viewer__stage { flex: 0 0 auto; width: 46%; }

  .isf-shop {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    padding: 28px 24px;
  }

  .isf-shop__title { font-size: 18px; margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .isf-progress-bar,
  .isf-media { transition: none; }
}
