/* Stories: the ring on the profile picture and the viewer. Tokens from css/base.css only. */

/* The ring: a thin line in the text colour around the picture, grey once watched. */
.story-ring { display: inline-block; border-radius: 50%; padding: 3px; box-shadow: inset 0 0 0 2px var(--ink); line-height: 0; }
.story-ring--seen { box-shadow: inset 0 0 0 2px var(--line-strong); }
/* On the profile header the ring takes the picture's place in the grid. */
.profile-head > .story-ring { grid-row: 1 / span 3; justify-self: start; }
@media (max-width: 735px) { .profile-head > .story-ring { grid-row: 1 / span 2; } }
.story-ring:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* The viewer: one picture or video at a time on a black 9:16 stage. */
.story-page { max-width: 460px; }
.story { position: relative; background: #000; color: #fff; border-radius: var(--radius); overflow: hidden; aspect-ratio: 9 / 16; max-height: calc(100vh - var(--header-h, 56px) - 96px); margin: 0 auto 16px; display: flex; flex-direction: column; }
.story__bars { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 3; display: flex; gap: 4px; }
.story__bar { flex: 1; height: 2px; background: rgba(255, 255, 255, .35); border-radius: 1px; overflow: hidden; }
.story__fill { display: block; height: 100%; width: 0; background: #fff; }
.story__bar.is-done .story__fill { width: 100%; }
.story__head { position: absolute; top: 18px; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 0 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.story__author { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: .9rem; }
.story__author:hover { color: #fff; }
.story__author .avatar { text-shadow: none; }
.story__time { color: rgba(255, 255, 255, .75); font-size: .8rem; flex: 1; }
.story__close { color: #fff; font-size: 1.8rem; line-height: 1; padding: 0 4px; }
.story__close:hover { color: #fff; text-decoration: none; }

.story__slides { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; }
.story__slide { position: relative; min-height: 100%; display: grid; place-items: center; }
.story__slide + .story__slide { border-top: 1px solid rgba(255, 255, 255, .2); }
.story__slide img, .story__slide video { width: 100%; height: 100%; max-height: 100%; object-fit: contain; }
.story__note { padding: 24px; text-align: center; color: rgba(255, 255, 255, .8); }
.story__owner { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 12px; background: rgba(0, 0, 0, .5); }
.story__owner a { color: #fff; text-decoration: underline; }

/* With JavaScript: one slide at a time, tap the left or right side to move. */
.story.is-playing .story__slides { overflow: hidden; }
.story.is-playing .story__slide { display: none; height: 100%; }
.story.is-playing .story__slide.is-current { display: grid; }
.story.is-playing .story__slide + .story__slide { border-top: 0; }
.story__tap { position: absolute; top: 64px; bottom: 64px; z-index: 2; width: 35%; border: 0; background: none; cursor: pointer; padding: 0; }
.story__tap--prev { left: 0; }
.story__tap--next { right: 0; }
.story__tap:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.story[data-has-video] .story__tap { bottom: 72px; }

.story-preview { display: block; border-radius: var(--radius-sm); margin-bottom: 16px; object-fit: cover; }

/* Highlights: circles under the profile header, kept after the 24 hours. */
.highlights { list-style: none; margin: 0 0 20px; padding: 4px 0; display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; }
.highlights::-webkit-scrollbar { display: none; }
.highlights__item { display: grid; justify-items: center; gap: 6px; width: 72px; }
.highlights__item:hover { text-decoration: none; }
.highlights__ring { display: inline-block; border-radius: 50%; padding: 3px; box-shadow: inset 0 0 0 1px var(--line-strong); line-height: 0; }
.highlights__ring img.avatar { object-fit: cover; }
.highlights__title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.highlights__item:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.story__highlight { font-size: .85rem; color: rgba(255, 255, 255, .85); }
.story__actions { display: inline-flex; gap: 12px; }

/* Close friends: a small green dot and label on stories shared with the close friends list only.
   Fixed colour: the viewer stage is always black. */
.story__cf { display: inline-flex; align-items: center; gap: 6px; }
.story__cf::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #6fcf97; flex: none; }
.close-friends__heading { font-size: 1rem; margin: 24px 0 8px; }
.close-friends .media { align-items: center; }
.close-friends .media form { flex: none; }
.close-friends__search { display: flex; gap: 8px; margin-bottom: 8px; }
.close-friends__search input[type="search"] { flex: 1; min-width: 0; }
