/* ─── Post feed item ────────────────────────────────────────────────────────── */
.post-thread-item {
  position: relative; /* let z-index below win against a later sibling's own
                          backdrop-filter stacking context */
  background: var(--ui-card-bg);
  border: var(--ui-card-border) !important;
  border-radius: var(--ui-radius-card);
  box-shadow: var(--ui-card-shadow);
  backdrop-filter: var(--ui-blur);
  -webkit-backdrop-filter: var(--ui-blur);
  margin-bottom: 14px;
  padding-inline-start: 17px !important;
  padding-inline-end: 17px !important;
}
/* backdrop-filter above makes this card its own stacking context, so an open
   dropdown inside it can render behind a later sibling card. Bump the whole
   card above its siblings while any of its dropdowns is open. */
.post-thread-item:has(.dropdown-menu.show) {
  z-index: 5;
}

.post-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

.post-avatar-placeholder {
  width: 40px;
  height: 40px;
  background-color: var(--clr-surface-2);
  color: var(--clr-muted);
  border-radius: 50%;
}

.post-author {
  color: var(--clr-text);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Zone tag — a compact pill instead of a plain colored link, sized for an
   inline metadata row (unlike .profile-tag, which is sized for the roomier
   profile header). .zone-link-plain mirrors .profile-tag.zone-link-plain's
   neutral treatment for user-created (non-canonical) zones. */
.post-zone-link {
  display: inline-flex;
  align-items: center;
  background-color: var(--clr-cyan-dim);
  color: var(--clr-cyan) !important;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.post-zone-link:hover,
.post-zone-link:focus {
  background-color: rgba(0, 232, 255, 0.2);
  color: var(--clr-cyan) !important;
}
.post-zone-link.zone-link-plain {
  background-color: var(--clr-surface-2);
  color: var(--clr-text) !important;
}
.post-zone-link.zone-link-plain:hover,
.post-zone-link.zone-link-plain:focus {
  background-color: var(--clr-border);
  color: var(--clr-text) !important;
}

/* View count — subtle, next to the timestamp, distinct from the like/reply/
   share action bar below. Reads post.views_count directly (already denormalized
   on Post; no separate tracking call needed for the feed card). */
.post-views {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-inline-start: auto;
  color: var(--clr-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* ─── Embedded quoted post card (references/quoted-post.png) ─────────────────── */
.quoted-post-card {
  border-color: var(--clr-border) !important;
  background: var(--clr-surface);
}
.quoted-post-card:hover {
  background: var(--clr-surface-2);
}
.quoted-post-avatar {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 50%;
}
.quoted-post-avatar.post-avatar-placeholder {
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
}
.quoted-post-body {
  font-size: 0.9rem;
}
.quoted-post-stats span {
  display: inline-flex;
  align-items: center;
}

.post-body {
  color: var(--clr-text);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ─── Post action buttons ───────────────────────────────────────────────────── */
/* Like/reply/repost cluster on the left with a tight gap; bookmark + "…"
   push to the right edge via margin-inline-start:auto on the bookmark wrapper —
   the wrapper span itself carries no distinguishing class (only its inner
   button does, .bookmark-btn), hence :has() rather than a direct selector. */
.post-actions {
  gap: 0.75rem;
}
.post-actions > *:has(.bookmark-btn) {
  margin-inline-start: auto;
}
.post-action-btn {
  color: var(--clr-muted) !important;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
  background: none;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.post-action-btn:hover,
.post-action-btn:focus {
  color: var(--clr-cyan) !important;
}
/* Heart hover → red */
.post-action-btn.like-btn:hover,
.post-action-btn.like-btn:focus {
  color: var(--clr-red) !important;
}
/* Liked state → filled red heart, stays red */
.post-action-btn.like-btn.liked,
.post-action-btn.like-btn.liked:hover,
.post-action-btn.like-btn.liked:focus {
  color: var(--clr-red) !important;
}
/* Like count text next to the heart */
.post-action-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-muted);
}
/* Bookmarked state → filled cyan, stays highlighted */
.post-action-btn.bookmark-btn.bookmarked,
.post-action-btn.bookmark-btn.bookmarked:hover,
.post-action-btn.bookmark-btn.bookmarked:focus {
  color: var(--clr-cyan) !important;
}
/* Reposted state → filled green retweet, stays highlighted */
.post-action-btn.reposted,
.post-action-btn.reposted:hover,
.post-action-btn.reposted:focus {
  color: var(--clr-green, #00ba7c) !important;
}

/* Repost / Quote menu (Bootstrap dropdown, dark theme) */
.share-menu.dropdown-menu {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  min-width: 220px;
}
.share-menu .share-menu-item {
  color: var(--clr-text);
  padding: 0.6rem 0.85rem;
  font-weight: 500;
}
.share-menu .share-menu-item:hover,
.share-menu .share-menu-item:focus {
  background: var(--clr-surface);
  color: var(--clr-text);
}
.share-menu .share-menu-item i {
  color: var(--clr-muted);
}
/* button_to inside a dropdown item must fill the row */
.share-menu li form {
  display: block;
}
.share-menu li form .share-menu-item {
  width: 100%;
  text-align: start;
}

/* Inline form wrappers from button_to */
.post-action-btn form,
form .post-action-btn {
  display: inline;
}

/* Thread connector line */
.border-start {
  border-inline-start-color: var(--clr-border) !important;
}

/* View full thread link */
.post-thread-item .btn-link {
  color: var(--clr-muted);
  font-size: 0.85rem;
}
.post-thread-item .btn-link:hover {
  color: var(--clr-cyan);
}

/* ─── Feed media display ────────────────────────────────────────────────────── */
/* Constrain the whole media block so large uploaded images don't push past the column */
.post-media {
  max-width: 100%;
  overflow: hidden;
}

/* A lone image, GIF or video (PostsHelper#feed_single_media), sized like Bluesky's
   web client. The box keeps the media's real shape (--ar, clamped to 1:2 in
   Ruby) and is as wide as the smallest of:
     - the column (100%)
     - the column times --ar, so it's never taller than it is wide
       (portrait media comes out narrower, left-aligned)
     - --native-w, the media's own pixel width, so it's never upscaled.
   cqw = the column's width (container query units). */
.post-media-single { container-type: inline-size; }
.post-media-single-box {
  position: relative;
  aspect-ratio: var(--ar, 1);
  width: min(100%, calc(100cqw * var(--ar, 1)), var(--native-w, 100%));
  border-radius: 12px;
  overflow: hidden;
  background: var(--clr-surface-2);
}
.post-media-single-box img,
.post-media-single-box video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* only crops when --ar was clamped (taller than 1:2) */
  display: block;
}
/* Unknown dimensions: square box, whole image visible. */
.post-media-single-box.is-contained img,
.post-media-single-box.is-contained video { object-fit: contain; }
.post-media-crop-badge {
  position: absolute; inset-inline-start: 6px; bottom: 6px; pointer-events: none;
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 6px; font-size: 11px; color: #fff; background: rgba(0, 0, 0, 0.6);
}

/* Gallery: 2+ images/video (posts/_post_media, media_carousel_controller.js),
   like Threads and Bluesky's gallery. One scroll-snapping row; every item
   is the row's height and its own width (--ar, Medium#gallery_aspect_ratio,
   clamped 1:2 … 1.91:1), so nothing is cropped to a shared shape and the
   next item peeks in at the edge. The row (--row-h) is at most 400px tall
   and 75% of the column (the 4:3 baseline), and shorter when its widest
   item (--max-ar, PostsHelper#feed_gallery_style) would otherwise take more
   than 88% of the column — so that item shows whole and the next one still
   peeks in. --row-h is resolved where it's used (the track and arrows), so
   cqw is this container's width. */
.post-media-gallery {
  position: relative;
  container-type: inline-size;
  --row-h: min(400px, 75cqw, calc(88cqw / var(--max-ar, 1)));
}
.post-media-gallery-track {
  position: relative;
  display: flex;
  gap: 6px;
  height: var(--row-h);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.post-media-gallery-track::-webkit-scrollbar { display: none; }
.post-media-gallery-track:focus-visible { outline: 2px solid var(--clr-cyan); outline-offset: 2px; border-radius: 12px; }
.post-media-gallery-item {
  flex: none;
  height: 100%;
  aspect-ratio: var(--ar, 1);
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--clr-surface-2);
  scroll-snap-align: start;
}
.post-media-gallery-item img,
.post-media-gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* only crops when --ar was clamped */
  display: block;
}
/* Unknown dimensions: square, whole item visible. */
.post-media-gallery-item.is-contained img,
.post-media-gallery-item.is-contained video { object-fit: contain; }

/* Prev/next arrows over the row — only where there's a mouse to hover;
   phones swipe. Vertically centred on the row (the dots sit below it). */
.post-media-gallery-nav {
  position: absolute;
  top: calc(var(--row-h) / 2);
  transform: translateY(-50%);
  z-index: 1;
  width: 32px; height: 32px;
  display: none; place-items: center;
  padding: 0; border: 0; border-radius: 50%;
  color: #fff; background: rgba(0, 0, 0, 0.6);
  font-size: 13px;
}
.post-media-gallery-nav.is-prev { inset-inline-start: 8px; }
.post-media-gallery-nav.is-next { inset-inline-end: 8px; }
.post-media-gallery-nav:hover { background: rgba(0, 0, 0, 0.8); }
.post-media-gallery-nav:focus-visible { display: grid; outline: 2px solid var(--clr-cyan); outline-offset: 2px; }
@media (hover: hover) {
  .post-media-gallery:hover .post-media-gallery-nav { display: grid; }
}
.post-media-gallery-nav[hidden] { display: none !important; }

/* Carousel dot indicators */
.post-media-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 0 2px;
}
.post-media-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--clr-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s;
}
.post-media-dot.active {
  background: var(--clr-cyan);
  width: 14px;
  border-radius: 3px;
  transition: width 0.2s, background 0.15s;
}

/* ─── Thread composer editor ────────────────────────────────────────────────── */
/* posts/_thread_part_field: the contenteditable editor and its "What's
   happening?" placeholder share one padding, so the placeholder sits exactly
   where the caret is — and no side padding, so text lines up with the
   username › Zone row above. No focus ring: with no side padding it would
   hug the text, and the caret already shows where you're typing. */
.composer-editor { padding: 0.25rem 0; }
.composer-editor:focus { box-shadow: none; }
.composer-placeholder {
  position: absolute; top: 0; inset-inline-start: 0; padding: 0.25rem 0;
  color: var(--clr-muted); pointer-events: none; user-select: none;
}

/* ─── Floating composer button ──────────────────────────────────────────────── */
/* Background/border/color now come from .btn-primary (glass style) — this
   element also carries that class, so no override is needed here anymore. */
.composer-fab {
  position: fixed;
  inset-inline-end: clamp(1rem, 4vw, 2rem);
  bottom: calc(1rem + env(safe-area-inset-bottom));
  width: 3.75rem;
  height: 3.75rem;
  z-index: 1040;
}
.composer-fab:focus-visible {
  outline: 0.25rem solid rgba(0, 232, 255, 0.35);
  outline-offset: 0.25rem;
}


/* ─── Thread part marker ────────────────────────────────────────────────────── */
.thread-part-marker {
  min-width: 1.5rem;
  text-align: center;
  color: var(--clr-border);
}

@media (max-width: 767px) {
  /* On mobile, images must not exceed the viewport width.
     The content column is flex-grow-1 min-w-0 so it already has a finite
     computed width — this ensures the media block and its children respect it. */
  .post-media {
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (min-width: 992px) {
  .composer-fab {
    inset-inline-end: max(2rem, calc((100vw - 960px) / 2));
  }
}

/* ─── @mentions + links in post bodies ─────────────────────────────────────── */
.post-mention,
.post-link {
  color: var(--clr-cyan);
  text-decoration: none;
  word-break: break-all;
}

.post-mention:hover,
.post-link:hover {
  text-decoration: none;
  color: var(--clr-cyan);
}

/* ─── Composer @mention autocomplete menu ────────────────────────────────────
   A Bootstrap .dropdown-menu (theme colors come from application.css); layout
   follows references/mentions.png — edge-to-edge rows with hairline dividers,
   round avatars, bold username over muted display name, and an accent ring on
   the active row. */
.mention-menu {
  position: absolute;
  z-index: 1080; /* above the composer modal */
  min-width: 300px;
  max-width: 340px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0;
}

.mention-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  white-space: normal;
  cursor: pointer;
}

.mention-menu .dropdown-item + .dropdown-item {
  border-top: 1px solid var(--clr-border);
}

.mention-menu .dropdown-item.active {
  background-color: var(--clr-surface-2);
  color: var(--clr-text);
  border-radius: 0.75rem;
  box-shadow: inset 0 0 0 2px var(--clr-cyan);
}

.mention-menu-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--clr-surface);
  color: var(--clr-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

.mention-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mention-menu-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mention-menu-username {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-menu-display-name {
  font-size: 0.85rem;
  color: var(--clr-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Composer zone/topic autocomplete menu ──────────────────────────────────
   Same shape as .mention-menu above (edge-to-edge rows, hairline dividers,
   accent ring on the active row), but two stacked text lines instead of an
   avatar — name, then "X members · Y recent posts" (references/topic-threads.png). */
.zone-menu {
  position: absolute;
  z-index: 1080;
  min-width: 280px;
  max-width: 340px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0;
}

.zone-menu .dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.9rem;
  white-space: normal;
  cursor: pointer;
}

.zone-menu .dropdown-item + .dropdown-item {
  border-top: 1px solid var(--clr-border);
}

.zone-menu .dropdown-item.active {
  background-color: var(--clr-surface-2);
  border-radius: 0.75rem;
  box-shadow: inset 0 0 0 2px var(--clr-cyan);
}

.zone-menu-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-cyan);
}

.zone-menu-meta {
  font-size: 0.8rem;
  color: var(--clr-muted);
}

/* Zone links: cyan for established zones (the default — see .zone-menu-name
   above and the bare <a> default in application.css), plain text for ad hoc
   user-created topics. Combined selectors (rather than relying on source
   order) so precedence holds regardless of which stylesheet loads first —
   see ApplicationHelper#zone_link_classes, the single place this is decided. */
.zone-menu-name.zone-link-plain {
  color: var(--clr-text);
}

.zones-index-item {
  color: var(--clr-cyan);
}

.zones-index-item.zone-link-plain {
  color: var(--clr-text);
}

.zone-link-plain {
  color: var(--clr-text);
}

/* Composer zone/topic field ("username › Zone"): no
   .form-control class here, so only the browser's own default focus
   outline needs suppressing to make it read as inline text, not a form
   field. */
.zone-input-field:focus {
  outline: none;
  box-shadow: none;
}

/* ─── Link preview card (OpenGraph) ────────────────────────────────────────── */
.link-preview-card {
  border-color: var(--clr-border) !important;
  background: var(--clr-surface-2);
  max-width: 480px;
}

.link-preview-card:hover {
  background: var(--clr-surface);
}

.link-preview-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--clr-bg);
}

.link-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.link-preview-title {
  color: var(--clr-text);
  font-size: 0.95rem;
}

/* ─── Activity page ────────────────────────────────────────────────────────── */
.activity-item-unread {
  background: var(--clr-cyan-dim);
  margin: 0 -0.75rem;
  padding-inline-start: 0.75rem !important;
  padding-inline-end: 0.75rem;
  border-radius: 0.5rem;
}

.activity-icon {
  position: absolute;
  inset-inline-end: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #fff;
  border: 2px solid var(--clr-surface);
}

.activity-icon-like    { background: var(--clr-red); }
.activity-icon-reply   { background: #4c8bf5; }
.activity-icon-quote   { background: #9b59b6; }
.activity-icon-repost  { background: #2ecc71; }
.activity-icon-mention { background: var(--clr-cyan); color: #111; }
.activity-icon-follow  { background: #f39c12; }
.activity-icon-default { background: var(--clr-muted); }

.activity-snippet {
  color: var(--clr-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ─── Unread activity badge (sidebar + mobile nav) ─────────────────────────── */
.activity-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--clr-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ─── Composer card surface ─────────────────────────────────────────────────
   Scoped to #postComposerModal only — other modals (delete-confirm, image
   lightbox) keep the plain .modal-content styling from application.css. */
/* The glass (background + backdrop blur) sits on a ::before layer, not on
   .modal-content itself: a backdrop-filter makes its element the containing
   block for position: fixed descendants, which kept the composer's
   fixed-strategy dropdowns (schedule calendar, who-can-reply) inside the
   modal's overflow: hidden — the calendar showed as a sliver. */
#postComposerModal .modal-content {
  background: transparent;
  border: var(--ui-card-border);
  border-radius: var(--ui-radius-card);
  box-shadow: var(--ui-card-shadow);
}
#postComposerModal .modal-content::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ui-card-bg);
  backdrop-filter: var(--ui-blur);
  -webkit-backdrop-filter: var(--ui-blur);
  pointer-events: none;
}

/* "Post" submit button — the same translucent glass-pill treatment as a
   selected/active sidebar nav item (aside .nav-link.active), not a solid
   fill. Given its own rule since this button isn't a descendant of <aside>. */
.composer-post-btn {
  background: var(--ui-active-bg);
  box-shadow: var(--ui-active-glow);
  color: var(--clr-cyan) !important;
  font-weight: 700;
  border: none;
}
.composer-post-btn:hover,
.composer-post-btn:focus {
  color: var(--clr-cyan) !important;
}

/* ─── Composer chrome (references/post-twitter.png, post-bluesky.png,
   post-threads.png) ────────────────────────────────────────────────────────
   Icon-only ghost buttons for the composer's toolbar row (GIF/Emoji/Media/
   Poll/Add-to-thread) and the audience-pill trigger. `.rounded-pill` in the
   markup is redundant now that .btn is pill-shaped by default (application.css)
   but harmless, so it's left in place. */
.composer-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--clr-cyan);
  font-size: 0.85rem;
}
.composer-icon-btn:hover,
.composer-icon-btn:focus {
  background-color: var(--clr-cyan-dim);
  color: var(--clr-cyan);
}
/* The audience pill carries visible text next to its icon, so it reads as a
   chip rather than a bare icon button — muted at rest, same hover as above. */
.composer-icon-btn.composer-pill {
  border-color: var(--clr-border);
  color: var(--clr-text);
}
.composer-icon-btn.composer-pill:hover,
.composer-icon-btn.composer-pill:focus {
  border-color: var(--clr-cyan);
  color: var(--clr-cyan);
}

/* Character-count ring: a single div, no SVG — a conic-gradient sweep masked
   into a ring, driven by thread_composer_controller.js setting --pct on
   every keystroke. Stays quiet (bordered track only) until updateCharRing
   turns it cyan/red, following the "only draw attention near the
   limit" behavior. */
.char-ring {
  --pct: 0;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(var(--clr-cyan) calc(var(--pct) * 1%), var(--clr-border) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
}
.char-ring--over {
  background: conic-gradient(var(--clr-red) calc(var(--pct) * 1%), var(--clr-border) 0);
}
.char-ring-remaining {
  display: none;
  font-size: 0.8rem;
  color: var(--clr-muted);
}
.char-ring--near ~ .char-ring-remaining,
.char-ring--over ~ .char-ring-remaining {
  display: inline;
}
.char-ring--over ~ .char-ring-remaining {
  color: var(--clr-red);
}

/* ─── GIF picker (references/gif-picker.png) ───────────────────────────────── */
/* Grow the composer modal to picker height while the panel is open. The app
   already requires :has() support (see allow_browser :modern). Desktop only:
   on mobile the composer is already full-bleed at 100dvh (application.css's
   mobile media query), and shrinking it to min(88vh, 920px) here would pull
   the edge-to-edge sheet in and leave a gap when the picker opens. */
@media (min-width: 768px) {
  .modal-dialog:has(#gifPickerPanel:not(.d-none)) .modal-content {
    height: min(88vh, 920px);
  }
}

.gif-picker-panel {
  inset: 0;
  z-index: 100;
  background: var(--clr-bg);
  border-radius: inherit; /* match the modal-content corners */
}

.gif-picker-header {
  border-bottom: 1px solid var(--clr-border);
}

.gif-picker-back,
.gif-picker-back:hover {
  color: var(--clr-text);
}

.gif-picker-clear,
.gif-picker-clear:hover {
  color: var(--clr-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.gif-picker-search {
  background-color: var(--clr-surface-2);
  border: 0;
  border-radius: 2rem;
  padding: 0.7rem 1.25rem 0.7rem 2.9rem;
  color: var(--clr-text);
}

.gif-picker-search:focus {
  background-color: var(--clr-surface-2);
  color: var(--clr-text);
  box-shadow: 0 0 0 1px var(--clr-border);
}

.gif-picker-search::placeholder {
  color: var(--clr-muted);
}

.gif-picker-search-icon {
  position: absolute;
  inset-inline-start: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-muted);
  pointer-events: none;
}

/* Two-column masonry of natural-ratio tiles, like the reference. The columns
   live on an inner wrapper (created by gif_picker_controller) so they can
   grow to natural height while .gif-picker-results scrolls. */
.gif-picker-columns {
  column-count: 2;
  column-gap: 0.75rem;
}

.gif-tile {
  display: inline-block;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  break-inside: avoid;
  cursor: pointer;
}

.gif-tile img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

.gif-tile:hover img,
.gif-tile:focus-visible img {
  outline: 2px solid var(--clr-cyan);
  outline-offset: -2px;
}

/* ─── Edited indicator (inline post editing) ───────────────────────────────── */
.post-edited-indicator {
  color: var(--clr-muted);
  font-size: 0.8rem;
}

/* ─── Followers / following lists ──────────────────────────────────────────── */
.profile-stat-link {
  color: var(--clr-muted);
  text-decoration: none;
}

.profile-stat-link:hover {
  color: var(--clr-text);
  text-decoration: underline;
}

.follows-you-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.35rem;
  background: var(--clr-surface-2);
  color: var(--clr-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.user-row-bio {
  color: var(--clr-text);
  font-size: 0.9rem;
}

/* Post / profile "..." menus: label left-justified, icon right-justified.
   The item's text node and trailing <i> become flex items, so the existing
   markup needs no per-item wrappers. */
.post-menu-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Profile action row: the follow button partial renders a btn-sm (right for
   follower-list rows) inside a Turbo Frame that is re-rendered on every
   follow/unfollow. Normalizing it here — rather than via a partial local the
   frame update would lose — keeps it the same size as the Mention button. */
.profile-actions turbo-frame {
  display: block;
}

.profile-actions turbo-frame .btn {
  width: 100%;
  --bs-btn-padding-y: 0.375rem;
  --bs-btn-padding-x: 0.75rem;
  --bs-btn-font-size: 1rem;
  --bs-btn-border-radius: var(--bs-border-radius);
}

/* Polls: feed-native card rendered under the post body (posts/_poll).
   Thin bars keep results readable at feed density; the card inherits the
   post surface so it doesn't read as an embed. */
.poll-card {
  background: var(--clr-surface);
  border-color: var(--clr-border) !important;
}

.poll-card .poll-result-bar {
  height: 6px;
}

/* button_to wraps each vote option in a form — make it fill the row. */
.poll-card form {
  width: 100%;
}

/* ─── Direct messages (inbox + thread) ──────────────────────────────────────── */
.dm-row {
  color: var(--clr-text);
  border-bottom: 1px solid var(--clr-border);
}
.dm-row:hover {
  background-color: var(--clr-surface);
}

.dm-row-preview {
  font-size: 0.9rem;
  min-width: 0;
}

.dm-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bs-primary, #0d6efd);
}

/* Chat layout: header | scrolling messages | composer, sized to the viewport
   so the composer stays put and #conversation_messages is the scroll
   container the dm-thread Stimulus controller pins to the bottom. */
.dm-thread {
  height: calc(100vh - 2rem);
}

@media (max-width: 767px) {
  /* Inside the mobile scroll wrapper: viewport minus top nav (~48px),
     bottom nav (56px), and the main column's vertical padding. */
  .dm-thread {
    height: calc(100dvh - 122px);
  }
}

.dm-header-avatar {
  width: 36px;
  height: 36px;
  object-fit: cover;
}

.dm-messages {
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dm-day-divider {
  font-size: 0.75rem;
}

.dm-message {
  max-width: 78%;
  margin-bottom: 0.4rem;
}
.dm-message-mine   { align-self: flex-end;   align-items: flex-end; }
.dm-message-theirs { align-self: flex-start; align-items: flex-start; }

.dm-bubble {
  padding: 0.45rem 0.8rem;
  border-radius: 1.1rem;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.dm-message-mine .dm-bubble {
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}
.dm-message-theirs .dm-bubble {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-bottom-left-radius: 0.3rem;
}

.dm-message-time {
  font-size: 0.7rem;
  margin-top: 2px;
}

.dm-composer {
  background: var(--clr-surface);
}

.dm-composer-input {
  resize: none;
  border-radius: 1.2rem;
}

.dm-send-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
