/* ==========================================================================
   Glint web — components (spec §5): StoryTray, PostCard, MediaCarousel,
   VideoPlayer, HeartBurst, GridTile, FollowButton, lists, comments, panels.
   ========================================================================== */

/* --- StoryTray ------------------------------------------------------------- */

.story-tray { position: relative; padding: 16px 0 12px; }
.story-track { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 4px; scrollbar-width: none; padding: 6px 4px; }
.story-track::-webkit-scrollbar { display: none; }
.story-item { flex: none; scroll-snap-align: start; }
.story-link { display: grid; justify-items: center; gap: 6px; width: 74px; padding-top: 4px; color: var(--text-primary); }
.story-avatar { position: relative; display: block; }
.story-add {
  position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-500); color: var(--on-brand); box-shadow: 0 0 0 2.5px var(--bg-base);
}
.story-name { max-width: 74px; font-size: var(--type-micro-size); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-name.is-seen { color: var(--text-secondary); }
.tray-arrow {
  position: absolute; top: 40px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--text-primary); color: var(--bg-base); opacity: 0.9; z-index: 2;
}
.tray-arrow.prev { left: 6px; }
.tray-arrow.next { right: 6px; }

/* --- PostCard --------------------------------------------------------------- */

.post-card { padding-bottom: 16px; margin-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.post-head { display: flex; align-items: center; gap: 10px; padding: 8px 4px 12px 4px; min-height: 56px; }
.post-head .icon-btn { margin-left: auto; }
.post-head-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.post-head-line { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--type-body-strong-size); }
.post-head-line .sep { color: var(--text-secondary); }
.post-sub { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: var(--type-meta-size); color: var(--text-primary); }
.post-sub:hover { color: var(--text-secondary); }
span.post-sub { color: var(--text-secondary); }

.post-media { position: relative; border-radius: var(--radius-photo-feed); overflow: hidden; background: var(--media-placeholder); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.post-frame { position: relative; }

.post-actions { position: relative; display: flex; align-items: center; gap: 16px; padding: var(--layout-post-actions-padding-top) 4px var(--layout-post-actions-padding-bottom); }
.post-actions .icon-btn { margin: -8px; }
.post-actions .action-save { margin-left: auto; margin-right: -8px; }
.post-actions .carousel-dots { position: absolute; left: 50%; transform: translateX(-50%); }
.action-like .liked { color: var(--accent-flash); }
.action-repost .reposted { color: var(--accent-selenium); }
.post-reposted {
  display: flex; align-items: center; gap: 6px; min-width: 0; padding: 10px 4px 0 6px;
  color: var(--text-secondary); font-size: var(--type-meta-size); line-height: 1.3;
}
.post-reposted:hover { color: var(--text-primary); }
.post-reposted .icon { flex: none; }
.post-reposted + .post-head { padding-top: 6px; }
/* "Liked by x · 12 reposts": when the reposts part wraps, its leading dot slides into the clipped
   left edge (negative margin + overflow), so a new line never starts with "·". */
.likes-row { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; overflow: hidden; padding: 2px; margin: -2px; }
.likes-row > .likes-line { margin-right: 16px; }
.likes-line + .reposts-line { margin-left: -16px; }
.reposts-line { display: inline-flex; align-items: center; color: var(--text-primary); }
.reposts-line .sep { width: 16px; text-align: center; color: var(--text-secondary); }
.reposts-line strong { font-weight: 600; }
.icon-btn.pop { animation: pop var(--motion-pop) ease-out; }
@keyframes pop { 50% { transform: scale(1.2); } }

.post-body { display: grid; gap: 6px; padding: 0 4px; font-size: var(--type-body-size); }
.likes-line { display: flex; align-items: center; gap: 8px; text-align: left; color: var(--text-primary); font-size: var(--type-body-size); }
.likes-line strong { font-weight: 600; }
.liked-by-avatars { display: flex; }
.liked-by-avatars .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg-base); border-radius: 50%; }
.caption { position: relative; }
.caption-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.caption-text.is-open { display: block; -webkit-line-clamp: unset; }
.caption-text .username-row { display: inline-flex; vertical-align: top; }
.caption-more { color: var(--text-secondary); font-size: var(--type-body-size); }
.caption-more:hover { color: var(--text-primary); }

/* --- AdCard (sponsored post) -------------------------------------------------- */
.ad-card .post-media { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ad-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px;
  background: var(--brand-500); color: var(--on-brand); font-weight: 600; font-size: var(--type-body-strong-size);
  border-radius: 0 0 var(--radius-photo-feed) var(--radius-photo-feed);
}
.ad-cta:hover { background: color-mix(in srgb, var(--brand-500) 88%, #000); }
.ad-cta:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.view-comments { color: var(--text-secondary); font-size: var(--type-body-size); width: fit-content; }
.view-comments:hover { color: var(--text-primary); }
.comment-preview { display: grid; gap: 2px; }
.comment-preview li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-preview .username-row { display: inline-flex; vertical-align: bottom; }
.post-time { font-size: var(--type-meta-size); color: var(--text-secondary); width: fit-content; }

.post-comment { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 0 4px; }
.post-comment textarea, .pd-form textarea {
  flex: 1; min-width: 0; resize: none; border: 0; background: transparent; color: var(--text-primary);
  font-size: var(--type-body-size); line-height: 1.4; padding: 6px 0; max-height: 80px; outline: none;
}
.post-comment textarea::placeholder, .pd-form textarea::placeholder { color: var(--text-secondary); }
.emoji { position: relative; }
.emoji-grid { position: absolute; bottom: 36px; right: 0; z-index: 20; min-width: 0; width: 244px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 8px; }
.pd-form .emoji-grid { left: 0; right: auto; }
.emoji-grid button { font-size: 22px; line-height: 1; padding: 6px 0; border-radius: 8px; }
.emoji-grid button:hover { background: var(--bg-raised); }
.link-btn.is-dim { opacity: 0.45; }

/* Processing: thin brand.500 line along the bottom edge of the media. */
.processing-line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; background: color-mix(in srgb, var(--brand-500) 25%, transparent); }
.processing-line::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--brand-500); animation: indeterminate 1.2s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* --- Media ------------------------------------------------------------------ */

.media { position: relative; width: 100%; overflow: hidden; background-color: var(--media-placeholder); background-size: cover; background-position: center; }
.media picture, .media img, .media video { width: 100%; height: 100%; }
.media img, .media video { object-fit: cover; }
.media.fit-contain img, .media.fit-contain video { object-fit: contain; }
.media-video video { background: transparent; cursor: pointer; }
.media-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none; }
.media-play .icon { width: 64px; height: 64px; filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.4)); }
.media-sound {
  position: absolute; right: 12px; bottom: 12px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(10, 12, 17, 0.72); color: #fff;
}
.media-tags { position: absolute; inset: 0; pointer-events: none; }
.media-tag-toggle { position: absolute; left: 12px; bottom: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 12, 17, 0.72); color: #fff; pointer-events: auto; }
.media-tag {
  position: absolute; transform: translate(-50%, 8px); pointer-events: auto; white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; background: rgba(10, 12, 17, 0.8); color: #fff; font-size: var(--type-meta-size); font-weight: 600;
}
/* Shopping tags: badge bottom-left (next to the user-tag toggle when both), pills at x/y. */
.media-products { position: absolute; inset: 0; pointer-events: none; }
.media-shop-badge {
  position: absolute; left: 12px; bottom: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 12, 17, 0.72); color: #fff; pointer-events: auto;
}
.media.has-user-tags .media-shop-badge { left: 48px; }
.media-product {
  position: absolute; transform: translate(-50%, 8px); display: grid; gap: 1px; max-width: 70%; padding: 6px 10px; border-radius: 6px;
  background: rgba(10, 12, 17, 0.84); color: #fff; text-align: left; pointer-events: auto; font-size: var(--type-meta-size); line-height: 1.25;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.media-product::before { content: ""; position: absolute; left: 50%; top: -5px; margin-left: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: rgba(10, 12, 17, 0.84); }
.media-product.is-above { transform: translate(-50%, calc(-100% - 8px)); }
.media-product.is-above::before { top: auto; bottom: -5px; border-bottom: 0; border-top: 5px solid rgba(10, 12, 17, 0.84); }
.media-product-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-product-price { color: rgba(255, 255, 255, 0.8); }
.media-product:hover { background: rgba(10, 12, 17, 0.95); }
.media.has-products { cursor: pointer; }
.product-sheet-body { display: grid; justify-items: center; gap: 6px; padding: 24px 24px 20px; text-align: center; }
.product-sheet-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-raised); color: var(--text-primary); margin-bottom: 4px; }
.product-sheet-title { font-size: var(--type-title-sm-size, 18px); font-weight: 600; overflow-wrap: anywhere; }
.product-sheet-price { font-size: var(--type-body-strong-size); font-weight: 600; }
.product-sheet-body .btn { width: 100%; margin-top: 6px; }
.product-sheet-cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px !important; }
.story-link.is-live { gap: 10px; }

.media-tag::before { content: ""; position: absolute; left: 50%; top: -5px; margin-left: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: rgba(10, 12, 17, 0.8); }

/* --- MediaCarousel ------------------------------------------------------------ */

.carousel { position: relative; width: 100%; overflow: hidden; }
.carousel-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline-offset: -3px; }
.carousel-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.carousel-slide .media { height: 100%; aspect-ratio: auto !important; }
.carousel-count {
  position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: 999px;
  background: rgba(10, 12, 17, 0.72); color: #fff; font-size: var(--type-micro-size); font-weight: 600; pointer-events: none;
}
.carousel-arrow {
  position: absolute; top: 50%; margin-top: -15px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(236, 239, 244, 0.86); color: #0E1117; z-index: 2;
}
.carousel-arrow.prev { left: 10px; }
.carousel-arrow.next { right: 10px; }
.carousel-arrow:hover { background: #fff; }
@media (hover: none), (max-width: 767px) { .carousel-arrow { display: none !important; } }
.carousel-dots { display: flex; gap: 4px; align-items: center; }
.carousel-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); transition: background-color 150ms; }
.carousel-dots span.is-on { background: var(--brand-500); }

/* --- HeartBurst ---------------------------------------------------------------- */

.heart-burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.heart-burst .burst-heart { width: 96px; height: 96px; color: var(--accent-flash); opacity: 0; transform: scale(0); filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.25)); }
.heart-burst .burst-p { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: var(--accent-flash); opacity: 0; }
.heart-burst.is-on .burst-heart { animation: heart-burst 700ms linear both; }
.heart-burst.is-on .burst-p { animation: heart-particle 560ms cubic-bezier(0.2, 0.9, 0.3, 1) 80ms both; }
/* 0 → 1.2 → 1 in 380ms (spring-like overshoot, damping ~12), fade out by 700ms. */
@keyframes heart-burst {
  0% { transform: scale(0); opacity: 1; animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1); }
  27% { transform: scale(1.2); opacity: 1; animation-timing-function: ease-in-out; }
  41% { transform: scale(0.95); opacity: 1; }
  54% { transform: scale(1); opacity: 1; }
  74% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}
@keyframes heart-particle {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(-30px) scale(0.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-82px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .heart-burst.is-on .burst-heart { animation: heart-still 600ms linear both !important; animation-duration: 600ms !important; }
  .heart-burst.is-on .burst-p { animation: none !important; opacity: 0; }
  @keyframes heart-still { 0%, 70% { transform: none; opacity: 1; } 100% { transform: none; opacity: 0; } }
}

/* --- Grid + GridTile -------------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--layout-grid-gap); }
.grid-explore { grid-auto-flow: dense; }
.tile {
  position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius-photo-grid);
  background-color: var(--media-placeholder); background-size: cover; background-position: center;
}
.tile.is-large { grid-column: span 2; grid-row: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-type { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.45)); }
.tile-type .icon { width: 18px; height: 18px; }
.tile-views { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; color: #fff; font-size: var(--type-meta-size); font-weight: 600; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5)); }
.tile-hover { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 28px; background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 16px; }
.tile-hover span { display: inline-flex; align-items: center; gap: 6px; }
@media (hover: hover) and (min-width: 768px) { .tile:hover .tile-hover, .tile:focus-visible .tile-hover { display: flex; } }

/* --- Follow link, user rows ----------------------------------------------------- */

.follow { display: inline-flex; flex: none; }
.follow-link { color: var(--brand-400); font-weight: 600; font-size: var(--type-meta-size); padding: 2px 0; }
.follow-link:hover { color: var(--text-primary); }
.follow-link.is-following { color: var(--text-secondary); }
.post-head-line .follow-link { font-size: var(--type-body-strong-size); }

.user-rows { display: grid; }
.user-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 16px; }
.user-row-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.user-row-text .username-row { font-size: var(--type-body-strong-size); }
.user-row-sub { font-size: var(--type-meta-size); color: var(--text-secondary); }
.list-empty { padding: 32px 16px; text-align: center; color: var(--text-secondary); }
.is-dim { opacity: 0.55; transition: opacity 120ms; }

/* Search field (panels, lists). */
.search-field { position: relative; display: flex; align-items: center; }
.search-field > .icon { position: absolute; left: 12px; color: var(--text-secondary); pointer-events: none; }
.search-field .input { padding-left: 36px; padding-right: 36px; height: 36px; min-height: 36px; border-color: transparent; }
.search-field.big .input { height: 40px; }
.search-field .input:focus { border-color: var(--border-subtle); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 10px; color: var(--text-tertiary); display: grid; }
.search-spin { position: absolute; right: 34px; }
.list-search { padding: 8px 16px; }

/* Tabs (underline, text.primary). */
.tabs { display: flex; border-bottom: 1px solid var(--border-subtle); }
.tabs-scroll { overflow-x: auto; scrollbar-width: none; padding: 0 16px; gap: 20px; }
.tab-btn { position: relative; padding: 12px 0; font-weight: 600; font-size: var(--type-body-size); color: var(--text-secondary); white-space: nowrap; }
.tab-btn.is-active { color: var(--text-primary); }
.tab-btn.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--text-primary); }
/* Pill tabs (hashtag / place hubs, search page): the filled pill is the selected state, so no underline;
   keyboard focus gets a soft ring only. */
.hub-tabs .tab-btn::after, .search-page .tab-btn::after { content: none; }
.hub-tabs .tab-btn:focus-visible, .search-page .tab-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand-400) 50%, transparent); outline-offset: 2px; }

/* Result rows (tags, places, audio). */
.result-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; text-align: left; color: var(--text-primary); }
.result-row:hover, .user-row:hover { background: color-mix(in srgb, var(--bg-raised) 60%, transparent); }
.result-icon { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 1px solid var(--border-subtle); color: var(--text-primary); }
.result-icon .icon { width: 20px; height: 20px; }
.result-icon.audio-cover { border-radius: 8px; background-size: cover; background-position: center; }
.result-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.result-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-text span { font-size: var(--type-meta-size); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Panels (Search, Notifications) --------------------------------------------- */

.panel-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.panel-inner .panel-body { padding-bottom: 24px; }
.panel-inner.is-page .panel-head { padding: 12px 16px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.recent-head h3 { font-size: var(--type-title-md-size); font-weight: 600; }
.panel-head + .panel-body, .panel-head + .tabs { border-top: 1px solid var(--border-subtle); }
.tabs + .panel-body { padding-top: 8px; }

.requests-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-subtle); }
.requests-row:hover { background: color-mix(in srgb, var(--bg-raised) 60%, transparent); }
.activity-section { padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.activity-section:last-child { border-bottom: 0; }
.activity-title { padding: 8px 16px; font-size: var(--type-title-md-size); font-weight: 600; }
.activity-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.activity-avatars { position: relative; width: 44px; height: 44px; flex: none; }
.activity-avatars.is-pair .avatar { position: absolute; }
.activity-avatars.is-pair .avatar:first-child { top: 0; left: 0; }
.activity-avatars.is-pair .avatar:last-child { right: 0; bottom: 0; box-shadow: 0 0 0 2px var(--bg-base); border-radius: 50%; }
.activity-icon { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--bg-raised); }
.activity-icon.is-warning { color: var(--status-warning); }
.activity-text { flex: 1; min-width: 0; font-size: var(--type-body-size); line-height: 1.35; overflow-wrap: anywhere; }
.activity-text time { white-space: nowrap; }
.activity-thumb { width: 44px; height: 44px; flex: none; background-size: cover; background-position: center; border-radius: 4px; }

/* --- Comments ----------------------------------------------------------------- */

.comments-list { display: grid; }
.comment { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; }
.comment.is-reply { padding: 6px 0; }
.comment-main { flex: 1; min-width: 0; }
.comment-text { overflow-wrap: anywhere; font-size: var(--type-body-size); }
.comment-text .username-row { display: inline-flex; vertical-align: top; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; font-size: var(--type-meta-size); color: var(--text-secondary); }
.comment-meta button { font-weight: 600; color: var(--text-secondary); font-size: var(--type-meta-size); }
.comment-meta button:hover { color: var(--text-primary); }
.comment-pinned { display: inline-flex; align-items: center; gap: 4px; }
.by-author { display: inline-flex; align-items: center; gap: 3px; }
.by-author .icon { color: var(--accent-flash); }
.comment-menu { opacity: 0; display: grid; }
.comment:hover .comment-menu, .comment-menu:focus-visible { opacity: 1; }
@media (hover: none) { .comment-menu { opacity: 1; } }
.comment-like { margin-top: 8px; display: grid; color: var(--text-secondary); padding: 2px; }
.comment-like.is-on { color: var(--accent-flash); }
.comment-like:hover { color: var(--text-primary); }
.comment-like.is-on:hover { color: var(--accent-flash); }
.replies-wrap { padding-left: 44px; }
.replies-toggle { display: flex; align-items: center; gap: 12px; padding: 4px 0 8px; font-size: var(--type-meta-size); font-weight: 600; color: var(--text-secondary); }
.replies-line { width: 24px; height: 1px; background: var(--text-tertiary); }
.replies { display: grid; }
.comments-more { display: grid; place-items: center; padding: 8px 0; }

/* --- Post detail (modal + page) --------------------------------------------------- */

.post-detail { width: 100%; }
.pd-missing { display: grid; justify-items: center; gap: 8px; padding: 48px 16px; text-align: center; }
.pd-frame { display: flex; background: var(--bg-base); }
.pd-media { position: relative; flex: none; background: #000; display: flex; align-items: center; justify-content: center; }
.pd-media > .media, .pd-media > .carousel { width: 100%; }
.pd-side { display: flex; flex-direction: column; min-width: 0; flex: 1; border-left: 1px solid var(--border-subtle); }
.pd-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.pd-head .icon-btn { margin-left: auto; }
.pd-comments { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px; }
.pd-comments .comment.is-caption { padding-bottom: 12px; }
.pd-note, .pd-empty { padding: 32px 0; text-align: center; color: var(--text-secondary); }
.pd-empty h3 { font-size: 22px; font-weight: 600; color: var(--text-primary); }
.pd-footer { border-top: 1px solid var(--border-subtle); padding: 4px 16px 12px; display: grid; gap: 4px; }
.pd-footer .post-actions { padding-inline: 0; }
.pd-form { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--border-subtle); }
.pd-login { padding: 16px; border-top: 1px solid var(--border-subtle); color: var(--text-secondary); }

.post-modal .overlay { padding: 24px 64px; }
.post-modal-body { width: auto; max-width: min(1200px, calc(100vw - 128px)); background: var(--bg-base); border-radius: 4px; overflow: hidden; animation: dialog-in var(--motion-sheet) both; }
/* Modal sizing: the media takes the width its aspect ratio needs at full height, but never more than
   the modal can spare beside the 420px comments column; wide photos then shrink the frame's height
   (down to 480px so the comments column stays usable) instead of overflowing and clipping the column. */
.post-detail.in-modal .pd { --pd-h: min(calc(100dvh - 48px), 880px); --pd-w: min(calc(var(--pd-h) * var(--pd-ratio)), calc(min(1200px, 100vw - 128px) - 420px)); }
.post-detail.in-modal .pd-frame { height: min(var(--pd-h), max(480px, calc(var(--pd-w) / var(--pd-ratio)))); }
.post-detail.in-modal .pd-media { height: 100%; width: var(--pd-w); }
.post-detail.in-modal .pd-media .media, .post-detail.in-modal .pd-media .carousel { max-height: 100%; }
.post-detail.in-modal .pd-side { width: 420px; flex: none; }
.pm-loading { width: min(1100px, calc(100vw - 128px)); height: min(calc(100dvh - 48px), 880px); gap: 0; }
.pm-sk-media { flex: 1; height: 100%; border-radius: 0; }
.pm-sk-side { width: 420px; padding: 16px; display: grid; align-content: start; gap: 18px; background: var(--bg-base); }
.modal-step { position: fixed; top: 50%; z-index: 92; margin-top: -16px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(236, 239, 244, 0.9); color: #0E1117; }
.modal-step.prev { left: 16px; }
.modal-step.next { right: 16px; }

/* --- Upload card, caught up, new posts pill ----------------------------------- */

.upload-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; margin: 8px 0 16px; border-radius: var(--radius-control); background: var(--bg-surface); overflow: hidden; }
.upload-thumb { width: 44px; height: 55px; flex: none; border-radius: 2px; background: var(--bg-raised) center / cover; }
.upload-text { flex: 1; min-width: 0; font-size: var(--type-body-size); }
.upload-icon { flex: none; }
.upload-line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--brand-500); transform-origin: left; transition: transform 200ms linear; }
.upload-card.is-failed .upload-line { background: var(--status-danger); }

.caught-up { display: grid; justify-items: center; gap: 6px; padding: 32px 16px 24px; text-align: center; border-bottom: 1px solid var(--border-subtle); }
.caught-up h2 { font-size: var(--type-title-md-size); font-weight: 600; margin-top: 6px; }
.caught-up p { color: var(--text-secondary); }
.caught-up-icon { color: var(--status-success); }
.feed-section-title { padding: 20px 4px 4px; font-size: var(--type-title-md-size); font-weight: 600; }

.new-posts { position: sticky; top: 16px; z-index: 20; height: 0; display: flex; justify-content: center; }
.new-posts-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border-radius: 999px; background: var(--brand-500); color: var(--on-brand); font-weight: 600; font-size: var(--type-meta-size); }
.new-posts-avatars { display: flex; }
.new-posts-avatars img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1.5px var(--brand-500); }
.new-posts-avatars img + img { margin-left: -6px; }
.pill-enter { animation: pill-drop var(--motion-pill) both; }
@keyframes pill-drop { from { transform: translateY(-48px); opacity: 0; } }
@media (max-width: 767px) { .new-posts { top: calc(var(--topbar-h) + 12px); } }

/* Suggested accounts (new account feed). */
.feed-empty { padding: 8px 0 0; border-bottom: 1px solid var(--border-subtle); }
.suggest-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 8px 4px 24px; }
.suggest-card { display: grid; justify-items: center; gap: 6px; padding: 20px 12px 16px; border: 1px solid var(--border-subtle); border-radius: 12px; text-align: center; min-width: 0; }
.suggest-card .t-meta { max-width: 100%; }
.suggest-card .follow { margin-top: 6px; width: 100%; }
.suggest-card .follow .btn { width: 100%; }

/* --- Share sheet, report dialog, user list ------------------------------------- */

.share-sheet { max-height: 80dvh; display: flex; flex-direction: column; }
/* Item 27: the people grid scrolls; the action row (Download · Copy link · Share to… · Email) always fits. */
.share-sheet > .dialog-head, .share-sheet > .list-search, .share-sheet > .sheet-handle, .share-sheet > .share-send, .share-sheet > .share-actions { flex: none; }
@media (min-width: 768px) { .share-sheet.sheet-dialog { width: 520px; max-height: 80vh; } }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px 4px; padding: 8px 12px 16px; overflow-y: auto; min-height: 120px; flex: 1 1 auto; }
.share-target { display: grid; justify-items: center; gap: 6px; padding: 4px; border-radius: 12px; }
.share-avatar { position: relative; display: block; }
.share-check { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-500); color: var(--on-brand); box-shadow: 0 0 0 2px var(--bg-surface); }
.share-name { font-size: var(--type-meta-size); max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-target.is-on .share-name { font-weight: 600; }
.share-send { display: grid; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--border-subtle); }
.share-actions { display: flex; gap: 16px; padding: 12px 16px 20px; border-top: 1px solid var(--border-subtle); overflow-x: auto; }
.share-action { display: grid; justify-items: center; gap: 6px; font-size: var(--type-meta-size); min-width: 72px; }
.share-action span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-raised); }
.share-action.is-disabled { opacity: 0.45; }
.report-q { padding: 20px 16px 4px; font-weight: 600; font-size: var(--type-title-md-size); }
.report-sub { padding: 0 16px 12px; color: var(--text-secondary); font-size: var(--type-meta-size); }
.report-reasons .menu-item { border-radius: 0; padding: 12px 16px; border-top: 1px solid var(--border-subtle); }
.report-follow-ups { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.report-follow-ups .menu-item { border-radius: 0; padding: 12px 16px; }
.user-list-dialog { height: min(460px, calc(100dvh - 48px)); }
.user-list-body { min-height: 0; }

/* --- Right rail, guest bar, footer ------------------------------------------------- */

.rail { width: var(--layout-web-right-rail); flex: none; padding-top: 36px; }
.rail-me { padding: 0 0 0 4px; }
.rail-me .link-btn { font-size: var(--type-meta-size); }
.rail-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 8px; padding-left: 4px; }
.rail-head span { color: var(--text-secondary); font-weight: 600; font-size: var(--type-body-size); }
.rail-head .text-btn { font-size: var(--type-meta-size); }
.rail .user-row { padding: 6px 0 6px 4px; }
.rail .user-row:hover { background: none; }
.rail .user-row-sub { font-size: 12px; }
.rail .site-footer { margin-top: 28px; padding-left: 4px; }

.site-footer { display: grid; gap: 12px; font-size: 12px; color: var(--text-tertiary); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.site-footer a:hover { color: var(--text-secondary); text-decoration: underline; }

.guest-bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 24px; background: var(--bg-base); border-bottom: 1px solid var(--border-subtle);
}
.guest-bar .wordmark { font-size: 24px; }
.is-guest .main { margin-left: 0; padding-bottom: 0; }
@media (max-width: 767px) { .guest-bar { height: 52px; padding: 0 16px; } }

/* Tile chunks sit directly in the parent grid. */
.tiles-chunk { display: contents; }
.grid-sentinel { grid-column: 1 / -1; height: 1px; }

/* Collection picker. */
.collection-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; text-align: left; }
.collection-row:hover { background: var(--bg-raised); }
.collection-thumb { width: 44px; height: 44px; flex: none; border-radius: 8px; background: var(--bg-raised) center / cover; display: grid; place-items: center; }
.collection-thumb.is-new { border: 1px solid var(--border-subtle); background: none; }

/* Edit post (⋯ → Edit): caption, location, alt text. */
.edit-post .dialog-head .head-action.start { left: 16px; right: auto; }
.edit-post .dialog-head .head-action:disabled { opacity: 0.45; }
@media (min-width: 768px) { .edit-post.sheet-dialog { width: 520px; max-height: 85vh; } }
.ep-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.ep-caption { display: flex; gap: 12px; padding: 12px 16px 16px; border-bottom: 1px solid var(--border-subtle); }
.ep-thumb { width: 56px; height: 56px; flex: none; object-fit: cover; border-radius: var(--radius-photo-feed); background: var(--bg-raised); }
.ep-caption-input { flex: 1; min-height: 88px; border: 0; background: none; color: var(--text-primary); resize: none; font: inherit; line-height: 1.45; outline: none; }
.ep-pad { padding: 8px 16px 0; }
.ep-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; border-bottom: 1px solid var(--border-subtle); }
.ep-row-label { display: inline-flex; align-items: center; gap: 8px; flex: none; font-weight: 600; color: var(--text-primary); }
.ep-place { display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; color: var(--text-secondary); }
.ep-place-input { flex: 1; min-width: 0; height: 36px; min-height: 36px; }
.ep-places { border-bottom: 1px solid var(--border-subtle); max-height: 220px; overflow-y: auto; }
.ep-places button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 10px 16px; text-align: left; }
.ep-places button:hover { background: var(--bg-raised); }
.ep-alts { display: grid; gap: 10px; padding: 14px 16px 18px; }
.ep-alt { display: flex; align-items: center; gap: 12px; }
.ep-alt img { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: var(--radius-photo-feed); background: var(--bg-raised); }
.ep-alt .input { flex: 1; min-width: 0; }

/* Emoji picker popover (components/emoji-picker; batch 3 item 8): fixed, anchored by glint.anchorPopover. */
.emoji-pop { position: fixed; z-index: 90; width: 340px; height: 360px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; gap: 6px; padding: 8px; overflow: hidden; }
.emoji-pop-q { flex: none; width: 100%; height: 36px; font-size: 14px; }
.emoji-pop-tabs { flex: none; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px; }
.emoji-pop-tabs::-webkit-scrollbar { display: none; }
.emoji-pop-tabs button { flex: none; width: 34px; height: 32px; display: grid; place-items: center; border-radius: 8px; font-size: 19px; line-height: 1; color: var(--text-secondary); }
.emoji-pop-tabs button:hover { background: var(--bg-menu-hover, var(--bg-raised)); color: var(--text-primary); }
.emoji-pop-tabs button[aria-selected="true"] { background: var(--bg-raised); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--brand-500); }
.emoji-pop-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.emoji-pop-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); padding: 6px 4px 4px; }
.emoji-pop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.emoji-pop-grid button { height: 36px; font-size: 28px; line-height: 1; border-radius: 8px; }
.emoji-pop-grid button:hover, .emoji-pop-grid button:focus-visible { background: var(--bg-menu-hover, var(--bg-raised)); }
.emoji-pop-empty { padding: 24px 8px; text-align: center; font-size: 14px; color: var(--text-secondary); }

/* "♪ title · artist" on music posts (components/post-music, public/js/music.js) */
.post-music { gap: 6px; }
.post-music-link { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: inherit; }
.post-music-link:hover { color: var(--text-primary); }
.post-music-toggle { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-raised); color: var(--text-primary); }
.post-music-toggle[aria-pressed="true"] { background: var(--brand-500); color: #fff; }
