/* Forge | feed.css — feed, post cards, create post, viewer */

/* ---------- Post card ---------- */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
  animation: post-in 340ms var(--ease-in) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes post-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
}
.post-head .ph-info { flex: 1; min-width: 0; cursor: pointer; }
.post-head .ph-name {
  font-weight: 600; font-size: 14px;
  color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-head .ph-sub {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-head .ph-menu {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.post-head .ph-menu:active { background: var(--surface-2); }
.post-head .ph-menu svg { width: 18px; height: 18px; }

.post-photo {
  position: relative;
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
}
.post-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 320ms var(--ease-in);
}
.post-photo:active img { transform: scale(1.02); }
.post-photo .post-photo-loader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}

.post-body { padding: 12px 14px 14px; }

.post-actions {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 6px;
}
.post-actions button {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: color var(--t-fast) var(--ease-in),
              transform var(--t-fast) var(--ease-in),
              background var(--t-fast) var(--ease-in);
}
.post-actions button:active { transform: scale(0.9); background: var(--surface-2); }
.post-actions button svg { width: 22px; height: 22px; }
.post-actions button.liked { color: var(--accent-pink); }
.post-actions button.liked svg { fill: currentColor; }
.post-actions button.saved { color: var(--primary); }
.post-actions button.saved svg { fill: currentColor; }
.post-actions button.just-liked svg { animation: heart-pop 420ms var(--ease-in); }
@keyframes heart-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.post-likes {
  font-size: 14px; font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 4px;
}
.post-caption {
  font-size: 14px; line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.post-caption .mention {
  color: var(--primary); font-weight: 600;
}
.post-caption .hashtag {
  color: var(--accent-blue); font-weight: 500;
}
.post-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.post-tags .tag {
  padding: 2px 10px; border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px; font-weight: 500;
}
.post-time {
  font-size: 11px; color: var(--muted);
  margin-top: 8px;
}
.post-comments-link {
  display: block;
  font-size: 13px; color: var(--muted);
  margin-top: 8px;
  font-weight: 500;
}
.post-comments-link:active { color: var(--primary); }

/* ---------- Create post ---------- */
.create-wrap { max-width: 520px; margin: 0 auto; }

.photo-pick {
  width: 100%; aspect-ratio: 1 / 1;
  background: var(--surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
  transition: border-color 200ms var(--ease-in), background 200ms var(--ease-in);
}
.photo-pick:active { background: var(--surface-3); }
.photo-pick.has-photo { border-style: solid; border-color: transparent; }
.photo-pick img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-pick .pp-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.photo-pick .pp-icon svg { width: 26px; height: 26px; }
.photo-pick .pp-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-strong);
}
.photo-pick .pp-sub {
  font-size: 12px; color: var(--muted);
  text-align: center;
  padding: 0 20px;
}
.photo-pick .pp-clear {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.photo-pick .pp-clear svg { width: 16px; height: 16px; }

.char-count {
  font-size: 11px; color: var(--muted);
  text-align: right;
  margin-top: 4px;
}
.char-count.warn { color: var(--warning); }
.char-count.over { color: var(--error); }

/* ---------- Photo viewer ---------- */
.photo-viewer {
  position: fixed; inset: 0; z-index: 250;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in 220ms var(--ease-in);
  overflow: hidden;
}
.photo-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 200ms var(--ease-in);
  user-select: none;
}
.photo-viewer .pv-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.photo-viewer .pv-close svg { width: 22px; height: 22px; }
.photo-viewer .pv-loader {
  position: absolute;
  color: #fff;
  font-size: 14px;
  opacity: 0.7;
}
.photo-viewer .pv-hint {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,0.4);
  pointer-events: none;
  animation: hint-fade 3200ms ease-in forwards;
}
@keyframes hint-fade {
  0%, 70% { opacity: 1; }
  100%    { opacity: 0; }
}

/* ---------- Comments ---------- */
.comment-row {
  display: flex; gap: 10px;
  padding: 10px 4px;
  animation: row-in 300ms var(--ease-in) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.comment-row .cr-body { flex: 1; min-width: 0; }
.comment-row .cr-head {
  display: flex; align-items: baseline; gap: 6px;
}
.comment-row .cr-name {
  font-weight: 600; font-size: 13px;
  color: var(--text-strong);
}
.comment-row .cr-time {
  font-size: 11px; color: var(--muted);
}
.comment-row .cr-text {
  font-size: 14px; line-height: 1.45;
  color: var(--text);
  margin-top: 2px;
  word-wrap: break-word;
}
.comment-row .cr-actions {
  display: flex; gap: 4px;
  margin-top: 4px;
}
.comment-row .cr-actions button {
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
}
.comment-row .cr-actions button.danger { color: var(--error); }

.comment-composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  position: sticky; bottom: 0;
  background: var(--bg);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.comment-composer textarea {
  flex: 1;
  min-height: 40px; max-height: 100px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
}
.comment-composer textarea:focus { border-color: var(--primary); }
.comment-composer .cc-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient-forge);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--t-fast) var(--ease-in), opacity var(--t-fast) var(--ease-in);
}
.comment-composer .cc-send:disabled { opacity: 0.4; }
.comment-composer .cc-send:active:not(:disabled) { transform: scale(0.94); }
.comment-composer .cc-send svg { width: 18px; height: 18px; }

/* ---------- Feed scope tabs (top of feed) ---------- */
.feed-tabs {
  display: flex; gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.feed-tab {
  flex: 1;
  padding: 12px 8px;
  font-size: 14px; font-weight: 600;
  color: var(--muted);
  text-align: center;
  position: relative;
  transition: color 200ms var(--ease-in);
}
.feed-tab.on { color: var(--text-strong); }
.feed-tab.on::after {
  content: '';
  position: absolute; bottom: -1px; left: 20%; right: 20%;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--gradient-forge);
}
.feed-tab .ft-badge {
  display: inline-flex; align-items: center;
  margin-left: 6px;
  padding: 0 6px;
  height: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 10px; font-weight: 700;
}
