/* ─── posts-panel ─────────────────────────────────────
 * TASK-150 / ADR-124 — the posts overlay panel, opened from the shared card's
 * offer zone on all three surfaces (the catalog, the landing teaser, the Mini App catalog).
 * Ported from design/components/a2-catalog.html: the panel block `:1896-2079` (the overlay, the
 * panel, the list, the item, the ≤767px bottom sheet). The `[hidden]` rule the mockup carries is
 * not ported: the dialog renders nothing while closed, so there is no hidden panel to style.
 *
 * One rule of ours is added: the title's channel-name span is hidden at ≤767px, where the
 * mockup's script drops the name from the sheet's title (`:5216-5220`). The avatar's image
 * overlay is the second addition: the card's avatar (initials with the image laid over) is the
 * anatomy the panel reuses, and the mockup's own avatar rule predates it.
 * ───────────────────────────────────────────────────── */

.posts-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-overlay);
}
.posts-panel {
  width: min(560px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.posts-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-divider);
}
.posts-panel__header h3 {
  font: 700 18px/1.3 var(--font-ui);
  color: var(--color-ink);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.posts-panel__close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--color-page);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-ink-2);
  cursor: pointer;
}
.posts-panel__close:hover { border-color: var(--color-danger); color: var(--color-danger); }
.posts-panel__list {
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
}
.posts-panel__list .post-item {
  flex: 1 1 0;
  min-width: 0;
}
.posts-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-divider);
  color: var(--color-ink-3);
  font: 400 12px/1.3 var(--font-ui);
}
.posts-panel__cta { flex: none; }
.post-item {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-page);
  align-items: flex-start;
}
.post-item__head { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.post-item__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 13px/1 var(--font-ui);
  flex: none;
  /* The image overlay needs a positioned, clipping box: the initials are the content and the
   * image is laid over them, so a failed image leaves the initials visible. */
  position: relative;
  overflow: hidden;
}
.post-item__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.post-item__who { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.post-item__name { font: 600 13px/1.2 var(--font-ui); color: var(--color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-item__handle { font: 400 12px/1.3 var(--font-ui); color: var(--color-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-item__text {
  font: 400 14px/1.5 var(--font-ui);
  color: var(--color-ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}
.post-item__media {
  height: 140px;
  width: 100%;
  border-radius: 8px;
  background: var(--color-muted-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink-3);
  font-size: 30px;
}
.post-item__doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.post-item__doc i { font-size: 20px; color: var(--color-ink-3); flex: none; }
.post-item__doc-info { min-width: 0; display: inline-flex; align-items: baseline; gap: 8px; }
.post-item__doc-name { font: 500 13px/1.3 var(--font-ui); color: var(--color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.post-item__doc-size { font: 400 12px/1 var(--font-num); color: var(--color-ink-3); flex: none; }
.post-item__cta {
  align-self: flex-start;
  min-height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  border-radius: 8px;
  font: 500 13px/1 var(--font-ui);
  color: var(--color-primary);
  cursor: pointer;
}
.post-item__cta:hover { border-color: var(--color-primary); }
@media (max-width: 767px) {
  .posts-overlay { align-items: flex-end; }
  .posts-panel {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
  }
  .posts-panel__header { padding: 16px; }
  .posts-panel__list {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 16px;
  }
  .posts-panel__list .post-item { flex: none; width: 100%; min-width: 0; }
  .post-item__head { gap: 8px; }
  .post-item__avatar { width: 32px; height: 32px; }
  .posts-panel__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .posts-panel__cta { width: 100%; }
  /* The mockup's script drops « · {channel}» from the sheet's title (`:5216-5220`); the
   * stylesheet drops it at the same breakpoint. */
  .posts-panel__channel { display: none; }
}
