/* ==========================================================================
   Glint web — posts: feed card (action bar with counts, caption, comment lines, reposts and
   quotes, recommended posts), the multi-photo grid, feed suggestion blocks, the post window,
   comments, the reels page and viewer, the quote dialog, profile social icons.
   Loaded last (after media.css). Colours and type from tokens.css.
   ========================================================================== */

/* Feed media: the whole post (header + media + action bar) fits a 1366×768 screen. */
:root { --feed-media-max: max(320px, calc(100vh - 260px)); }

/* --- Action bar: ♡ 12 · 💬 3 · 🔁 1 · ➤ … 🔖 ------------------------------------------ */
.post-actions { display: flex; align-items: center; gap: 2px; padding: 6px 0 2px; margin: 0 -8px; }
.post-actions .pa-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 8px; border-radius: 20px; color: var(--text-primary); }
.post-actions .pa-btn:hover .pa-icon { opacity: 0.6; }
.pa-icon { display: grid; place-items: center; }
.pa-icon .icon { width: 24px; height: 24px; }
.pa-count { font-size: 14px; font-weight: 500; line-height: 1; color: var(--text-primary); }
.pa-spacer { flex: 1; }
.pa-btn.action-like .liked, .pa-btn.action-like .liked .icon { color: var(--accent-flash); }
.pa-btn.action-repost.is-on { color: var(--text-primary); }
.pa-btn.pop .pa-icon { animation: like-pop 320ms cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.pa-repost { position: relative; display: inline-flex; }
.pa-pop { position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 30; min-width: 200px; display: grid; }
.pa-pop .menu-item { display: flex; align-items: center; width: 100%; text-align: left; }
@media (prefers-reduced-motion: reduce) { .pa-btn.pop .pa-icon { animation: none; } }

/* --- Feed card ----------------------------------------------------------------------- */
.post-card .post-head .avatar { flex: none; }
.post-head-line { flex-wrap: nowrap; }
.post-when { font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.post-when time { color: inherit; }
a.post-when:hover { color: var(--text-primary); }
.post-head-line .follow-link { font-size: 15px; color: var(--brand-400); }
.post-head .icon-btn + .icon-btn { margin-left: 0; }
.post-reposted { display: flex; align-items: center; gap: 8px; padding: 12px 0 0; font-size: 14px; color: var(--text-secondary); }
.post-reposted strong { color: var(--text-primary); font-weight: 600; }
.post-reposted + .post-head { padding-top: 8px; }
.post-body { display: grid; gap: 4px; padding-top: 2px; }

/* Caption: bold name + text, 2 lines, "… more" inline at the end of line 2. */
.post-card .caption, .pw-caption, .quote-caption { position: relative; font-size: 15px; line-height: 1.4; }
.post-card .caption-text, .pw-caption .caption-text, .quote-caption .caption-text { -webkit-line-clamp: 2; }
.post-card .caption-text .caption-user .username { font-weight: 600; }
.post-card .caption-more, .pw-caption .caption-more, .quote-caption .caption-more {
  position: absolute; right: 0; bottom: 0; padding-left: 36px; font-size: 15px; color: var(--text-secondary);
  background: linear-gradient(to right, transparent, var(--bg-surface) 30px);
}
.post-card .caption-more:hover { color: var(--text-primary); }

/* Up to two short comment lines with a small ♡. */
.view-comments { font-size: 14px; color: var(--text-secondary); }
.comment-preview { display: grid; gap: 2px; }
.comment-preview li { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: normal; }
.comment-preview .cp-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.comment-preview .cp-text .username { font-weight: 600; }
.comment-preview .cp-like { flex: none; display: grid; place-items: center; width: 20px; height: 20px; color: var(--text-secondary); }
.comment-preview .cp-like.is-on { color: var(--accent-flash); }
.comment-preview li.is-mine { animation: fade-in 200ms both; }

/* Quote reposts: the reposter's caption, then the original in a bordered card. */
.quote-caption { margin: -4px 0 8px; }
.quote-embed { border: 1px solid var(--border-subtle); border-radius: 12px; padding: 0 10px 10px; margin-bottom: 2px; }
.quote-embed .post-head { padding: 8px 0; min-height: 0; }
.quote-embed .post-media { border-radius: 8px; }
.quote-embed-caption { margin-top: 8px; font-size: 14px; color: var(--text-secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quote-embed-caption .username { color: var(--text-primary); font-weight: 600; }

/* Recommended post ✕ → "Post hidden · Undo". */
.post-dismissed { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 4px 4px; }
.post-dismissed > div { display: grid; gap: 2px; }
.post-dismissed strong { font-size: 15px; }
.post-dismissed span { font-size: 13px; color: var(--text-secondary); }
.post-card.is-recommended:has(.post-dismissed[style*="none"]) { }

/* Single media: capped height (true aspect, letterboxed). */
.post-card .post-media { cursor: pointer; }
.post-card .post-media > .mgrid { max-height: var(--feed-media-max); }

/* --- Multi-photo grid (Facebook style) ------------------------------------------------- */
.mgrid { display: grid; gap: 3px; width: 100%; overflow: hidden; border-radius: inherit; }
.mgrid-g2 { grid-template-columns: 1fr 1fr; }
.mgrid-g3 { grid-template-columns: 3fr 2fr; grid-template-rows: 1fr 1fr; }
.mgrid-g3 .t0 { grid-row: 1 / 3; }
.mgrid-g3w { grid-template-columns: 1fr 1fr; grid-template-rows: 3fr 2fr; }
.mgrid-g3w .t0 { grid-column: 1 / 3; }
.mgrid-g4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mgrid-g5 { grid-template-columns: repeat(6, 1fr); grid-template-rows: 3fr 2fr; }
.mgrid-g5 .t0 { grid-column: 1 / 4; } .mgrid-g5 .t1 { grid-column: 4 / 7; }
.mgrid-g5 .t2 { grid-column: 1 / 3; } .mgrid-g5 .t3 { grid-column: 3 / 5; } .mgrid-g5 .t4 { grid-column: 5 / 7; }
.mgrid-tile { position: relative; display: block; min-width: 0; min-height: 0; overflow: hidden; background-color: var(--bg-raised); background-size: cover; }
.post-card .post-media .mgrid-tile img, .mgrid-tile img, .mgrid-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.mgrid-tile video { opacity: 0; transition: opacity 200ms; }
.mgrid-tile video.is-on { opacity: 1; }
.mgrid-tile::after { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 150ms; pointer-events: none; }
.mgrid-tile:hover::after { opacity: 0.06; }
.mgrid-play { position: absolute; left: 8px; bottom: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mgrid-more { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 30px; font-weight: 700; }

/* --- Feed suggestion blocks ------------------------------------------------------------- */
.feed-block { position: relative; margin-bottom: 16px; padding: 14px 0 16px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--card-radius); box-shadow: var(--shadow-card); }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 12px; }
.fb-head h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.fb-link { font-size: 14px; font-weight: 600; color: var(--brand-400); }
.fb-track { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px; scroll-snap-type: x proximity; scroll-padding: 0 16px; scrollbar-width: none; overscroll-behavior-x: contain; }
.fb-track::-webkit-scrollbar { display: none; }
.fb-scroll { position: absolute; top: calc(50% + 18px); z-index: 3; width: 36px; height: 36px; margin-top: -18px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #0F1419; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.fb-scroll.prev { left: 8px; } .fb-scroll.next { right: 8px; }
.fb-scroll:hover { background: #F2F2F2; }
@media (hover: none) { .fb-scroll { display: none !important; } }

.person-card { position: relative; flex: 0 0 172px; display: grid; justify-items: center; align-content: start; gap: 2px; padding: 18px 12px 12px; border: 1px solid var(--border-subtle); border-radius: 12px; text-align: center; background: var(--bg-surface); scroll-snap-align: start; }
.person-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--text-secondary); }
.person-x:hover { background: var(--bg-hover); color: var(--text-primary); }
.person-avatar { margin-bottom: 8px; }
.person-card .username-row { max-width: 100%; justify-content: center; font-size: 15px; }
.person-name { max-width: 100%; font-size: 13px; color: var(--text-secondary); }
.person-sub { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; font-size: 12px; line-height: 1.3; color: var(--text-secondary); }
.person-sub > span:last-child { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.person-sub .avatar { flex: none; }
.person-follow { width: 100%; margin-top: 8px; }
.person-follow .btn { width: 100%; }

.reels-track { gap: 6px; }
.reel-thumb { position: relative; flex: 0 0 152px; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: #000; scroll-snap-align: start; }
.reel-thumb-link { position: absolute; inset: 0; display: block; }
.reel-thumb-link img, .reel-thumb-link video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel-thumb-link video { opacity: 0; transition: opacity 200ms; }
.reel-thumb-link video.is-on { opacity: 1; }
.reel-thumb-shade { position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); pointer-events: none; }
.reel-thumb-who { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; color: #fff; font-size: 13px; font-weight: 600; }
.reel-thumb-views { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.reel-thumb-menu { position: absolute; top: 4px; right: 4px; z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, 0.35); }
.reel-thumb-menu:hover { background: rgba(0, 0, 0, 0.6); }
@media (max-width: 767px) {
  .feed-block { border-radius: 0; border-inline: 0; box-shadow: none; margin-bottom: 8px; }
  .person-card { flex-basis: 156px; }
  .reel-thumb { flex-basis: 132px; }
}

/* --- Post window ---------------------------------------------------------------------------
   Desktop: media (true aspect, on black) + a fixed-width panel, centred over a dim scrim, ‹ › just
   outside the edges. The frame size comes from --r (aspect of the first item). Under 900px: full
   screen, one column, comments in a bottom sheet. */
html.overlay-open { overflow: hidden; }
.pw { position: fixed; inset: 0; z-index: 85; display: none; }
.pw.is-open { display: block; }
.pw-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); animation: fade-in 160ms both; }
.pw-close { position: absolute; top: 12px; right: 12px; z-index: 4; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.pw-close:hover { background: rgba(255, 255, 255, 0.12); }
.pw-window {
  --pw-panel: 405px; --pw-gap: 76px;
  --pw-maxh: min(calc(100dvh - 48px), 1100px);
  --pw-maxw: calc(100vw - 2 * var(--pw-gap) - var(--pw-panel));
  --pw-mw: min(calc(var(--pw-maxh) * var(--r, 1)), var(--pw-maxw));
  --pw-h: max(min(var(--pw-maxh), calc(var(--pw-mw) / var(--r, 1))), min(520px, var(--pw-maxh)));
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(var(--pw-mw) + var(--pw-panel)); height: var(--pw-h); outline: none;
}
.pw.is-open .pw-window { animation: pw-in 200ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.pw.reduce .pw-window, .pw.reduce .pw-scrim { animation: fade-in 120ms both; }
@keyframes pw-in { from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (prefers-reduced-motion: reduce) { .pw.is-open .pw-window { animation: fade-in 120ms both; } }
@media (min-width: 900px) and (max-width: 1099px) { .pw-window { --pw-panel: 340px; --pw-gap: 60px; } }
.pw-frame { position: absolute; inset: 0; overflow: hidden; border-radius: 8px; background: var(--bg-surface); box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45); }
.pw-step { position: absolute; top: 50%; z-index: 3; width: 40px; height: 40px; margin-top: -20px; display: none; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #0F1419; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
.pw-step:hover { background: #fff; }
.pw-step.prev { left: -58px; } .pw-step.next { right: -58px; }
.pw.has-prev .pw-step.prev, .pw.has-next .pw-step.next { display: grid; }

.pw-preview { position: absolute; inset: 0; display: grid; grid-template-columns: var(--pw-mw) var(--pw-panel); }
.pw.is-ready .pw-preview { display: none; }
.pw-preview-media { display: grid; place-items: center; min-width: 0; background: #000; }
.pw-preview-media img { width: 100%; height: 100%; object-fit: contain; }
.pw-preview-media img:not([src]) { visibility: hidden; }
.pw-preview-side { display: grid; grid-template-rows: auto 1fr auto; gap: 16px; padding: 16px; border-left: 1px solid var(--border-subtle); }
.pw-sk-body { display: grid; align-content: start; gap: 18px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.pw-sk-row { display: flex; align-items: center; gap: 12px; }
.pw-sk-row .sk-circle { width: 32px; height: 32px; flex: none; }
.pw-sk-row .sk-line { height: 12px; }
.pw-failed { display: none; }
.pw.is-failed .pw-preview-side { grid-template-rows: 1fr; }
.pw.is-failed .pw-preview-side > .pw-sk-row, .pw.is-failed .pw-preview-side > .pw-sk-body { display: none; }
.pw.is-failed .pw-failed { display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; font-size: 14px; color: var(--text-secondary); }
.cmt.is-loading .cmt-skeleton { border-top: 0; padding: 4px 0; }
.pw-live { position: absolute; inset: 0; visibility: hidden; }
.pw.is-ready .pw-live { visibility: visible; }
.pw-content { height: 100%; }
.pw-content .pd-missing { height: 100%; display: grid; place-content: center; }

.pw-post { display: grid; grid-template-columns: var(--pw-mw) var(--pw-panel); height: 100%; background: var(--bg-surface); }
.pw-media { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #000; outline: none; user-select: none; -webkit-user-select: none; }
.pw-slides { position: absolute; inset: 0; }
.pw-slide { position: absolute; inset: 0; display: grid; place-items: center; }
.pw-photo { width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center; container-type: size; }
.pw-photo > .media { width: min(100cqw, calc(100cqh * var(--ar, 1))); height: auto; max-height: 100cqh; border-radius: 0; background-color: transparent !important; background-image: none !important; transition: transform 200ms ease; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.pw-photo > .media img { width: 100%; height: 100%; object-fit: contain; }
.pw-photo.is-zoomed > .media { transform: scale(2); cursor: zoom-out; }
.pw-media .heart-burst { z-index: 2; }
.pw-arrow { position: absolute; top: 50%; z-index: 3; width: 32px; height: 32px; margin-top: -16px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.88); color: #0F1419; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3); }
.pw-arrow:hover { background: #fff; }
.pw-arrow.prev { left: 12px; } .pw-arrow.next { right: 12px; }
.pw-counter { position: absolute; top: 12px; right: 12px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 600; }
.pw-dots { position: absolute; left: 50%; bottom: 12px; z-index: 3; display: flex; gap: 4px; transform: translateX(-50%); pointer-events: none; }
.pw-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); transition: background-color 150ms; }
.pw-dots span.is-on { background: #fff; }
.pw-zoom { position: absolute; left: 12px; bottom: 12px; z-index: 3; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; }
.pw-zoom:hover { background: rgba(0, 0, 0, 0.75); }
.pw-dots ~ .pw-zoom { bottom: 26px; }

/* Video player. */
.pw-video { position: relative; width: 100%; height: 100%; background: #000; }
.pw-video video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.pw-video-big { position: absolute; left: 50%; top: 50%; z-index: 2; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, 0.5); color: #fff; }
.pw-video-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 28px 12px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.65)); color: #fff; transition: opacity 200ms; }
.pw-media:has(.pw-dots) .pw-video-bar { padding-bottom: 26px; }
.pw-video.is-idle .pw-video-bar { opacity: 0; }
.pw-video.is-idle { cursor: none; }
.pw-vbtn { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.pw-vbtn:hover { background: rgba(255, 255, 255, 0.14); }
.pw-seek { position: relative; flex: 1; height: 20px; cursor: pointer; touch-action: none; outline: none; }
.pw-seek::before, .pw-seek-buf, .pw-seek-fill { content: ""; position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; }
.pw-seek::before { right: 0; background: rgba(255, 255, 255, 0.28); }
.pw-seek-buf { background: rgba(255, 255, 255, 0.45); }
.pw-seek-fill { background: #fff; }
.pw-seek-knob { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform 120ms; }
.pw-seek:hover .pw-seek-knob, .pw-seek:focus-visible .pw-seek-knob { transform: scale(1); }
.pw-vtime { flex: none; min-width: 76px; font-size: 12px; font-weight: 600; text-align: center; }
.pw-volume { display: flex; align-items: center; }
.pw-volume input { width: 0; opacity: 0; accent-color: #fff; transition: width 150ms, opacity 150ms; }
.pw-volume:hover input, .pw-volume:focus-within input { width: 72px; opacity: 1; margin-right: 4px; }
.pw-video:fullscreen { width: 100vw; height: 100vh; }

/* Panel: head / comments (scroll) / action bar / composer. Post\Comments' root is display: contents
   here so the action bar can sit between the list and the composer. */
.pw-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "head" "list" "foot" "composer"; min-width: 0; min-height: 0; border-left: 1px solid var(--border-subtle); background: var(--bg-surface); }
.pw-head { grid-area: head; display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.pw-head .icon-btn { margin-left: auto; }
.pw-head .post-head-line .follow-link { font-size: 15px; }
.pw-comments, .pw-panel .cmt { display: contents; }
.pw-panel .cmt-scroll { grid-area: list; }
.pw-panel .cmt-composer, .pw-panel .cmt-login { grid-area: composer; }
.pw-sheet-head, .pw-sheet-scrim, .pw-view-comments, .pw-caption { display: none; }
.pw-foot { grid-area: foot; display: grid; gap: 2px; padding: 4px 16px 12px; border-top: 1px solid var(--border-subtle); }
.pw-foot .post-actions { margin: 0 -8px; padding-top: 4px; }
.pw-time { font-size: 13px; color: var(--text-secondary); width: fit-content; }
.pw-view-comments { text-align: left; font-size: 14px; color: var(--text-secondary); }

@media (max-width: 899px) {
  .pw-window { left: 0; top: 0; width: 100%; height: 100%; transform: none; }
  .pw.is-open .pw-window { animation: fade-in 140ms both; }
  .pw-frame { border-radius: 0; box-shadow: none; }
  .pw-step { display: none !important; }
  .pw-close { top: 6px; left: 4px; right: auto; z-index: 6; color: var(--text-primary); }
  .pw-close:hover { background: var(--bg-hover); }
  .pw-preview { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr; }
  .pw-preview-media { grid-row: 2; aspect-ratio: var(--r, 1); max-height: 70dvh; }
  .pw-preview-side { grid-row: 3; border-left: 0; }
  .pw-live { overflow-y: auto; overscroll-behavior: contain; }
  .pw-content { height: auto; min-height: 100%; }
  .pw-post { display: flex; flex-direction: column; height: auto; min-height: 100%; }
  .pw-panel { display: contents; }
  .pw-head { order: 0; padding-left: 52px; border-bottom: 0; }
  .pw-media { order: 1; width: 100%; aspect-ratio: var(--r, 1); max-height: 72dvh; flex: none; }
  .pw-foot { order: 2; border-top: 0; padding-bottom: 24px; }
  .pw-caption, .pw-view-comments { display: block; }
  .pw-caption .caption-more { background: linear-gradient(to right, transparent, var(--bg-surface) 30px); }
  /* Comments: bottom sheet. */
  .pw-comments { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; height: 78dvh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; background: var(--bg-surface); box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3); transform: translateY(105%); transition: transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1); visibility: hidden; }
  .sheet-open .pw-comments { transform: none; visibility: visible; }
  .pw-sheet-scrim { position: fixed; inset: 0; z-index: 7; background: rgba(0, 0, 0, 0.45); }
  .sheet-open .pw-sheet-scrim { display: block; }
  .pw-sheet-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
  .pw-sheet-head strong { font-size: 16px; }
  .pw-sheet-head .icon-btn { position: absolute; right: 8px; }
  .pw-panel .cmt { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .pw-panel .cmt-scroll { flex: 1; }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) { .pw-comments { transition: none; } }

/* /p/{id}: the same layout inline. */
.post-page-inner > .pw-content { max-width: 1100px; margin: 0 auto; }
.post-page .pw-content:not(.in-modal) .pw-post { --pw-panel: 405px; --pw-mw: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) 405px; height: min(86dvh, 820px); border: 1px solid var(--border-subtle); border-radius: 8px; overflow: hidden; }
@media (max-width: 899px) {
  .post-page .pw-content:not(.in-modal) .pw-post { display: flex; height: auto; border: 0; border-radius: 0; overflow: visible; }   /* visible: keeps the composer sticky */
  .post-page .pw-content:not(.in-modal) .pw-head { padding-left: 16px; }
  .post-page .pw-content:not(.in-modal) .pw-comments { position: static; transform: none; visibility: visible; height: auto; box-shadow: none; border-radius: 0; order: 3; }
  .post-page .pw-content:not(.in-modal) .pw-sheet-head, .post-page .pw-content:not(.in-modal) .pw-view-comments, .post-page .pw-content:not(.in-modal) .pw-sheet-scrim { display: none !important; }
  .post-page .pw-content:not(.in-modal) .cmt-composer { position: sticky; bottom: calc(56px + env(safe-area-inset-bottom)); }
}

/* --- Comments (Post\Comments) --------------------------------------------------------------- */
.cmt { display: flex; flex-direction: column; min-height: 0; }
.cmt-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 16px; }
.cmt-note, .cmt-login { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.cmt-login { border-top: 1px solid var(--border-subtle); }
.cmt-toolbar { position: relative; display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.cmt-sort { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.cmt-sort:hover { color: var(--text-primary); }
.cmt-sort-menu { position: absolute; left: 0; top: calc(100% + 4px); z-index: 10; width: min(320px, 100%); display: grid; padding: 6px; }
.cmt-sort-item { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--text-primary); }
.cmt-sort-item:hover { background: var(--bg-menu-hover); }
.cmt-sort-item strong { font-size: 15px; font-weight: 600; }
.cmt-sort-item span { grid-column: 1; font-size: 13px; line-height: 1.35; color: var(--text-secondary); }
.cmt-sort-item .icon { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--brand-400); }
.cmt-list { display: grid; gap: 16px; }
.cmt-pending:empty { display: none; }
.cmt-pending { margin-bottom: 16px; }
.cmt-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; }
.cmt-item.is-reply { grid-template-columns: 24px minmax(0, 1fr); }
.cmt-item.is-caption { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border-subtle); }
.cmt-main { min-width: 0; }
.cmt-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: 14px; line-height: 1.3; }
.cmt-head .username { font-size: 14px; font-weight: 600; }
.cmt-head time { font-size: 13px; color: var(--text-secondary); }
.cmt-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.cmt-badge.is-author .icon { color: var(--accent-flash); }
.cmt-replying { font-size: 13px; color: var(--text-secondary); }
.cmt-body { margin-top: 2px; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-line; color: var(--text-primary); }
.cmt-body.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden; }
.cmt-see-more { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.cmt-see-more:hover { color: var(--text-primary); text-decoration: underline; }
.cmt-content { display: flex; align-items: flex-start; gap: 2px; }
.cmt-text { min-width: 0; }
.cmt-item.is-hidden .cmt-body, .cmt-item.is-hidden .cmt-media-img { opacity: 0.55; }
.cmt-media-btn { display: block; margin-top: 6px; border-radius: 12px; cursor: zoom-in; }
.cmt-media-btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.cmt-media-img { display: block; width: auto; height: auto; max-width: min(220px, 100%); max-height: 220px; margin-top: 6px; border-radius: 12px; background: var(--bg-raised); object-fit: cover; }
.cmt-media-btn .cmt-media-img { margin-top: 0; }
.cmt-media-img.is-sticker { width: 110px; height: 110px; max-width: 110px; background: none; border-radius: 0; object-fit: contain; }
.cmt-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cmt-meta button:hover { color: var(--text-primary); }
.cmt-like.is-on { color: var(--accent-flash); }
.cmt-likes { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; }
.cmt-likes .icon { color: var(--accent-flash); }
.cmt-edited { font-weight: 500; }
.cmt-menu { flex: none; width: 32px; height: 32px; color: var(--text-secondary); opacity: 0; transition: opacity 120ms; }
.cmt-item:hover .cmt-menu, .cmt-item:focus-within .cmt-menu, .cmt-menu:focus-visible { opacity: 1; }
@media (hover: none) { .cmt-menu { opacity: 1; } }
.cmt-failed { color: var(--status-danger); font-weight: 600; }
.cmt-failed button { text-decoration: underline; color: inherit; }
.cmt-item.is-pending:not(.is-failed) { opacity: 0.7; }
.cmt-edit textarea { display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--bg-raised); color: var(--text-primary); font-size: 15px; line-height: 1.4; resize: none; outline: none; }
.cmt-edit textarea:focus { box-shadow: 0 0 0 2px var(--brand-500); }
.cmt-edit-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.cmt-thread { display: grid; gap: 12px; padding-left: 42px; }
.cmt-replies { display: grid; gap: 14px; }
.cmt-thread-toggle { display: flex; align-items: center; gap: 12px; width: fit-content; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cmt-thread-toggle:hover { color: var(--text-primary); }
.cmt-thread-line { width: 24px; height: 1px; background: var(--text-secondary); opacity: 0.6; }
.cmt-more { display: block; margin: 14px 0 0; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.cmt-more:hover { color: var(--text-primary); }
.cmt-empty { display: grid; justify-items: center; gap: 4px; padding: 36px 0; text-align: center; }
.cmt-empty strong { font-size: 18px; }
.cmt-empty span { font-size: 14px; color: var(--text-secondary); }

/* Composer: avatar, one rounded field that grows to several lines with the tools inside it at the
   right (Facebook), Post. .is-multi: the text takes the whole first row and the tools go below. */
.cmt-composer { position: relative; padding: 10px 12px 12px 16px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface); }
.cmt-row { display: flex; align-items: flex-end; gap: 8px; }
.cmt-me { flex: none; margin-bottom: 4px; }
.cmt-field { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 2px; padding: 2px 4px 2px 14px; border-radius: 20px; background: var(--bg-raised); }
.cmt-field.is-multi { border-radius: 18px; padding-top: 4px; }
.cmt-field:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-500) 40%, transparent); }
.cmt-field textarea { flex: 1 1 110px; min-width: 0; max-height: 120px; padding: 8px 0; border: 0; background: transparent; color: var(--text-primary); font-size: 15px; line-height: 20px; resize: none; outline: none; }
.cmt-field.is-multi textarea { flex-basis: 100%; padding-bottom: 2px; }
.cmt-field textarea::placeholder { color: var(--text-secondary); }
.cmt-tools { display: flex; flex: none; margin-left: auto; padding-bottom: 2px; }
.cmt-tool { width: 30px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--text-secondary); }
.cmt-tool:hover { background: var(--bg-hover); color: var(--text-primary); }
.cmt-tool:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.cmt-tool.is-on { color: var(--brand-400); }
.cmt-tool:disabled { opacity: 0.35; pointer-events: none; }
.cmt-post { flex: none; height: 36px; padding: 0 4px; font-size: 15px; font-weight: 700; color: var(--brand-400); }
.cmt-post:disabled { color: var(--text-tertiary); cursor: default; }
.cmt-reply-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 6px 42px; font-size: 13px; color: var(--text-secondary); }
.cmt-reply-chip strong { color: var(--text-primary); }
.cmt-attach { padding: 0 0 8px 42px; }
.cmt-attach-preview { position: relative; width: fit-content; }
.cmt-attach-preview img { display: block; max-width: 120px; max-height: 96px; border-radius: 10px; background: var(--bg-raised); }
.cmt-attach-preview.is-sticker img { width: 80px; height: 80px; object-fit: contain; background: none; }
.cmt-attach-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); border-radius: 10px; }
.cmt-attach-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--text-primary); color: var(--bg-base); }

/* Popovers above the composer. Height = the room between the panel top and the composer
   (--cmt-pop-h, set by fitPopover() in app.js), so they never get clipped. */
.cmt-popover { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 2px); z-index: 12; }
.cmt-picker { left: auto; width: min(380px, calc(100% - 24px)); height: min(var(--cmt-pop-h, 360px), 420px); display: flex; flex-direction: column; gap: 6px; padding: 8px; overflow: hidden; }
.cmt-picker-head .input { width: 100%; height: 36px; font-size: 14px; }
.cmt-picker-tabs { flex: none; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px; }
.cmt-picker-tabs::-webkit-scrollbar { display: none; }
.cmt-picker-tabs button { flex: none; min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; border-radius: 8px; font-size: 20px; line-height: 1; color: var(--text-secondary); }
.cmt-picker-tabs button.is-text { padding: 0 10px; font-size: 13px; font-weight: 700; }
.cmt-picker-tabs img { width: 24px; height: 24px; object-fit: contain; }
.cmt-picker-section + .cmt-picker-section { margin-top: 8px; }
.cmt-picker-section .cmt-picker-title { padding: 2px 4px 4px; }
.cmt-picker-tabs button:hover { background: var(--bg-menu-hover); color: var(--text-primary); }
.cmt-picker-tabs button[aria-selected="true"] { background: var(--bg-raised); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--brand-500); }
.cmt-picker-tabs button:focus-visible, .cmt-picker-body button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.cmt-picker-title { flex: none; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); padding: 0 4px; }
.cmt-picker-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cmt-picker-empty { grid-column: 1 / -1; padding: 24px 8px; text-align: center; font-size: 14px; color: var(--text-secondary); }
.cmt-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); align-content: start; }
.cmt-emoji-grid button { height: 38px; font-size: 24px; line-height: 1; border-radius: 8px; }
.cmt-emoji-grid button:hover { background: var(--bg-menu-hover); }
.cmt-sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; align-content: start; }
.cmt-sticker { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; transition: transform 100ms; }
.cmt-sticker:hover { background: var(--bg-menu-hover); transform: scale(1.06); }
.cmt-sticker img { width: 64px; height: 64px; object-fit: contain; }
.cmt-giphy-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.cmt-giphy-pane .input { height: 36px; font-size: 14px; }
.cmt-mentions { max-height: 248px; overflow-y: auto; display: grid; padding: 6px; }
.cmt-mention { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; color: var(--text-primary); }
.cmt-mention:hover, .cmt-mention.is-active { background: var(--bg-menu-hover); }
.cmt-mention img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-raised); }
.cmt-mention span { display: grid; min-width: 0; }
.cmt-mention strong { font-size: 14px; }
.cmt-mention small { font-size: 13px; color: var(--text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmt-gifs-grid { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; align-content: start; }
.cmt-gif { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--bg-raised); }
.cmt-gif img { width: 100%; height: 100%; object-fit: cover; }
.cmt-gif.is-sticker { background: transparent; }
.cmt-gif.is-sticker img { object-fit: contain; }
.cmt-gifs-loading { grid-column: 1 / -1; display: grid; place-items: center; padding: 8px; }
.cmt-giphy { flex: none; font-size: 12px; font-weight: 600; text-align: right; color: var(--text-secondary); }

/* --- Reels: Instagram desktop layout -------------------------------------------------------
   Video fills the height at 9:16, centred; the action rail sits outside it on the right; ↑ ↓ at the
   far right; comments open as a panel beside the video. */
.reels-nav { display: none; }
.reel-caption .caption-text { -webkit-line-clamp: 2; }
.reel-caption .caption-text.is-open { max-height: 40vh; overflow-y: auto; }
.reel-caption .caption-more { color: #fff; font-weight: 600; font-size: 14px; padding: 0; }
.reel-author .sep { color: rgba(255, 255, 255, 0.8); }
.reel-author .follow-link { border: 0 !important; padding: 0 !important; background: none !important; color: #fff !important; font-size: 15px !important; font-weight: 700; }
.reel-rail .reel-icon { display: grid; place-items: center; }
.reel-rail .reel-icon.liked .icon { color: var(--accent-flash); }
.reel-rail .pa-pop { left: auto; right: calc(100% + 8px); bottom: 0; }
.reel-count:empty { display: none; }

@media (min-width: 768px) {
  body.page-reels .reels-page { display: block !important; position: relative; height: calc(100dvh - var(--header-h)); padding: 0 !important; overflow: hidden; }
  body.page-reels .reels-top, body.page-reels .sound-hint { display: none !important; }
  body.page-reels .reels-scroller { position: absolute; inset: 0; height: auto !important; transition: right 200ms ease; }
  body.page-reels .reels-page.has-comments .reels-scroller { right: 424px; }
  body.page-reels .reel { height: calc(100dvh - var(--header-h)) !important; min-height: 0 !important; padding: 16px 0 !important; display: flex !important; align-items: center; justify-content: center; }
  body.page-reels .reel-stage, .rv .reel-stage { height: 100% !important; width: auto !important; display: flex !important; align-items: flex-end; gap: 12px; transform: translateX(34px); }
  body.page-reels .reel-media, .rv .reel-media { height: 100% !important; width: auto !important; max-width: none !important; aspect-ratio: 9 / 16 !important; border-radius: 12px; }
  body.page-reels .reel-media > .media, .rv .reel-media > .media { height: 100% !important; aspect-ratio: auto !important; }
  body.page-reels .reel-rail, .rv .reel-rail { position: relative !important; inset: auto !important; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 56px; padding-bottom: 0; }
  body.page-reels .reel-action { color: var(--text-primary) !important; filter: none !important; }
  body.page-reels .reel-action .icon { filter: none; }
  .reel-rail .reel-icon { width: 48px; height: 48px; border-radius: 50%; transition: background-color 120ms; }
  .reel-rail .reel-action:hover .reel-icon { background: var(--bg-hover); }
  .rv .reel-rail .reel-action:hover .reel-icon { background: rgba(255, 255, 255, 0.12); }
  body.page-reels .reel-count, .rv .reel-count { font-size: 12px; font-weight: 600; margin-top: -4px; }
  body.page-reels .reel-overlay, .rv .reel-overlay { padding-right: 16px !important; }
  body.page-reels .reel-disc { border-color: var(--text-primary); }
  body.page-reels .reels-hud { position: absolute !important; top: 28px !important; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; align-items: center; gap: 8px; width: auto !important; height: auto !important; transform: translateX(-34px); pointer-events: none; }
  body.page-reels .reels-page.has-comments .reels-hud { right: 424px; }
  body.page-reels .reels-hud-sound { position: static; }
  .reels-nav { position: absolute; right: 24px; top: 50%; z-index: 6; display: grid; gap: 12px; transform: translateY(-50%); }
  body.page-reels .reels-page.has-comments .reels-nav { right: 448px; }
  .reels-nav-btn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-raised); color: var(--text-primary); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
  .reels-nav-btn:hover { background: var(--bg-hover); }
  .reels-nav-btn:disabled { opacity: 0.35; cursor: default; }
  .reel-comments-panel { position: absolute; top: 16px; bottom: 16px; right: 24px; z-index: 7; width: 400px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-card); }
}
@media (min-width: 768px) and (max-width: 1100px) {
  body.page-reels .reels-page.has-comments .reels-scroller, body.page-reels .reels-page.has-comments .reels-hud { right: 384px; }
  body.page-reels .reels-page.has-comments .reels-nav { right: 400px; }
  .reel-comments-panel { width: 360px; right: 16px; }
}
.rcp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--border-subtle); }
.rcp-head strong { font-size: 16px; }
.rcp-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rcp-loading { display: grid; gap: 18px; padding: 16px; }
.rcp-live { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.reel-comments-panel .cmt { flex: 1; min-height: 0; }
.reel-comments-panel .cmt-scroll { flex: 1; }
@media (max-width: 767px) {
  .reel-comments-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: 72dvh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; background: var(--bg-surface); box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35); }
}

/* Reels viewer overlay (glint.reelViewer): below menus and dialogs so ⋯ / Share / Report open over it. */
.rv { z-index: 86 !important; }
.rv-fly { z-index: 87 !important; background: #000 center / cover no-repeat; pointer-events: none; }
.rv-poster { position: absolute; left: 50%; top: 16px; z-index: 1; height: calc(100dvh - 32px); aspect-ratio: 9 / 16; display: none; place-items: center; border-radius: 16px; transform: translateX(-50%); background: #000 center / cover no-repeat; color: #fff; }
.rv.is-open:not(.is-ready) .rv-poster { display: grid; }
.rv-scroller { z-index: 2; }
.rv .reel { padding: 16px 0 !important; display: flex !important; justify-content: center; align-items: center; }
.rv .reel-stage { height: calc(100dvh - 32px) !important; }
.rv .reel-action { color: #fff !important; }
.rv.has-comments .rv-scroller { right: 424px; }
.rv .reel-comments-panel { z-index: 5; }
.rv .reels-nav { z-index: 4; }
.rv:not(.is-ready) .reels-nav { display: none; }
.rv .reels-nav-btn { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
.rv .reels-nav-btn:hover { background: rgba(255, 255, 255, 0.24); }
.rv.has-comments .reels-nav { right: 448px; }
.rv-close { z-index: 6; }
.rv.reduce .rv-backdrop, .rv.reduce .rv-scroller { transition: opacity 120ms !important; }
@media (max-width: 767px) {
  .rv .reel { padding: 0 !important; }
  .rv .reel-stage { transform: none; width: 100vw !important; height: 100dvh !important; }
  .rv .reel-rail { position: absolute !important; right: 8px; bottom: 24px; }
  .rv-poster { top: 0; height: 100dvh; border-radius: 0; width: 100vw; aspect-ratio: auto; }
}

/* --- Quote dialog ------------------------------------------------------------------------------ */
.quote-dialog { width: min(540px, calc(100vw - 32px)); padding: 0; text-align: left; border-radius: 16px; overflow: hidden; background: var(--bg-surface); }
.quote-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border-subtle); }
.quote-head h2 { font-size: 16px; font-weight: 700; }
.quote-head .btn { justify-self: end; }
.quote-head .link-btn { justify-self: start; color: var(--text-primary); font-weight: 500; }
.quote-body { display: grid; gap: 12px; max-height: 72dvh; overflow-y: auto; padding: 16px; }
.quote-input { width: 100%; min-height: 52px; padding: 0; border: 0; background: transparent; color: var(--text-primary); font-size: 16px; line-height: 1.4; resize: none; outline: none; }
.quote-card { border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; }
.quote-card-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; }
.quote-card-head img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.quote-card-media { position: relative; background: #000; }
.quote-card-media img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.quote-card-count { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 600; }
.quote-card-caption { padding: 10px 12px; font-size: 14px; color: var(--text-secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* --- Lightbox (comment photos) ------------------------------------------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; background: rgba(0, 0, 0, 0.92); cursor: zoom-out; animation: fade-in 120ms both; }
.lightbox img { max-width: 94vw; max-height: 94vh; object-fit: contain; }

/* --- Profile social links: brand icons only -------------------------------------------------- */
.profile-socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.profile-social { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-raised); color: #fff; transition: transform 120ms, filter 120ms; }
.profile-social:hover { transform: translateY(-1px); filter: brightness(1.08); }
.profile-social.is-whatsapp { background: #25D366; }
.profile-social.is-x, .profile-social.is-threads { background: #000; }
:root[data-theme="dark"] .profile-social.is-x, :root[data-theme="dark"] .profile-social.is-threads { background: #fff; color: #000; }
.profile-social.is-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.profile-social.is-facebook { background: #1877F2; }
.profile-social.is-linkedin { background: #0A66C2; }

/* --- Explore: popular hashtag rows (tag and count on separate lines) --------------------------- */
.topic-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; color: var(--text-primary); }
.topic-row:hover { background: var(--bg-hover); }
.topic-row img { width: 48px; height: 48px; flex: none; border-radius: 8px; object-fit: cover; background: var(--bg-raised); }
.topic-row > span { display: grid; gap: 2px; flex: 1; min-width: 0; }
.topic-row strong { font-size: 15px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topic-row small { font-size: 13px; color: var(--text-secondary); }
.topic-row > .icon { color: var(--text-secondary); }
.person-sub .avatar { --size: 18px; width: 18px; height: 18px; }
.rv, .reel-media { -webkit-user-select: none; user-select: none; }
.reel-action .reposted, .reel-action .reposted .icon, .pa-btn .reposted .icon { color: currentColor; }

.pw-panel .cmt-note.is-off { display: none; }
.pw-comments-off { font-size: 14px; color: var(--text-secondary); }
/* The player never outgrows its column (narrow tablets with comments open, 4K screens): the stage height
   follows the scroller's width too (9:16 video + the rail), and caps at 1400px. */
@media (min-width: 768px) {
  body.page-reels .reels-scroller, .rv .rv-scroller { container-type: size; }
  body.page-reels .reel-stage, .rv .reel-stage { height: min(100%, calc((100cqw - 150px) * 16 / 9), 1400px) !important; }
}
@media (min-width: 768px) and (max-width: 1100px) { body.page-reels .reels-page.has-comments .reels-nav { display: none; } }

/* /p/{id} loaded directly on a wide screen: the post window opens over the page, so the page itself stays out of view. */
.post-page.pp-direct { display: none; }

/* Edit profile: Save stays in view. */
.set-actions-sticky { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 0; background: var(--bg-surface, var(--bg-base)); border-top: 1px solid var(--border-subtle); }
.set-unsaved { font-size: 14px; color: var(--text-secondary); }

/* --- Expanded photo view (expand button in the post window; Facebook-style photo viewer) ------------
   The window fills the screen: black photo stage (left) + the same details panel (right, 380px).
   ✕ / Esc return to the normal window. Zoom 1×–4× around the pointer, drag to pan (pwMedia). */
.pw-expand { position: absolute; left: 56px; bottom: 12px; z-index: 3; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; }
.pw-expand:hover { background: rgba(0, 0, 0, 0.75); }
.pw-dots ~ .pw-expand { bottom: 26px; }
/* Readable on light photos too: a thin light ring + soft shadow around the dark disc. */
.pw-zoom, .pw-expand { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.35); }
/* Videos: no zoom, so Expand takes its place, above the control bar (it hides with the bar while playing). */
.pw-expand.is-video { left: 12px; bottom: 64px; transition: opacity 200ms; }
.pw-media:has(.pw-dots) .pw-expand.is-video { bottom: 80px; }
.pw-media:has(.pw-slide:not([style*="none"]) .pw-video.is-playing:not(.is-awake):not(:focus-within)):not(:hover) .pw-expand.is-video { opacity: 0; pointer-events: none; }
/* Expanded video: the player fills the stage exactly (the video letterboxes inside it), control bar at the bottom. */
.pw-media.is-expanded .pw-video { position: absolute; inset: 0; width: auto; height: auto; background: #000; }
.pw-media.is-expanded .pw-video video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.pw-xbar { position: absolute; top: 16px; z-index: 4; display: flex; align-items: center; gap: 10px; }
.pw-xbar.is-start { left: 16px; }
.pw-xbar.is-end { right: 16px; }
.pw-xclose { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #E4E6EB; color: #050505; }
.pw-xclose:hover { background: #fff; }
.pw-xlogo { width: 40px; height: 40px; border-radius: 50%; }
.pw-xbtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(40, 42, 46, 0.78); color: #fff; }
.pw-xbtn:hover:not(:disabled) { background: rgba(70, 72, 78, 0.9); }
.pw-xbtn:disabled { opacity: 0.4; cursor: default; }
.pw-xclose:focus:not(:focus-visible), .pw-xbtn:focus:not(:focus-visible), .pw-expand:focus:not(:focus-visible) { outline: none; }
.pw-media:fullscreen { background: #000; }

/* Shell: the post window becomes the whole viewport. */
.pw.is-expanded .pw-window { --pw-mw: minmax(0, 1fr); --pw-panel: 380px; left: 0; top: 0; width: 100%; height: 100%; transform: none; animation: none; }
.pw.is-expanded .pw-scrim { background: #000; }
.pw.is-expanded .pw-frame { border-radius: 0; box-shadow: none; }
.pw.is-expanded .pw-close { display: none; }
.pw.is-expanded .pw-preview-media { background: #000; }
/* Previous / next post: big round arrows on the stage edges (hidden on a side where the carousel still pages). */
.pw.is-expanded .pw-step { width: 48px; height: 48px; margin-top: -24px; background: rgba(228, 230, 235, 0.55); color: #050505; box-shadow: none; }
.pw.is-expanded .pw-step:hover { background: rgba(228, 230, 235, 0.85); }
.pw.is-expanded .pw-step.prev { left: 16px; }
.pw.is-expanded .pw-step.next { right: calc(380px + 16px); }
.pw.is-expanded:has(.pw-live .pw-arrow.prev:not([style*="none"])) .pw-step.prev,
.pw.is-expanded:has(.pw-live .pw-arrow.next:not([style*="none"])) .pw-step.next { display: none; }

/* Content (window and /p/{id} page alike). */
.pw-content.is-expanded:not(.in-modal) { position: fixed; inset: 0; z-index: 90; height: 100%; max-width: none; margin: 0; background: #000; }
.pw-content.is-expanded .pw-post { grid-template-columns: minmax(0, 1fr) 380px !important; height: 100% !important; border: 0 !important; border-radius: 0 !important; }
.pw-content.is-expanded .pw-panel { background: var(--bg-surface); }
.pw-media.is-expanded { background: #000; }
.pw-media.is-expanded .pw-zoom, .pw-media.is-expanded .pw-dots { display: none; }
.pw-media.is-expanded .pw-counter { top: auto; bottom: 16px; right: auto; left: 50%; transform: translateX(-50%); }
.pw-media.is-expanded .pw-arrow { width: 48px; height: 48px; margin-top: -24px; background: rgba(228, 230, 235, 0.55); color: #050505; box-shadow: none; }
.pw-media.is-expanded .pw-arrow:hover { background: rgba(228, 230, 235, 0.85); }
.pw-media.is-expanded .pw-arrow .icon { width: 22px; height: 22px; }
.pw-media.is-expanded .pw-arrow.prev { left: 16px; } .pw-media.is-expanded .pw-arrow.next { right: 16px; }
.pw-media.is-expanded .pw-photo { touch-action: none; cursor: zoom-in; background-color: #000 !important; }
.pw-media.is-expanded.is-panned .pw-photo { cursor: grab; }
.pw-media.is-expanded.is-dragging .pw-photo { cursor: grabbing; }
.pw-media.is-expanded .pw-photo > .media { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--s, 1)); transform-origin: 50% 50%; transition: transform 160ms ease-out; cursor: inherit; }
.pw-media.is-expanded.is-dragging .pw-photo > .media { transition: none; }
.pw-media.is-expanded .pw-photo img { -webkit-user-drag: none; }
@media (max-width: 899px) {
  .pw-content.is-expanded .pw-media { position: fixed; inset: 0; z-index: 20; width: auto; max-height: none; aspect-ratio: auto; }
  .pw.is-expanded .pw-step { display: none !important; }
}

/* Feed "Reels" row (batch 3 items 2 + 35): the track runs edge to edge inside the block with 12px side
   margins; tiles are sized so exactly ~2.5 show on phones (~3.5 on desktop) with 6px gaps, snap to the
   start. Every tile keeps the 9:16 tile height and is as wide as its reel's own aspect (--ra, clamped to
   1:2 … 1:1 server-side) so the reel shows whole with no letterbox; a bottom gradient with ▶ views over the username. Muted previews of the
   tiles in view come from js/tile-preview.js ([data-tile-preview] → .is-playing). */
.reels-block { padding-bottom: 12px; }
.reels-block .fb-head { padding-inline: 12px 8px; }
.reels-block .reels-track { gap: 6px; padding: 0 12px; scroll-snap-type: x mandatory; scroll-padding-inline: 12px; }
.reels-block .reel-thumb { --rb: calc(100% / 2.5); flex: 0 0 calc(var(--rb) * var(--ra, .5625) / .5625); width: calc(var(--rb) * var(--ra, .5625) / .5625); aspect-ratio: var(--ra, .5625); border-radius: 10px; scroll-snap-align: start; scroll-snap-stop: normal; }
.reels-block .reel-thumb-link img, .reels-block .reel-thumb-link .tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reels-block .reel-thumb-link .tile-video { opacity: 0; transition: opacity 200ms; pointer-events: none; background: transparent; }
.reels-block .reel-thumb-link.is-playing .tile-video { opacity: 1; }
.reel-thumb-link .tile-frame { position: absolute; inset: 0; display: block; overflow: hidden; }
.reels-block .reel-thumb-shade { height: 42%; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); }
.reels-block .reel-thumb-meta { position: absolute; left: 10px; right: 10px; bottom: 9px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .55); pointer-events: none; }
.reels-block .reel-thumb-views { position: static; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; line-height: 1.2; }
.reels-block .reel-thumb-views .icon { width: 14px; height: 14px; }
.reels-block .reel-thumb-who { position: static; display: block; max-width: 100%; font-size: 14px; font-weight: 600; line-height: 1.25; }
/* Desktop (wide feed column, ~620px-tall laptop screens): ~3.5 tiles so the row stays within one screen. */
@media (min-width: 768px) { .reels-block .reel-thumb { --rb: calc((100% - 6px) / 3.5); } }
/* …but a narrow feed column (short screens, WF-01) keeps the phone's 2.5 tiles, not ~105px slivers. */
.reels-block { container: reels-block / inline-size; }
@container reels-block (max-width: 560px) { .reels-block .reel-thumb { --rb: calc((100% - 6px) / 2.5); } }

/* Pull-to-refresh on the home feed (touch; js/app.js glint.refreshFeed). */
.feed-ptr { position: fixed; left: 50%; top: 8px; z-index: 60; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; background: var(--bg-surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); opacity: 0; transform: translateY(calc(var(--pull, 0px) - 40px)); pointer-events: none; transition: opacity 150ms; }
.feed-ptr::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 2.5px solid var(--text-tertiary); border-top-color: var(--brand-500); transform: rotate(calc(var(--pull, 0px) * 3deg)); }
.feed-ptr.is-pulling { opacity: 1; }
.feed-ptr.is-ready::after { border-color: var(--brand-500); }
