/* =====================================================
   COMUNIDAD · feed estilo pestaña Comunidad de YouTube
   (usa los colores y componentes de styles.css y eventos.css)
   ===================================================== */
.com-wrap { max-width: 720px; }
/* las secciones del inicio llevan mucho aire alrededor: acá no */
.com-wrap section, .com-modal section { padding: 0; }
.navlinks a.nav-comunidad[aria-current="page"] { color: var(--blue); }
body.sin-scroll { overflow: hidden; }

/* ---------- feed ---------- */
.com-feed { display: grid; gap: 1.1rem; }
.com-pub { display: grid; gap: 0.9rem; padding: clamp(1rem, 3vw, 1.35rem); }
.com-pub.listo:not(.sin-anim) { animation: subir 0.45s var(--ease-out) backwards; animation-delay: calc(min(var(--i, 0), 6) * 50ms); }
.com-pub.fijada { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.com-pub.programada { border-style: dashed; border-color: var(--blue); }
.com-pub.saliendo { opacity: 0; transform: scale(0.98); transition: opacity 0.3s ease, transform 0.3s ease; }
.com-skel { gap: 0.55rem; }
.com-skel .skel { display: block; height: 0.9rem; }

.com-pub-head { display: flex; align-items: center; gap: 0.7rem; }
.com-dem { width: 2.6rem; height: 2.6rem; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); }
.com-pub-quien { display: grid; min-width: 0; flex: 1; }
.com-pub-quien b { font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; }
.com-tiempo { font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; color: var(--muted); }
.com-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.com-chip { font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap; text-decoration: none; }
.com-chip.oro { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }

.com-texto { font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }
.com-texto a, .com-c-texto a, .com-quiz-res a { color: var(--blue); }

/* ---------- menú ⋯ ---------- */
.com-menu { position: relative; flex: none; }
.com-menu > summary { list-style: none; cursor: pointer; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: var(--muted); font-size: 1.2rem; line-height: 1; transition: background 0.15s ease, color 0.15s ease; }
.com-menu > summary::-webkit-details-marker { display: none; }
.com-menu > summary:hover, .com-menu[open] > summary { background: var(--surface-2); color: var(--ink); }
.com-menu.chico > summary { width: 1.7rem; height: 1.7rem; font-size: 1rem; }
.com-menu-lista { position: absolute; right: 0; top: calc(100% + 0.3rem); z-index: 20; min-width: 11rem; display: grid; padding: 0.35rem; border-radius: 0.7rem; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 36px -16px rgba(0,0,0,0.7); animation: caer 0.2s var(--ease-out); }
.com-menu-lista button { font: inherit; font-size: 0.88rem; font-weight: 600; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 0.45rem; padding: 0.55rem 0.7rem; cursor: pointer; }
.com-menu-lista button:hover { background: var(--surface-2); }
.com-menu-lista button.peligro { color: var(--error); }

/* ---------- carrusel de imágenes ---------- */
.com-carrusel { position: relative; border-radius: 0.8rem; overflow: hidden; background: #050c18; margin: 0 calc(-1 * clamp(1rem, 3vw, 1.35rem)); }
@media (min-width: 560px) { .com-carrusel { margin: 0; } }
.com-pista { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.com-pista::-webkit-scrollbar { display: none; }
.com-pista img { flex: 0 0 100%; width: 100%; aspect-ratio: 4 / 5; max-height: 72vh; object-fit: contain; scroll-snap-align: center; cursor: zoom-in; display: block; }
.com-carrusel[data-n="1"] .com-pista img { aspect-ratio: auto; max-height: 80vh; }
.com-car-flecha { position: absolute; top: 50%; translate: 0 -50%; width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 1.5rem; line-height: 1; color: #0B1B33; background: rgba(255,255,255,0.88); cursor: pointer; box-shadow: 0 6px 18px -6px rgba(0,0,0,0.6); transition: opacity 0.2s ease, transform 0.2s var(--ease-out); }
.com-car-flecha:hover { transform: scale(1.08); }
.com-car-flecha.prev { left: 0.6rem; }
.com-car-flecha.next { right: 0.6rem; }
.com-carrusel.en-inicio .prev, .com-carrusel.en-fin .next { opacity: 0; pointer-events: none; }
.com-car-num { position: absolute; top: 0.6rem; right: 0.6rem; font: 600 0.72rem 'IBM Plex Mono', monospace; color: #fff; background: rgba(0,0,0,0.55); padding: 0.2rem 0.5rem; border-radius: 999px; }
.com-car-puntos { position: absolute; bottom: 0.6rem; left: 0; right: 0; display: flex; justify-content: center; gap: 0.3rem; pointer-events: none; }
.com-car-puntos span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.45); transition: background 0.2s ease, transform 0.2s ease; }
.com-car-puntos span.on { background: #fff; transform: scale(1.3); }
@media (hover: none) { .com-car-flecha { display: none; } }

/* ---------- video ---------- */
.com-video { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 0.8rem; overflow: hidden; background: #000; border: 0; padding: 0; cursor: pointer; }
.com-video img, .com-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.com-video .reel-play { z-index: 1; opacity: 1; width: 4rem; height: 4rem; transform: translate(-50%, -50%); background: rgba(11, 27, 51, 0.6); transition: transform 0.25s var(--ease-out), background 0.2s ease; }
.com-video .reel-play svg { width: 1.5rem; height: 1.5rem; }
.com-video:hover .reel-play { transform: translate(-50%, -50%) scale(1.08); background: #FF0000; border-color: #FF0000; }

/* ---------- encuestas y quizzes ---------- */
.com-encuesta { display: grid; gap: 0.55rem; }
.com-enc-tag { font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); }
.com-encuesta.quiz .com-enc-tag { color: var(--gold); }
.com-ops { display: grid; gap: 0.45rem; }
.com-op { position: relative; display: flex; align-items: center; gap: 0.7rem; width: 100%; min-height: 3rem; padding: 0.6rem 0.9rem; font: inherit; font-weight: 600; text-align: left; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 0.7rem; overflow: hidden; isolation: isolate; }
button.com-op { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s var(--ease-out); }
button.com-op:hover:not(:disabled) { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--bg)); }
button.com-op:active:not(:disabled) { transform: scale(0.98); }
button.com-op:disabled { cursor: default; }
button.com-op.elegida { border-color: var(--blue); }
.com-op .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.com-op .t small { color: var(--blue); font-weight: 700; }
.com-op-imagen { width: 2.6rem; height: 2.6rem; border-radius: 0.45rem; object-fit: cover; flex: none; }
/* resultados: barra que se llena hasta el % */
.com-op.res::before { content: ""; position: absolute; inset: 0; z-index: -1; width: var(--p); background: color-mix(in srgb, var(--blue) 18%, transparent); animation: llenar 0.8s var(--ease-out) backwards; }
@keyframes llenar { from { width: 0; } }
.com-op.res .pct { font-family: var(--font-display); font-weight: 800; }
.com-op.res.mia { border-color: var(--blue); }
.com-op.res.correcta { border-color: var(--ok); }
.com-op.res.correcta::before { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.com-op.res.incorrecta { border-color: var(--error); }
.com-op.res.incorrecta::before { background: color-mix(in srgb, var(--error) 18%, transparent); }
.com-quiz-res { border-radius: 0.6rem; padding: 0.7rem 0.9rem; background: var(--surface-2); font-weight: 700; animation: subir 0.4s var(--ease-out); }
.com-quiz-res.ok { color: var(--ok); }
.com-quiz-res.mal { color: var(--error); }
.com-quiz-res p { margin: 0.35rem 0 0; font-weight: 400; color: var(--ink-dim); }
.com-enc-pie { margin: 0; font-family: 'IBM Plex Mono', monospace; font-size: 0.74rem; color: var(--muted); }

/* ---------- likes y botón de comentarios ---------- */
.com-acciones { display: flex; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.com-acc { display: inline-flex; align-items: center; gap: 0.4rem; font: inherit; font-weight: 700; font-size: 0.9rem; color: var(--ink-dim); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0.45rem 0.9rem; cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
.com-acc svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; }
.com-acc small { font-weight: 500; color: var(--muted); }
.com-compartir { margin-left: auto; }
.com-pub { scroll-margin-top: 5.5rem; }
.com-pub.enlazada { border-color: var(--blue); }
.com-acc:hover { color: var(--ink); border-color: color-mix(in srgb, var(--blue) 50%, var(--line)); }
.com-acc[data-like-pub].on { color: #FF4D6D; border-color: color-mix(in srgb, #FF4D6D 50%, transparent); background: color-mix(in srgb, #FF4D6D 10%, var(--bg)); }
.com-acc[data-like-pub].on svg { fill: currentColor; }
.com-acc.latido svg { animation: latir 0.45s var(--ease-out); }
@keyframes latir { 40% { transform: scale(1.35); } }
.com-acc[aria-expanded="true"] { color: var(--blue); border-color: var(--blue); }

/* ---------- comentarios ---------- */
.com-coms { display: grid; gap: 0.9rem; animation: subir 0.3s var(--ease-out); }
.com-coms-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.com-orden { display: flex; gap: 0.3rem; padding: 0.2rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.com-orden button { font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 0.3rem 0.75rem; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.com-orden button.on { background: var(--surface-2); color: var(--ink); }
.com-ingresar { margin: 0; font-size: 0.9rem; color: var(--ink-dim); }
.com-ingresar a { color: var(--blue); font-weight: 700; }
.com-coms-cargando { display: grid; gap: 0.5rem; }
.com-coms-cargando .skel { display: block; height: 0.9rem; }

.com-av { flex: none; width: 2.3rem; height: 2.3rem; border-radius: 50%; padding: 0; border: 0; overflow: hidden; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font-family: var(--font-display); font-weight: 800; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px #5BC8F2; }
.com-av.admin { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px #E3A52F; }
.com-av img { width: 100%; height: 100%; object-fit: cover; }
span.com-av { cursor: default; }

.com-escribir { display: flex; gap: 0.7rem; align-items: flex-start; }
.com-escribir-caja { flex: 1; min-width: 0; display: grid; gap: 0.4rem; }
.com-escribir textarea, .com-editar textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.6rem 0.75rem; resize: none; min-height: 2.6rem; transition: border-color 0.15s ease; }
.com-escribir textarea:focus, .com-editar textarea:focus { outline: none; border-color: var(--blue); }
.com-escribir-pie { display: flex; justify-content: flex-end; align-items: center; gap: 0.45rem; }
.com-cuenta { margin-right: auto; font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; color: var(--muted); }
.com-cuenta.cerca { color: var(--gold); }
.com-escribir.resp { margin-top: 0.6rem; animation: subir 0.25s var(--ease-out); }
.com-escribir.resp .com-av { width: 1.9rem; height: 1.9rem; }
.com-editar { display: grid; gap: 0.4rem; margin: 0.2rem 0; }

.com-lista { display: grid; gap: 1rem; }
.com-c { display: flex; gap: 0.7rem; align-items: flex-start; }
.com-c.nuevo > .com-c-cuerpo { animation: resaltar 1.6s ease; }
@keyframes resaltar { 0%, 30% { background: color-mix(in srgb, var(--blue) 14%, transparent); } }
.com-c.saliendo { opacity: 0; transition: opacity 0.25s ease; }
.com-c-cuerpo { flex: 1; min-width: 0; border-radius: 0.5rem; }
.com-c.fijado > .com-c-cuerpo { }
.com-c-fijado { font-size: 0.74rem; font-weight: 700; color: var(--gold); margin-bottom: 0.15rem; }
.com-c-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0 0.4rem; }
.com-c-nombre { font: inherit; font-weight: 800; font-size: 0.9rem; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; }
.com-c-nombre.admin { color: var(--gold); }
.com-c-nombre:hover { text-decoration: underline; }
.com-c-head .insignia-verif, .com-c-head .insignia-estrella { font-size: 0.9rem; margin-left: 0; }
.com-c-texto { font-size: 0.94rem; line-height: 1.5; overflow-wrap: anywhere; margin-top: 0.1rem; }
.com-mencion { color: var(--blue); font-weight: 700; }
.com-c-acc { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; }
.com-mini { display: inline-flex; align-items: center; gap: 0.3rem; font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 0.3rem 0.55rem; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.com-mini:hover { background: var(--surface-2); color: var(--ink); }
.com-mini svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; }
.com-mini.on { color: #FF4D6D; }
.com-mini.on svg { fill: currentColor; }
.com-corazon-dem { position: relative; display: inline-flex; align-items: center; margin-left: 0.2rem; font-size: 0.7rem; }
.com-corazon-dem img { width: 1.35rem; height: 1.35rem; border-radius: 50%; }
.com-corazon-dem::after { content: ""; }
.com-respuestas { display: grid; gap: 0.85rem; margin-top: 0.75rem; }
.com-c.respuesta .com-av { width: 1.9rem; height: 1.9rem; }

/* ---------- avisos rápidos ---------- */
.com-toast { position: fixed; left: 50%; bottom: 1.2rem; z-index: 100; translate: -50% 1rem; opacity: 0; pointer-events: none; max-width: min(92vw, 30rem);
  padding: 0.75rem 1.1rem; border-radius: 0.8rem; background: #111d33; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 18px 40px -16px rgba(0,0,0,0.8);
  font-size: 0.92rem; font-weight: 600; text-align: center; transition: opacity 0.25s ease, translate 0.3s var(--ease-out); }
.com-toast.on { opacity: 1; translate: -50% 0; pointer-events: auto; }
.com-toast.ok { border-color: var(--ok); }
.com-toast.error { border-color: var(--error); }
.com-toast a { color: var(--blue); margin-left: 0.4rem; }
.com-mas { display: flex; justify-content: center; }

/* ---------- perfil público ---------- */
.com-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1rem; background: rgba(4, 10, 20, 0.72); animation: aparecer 0.2s ease; }
.com-modal[hidden] { display: none; }
.com-modal-caja { position: relative; width: min(100%, 360px); border-radius: 1.1rem; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 60px -20px rgba(0,0,0,0.8); animation: acercarse 0.3s var(--ease-out); }
@keyframes acercarse { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.com-modal-x { position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 0; background: rgba(0,0,0,0.45); color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.com-perfil-portada { aspect-ratio: 18 / 5; min-height: 7.6rem; display: grid; justify-items: center; align-items: start; padding-top: 1rem; }.com-perfil-portada img { height: 2.3rem; opacity: 0.95; }
.com-perfil-cuerpo { display: grid; justify-items: center; text-align: center; padding: 0 1.3rem 1.5rem; }
.com-perfil-foto { position: relative; z-index: 1; width: 5.5rem; height: 5.5rem; margin-top: -2.75rem; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-2);
  font-family: var(--font-display); font-weight: 800; font-size: 2rem; box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px #5BC8F2; }
.com-perfil-foto.admin { box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px #E3A52F; }
.com-perfil-foto img { width: 100%; height: 100%; object-fit: cover; }
.com-perfil-nombre { margin: 1rem 0 0; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; text-transform: uppercase; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.com-perfil-rol { margin: 0.55rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; }
.com-perfil-bio { margin: 0.9rem 0 0; color: var(--ink-dim); line-height: 1.55; overflow-wrap: anywhere; }
.com-perfil-bio.vacia { color: var(--muted); font-style: italic; }

/* ---------- crear publicación (admins) ---------- */
.com-form { display: grid; gap: 1rem; margin-top: 1rem; }
.com-tipos { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.com-tipos label { cursor: pointer; }
.com-tipos input { position: absolute; opacity: 0; pointer-events: none; }
.com-tipos span { display: inline-block; font-weight: 700; font-size: 0.86rem; padding: 0.45rem 0.85rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.com-tipos input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.com-tipos input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.com-campo { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.com-campo textarea, .com-campo input, .com-programar input[type="datetime-local"] { font: inherit; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.6rem 0.75rem; width: 100%; min-width: 0; }
.com-campo textarea { resize: vertical; }
.com-mitad { max-width: 22rem; }
.com-opcional { color: var(--muted); font-weight: 400; display: inline; }
.com-campo:has(.com-opcional) { grid-template-columns: auto 1fr; }
.com-campo:has(.com-opcional) textarea { grid-column: 1 / -1; }
#pub-agregar-op { justify-self: start; }
.com-seccion { display: grid; gap: 0.6rem; }
.com-seccion[hidden], [data-solo-tipo][hidden] { display: none !important; }
.com-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.com-fotos:empty { display: none; }
.com-video-previa .com-video { max-width: 26rem; cursor: default; }
.com-ops-editor { display: grid; gap: 0.45rem; }
.com-op-ed { display: flex; align-items: center; gap: 0.45rem; }
.com-op-ed.bloqueada { opacity: 0.6; }
.com-op-txt { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.55rem 0.7rem; }
.com-op-ok { cursor: pointer; flex: none; }
.com-op-ok input { position: absolute; opacity: 0; pointer-events: none; }
.com-op-ok span { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); color: var(--muted); font-weight: 800; transition: all 0.15s ease; }
.com-op-ok input:checked + span { background: var(--ok); border-color: var(--ok); color: #0B1B33; }
.com-op-img { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 0.45rem; border: 1px dashed var(--line); display: grid; place-items: center; cursor: pointer; overflow: hidden; font-size: 1rem; }
.com-op-img img { width: 100%; height: 100%; object-fit: cover; }
.com-op-x { flex: none; font: inherit; font-size: 0.78rem; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 0.4rem; padding: 0.35rem 0.5rem; cursor: pointer; }
.com-op-x:hover { color: var(--error); border-color: var(--error); }
.com-programar { display: grid; gap: 0.5rem; }
.com-programar .ins-online { margin-top: 0; }
.com-programar input[type="datetime-local"] { max-width: 22rem; }
.com-programar input[hidden] { display: none; }

@media (max-width: 560px) {
  .com-pub-head { flex-wrap: wrap; }
  .com-chips { order: 3; width: 100%; justify-content: flex-start; }
  .com-acc { padding: 0.45rem 0.75rem; }
  .com-acc small { display: none; }


}
