/* ═══════════════════════════════════════
   STORIED FLAVOURS — Gathering Page
   "In the Kitchen" / "Around the Fire"
   ═══════════════════════════════════════ */

/* ── Toolbar ──────────────────────────────────────────────────────────────── */

.gathering-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.gathering-toolbar .search-box {
  flex: 1;
  min-width: 200px;
}

.gathering-toolbar .form-select {
  width: auto;
  min-width: 130px;
}

/* ── Page shell ───────────────────────────────────────────────────────────── */

.gathering-page {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) var(--space-20);
}

.gathering-page::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.gathering-page--family::before {
  background-image: url('../assets/gathering-bg.png');
}

.gathering-page--circle::before {
  background-image: url('../assets/aroundthefire-bg.png');
}

.gathering-page > * {
  position: relative;
  z-index: 1;
}

/* ── Back nav ─────────────────────────────────────────────────────────────── */

.gathering-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

/* Remove conversation button — quiet, owner/steward only */
.thread-remove-btn {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
}
.thread-remove-btn:hover {
  opacity: 1;
  color: var(--color-error, #c0392b);
}

/* Per-message remove × button */
.btn-remove-message {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--font-size-base);
  line-height: 1;
  padding: 0 var(--space-1);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  margin-left: auto;
  flex-shrink: 0;
}
.thread-reply:hover .btn-remove-message,
.btn-remove-message:focus {
  opacity: 0.6;
}
.btn-remove-message:hover {
  opacity: 1 !important;
  color: var(--color-error, #c0392b);
}

.thread-reply-edited {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
}

.gathering-back-link {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.gathering-back-link:hover {
  color: var(--color-amber-dark);
}

/* ── Page header ──────────────────────────────────────────────────────────── */

.gathering-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.gathering-header-text {
  flex: 1;
  min-width: 0;
}

.gathering-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
}

.gathering-subtitle {
  font-size: var(--font-size-base);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.gathering-start-btn {
  flex-shrink: 0;
  align-self: center;
}

/* ── Thread feed ──────────────────────────────────────────────────────────── */

.gathering-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── Thread card ──────────────────────────────────────────────────────────── */

.gathering-thread-card {
  background: var(--surface-card);
  border: 1px solid var(--color-brown-100);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gathering-thread-card:hover {
  border-color: var(--color-brown-200);
  box-shadow: var(--shadow-sm);
}

/* Author row */
.gathering-thread-author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.gathering-thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.gathering-thread-author-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gathering-thread-author-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.gathering-thread-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Thread body */
.gathering-thread-body {
  padding-left: calc(36px + var(--space-3));
}

.gathering-thread-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
  line-height: 1.4;
}

.gathering-thread-preview {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Thread footer */
.gathering-thread-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-left: calc(36px + var(--space-3));
  margin-top: var(--space-1);
}

.gathering-thread-footer-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.gathering-thread-replies {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.gathering-thread-replies--none {
  font-style: italic;
  font-weight: 400;
}

.gathering-thread-entity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.gathering-thread-entity-badge--recipe {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}

.gathering-thread-entity-badge--story {
  background: var(--color-sage-light, #f0f5ee);
  color: var(--color-sage);
}

.gathering-thread-entity-badge--celebration {
  background: var(--color-dusty-rose-light, #f5efef);
  color: var(--color-dusty-rose);
}

/* Thread card open indicator — now a span inside an <a> */

/* Thread card as anchor link — reset link styles */
a.gathering-thread-card {
  display: flex;
  text-decoration: none;
  color: inherit;
}

a.gathering-thread-card:hover {
  border-color: var(--color-brown-200);
  box-shadow: var(--shadow-sm);
}

.gathering-thread-open-btn {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-amber-dark);
  flex-shrink: 0;
}

a.gathering-thread-card:hover .gathering-thread-open-btn {
  text-decoration: underline;
}

/* Simplified empty state (no CTA — composer is always available above) */
.gathering-empty {
  text-align: center;
  padding: var(--space-10) var(--space-8);
  max-width: 520px;
  margin: 0 auto;
}

.gathering-empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
  line-height: 1;
}

.gathering-empty-body {
  font-size: var(--font-size-base);
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
  font-style: italic;
}

/* ── Composer block ────────────────────────────────────────────────────────── */

.composer-block {
  background: var(--surface-card);
  border: 1px solid var(--color-brown-100);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
}

.composer-header {
  margin-bottom: var(--space-4);
}

.composer-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}

.composer-sub {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ── Starter prompt ────────────────────────────────────────────────────────── */

.composer-starter {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-amber-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  transition: opacity 0.3s ease;
}

.composer-starter--faded {
  opacity: 0.35;
  pointer-events: none;
}

.composer-starter-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--color-amber-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.composer-starter-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

/* ── Composer form ─────────────────────────────────────────────────────────── */

.composer-body-group {
  margin-bottom: var(--space-3);
}

.composer-body {
  resize: vertical;
  min-height: 96px;
}

.composer-optional-fields {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-brown-100);
  margin-bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.composer-ref-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.composer-ref-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.composer-ref-type-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.composer-ref-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-brown-200);
  background: var(--surface-card);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.composer-ref-type-btn:hover {
  background: var(--color-amber-light);
  border-color: var(--color-amber);
}

.composer-ref-type-btn--active {
  background: var(--color-amber-light);
  border-color: var(--color-amber-dark);
  color: var(--color-amber-dark);
  font-weight: 600;
}

.composer-ref-select {
  margin-top: var(--space-1);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.composer-expand-btn {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.composer-expand-btn:hover {
  color: var(--color-amber-dark);
}

/* ── Thread detail page ────────────────────────────────────────────────────── */

.thread-detail-page .gathering-title {
  /* inherit from gathering-page */
}

/* Thread header — the opening post */
.thread-detail-header {
  background: var(--surface-card);
  border: 1px solid var(--color-brown-100);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-6);
}

.thread-detail-author-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.thread-detail-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  font-weight: 700;
  flex-shrink: 0;
}

.thread-detail-author-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.thread-detail-author-name {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-secondary);
}

.thread-detail-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.thread-detail-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.thread-detail-opening-body {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  line-height: 1.75;
  white-space: pre-wrap;
  /* Opening body has a bit more presence than a reply */
  font-size: var(--font-size-base);
}

/* Attachment reference badge */
.thread-detail-ref-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.thread-detail-ref-badge--recipe {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}

.thread-detail-ref-badge--story {
  background: var(--color-sage-light, #f0f5ee);
  color: var(--color-sage);
}

.thread-detail-ref-badge--celebration {
  background: var(--color-dusty-rose-light, #f5efef);
  color: var(--color-dusty-rose);
}

.thread-detail-ref-link {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* ── Replies section ────────────────────────────────────────────────────────── */

.thread-replies-section {
  margin-bottom: var(--space-6);
}

.thread-replies-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.thread-replies-count {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.thread-replies-divider {
  flex: 1;
  height: 1px;
  background: var(--color-brown-100);
}

.thread-replies-empty {
  padding: var(--space-6) 0;
}

.thread-replies-empty p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* ── Reply items ────────────────────────────────────────────────────────────── */

.thread-reply-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.thread-reply {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--color-brown-100);
}

.thread-reply:last-child {
  border-bottom: none;
}

.thread-reply-author-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.thread-reply-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-cream);
  color: var(--text-secondary);
  border: 1px solid var(--color-brown-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.thread-reply-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.thread-reply-author-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.thread-reply-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.thread-reply-body {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  line-height: 1.7;
  padding-left: calc(32px + var(--space-3));
  white-space: pre-wrap;
}

/* ── Reply composer ─────────────────────────────────────────────────────────── */

.thread-reply-composer {
  background: var(--surface-card);
  border: 1px solid var(--color-brown-100);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-top: var(--space-6);
}

.thread-reply-composer-label {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
}

.thread-reply-composer-input {
  resize: vertical;
  min-height: 96px;
  margin-bottom: var(--space-3);
}

.thread-reply-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ── Reply composer: photo attachment (Shared Moments, Phase 3) ─────────────
   Quiet, dashed-outline secondary affordance. Sits next to the primary
   "Share it" submit. Once a file is picked, a pill-shaped chip displays the
   filename + a remove × so it can be cleared before submit. */

.thread-reply-composer-attach {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.thread-reply-composer-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px dashed var(--color-brown-200, var(--border-light));
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.thread-reply-composer-attach-btn:hover,
.thread-reply-composer-attach-btn:focus-visible {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.thread-reply-composer-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-page);
  border: 1px solid var(--color-brown-100, var(--border-light));
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  padding: var(--space-2) var(--space-3);
  border-radius: 9999px;
  max-width: 280px;
}

.thread-reply-composer-attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.thread-reply-composer-attach-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.thread-reply-composer-attach-chip-remove:hover {
  color: var(--text-primary);
}

/* Keyboard focus: a quiet, calm outline so keyboard users can see where they are. */
.thread-reply-composer-attach-chip-remove:focus-visible {
  outline: 2px solid var(--color-amber-dark, var(--text-secondary));
  outline-offset: 2px;
  border-radius: 9999px;
  color: var(--text-primary);
}

/* ── Inline message moments (photos under a reply / opening post) ──────────
   Small calm gallery beneath the message body. Capped width keeps it from
   reading like a social-feed image strip. */

.thread-moments-section {
  margin-top: var(--space-3);
  padding-left: calc(32px + var(--space-3)); /* aligns with .thread-reply-body */
  max-width: 540px;
}

/* Opening post has no avatar gutter, so don't indent its section either. */
.thread-detail-header .thread-moments-section {
  padding-left: 0;
}

/* Archive-type aware section label: "Shared in the Kitchen" / "Shared Around the Fire" */
.thread-moments__label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
}

.thread-moments__helper {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
  margin: var(--space-2) 0 0;
  line-height: 1.5;
}

/* The grid itself — nested inside .thread-moments-section so it inherits
   alignment from the section wrapper. */
.thread-moments-section .thread-moments {
  margin-top: 0;
  padding-left: 0;
  max-width: none;
}

.thread-moments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
  max-width: 540px;
  padding-left: calc(32px + var(--space-3)); /* aligns with .thread-reply-body */
}

/* Opening post body has no avatar gutter, so don't indent its moments. */
.thread-detail-header .thread-moments {
  padding-left: 0;
}

.thread-moments__card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.thread-moments__thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-muted, var(--surface-page));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.thread-moments__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thread-moments__remove-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 2;
}

.thread-moments__card:hover .thread-moments__remove-btn,
.thread-moments__card:focus-within .thread-moments__remove-btn,
.thread-moments__remove-btn:focus-visible {
  opacity: 1;
}

.thread-moments__remove-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* Touch / no-hover inputs (phones, most tablets): always show the affordance
   so deletion is discoverable without hover. */
@media (hover: none) {
  .thread-moments__remove-btn {
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.5);
  }
}

.thread-moments__caption {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* ── Thread archive actions ─────────────────────────────────────────────────
   The user-initiated bridge from conversation content into the archive.
   Restrained, warm, secondary — these are not primary CTAs.
   ─────────────────────────────────────────────────────────────────────────── */

.thread-archive-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-brown-100);
}

.thread-archive-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-amber-dark);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s, color 0.15s;
  font-family: inherit;
}

.thread-archive-btn:hover {
  text-decoration-color: currentColor;
}

.thread-archive-sep {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  user-select: none;
}

/* ── Archive action modal body ────────────────────────────────────────────── */

.archive-action-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.archive-action-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.archive-action-textarea {
  resize: vertical;
  min-height: 120px;
  font-size: var(--font-size-sm);
  line-height: 1.7;
}

.archive-action-empty {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
  line-height: 1.6;
}

/* ── Recipe picker ────────────────────────────────────────────────────────── */

.recipe-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-brown-100);
  border-radius: var(--radius-md);
  padding: var(--space-1);
}

.recipe-picker-item {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.recipe-picker-item:hover {
  background: var(--color-amber-light);
}

.recipe-picker-item--selected {
  background: var(--color-amber-light);
  outline: 2px solid var(--color-amber-dark);
  outline-offset: -2px;
}

.recipe-picker-item-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .gathering-page {
    padding: var(--space-5) var(--space-4) var(--space-16);
  }

  .gathering-header {
    margin-bottom: var(--space-5);
  }

  .gathering-title {
    font-size: var(--font-size-2xl);
  }

  .gathering-thread-body,
  .gathering-thread-footer {
    padding-left: 0;
  }

  .gathering-thread-card {
    padding: var(--space-4);
  }

  .composer-block {
    padding: var(--space-4);
  }

  .thread-detail-header {
    padding: var(--space-5);
  }

  .thread-reply-body {
    padding-left: 0;
  }

  .thread-reply-composer {
    padding: var(--space-4);
  }

  .composer-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .composer-submit {
    width: 100%;
  }
}

/* ── New-thread composer: photo attachment (Shared Moments, Phase 3D) ──────
   Quiet attach affordance under the optional fields. When a file is picked,
   a chip with a small thumbnail preview + filename + remove × appears so the
   user can confirm or change the image before posting.
   ─────────────────────────────────────────────────────────────────────────── */

.composer-attach-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.composer-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px dashed var(--color-brown-200, var(--border-light));
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 160ms ease, color 160ms ease;
}

.composer-attach-btn:hover,
.composer-attach-btn:focus-visible {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.composer-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-page);
  border: 1px solid var(--color-brown-100, var(--border-light));
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  border-radius: 9999px;
  max-width: 320px;
}

.composer-attach-chip__thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.composer-attach-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.composer-attach-chip__remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 var(--space-1);
}

.composer-attach-chip__remove:hover {
  color: var(--text-primary);
}

/* Keyboard focus: a quiet, calm outline so keyboard users can see where they are. */
.composer-attach-chip__remove:focus-visible {
  outline: 2px solid var(--color-amber-dark, var(--text-secondary));
  outline-offset: 2px;
  border-radius: 9999px;
  color: var(--text-primary);
}

/* ── Composer microcopy ──────────────────────────────────────────────────────── */

.composer-microcopy {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: var(--space-2);
}

/* ── Rotating placeholder overlay ───────────────────────────────────────────── */

.composer-placeholder-wrap {
  position: relative;
}

.composer-placeholder-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity 0.35s ease;
  font-size: var(--font-size-sm);
  user-select: none;
  line-height: 1.5;
}

.composer-placeholder-overlay.fading {
  opacity: 0;
}

/* ── Conversation clustering ─────────────────────────────────────────────────── */

.thread-cluster {
  display: flex;
  flex-direction: column;
}

/* Remove bottom border from the last reply in each cluster */
.thread-cluster .thread-reply:last-child {
  border-bottom: none;
}

/* Quiet timestamp label between conversation clusters */
.thread-cluster-divider {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-7) 0 var(--space-3);
  opacity: 0.65;
  letter-spacing: 0.02em;
  user-select: none;
}
