/* ==========================================================================
   Beltchecker: profile wall (profile_card_wall.php) and the front page's
   "Latest wall messages" (index_card_wallmessages.php).
   Markup from functions_wall.php, behaviour in scripts/bc-wall.js. Tokens from styles/modern.css.
   ========================================================================== */

.bc-wall { display: flex; flex-direction: column; gap: 12px; min-width: 0; font-family: var(--bc-font); }

/* ---------- Composer ---------- */

.bc-wall-composer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--bc-r);
  background: var(--bc-surface-2);
  box-shadow: 0 0 0 1px var(--bc-line) inset;
  transition: box-shadow .2s var(--bc-ease), background-color .2s var(--bc-ease);
}
.bc-wall-composer:focus-within { background: var(--bc-surface); box-shadow: 0 0 0 1px var(--bc-accent) inset, var(--bc-ring); }
.bc-wall-composer-av { flex: 0 0 36px; line-height: 0; padding-top: 1px; }
.bc-wall-composer-av > div { display: block !important; }
.bc-wall-composer-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.bc-wall .bc-wall-input {
  display: block;
  width: 100%;
  min-height: 38px;
  max-height: 240px;
  margin: 0;
  padding: 8px 2px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--bc-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
}
.bc-wall .bc-wall-input:focus { outline: none; }
.bc-wall .bc-wall-input::placeholder { color: var(--bc-faint); }

.bc-wall-composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.bc-wall-count {
  margin-right: auto;
  color: var(--bc-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity .2s var(--bc-ease), color .2s var(--bc-ease);
}
.bc-wall-count.is-visible { opacity: 1; }
.bc-wall-count.is-near { color: var(--bc-amber); }
.bc-wall-count.is-over { color: var(--bc-red); font-weight: 600; }

.bc-wall-post {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  min-width: 76px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--bc-ink);
  color: var(--bc-on-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s var(--bc-ease), opacity .2s var(--bc-ease), transform .2s var(--bc-ease);
}
.bc-wall-post:hover { background: #26262f; }
.bc-wall-post:active { transform: scale(.97); }
.bc-wall-post:focus-visible { outline: none; box-shadow: var(--bc-ring); }
.bc-wall-post:disabled { opacity: .35; cursor: default; transform: none; background: var(--bc-ink); }
.bc-wall-post.is-busy { opacity: 1; }

/* Small spinner used by the post and "older messages" buttons */
.bc-wall-spin {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: bc-wall-spin .7s linear infinite;
}
.is-busy > .bc-wall-spin { display: inline-block; }
@keyframes bc-wall-spin { to { transform: rotate(360deg); } }

/* ---------- Messages ---------- */

.bc-wall-list { display: flex; flex-direction: column; }
.bc-wall-list:empty { display: none; }

.bc-wpost {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--bc-line);
  transition: opacity .25s var(--bc-ease);
}
.bc-wpost:first-child { border-top: 0; padding-top: 4px; }
.bc-wpost-av { flex: 0 0 40px; line-height: 0; }
.bc-wpost-av > div { display: block !important; }
.bc-wpost-main { flex: 1 1 auto; min-width: 0; }
.bc-wpost-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 6px;
  line-height: 1.3;
  padding-right: 34px; /* room for the delete button */
}
.bc-wpost-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bc-ink) !important;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none !important;
}
.bc-wpost-name:hover { color: var(--bc-accent) !important; }
.bc-wpost-dot { color: var(--bc-faint); font-size: 12px; }
.bc-wpost-time { color: var(--bc-muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bc-wpost-text {
  margin-top: 3px;
  color: var(--bc-ink-2);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bc-wpost-text a { color: var(--bc-accent) !important; text-decoration: none; font-weight: 500; }
.bc-wpost-text a:hover { text-decoration: underline; }
.bc-wpost-text img { vertical-align: middle; }

.bc-wpost-del {
  position: absolute;
  top: 6px;
  right: -6px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bc-faint);
  font-size: 13px;
  cursor: pointer;
  transition: background-color .2s var(--bc-ease), color .2s var(--bc-ease), opacity .2s var(--bc-ease);
}
.bc-wpost:first-child .bc-wpost-del { top: -2px; }
.bc-wpost-del:hover,
.bc-wpost-del:focus-visible { outline: none; background: rgba(225, 29, 72, .08); color: var(--bc-red); }
@media (hover: hover) {
  .bc-wpost .bc-wpost-del { opacity: 0; }
  .bc-wpost:hover .bc-wpost-del,
  .bc-wpost .bc-wpost-del:focus-visible { opacity: 1; }
}

/* Optimistic post while it is being saved, and a message on its way out */
.bc-wpost.is-pending { opacity: .55; }
.bc-wpost.is-new { animation: bc-wall-in .35s var(--bc-ease); }
.bc-wpost.is-removing { opacity: 0; pointer-events: none; }
@keyframes bc-wall-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Empty state and older messages ---------- */

.bc-wall-empty { padding: 18px 12px 10px; text-align: center; }
.bc-wall-empty[hidden] { display: none; }
.bc-wall-empty-ic {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--bc-surface-3);
  color: var(--bc-muted);
  font-size: 18px;
}
.bc-wall-empty-title { margin: 0 !important; color: var(--bc-ink); font-size: 14.5px; font-weight: 600; }
.bc-wall-empty-sub { margin: 2px 0 0 !important; color: var(--bc-muted); font-size: 13px; }

.bc-wall-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--bc-line-strong);
  border-radius: 999px;
  background: var(--bc-surface);
  color: var(--bc-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s var(--bc-ease);
}
.bc-wall-more:hover { background: var(--bc-surface-3); }
.bc-wall-more:focus-visible { outline: none; box-shadow: var(--bc-ring); }
.bc-wall-more:disabled { cursor: default; opacity: .7; }

/* ---------- Front page: latest wall messages ---------- */

.bc-wall-mini { list-style: none; margin: 0 !important; padding: 0 !important; font-family: var(--bc-font); }
.bc-wall-mini-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 -10px !important;
  padding: 10px;
  border-radius: 12px;
  transition: background-color .2s var(--bc-ease);
}
.bc-wall-mini-row + .bc-wall-mini-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 58px;
  right: 10px;
  border-top: 1px solid var(--bc-line);
}
.bc-wall-mini-row:hover { background: var(--bc-surface-2); }
.bc-wall-mini-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.bc-wall-mini-link:focus-visible { outline: none; box-shadow: var(--bc-ring); }
.bc-wall-mini-av { position: relative; z-index: 2; flex: 0 0 36px; line-height: 0; }
.bc-wall-mini-av > div { display: block !important; }
.bc-wall-mini-to { position: absolute; right: -6px; bottom: -4px; line-height: 0; }
.bc-wall-mini-to img,
.bc-wall-mini-to .bc-av { box-shadow: 0 0 0 2px var(--bc-surface) !important; }
.bc-wall-mini-main { flex: 1 1 auto; min-width: 0; }
.bc-wall-mini-head { display: flex; align-items: center; gap: 5px; min-width: 0; line-height: 1.3; }
.bc-wall-mini-name {
  position: relative;
  z-index: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bc-ink) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}
.bc-wall-mini-name:hover { color: var(--bc-accent) !important; }
.bc-wall-mini-name--to { color: var(--bc-ink-2) !important; font-weight: 500; }
.bc-wall-mini-arrow { flex: 0 0 auto; color: var(--bc-faint); font-size: 11px; }
.bc-wall-mini-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 2px;
  color: var(--bc-ink-2);
  font-size: 13.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.bc-wall-mini-text a { position: relative; z-index: 2; color: var(--bc-accent) !important; text-decoration: none; }
.bc-wall-mini-text img { vertical-align: middle; }
.bc-wall-mini-time { display: block; margin-top: 2px; color: var(--bc-muted); font-size: 12px; }

@media (max-width: 480px) {
  .bc-wall-composer { padding: 8px 10px; }
  .bc-wall .bc-wall-input { font-size: 16px; } /* no iOS zoom on focus */
  .bc-wpost { gap: 10px; }
  .bc-wpost-av { flex-basis: 36px; }
  .bc-wpost-av img, .bc-wpost-av .bc-av { width: 36px !important; height: 36px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .bc-wpost, .bc-wpost.is-new, .bc-wall-spin { animation: none; transition: none; }
}
