/* Post cards, the emoji popup and the post box fold. Loaded for signed-in members by views/app/head.php. */

/* a column of post cards */
    .post-col { width: 100%; max-width: 600px; margin-inline: auto; }
    @media (min-width: 992px) { .post-col.post-col-left { margin-inline: 0; } }   /* beside the sidebar, not floating in the middle */
    .post-col .post-card { border-radius: var(--bs-border-radius-lg); }
    .post-col .post-body { overflow-wrap: anywhere; }
    .post-col .post-body.is-folded { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--fold-lines, 8); line-clamp: var(--fold-lines, 8); overflow: hidden; }
    .post-col .post-fold { position: relative; }
    .post-col .post-fold > .post-body { margin-bottom: 0 !important; }
    .post-col .post-fold > .post-body.is-folded { cursor: pointer; }
    .post-col .post-more { position: absolute; right: 0; bottom: 0; padding: 0 0 0 1.5rem; border: 0; font: inherit; color: var(--bs-link-color); background: linear-gradient(to right, transparent, var(--bs-card-bg, var(--bs-body-bg)) 1.25rem); }
    .post-col .post-more:hover { text-decoration: underline; }
    .post-col .feed-social-line { font-size: .8rem; }
    .post-col .feed-social-line .avatar, .post-col .feed-social-line img { flex-shrink: 0; }
    .post-col .post-actions { margin-inline: -.5rem; }
    .post-col .post-act { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; min-width: 40px; justify-content: center; padding: 0 .6rem; border: 0; background: transparent; color: var(--bs-secondary-color); font-size: .95rem; }
    .post-col .post-act:hover { color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
    .post-col .post-act.is-on { color: var(--bs-primary); }
    .post-col .post-act i { font-size: 1.15rem; line-height: 1; }
    .post-col .feed-divider { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; border: 0 !important; padding-bottom: 0 !important; }
    .post-col .feed-community { margin-top: 1.5rem; }
    .post-col .feed-community .feed-divider { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
    .post-col .feed-divider .feed-title { min-width: 0; overflow-wrap: anywhere; }
    .post-col .feed-divider .feed-post { text-transform: none; letter-spacing: normal; flex-shrink: 0; padding: .1rem .6rem; font-size: .8rem; }
    .post-col .feed-community .feed-divider { position: sticky; top: var(--ui-topbar-height, 62px); z-index: 10; background: var(--bs-body-bg); margin: 0 0 .5rem; padding-top: .5rem; padding-bottom: .5rem !important; border-bottom: 1px solid var(--bs-border-color) !important; }
    .post-col #feed-items > div.small:not(.feed-divider), .post-col #feed-items > .feed-community > div.small { margin: -.25rem 0 1rem !important; padding-inline: 1rem; }
    .post-col .post-card > .card-body:has(+ .post-gallery) { padding-bottom: .5rem; }   /* text, then the photos edge to edge */
    .post-col .post-menu .btn { padding: .1rem .4rem; margin: -.25rem -.4rem 0 0; }
    .post-col .post-menu .dropdown-menu { z-index: var(--layer-popup); }
    .post-col .post-card video { display: block; max-width: 100%; background: #000; }
    .post-col .post-card .ratio > img { max-width: 100%; }
    .post-col .post-composer .btn-check + .btn { max-width: 100%; white-space: normal; }

/* emoji popup */
    .tnx-emoji-pop { position: fixed; z-index: var(--layer-popup); left: 0; top: 0; width: min(22rem, calc(100vw - 1rem)); background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); box-shadow: var(--bs-box-shadow); padding: .5rem; }
    .tnx-emoji-grid { max-height: 14rem; overflow-y: auto; overflow-x: hidden; margin-top: .5rem; }
    .tnx-emoji-row { display: flex; flex-wrap: wrap; gap: .125rem; }
    .tnx-emoji-item { font-size: 1.25rem; line-height: 1; padding: .25rem .35rem; }
    .tnx-emoji-item:hover { background: var(--bs-tertiary-bg); }
    .tnx-emoji-group { margin: .25rem 0 .125rem; }

/* send and emoji buttons inside the input */
    .tnx-input .form-control { padding-right: 5.75rem; }
    .tnx-input-btns { position: absolute; right: .3rem; bottom: .3rem; display: flex; align-items: center; gap: .25rem; }
    .tnx-input-btns .btn { min-height: 2rem; min-width: 2rem; line-height: 1; border-radius: 50%; padding: 0 .4rem; }
    .tnx-send { font-size: 1.25rem; font-weight: 700; }

/* post box fold */
    .tnx-compact .tnx-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
    .tnx-compact .tnx-fold-inner { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s .25s; }
    .tnx-compact.is-open .tnx-fold { grid-template-rows: 1fr; }
    .tnx-compact.is-open .tnx-fold-inner { overflow: visible; visibility: visible; transition-delay: 0s; }
    .tnx-compact textarea { resize: none; }
    .tnx-compact-bar .tnx-o1 { order: 1; }
    .tnx-compact-bar .tnx-o2 { order: 2; }
    .tnx-compact-bar .tnx-o3 { order: 5; flex: 0 0 100%; margin-top: 0 !important; }
    .tnx-compact-bar > .tnx-up { display: contents; }
    .tnx-compact-bar .tnx-up-panel { order: 5; flex: 0 0 100%; }
    .tnx-compact-bar .tnx-vis-panel { order: 6; flex: 0 0 100%; }
    @media (prefers-reduced-motion: reduce) { .tnx-compact .tnx-fold { transition: none; } }

/* @handle in a post body: a link with a light tint */
.post-body a.mention { text-decoration: none; font-weight: 500; padding: 0 .2em; border-radius: var(--bs-border-radius-sm);
    color: var(--bs-link-color); background: rgba(var(--bs-primary-rgb), .1); }
.post-body a.mention:hover { background: rgba(var(--bs-primary-rgb), .2); text-decoration: underline; }

/* uploader: thumbnail strip */
.tnx-up-add { min-height: 44px; display: inline-flex; align-items: center; }
.tnx-up-strip { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.tnx-up-strip:empty { display: none; }
.tnx-up-item { display: flex; align-items: center; gap: .5rem; flex: 1 1 16rem; min-width: 0; min-height: 44px; padding: .375rem;
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); }
.tnx-up-item[data-state=failed] { border-color: var(--bs-danger); }
.tnx-up-thumb { flex: 0 0 48px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; overflow: hidden;
    border-radius: var(--bs-border-radius-sm); background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.tnx-up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tnx-up-body { flex: 1 1 auto; min-width: 0; }
.tnx-up-name { font-size: .875rem; }
.tnx-up-bar { height: 1rem; margin: .125rem 0; font-size: .7rem; }
.tnx-up-actions { flex: 0 0 auto; display: flex; align-items: center; gap: .25rem; }
.tnx-up-actions .btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.tnx-up-tick { font-size: 1.25rem; padding: 0 .25rem; }
@media (max-width: 575.98px) { .tnx-up-item { flex-basis: 100%; } }

/* uploader: drop area, cover label, reorder */
form.tnx-drop-over { outline: 2px dashed var(--bs-primary); outline-offset: 2px; background: rgba(var(--bs-primary-rgb), .08); border-radius: var(--bs-border-radius); }
.tnx-up-item { cursor: grab; }
.tnx-up-item.is-dragging { opacity: .5; border-style: dashed; border-color: var(--bs-primary); }
.tnx-up-cover { margin-bottom: .125rem; }
.tnx-up-move { flex: 0 0 auto; display: flex; gap: .25rem; }
.tnx-up-move[hidden] { display: none; }
.tnx-up-move .btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* a post's photos and videos (views/posts/_gallery.php); the viewer is public/js/gallery.js */
    .post-gallery { display: grid; gap: 2px; grid-template-columns: 1fr 1fr; width: 100%; max-width: 100%; overflow: hidden; background: var(--bs-body-bg); }
    .post-gallery .pg-tile { position: relative; display: block; min-width: 0; padding: 0; border: 0; overflow: hidden; background: var(--bs-secondary-bg); color: #fff; cursor: zoom-in; aspect-ratio: 1 / 1; }
    .post-gallery .pg-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
    .post-gallery .pg-blank { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 2rem; color: var(--bs-secondary-color); }
    .post-gallery .pg-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 3rem; text-shadow: 0 1px 8px rgba(0,0,0,.6); pointer-events: none; }
    .post-gallery .pg-more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.75rem; font-weight: 600; background: rgba(0,0,0,.55); }
    .post-gallery.n1 { grid-template-columns: 1fr; }
    .post-gallery.n1 .pg-tile { aspect-ratio: 4 / 3; }
    .post-gallery.n3 .pg-tile:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
    .post-gallery.n4 { grid-template-columns: 1fr 1fr 1fr; }
    .post-gallery.n4 .pg-tile:first-child { grid-column: 1 / -1; aspect-ratio: 3 / 2; }

    .pg-viewer { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: rgba(0,0,0,.92); color: #fff; }
    .pg-viewer[hidden] { display: none; }
    .pg-viewer .pg-bar { display: flex; align-items: center; justify-content: space-between; padding: .5rem .75rem; flex: 0 0 auto; }
    .pg-viewer .pg-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom; overflow: hidden; }
    .pg-viewer .pg-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
    .pg-viewer .pg-stage .video-box { width: min(100%, 960px); }
    .pg-viewer .pg-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; font-size: 1.25rem; }
    .pg-viewer .pg-prev { left: .5rem; } .pg-viewer .pg-next { right: .5rem; }
    .pg-viewer .pg-x { border: 0; background: none; color: #fff; font-size: 1.5rem; line-height: 1; }
    .pg-viewer .pg-say { padding: 1rem; text-align: center; }

/* the runtime pins html and body to the window's height, so the sticky top bar lets go after one screen; on the feed let the page be as tall as its posts so the bar and each community's header stay put */
    html:has(#feed), html:has(#feed) body { height: auto; }

/* Dashboard welcome: faces and starter chips scroll sideways inside their own row */
.people-faces, .chip-row { overflow-x: auto; scrollbar-width: none; }
.people-faces::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display: none; }

/* person page: vouches accordion header */
.vouch-head { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }

.post-videos { display: grid; gap: .5rem; }
.post-yt, .post-yt-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: .5rem; overflow: hidden; background: #1b1d21; color: #fff; cursor: pointer; }
.post-yt img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-yt .pg-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; text-shadow: 0 1px 8px rgba(0,0,0,.6); pointer-events: none; }

.post-link-card { display: block; width: 100%; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .5rem; overflow: hidden; color: inherit; text-decoration: none; background: var(--bs-body-bg, #fff); }
.post-link-card:hover { background: var(--bs-tertiary-bg, #f8f9fa); color: inherit; }
.post-link-card img { display: block; width: 100%; height: auto; aspect-ratio: 1.91 / 1; object-fit: cover; }
.post-link-card .plc-text { display: block; padding: .5rem .75rem; min-width: 0; overflow-wrap: anywhere; }
.post-link-card .plc-site { display: block; font-size: .75rem; color: var(--bs-secondary-color, #6c757d); }
.post-link-card .plc-title { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; }
.post-link-card .plc-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .875rem; color: var(--bs-secondary-color, #6c757d); }
.post-yt .pg-note { position: absolute; left: 0; right: 0; bottom: 0; padding: .35rem .6rem; font-size: .75rem; line-height: 1.2; text-align: left; color: #fff; background: linear-gradient(0deg, rgba(0,0,0,.75), rgba(0,0,0,0)); pointer-events: none; }

/* Reactions: the pop-up row, the summary under a post, and the owner's emoji grid */
.js-like { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.js-like[data-kind=like] { color: #0a66c2 !important; }
.js-like[data-kind=funny] { color: #b7791f !important; }
.js-like[data-kind=love] { color: #d6336c !important; }
.js-like[data-kind=insightful] { color: #9a6b00 !important; }
.js-like .js-like-emoji { font-size: 1.15rem; line-height: 1; }
.rx-pop { position: absolute; bottom: 100%; left: 0; z-index: 20; padding-bottom: .4rem; max-width: calc(100vw - 16px); }
.rx-pop[hidden] { display: none; }
.rx-pop-row { display: flex; flex-wrap: wrap; gap: .1rem; padding: .35rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 2rem; box-shadow: var(--bs-box-shadow); width: max-content; max-width: 100%; }
.rx-opt { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.9rem; height: 2.9rem; padding: 0; border: 0; border-radius: 50%; background: transparent; transition: transform .12s; }
.rx-opt .rx-emoji { font-size: 1.9rem; line-height: 1; }
.rx-opt:hover, .rx-opt:focus-visible, .rx-opt:active { transform: scale(1.25); background: var(--bs-tertiary-bg); z-index: 1; }
.rx-opt.is-on { background: var(--bs-primary-bg-subtle); box-shadow: inset 0 0 0 2px var(--bs-primary); }
.rx-opt .rx-label { position: absolute; bottom: calc(100% + .1rem); left: 50%; transform: translateX(-50%); display: none; padding: .1rem .5rem; border-radius: 1rem; background: #212529; color: #fff; font-size: .75rem; line-height: 1.4; white-space: nowrap; pointer-events: none; }
.rx-opt:hover .rx-label, .rx-opt:focus-visible .rx-label, .rx-opt:active .rx-label { display: block; }
.rx-opt:first-child .rx-label { left: 0; transform: none; }
.rx-summary { position: relative; }
.rx-sum-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; padding: .1rem .25rem; border: 0; background: transparent; color: var(--bs-secondary-color); font-size: .875rem; }
.rx-sum-btn:hover .rx-total { text-decoration: underline; }
.rx-bubbles { display: inline-flex; }
.rx-bub { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; margin-left: -.4rem; border: 2px solid var(--bs-body-bg); border-radius: 50%; background: var(--bs-tertiary-bg); font-size: .85rem; line-height: 1; }
.rx-bub:first-child { margin-left: 0; }
.rx-breakdown { position: absolute; z-index: 15; left: 0; top: 100%; min-width: 11rem; max-width: calc(100vw - 2rem); }
.rx-breakdown[hidden] { display: none; }
.rx-row { display: flex; align-items: center; gap: .5rem; padding: .15rem .25rem; font-size: .9rem; }
.rx-row-emoji { font-size: 1.25rem; line-height: 1; }
.rx-row-title { flex: 1 1 auto; }

[data-rx-grid] fieldset { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr)); gap: .5rem; }
[data-rx-grid] fieldset legend { grid-column: 1 / -1; }
[data-rx-grid] fieldset .form-check { position: relative; margin: 0; padding: 0; min-height: 0; }
[data-rx-grid] fieldset .form-check-input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
[data-rx-grid] fieldset .form-check-label { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; font-size: 1.9rem; line-height: 1; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg); background: var(--bs-body-bg); cursor: pointer; }
[data-rx-grid] fieldset .form-check-input:hover + .form-check-label { background: var(--bs-tertiary-bg); }
[data-rx-grid] fieldset .form-check-input:checked + .form-check-label { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); box-shadow: 0 0 0 2px var(--bs-primary); }
[data-rx-grid] fieldset .form-check-input:focus-visible + .form-check-label { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
[data-rx-preview] { display: flex; align-items: center; gap: .75rem; }
[data-rx-preview] .rx-pop-row { flex-wrap: nowrap; }
[data-rx-preview] .rx-label { position: static; display: inline-block; transform: none; }
[data-rx-preview].is-empty .rx-emoji { opacity: .4; }
[data-rx-grid] fieldset > :not(.form-check):not(legend) { grid-column: 1 / -1; }
.rx-bub { width: 1.75rem; height: 1.75rem; font-size: 1rem; }
