/* Custom styles layered on top of Tailwind. Story rings + grid polish + skeletons. */

:root {
  --ig-ring: linear-gradient(45deg, #feda75, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5);
}

body { scroll-behavior: smooth; }

/* Instagram-style gradient ring avatar */
.story-ring {
  padding: 3px;
  background: var(--ig-ring);
  border-radius: 9999px;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.story-ring:hover { transform: scale(1.04); }
.story-ring > img,
.story-ring > .ring-inner {
  display: block;
  border-radius: 9999px;
  border: 3px solid #0a0a0f;
  background: #181826;
  object-fit: cover;
}
.story-ring.seen { background: #33334a; }

/* media grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (min-width: 640px) { .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; } }
@media (min-width: 1024px) { .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.media-card {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0.9rem;
  background: #181826;
}
.media-card img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.25s ease;
}
.media-card:hover img { transform: scale(1.05); }

.media-badge {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: rgba(0,0,0,0.55); color: #fff;
  border-radius: 9999px; padding: 0.15rem 0.45rem;
  font-size: 0.7rem; display: flex; align-items: center; gap: 0.2rem;
  backdrop-filter: blur(4px);
}
.media-dl {
  position: absolute; bottom: 0.5rem; right: 0.5rem;
  background: rgba(0,0,0,0.6); color: #fff;
  width: 2rem; height: 2rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s ease; text-decoration: none;
}
.media-card:hover .media-dl { opacity: 1; }
.media-card { border: none; padding: 0; cursor: pointer; }
.media-stats {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.4rem 0.6rem 0.5rem; color: #fff; font-size: 0.72rem; font-weight: 600;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  opacity: 0; transition: opacity 0.15s ease; text-align: left;
}
.media-card:hover .media-stats { opacity: 1; }

/* ---------- media modal ---------- */
#modal-root { position: fixed; inset: 0; z-index: 50; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(6px); }
.modal-card {
  position: absolute; inset: 0; margin: auto; z-index: 2;
  width: min(960px, 96vw); height: min(620px, 92vh);
  display: grid; grid-template-columns: 1fr 340px;
  background: #101018; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1rem; overflow: hidden;
}
@media (max-width: 720px) {
  .modal-card { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr) auto; width: 100vw; height: 100vh; border-radius: 0; }
  .modal-meta { max-height: 42vh; }
}
.modal-media { background: #000; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.modal-img, .modal-video { max-width: 100%; max-height: 100%; object-fit: contain; }
.modal-meta { padding: 1.1rem; display: flex; flex-direction: column; overflow-y: auto; }
.modal-caption { max-height: 9rem; overflow-y: auto; }
.modal-x {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 5;
  width: 2.2rem; height: 2.2rem; border-radius: 9999px; border: none;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 1rem; cursor: pointer;
}
.modal-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 4;
  width: 2.6rem; height: 2.6rem; border-radius: 9999px; border: none; cursor: pointer;
  background: rgba(0,0,0,0.5); color: #fff; font-size: 1.6rem; line-height: 1;
}
.modal-nav.left { left: 0.6rem; } .modal-nav.right { right: calc(340px + 0.6rem); }
@media (max-width: 720px) { .modal-nav.right { right: 0.6rem; } .modal-nav { top: 30%; } }
.modal-loading { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; color: #94a3b8; }
.spinner { width: 2rem; height: 2rem; border: 3px solid rgba(255,255,255,0.2); border-top-color: #d62976; border-radius: 9999px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-dots { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem; }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; border: none; background: #3a3a52; cursor: pointer; }
.dot.on { background: #d62976; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem; border-radius: 0.75rem;
  font-weight: 600; color: #0a0a0f; text-decoration: none;
  background: linear-gradient(90deg, #feda75, #d62976, #4f5bd5);
}
.ghost-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem; border-radius: 0.75rem;
  font-weight: 600; color: #cbd5e1; text-decoration: none; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
}

/* skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, #181826 25%, #22223a 37%, #181826 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* tabs */
.tab-btn { position: relative; padding: 0.6rem 0.25rem; color: #94a3b8; font-weight: 600; }
.tab-btn[aria-selected="true"] { color: #fff; }
.tab-btn[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, #feda75, #d62976, #4f5bd5);
}

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
