/* ============================================================
   SMILE — story circles (like Instagram) and the full-screen story viewer.
   Motion rules (css/motion.css): only transform / opacity; nothing moves by itself
   except the running story's progress bar and a very slow zoom on its photo.
   ============================================================ */

/* ---------- the row of circles ---------- */
.stories { background: #FFFFFF; border-bottom: 1px solid var(--sh-line, #E3E3DF); }
.stories__row { display: flex; gap: 14px; overflow-x: auto; padding: 12px 16px 10px; scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
.stories__row::-webkit-scrollbar { display: none; }
html:not(.phone) .stories__row { justify-content: center; padding-block: 16px 12px; }
.stc { flex: 0 0 auto; width: 72px; display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; scroll-snap-align: start; color: var(--sh-ink, #141413); font: inherit; -webkit-tap-highlight-color: transparent; }
.stc__ring { position: relative; width: 70px; height: 70px; border-radius: 50%; padding: 3px; display: grid; place-items: center;
  background: conic-gradient(from 210deg, #FFE45C, #F7B733, #EF7B2F, #D8442E, #C8322B, #EF7B2F, #FFE45C); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.stc__ring::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #FFFFFF; }
.stc__ring img { position: relative; width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: var(--sh-soft, #F3F3F1); }
.stc.seen .stc__ring { background: #D9D9D5; padding: 1.5px; }
.stc.seen .stc__ring::before { inset: 1.5px; }
.stc:active .stc__ring { transform: scale(.94); }
.stc__name { font-size: 12px; font-weight: 600; line-height: 1.2; max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stc.seen .stc__name { color: var(--sh-muted, #77766F); font-weight: 500; }
/* the brand circle: the logo on yellow; the clips circle: a small play badge */
.stc--brand .stc__ring img { object-fit: cover; }
.stc__logo { position: relative; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--sh-yellow, #FFE45C); color: #141413; font: 700 17px/1 var(--font-display); letter-spacing: .02em; }
.stc__badge { position: absolute; bottom: -1px; inset-inline-end: -1px; width: 22px; height: 22px; border-radius: 50%; background: #141413; color: #FFFFFF; display: grid; place-items: center; border: 2px solid #FFFFFF; }
.stc__badge svg { width: 10px; height: 10px; fill: currentColor; stroke: none; }

/* ---------- the viewer ---------- */
.sv { position: fixed; inset: 0; z-index: 88; background: #0B0B0A; color: #FFFFFF; touch-action: none; user-select: none; -webkit-user-select: none; }
.sv[hidden] { display: none; }
html:not(.phone) .sv { display: grid; place-items: center; background: rgba(11, 11, 10, .94); }
html:not(.phone) .sv[hidden] { display: none; }
.sv__stage { position: absolute; inset: 0; perspective: 1100px; overflow: hidden; }
html:not(.phone) .sv__stage { position: relative; inset: auto; width: min(420px, 92vw); height: min(88vh, 747px); border-radius: 18px; }
.sv__grp { position: absolute; inset: 0; overflow: hidden; background: #111; backface-visibility: hidden; transform-style: preserve-3d; will-change: transform; }
html:not(.phone) .sv__grp { border-radius: 18px; }

.sv__media { position: absolute; inset: 0; overflow: hidden; }
.sv__bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(28px) saturate(1.1); opacity: .75; transform: scale(1.1); }
.sv__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 40%; }
.sv__img.contain { object-fit: contain; }
.sv__img.zoom { animation: svZoom 9s linear forwards; }
@keyframes svZoom { from { transform: scale(1); } to { transform: scale(1.07); } }
.sv.paused .sv__img.zoom { animation-play-state: paused; }
.sv__shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 55%, rgba(0,0,0,.62) 100%); }

/* top: progress bars + who */
.sv__top { position: absolute; top: 0; inset-inline: 0; padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 0; transition: opacity .22s; }
.sv__bars { display: flex; gap: 4px; }
.sv__bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.sv__bars b { display: block; height: 100%; background: #FFFFFF; transform: scaleX(0); transform-origin: 100% 50%; }
[dir="ltr"] .sv__bars b { transform-origin: 0 50%; }
.sv__bars i.done b { transform: scaleX(1); }
.sv__who { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sv__who img, .sv__who .sv__logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1.5px solid rgba(255,255,255,.7); }
.sv__logo { display: grid; place-items: center; background: #FFE45C; color: #141413; font: 700 11px/1 var(--font-display); }
.sv__who b { font-size: 14px; font-weight: 700; }
.sv__who small { font-size: 12px; opacity: .8; }
.sv__who .sp { flex: 1; }
.sv__ib { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: #FFFFFF; display: grid; place-items: center; cursor: pointer; }
.sv__ib svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sv__ib[hidden] { display: none; }

/* words on the frame */
.sv__txt { position: absolute; inset-inline: 20px; top: calc(92px + env(safe-area-inset-top, 0px)); text-align: center; pointer-events: none; transition: opacity .22s; }
.sv__txt h3 { margin: 0; font: 700 clamp(30px, 9vw, 40px)/1.35 var(--font-display); text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.sv__txt h3 mark { background: #FFE45C; color: #141413; padding: 0 .18em; border-radius: 4px; display: inline-block; transform: rotate(-1.5deg); text-shadow: none; }
.sv__txt p { display: inline-block; margin: 10px 0 0; padding: 6px 12px; border-radius: 10px; background: rgba(255,255,255,.94); color: #141413; font-size: 15px; font-weight: 600; line-height: 1.5; }
.sv__user { font-size: 13px; opacity: .9; display: block; margin-top: 6px; }

/* bottom: the piece's sticker, then the reply bar */
.sv__foot { position: absolute; bottom: 0; inset-inline: 0; padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; transition: opacity .22s; }
.sv__stk { justify-self: center; display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 8px; padding-inline-end: 14px; border: 0; border-radius: 16px; background: #FFFFFF; color: #141413; text-align: start; font: inherit; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.sv__stk img { width: 48px; height: 58px; border-radius: 10px; object-fit: cover; background: #F3F3F1; }
.sv__stk > span { display: grid; gap: 2px; min-width: 0; }
.sv__stk .pr span { display: inline; }
.sv__stk small { font-size: 11px; color: #77766F; }
.sv__stk b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.sv__stk .pr { font-size: 13px; font-weight: 800; }
.sv__stk .pr s { color: #77766F; font-weight: 500; margin-inline-start: 6px; }
.sv__stk em { font-style: normal; font-size: 12px; font-weight: 800; background: #FFE45C; border-radius: 999px; padding: 7px 12px; white-space: nowrap; }
.sv__look { justify-self: center; display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 18px; background: #FFFFFF; color: #141413; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.sv__look button { border: 0; padding: 0; background: none; cursor: pointer; }
.sv__look img { width: 50px; height: 60px; border-radius: 10px; object-fit: cover; background: #F3F3F1; display: block; }
.sv__look .go { display: grid; gap: 4px; padding-inline: 4px; }
.sv__look .go button { font: 800 12px/1 inherit; font-family: inherit; border-radius: 999px; padding: 8px 12px; background: #FFE45C; color: #141413; white-space: nowrap; }
.sv__look .go button + button { background: #141413; color: #FFFFFF; }
.sv__more { justify-self: center; border: 0; background: none; color: #FFFFFF; font: 700 13px/1 inherit; font-family: inherit; display: grid; justify-items: center; gap: 2px; cursor: pointer; padding: 4px 10px; }
.sv__more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sv__bar { display: flex; align-items: center; gap: 6px; }
.sv__reply { flex: 1; min-width: 0; width: 0; height: 46px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.75); background: transparent; color: #FFFFFF; padding-inline: 18px; font: inherit; font-size: 15px; outline: none; user-select: text; -webkit-user-select: text; }
.sv__reply::placeholder { color: rgba(255,255,255,.85); }
.sv__ib.liked svg { fill: #E0413A; stroke: #E0413A; }
.sv__ib.pop { animation: svPop .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes svPop { 50% { transform: scale(1.3); } }

/* holding the finger on the story: the chrome steps aside (like Instagram) */
.sv.hold .sv__top, .sv.hold .sv__txt, .sv.hold .sv__foot { opacity: 0; }
.sv__heart { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; pointer-events: none; fill: #FFFFFF; filter: drop-shadow(0 6px 18px rgba(0,0,0,.3)); animation: svHeart .8s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes svHeart { 0% { transform: scale(.2); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 60% { transform: scale(.95); opacity: 1; } 100% { transform: scale(1.05) translateY(-30px); opacity: 0; } }

/* desktop: arrows beside the story */
.sv__nav { display: none; }
html:not(.phone) .sv__nav { display: grid; place-items: center; position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #141413; cursor: pointer; z-index: 2; }
html:not(.phone) .sv__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sv__nav--next { left: calc(50% - min(420px, 92vw) / 2 - 64px); }
.sv__nav--prev { right: calc(50% - min(420px, 92vw) / 2 - 64px); }

@media (prefers-reduced-motion: reduce) {
  .sv__img.zoom { animation: none; }
  .stc__ring { transition: none; }
}
/* while a story is open the page underneath is still (the smiley and the chat wait) */
body.sv-open .assist-fab, body.sv-open .fab, body.sv-open .backtop { visibility: hidden; }

/* ---------- the owner's choice (28 Sep 2026): the circles stay fixed just above the bottom tabs ---------- */
:root { --st-h: 0px; }
html.phone { --st-h: 84px; }
.stories { position: fixed; z-index: 47; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); margin: 0 auto; max-width: 720px;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--sh-line, #E3E3DF); border-bottom: 0; box-shadow: 0 -8px 20px -14px rgba(0,0,0,.25); }
.stories__row { gap: 10px; padding: 8px 12px 6px; }
.stc { width: 60px; gap: 4px; }
.stc__ring { width: 56px; height: 56px; padding: 2.5px; }
.stc__ring::before { inset: 2.5px; }
.stc__ring img, .stc__logo { width: 48px; height: 48px; }
.stc__logo { font-size: 14px; }
.stc__name { font-size: 11px; max-width: 60px; }
.stc__badge { width: 19px; height: 19px; }
/* computer: a floating bar at the bottom centre */
html:not(.phone) .stories { left: 50%; right: auto; bottom: 18px; transform: translateX(-50%); max-width: calc(100vw - 240px); border: 1px solid var(--sh-line, #E3E3DF); border-radius: 22px; box-shadow: 0 14px 34px -14px rgba(0,0,0,.3); }
html:not(.phone) .stories__row { justify-content: flex-start; padding: 10px 16px 8px; }
/* what floats above the tabs moves up by the strip; the page ends above it */
html.phone body { padding-bottom: calc(var(--nav-h) + var(--safe-b) + var(--st-h)); }
html.phone .fab, html.phone .backtop, html.phone .assist-fab.smiley { bottom: calc(var(--nav-h) + var(--safe-b) + var(--st-h) + 12px); }
html.phone .toast { bottom: calc(var(--nav-h) + var(--safe-b) + var(--st-h) + 66px); }
html.phone .cs { bottom: calc(var(--nav-h) + var(--safe-b) + var(--st-h) + 8px); }
html:not(.phone) body { padding-bottom: 110px; }
/* the phone too: a rounded floating bar like on the computer (the owner's choice), a little above the tabs */
html.phone { --st-h: 96px; }
html.phone .stories { left: 10px; right: 10px; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); border: 1px solid var(--sh-line, #E3E3DF); border-radius: 22px; box-shadow: 0 12px 30px -14px rgba(0,0,0,.28); overflow: hidden; }
html.phone .stories__row { padding: 9px 12px 7px; }

/* ---------- the bar steps aside: down while scrolling down, back on scrolling up; hide / show buttons ---------- */
.stories { transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .25s ease; }
html.st-away .stories, html.st-collapsed .stories { transform: translateY(calc(100% + 16px)); opacity: 0; pointer-events: none; }
html:not(.phone).st-away .stories, html:not(.phone).st-collapsed .stories { transform: translate(-50%, calc(100% + 24px)); }
.stories__hide { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #F3F3F1; color: #141413; display: grid; place-items: center; cursor: pointer; z-index: 1; }
.stories__hide svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.stories__show { position: fixed; z-index: 47; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); inset-inline-end: 12px; display: none; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; border: 1px solid var(--sh-line, #E3E3DF); border-radius: 999px; background: rgba(255,255,255,.97); color: #141413; font: 700 12.5px/1 var(--font-body); box-shadow: 0 10px 24px -12px rgba(0,0,0,.3); cursor: pointer; }
.stories__show i { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(from 210deg, #FFE45C, #F7B733, #EF7B2F, #D8442E, #C8322B, #EF7B2F, #FFE45C); box-shadow: inset 0 0 0 3px #FFFFFF; }
.stories__show svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
html.st-collapsed .stories__show { display: inline-flex; }
html:not(.phone) .stories__show { bottom: 18px; }
@media (prefers-reduced-motion: reduce) { .stories { transition: none; } }
