/* Feed de la comunidad */

.feed-wrap {
  max-width: 680px;
  margin: 28px auto 90px;
  padding: 0 16px;
}

.avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 1.05rem;
  object-fit: cover;
}

/* ----------------------------------------------------------- compositor */

.composer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.composer.over {
  border-color: var(--accent);
}

.composer.guest {
  text-align: center;
  color: var(--text-dim);
}

.composer.guest p {
  margin: 6px 0;
}

.composer-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.composer textarea {
  flex: 1;
  resize: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 1rem;
  line-height: 1.5;
  font-family: inherit;
  min-height: 48px;
}

.composer textarea:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0 54px;
}

.thumbs:empty {
  display: none;
}

.thumb {
  position: relative;
  width: 84px;
  height: 84px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.thumb-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #000c;
  color: #fff;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
}

.composer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.tools {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.tool {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.tool.wide {
  font-size: 0.84rem;
  font-weight: 600;
}

.tool:hover {
  border-color: var(--accent);
}

.send {
  display: flex;
  align-items: center;
  gap: 12px;
}

.count {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.composer .auth-submit {
  width: auto;
  margin: 0;
  padding: 9px 24px;
}

.composer .auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer .bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
  display: none;
}

.composer .bar > div {
  height: 100%;
  width: 0;
  background: var(--accent-2);
  transition: width 0.15s;
}

.composer-msg {
  margin: 10px 0 0;
  color: #e8836b;
  font-size: 0.86rem;
}

.emoji-wrap {
  position: relative;
}

.emoji-pop {
  position: absolute;
  top: 42px;
  left: 0;
  z-index: 30;
  width: 252px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 30px #0008;
}

.emoji-pop[hidden] {
  display: none;
}

.emoji-pop button {
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 1.25rem;
  cursor: pointer;
}

.emoji-pop button:hover {
  background: var(--bg-card);
}

/* ---------------------------------------------------------------- tarjetas */

.fp {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin-bottom: 16px;
}

.fp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.fp-who {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  min-width: 0;
}

.fp-time {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-decoration: none;
}

.fp-time:hover {
  text-decoration: underline;
}

.fp-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}

.fp-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.55;
  padding: 6px;
  border-radius: 8px;
}

.fp-del:hover {
  opacity: 1;
  background: var(--bg-elevated);
}

.fp-body {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.fp-body p {
  margin: 0 0 0.7em;
}

.fp-body p:last-child {
  margin-bottom: 0;
}

.fp-body a {
  color: var(--accent-2);
}

.em-tag {
  color: var(--accent);
  font-weight: 600;
}

/* Cuadrícula de imágenes (1, 2, 3, 4+) */
.fp-media {
  margin-top: 12px;
  display: grid;
  gap: 4px;
  border-radius: 12px;
  overflow: hidden;
}

.fp-img {
  position: relative;
  padding: 0;
  border: none;
  background: var(--bg-elevated);
  cursor: zoom-in;
  display: block;
  overflow: hidden;
}

.fp-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fp-media.n1 .fp-img img {
  height: auto;
  max-height: 600px;
  object-fit: contain;
  background: #0b1008;
}

.fp-media.n2 {
  grid-template-columns: 1fr 1fr;
}

.fp-media.n2 .fp-img {
  aspect-ratio: 1 / 1;
}

.fp-media.n3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 4 / 3;
}

.fp-media.n3 .fp-img:first-child {
  grid-row: 1 / 3;
}

.fp-media.n4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1 / 1;
}

.fp-img .more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000a;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}

/* Artículo dentro del feed */
.fa-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
}

.fa-card:hover {
  border-color: var(--accent);
}

.fa-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.fa-body {
  padding: 12px 14px 14px;
}

.fa-body h3 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  line-height: 1.3;
}

.fa-body p {
  margin: 0 0 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.fa-more {
  color: var(--accent-2);
  font-size: 0.84rem;
  font-weight: 600;
}

.feed-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
}

.sentinel {
  text-align: center;
  margin-top: 8px;
}

.sentinel[hidden],
.feed-empty[hidden],
.composer-msg[hidden],
.count[hidden] {
  display: none;
}

.btn-soft {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
}

/* ---------------------------------------------------------------- visor */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
}

.lb-close,
.lb-nav {
  position: absolute;
  background: #0008;
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}

.lb-close {
  top: 16px;
  right: 16px;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  line-height: 1;
}

.lb-nav.prev {
  left: 14px;
}

.lb-nav.next {
  right: 14px;
}

.lb-count {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.85rem;
  background: #0008;
  padding: 3px 12px;
  border-radius: 999px;
}

@media (max-width: 640px) {
  .feed-wrap {
    padding: 0 10px;
    margin-top: 16px;
  }

  .thumbs {
    margin-left: 0;
  }

  .composer .auth-submit {
    padding: 9px 18px;
  }
}
