/* Feed, discovery and threads: home, explore, search, tag, post, bookmarks.
   Built on the southbag.css tokens and furniture: greyscale, square corners, dashed dividers,
   slow linear transitions. Buttons are styled once in southbag.css and never here.
   Media sits in fixed-shape boxes and is stretched to fill them. */

/* Page wrappers are layout, not panels: no halo. */
.feed-page, .explore-page, .search-page, .tag-page, .thread-page, .bookmarks-page, .feed-page > div, .search-page > div, .thread-page > div:not(.south-card) { box-shadow: none; }

/* -- Page headings ------------------------------------------------------ */
.feed-head { align-items: flex-start; }
.feed-head h1 { overflow-wrap: anywhere; }
.feed-head .sub { margin: 6px 0 0; font-size: 0.9rem; }
.feed-head > .back-btn { margin-top: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; padding: 0 0 4px; border-bottom: 2px dashed #000; box-shadow: none; }
:root[data-theme='dark'] .section-head { border-bottom-color: #666; }
.section-head h2 { margin: 0; }

/* -- Home feed ---------------------------------------------------------- */
.feed-page > .south-card.flat { margin-bottom: 1rem; }
.feed-notice { font-size: 0.95rem; }

/* -- Sponsored cards (client-side, Southbag products) ------------------- */
.sponsored-card { transform: rotate(0.3deg); }
.sponsored-head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; box-shadow: none; }
.sponsored-head .spacer { flex: 1; box-shadow: none; }
.sponsored-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--sb-muted); border: 1px solid #999; padding: 0 5px; }
.sponsored-brand { font-size: 1.3rem; margin: 4px 0 2px; }
.sponsored-card p { margin: 2px 0 10px; }

/* -- Thread page -------------------------------------------------------- */
.thread-ancestors { margin: 0 0 8px; box-shadow: none; }
.thread-more { display: inline-block; font-size: 0.9rem; margin: 0 0 8px 4px; }
.thread-ancestor { position: relative; padding: 0 0 10px; box-shadow: none; }
/* The dashed line running from one ancestor's avatar down to the next. */
.thread-ancestor::before { content: ''; position: absolute; left: 21px; top: 52px; bottom: 0; border-left: 2px dashed #000; }
:root[data-theme='dark'] .thread-ancestor::before { border-left-color: #777; }
.thread-ancestor .post { padding: 4px 0 0; box-shadow: none; }
.thread-ancestor .post-actions { margin-left: 54px; }
.thread-ancestor .post-body, .thread-ancestor .post-media, .thread-ancestor .quote, .thread-ancestor .post-title { margin-left: 54px; }

.south-card.focused-post { scroll-margin-top: 100px; transform: none; margin: 0 0 18px; padding: 14px 16px 16px; border-width: 3px; }
.focused-post .post-body { font-size: 1.3rem; line-height: 1.45; }
.focused-post .post-title { font-size: 1.6rem; }
/* Shorts play in a tall fixed box; the video is stretched to it. */
.focused-post .short-media .video-wrap { width: min(360px, 100%); margin: 0 auto; aspect-ratio: 9 / 16; }
.post-details { margin: 12px 0 0; padding: 10px 0 0; border-top: 2px dashed #000; font-size: 0.9rem; color: var(--sb-muted); box-shadow: none; }
:root[data-theme='dark'] .post-details { border-top-color: #666; }
.post-details .when { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-bottom: 8px; box-shadow: none; }
.post-details .stats { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 0; border-top: 1px dashed #999; border-bottom: 1px dashed #999; box-shadow: none; }
.post-details .stats strong { color: var(--sb-text); }
.reaction-breakdown { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; box-shadow: none; }
.focused-post .post-details + .post-actions { margin-top: 8px; }
.reaction-word { font-size: 0.85rem; color: var(--sb-muted); }
.reactions-dialog { min-width: min(320px, 80vw); max-height: 60vh; overflow: auto; box-shadow: none; }

.reply-box { margin-bottom: 18px; }
.thread-closed { font-style: italic; margin: 0 0 16px; }
.replies-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px dashed #000; margin: 0 0 12px; box-shadow: none; }
:root[data-theme='dark'] .replies-head { border-bottom-color: #666; }
.replies-head h2 { margin: 0 0 8px; }
.replies-head .tabs { margin: 0 0 6px; padding: 0; border-bottom: 0; }
.thread-replies { box-shadow: none; }
.reply-item { margin: 0 0 12px; box-shadow: none; }
.reply-item .south-card { margin: 0; }
.reply-item:nth-child(even) .south-card { transform: rotate(0.25deg); }
.view-replies { display: inline-block; margin: 6px 0 0 54px; font-size: 0.9rem; font-weight: 700; }
.thread-missing h1 { margin-bottom: 0.6em; }

/* -- Explore & search --------------------------------------------------- */
.explore-search { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; box-shadow: none; }
.explore-search input { flex: 1; min-width: 0; min-height: 2.6rem; }
.explore-search .btn { flex-shrink: 0; }
.trending-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
a.tag-card { position: relative; display: flex; flex-direction: column; gap: 2px; color: var(--sb-text); transition: transform 1.8s linear, background-color 2.4s linear; }
a.tag-card:hover { transform: rotate(-0.8deg); font-weight: inherit; }
a.tag-card strong { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 26px; }
a.tag-card .muted { font-size: 0.82rem; }
a.tag-card .rank { position: absolute; top: 6px; right: 8px; font-size: 0.8rem; color: var(--sb-faint); }

.explore-section { margin: 0 0 22px; min-width: 0; box-shadow: none; }
/* Square tiles; photos of any shape are stretched into them. */
.photo-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; box-shadow: none; }
.photo-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--sb-text); text-decoration: none; box-shadow: none; }
.photo-tile:hover { background: none; font-weight: inherit; }
.photo-tile .tile-box { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border: 2px inset var(--sb-bevel); background: #000; }
.photo-tile img { display: block; width: 100%; height: 100%; transition: filter 2s linear; }
.photo-tile:hover img, .photo-tile:focus-visible img { filter: grayscale(1) brightness(0.8); }
.photo-tile .multi { position: absolute; left: 4px; bottom: 4px; background: #fff; color: #000; font-size: 0.72rem; padding: 0 4px; }
.photo-tile .tile-stats { font-size: 0.75rem; color: var(--sb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; }
.photo-tile:nth-child(4n + 2) .tile-box { transform: rotate(-0.5deg); }
.photo-tile:nth-child(5n) .tile-box { transform: rotate(0.4deg); }
@media (max-width: 1100px) { .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } }

.explore-page { max-width: 1010px; min-width: 0; }
.explore-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 24px; box-shadow: none; }
.explore-people .announcement-grid { grid-template-columns: minmax(0, 1fr); }
.explore-people .announcement-card { min-width: 0; }
.explore-people .user-row { flex-wrap: wrap; row-gap: 6px; }
.explore-people .user-row .grow { flex: 1 1 calc(100% - 48px); }
.explore-people .user-row .bio { white-space: normal; }
.explore-people .user-row > .btn-small { margin-left: 42px; }
@media (min-width: 1181px) { .explore-people { position: sticky; top: 96px; align-self: start; } }
@media (max-width: 1180px) {
  .explore-columns { grid-template-columns: minmax(0, 1fr); }
  .explore-people { order: -1; }
}
.search-page { min-width: 0; }

.search-section { margin-bottom: 14px; }
.search-section .section-head { margin-bottom: 6px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; box-shadow: none; }
.tag-chips .chip { font-size: 0.9rem; color: var(--sb-ink); padding: 2px 8px; text-decoration: underline; }
.results-title { margin: 8px 0 12px; }
.no-posts { margin: 0 0 12px; }

.result-list { padding: 4px 12px; }
.result-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; color: var(--sb-text); text-decoration: none; min-width: 0; box-shadow: none; }
.result-row + .result-row { border-top: 1px dashed #999; }
.result-row:hover { font-weight: inherit; }
.result-row .grow { display: flex; flex-direction: column; min-width: 0; box-shadow: none; }
.result-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; }
.result-row .desc { font-size: 0.88rem; color: var(--sb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-row .group-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 0.82rem; box-shadow: none; }
@media (max-width: 640px) {
  .trending-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .result-row .group-meta .muted { display: none; }
}
