/* ============================================
   INSTAGRAM-STYLE STORY AVATARS
   Perfect circular design with clean story ring
   v20260821
   ============================================ */

/* Story Container */
.story {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.story:active {
  transform: scale(0.95);
}

/* Story Ring - Instagram-style gradient */
.story-ring {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px; /* Ring thickness */
  background: linear-gradient(45deg, #ff6b1a, #ff4d8e, #ffcd6b, #ff6b1a);
  background-size: 200% 200%;
  animation: storyGradientShift 3s ease infinite;
}

@keyframes storyGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Story Ring - Seen (gray) */
.story-ring-seen {
  background: rgba(255, 255, 255, 0.25);
  animation: none;
}

/* Story Ring - Empty (for "Your story" without content) */
.story-ring-empty {
  background: rgba(255, 255, 255, 0.15);
  animation: none;
}

/* Inner dark separator - creates gap between ring and avatar */
.story-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 3px; /* Ring thickness */
  background: #0a0a10; /* Dark background color */
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Story Avatar Container - Perfect circle */
.story-avatar {
  position: relative;
  width: 70px; /* Avatar size */
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  background: #14141f; /* Dark background for placeholder */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Avatar Image - Perfectly circular and centered */
.story-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  display: block;
}

/* Avatar SVG/Icon Placeholder - Centered person icon */
.story-avatar svg,
.story-avatar .post-avatar {
  width: 40px;
  height: 40px;
  color: #ff6b1a;
  flex-shrink: 0;
}

/* Ensure post-avatar (placeholder) is circular */
.story-avatar .post-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #14141f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.story-avatar .post-avatar::before {
  content: '';
  width: 40px;
  height: 40px;
  background: #ff6b1a;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='12' cy='7' r='4' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='12' cy='7' r='4' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Story Plus Icon - "+" for adding story */
.story-plus {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b1a, #ff4d8e);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #0a0a10; /* Dark border to separate from ring */
  box-shadow: 0 2px 8px rgba(255, 107, 26, 0.4);
  pointer-events: none;
}

/* Story Label - Username */
.story-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* Your Story - Special styling */
.story-mine .story-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 1);
}

/* Mobile Adjustments */
@media (max-width: 375px) {
  .story-ring {
    width: 68px;
    height: 68px;
    padding: 2.5px;
  }

  .story-avatar {
    width: 63px;
    height: 63px;
  }

  .story-avatar .post-avatar {
    width: 63px;
    height: 63px;
  }

  .story-avatar svg,
  .story-avatar .post-avatar::before {
    width: 36px;
    height: 36px;
  }

  .story-plus {
    width: 22px;
    height: 22px;
    font-size: 16px;
  }

  .story-label {
    font-size: 11px;
    max-width: 68px;
  }
}

/* Accessibility - Focus states */
.story:focus {
  outline: 2px solid rgba(255, 107, 26, 0.5);
  outline-offset: 2px;
  border-radius: 12px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .story {
    transition: none;
  }

  .story-ring {
    animation: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .story-ring {
    background: #ff6b1a;
  }

  .story-ring-seen {
    background: rgba(255, 255, 255, 0.5);
  }
}
