/* Ana səhifə — mobil story kartları (Instagram-style) */

.home-stories {
  --story-card-w: clamp(118px, 32vw, 148px);
  --story-card-h: clamp(200px, 54vw, 250px);
  --story-gap: 10px;
  --story-orange: #ff9100;
  --story-orange-2: #ffae00;
  --story-radius: 18px;

  display: none;
  padding: 8px 0 4px;
  margin: 0;
}

.home-stories:not(.home-stories--empty) {
  display: block;
}

.home-stories__track {
  display: flex;
  align-items: stretch;
  gap: var(--story-gap);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
}

.home-stories__track::-webkit-scrollbar {
  display: none;
}

.home-stories__item {
  flex: 0 0 auto;
  width: var(--story-card-w);
  height: var(--story-card-h);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  scroll-snap-align: start;
  border-radius: var(--story-radius);
  overflow: hidden;
  position: relative;
  background: #111;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.home-stories__item:active {
  transform: scale(0.97);
}

.home-stories__item.is-viewed {
  opacity: 0.72;
}

.home-stories__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #1a1a1a;
}

.home-stories__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 28px 10px 10px;
  font-size: clamp(11px, 3vw, 12px);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-align: left;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Viewer — tam ekran Instagram story */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  overflow: hidden;
  box-sizing: border-box;
}

.story-viewer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.story-viewer__dialog {
  box-sizing: border-box;
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: #000;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: none;
}

.story-viewer__progress {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.story-viewer__seg {
  flex: 1 1 0;
  height: 2.5px;
  min-width: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.story-viewer__seg-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #fff;
  transform-origin: left center;
}

.story-viewer__seg.is-done .story-viewer__seg-fill {
  width: 100%;
  transition: none;
}

.story-viewer__media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  padding: 0;
}

.story-viewer__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  background: #000;
}

.story-viewer__close {
  position: absolute;
  top: max(28px, calc(18px + env(safe-area-inset-top, 0px)));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 5;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.story-viewer__close:active {
  transform: scale(0.94);
  background: rgba(0, 0, 0, 0.6);
}

.story-viewer__foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(24px, calc(16px + env(safe-area-inset-bottom, 0px)));
  z-index: 3;
  padding: 0 24px;
  display: flex;
  justify-content: center;
  background: transparent;
  border: none;
  pointer-events: none;
}

.story-viewer__foot[hidden] {
  display: none !important;
}

.story-viewer__link {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 48px;
  padding: 0 28px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #111;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
}

.story-viewer__link:active {
  opacity: 0.92;
  transform: scale(0.98);
}

@media (max-width: 768px) {
  .home-stories:not(.home-stories--empty) {
    display: block;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }

  .home-stories__track {
    padding-left: 2px;
    padding-right: 2px;
  }

  .main > .home-stories:not(.home-stories--empty) + .home-shop {
    margin-top: 2px;
  }
}

@media (max-width: 380px) {
  .home-stories {
    --story-card-w: 108px;
    --story-card-h: 184px;
    --story-gap: 8px;
    --story-radius: 16px;
  }
}

@media (min-width: 769px) {
  .home-stories {
    display: none !important;
  }

  .story-viewer {
    display: none !important;
  }
}
