/* La tarjeta de la casa viaja con la de Avances: Social, un grupo, tu Perfil
   y el de otra persona la pintan igual sin pedir otro archivo. */
@import url("tarjeta-casa.css?v=1.1.0");
/* ════════════════════════════════════════════════════════════════════
   avances.css — LA tarjeta de Avances, sus hojas y el compositor
   (js/avances.js, 2026-10-27). Solo tokens de global.css: claro y oscuro
   salen solos. Una tarjeta para Social, un grupo y los perfiles.
   El fondo, el borde y el color de su tipo los pone la tarjeta de la casa
   (.pf-tarjeta .pf-tono-*, css/tarjeta-casa.css, 2026-11-03); aquí, lo de dentro.
   ════════════════════════════════════════════════════════════════════ */

.av {
  padding: 16px 16px 10px;
  animation: av-entra .45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.av + .av { margin-top: 12px; }
@keyframes av-entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
/* Las tarjetas entran escalonadas, una tras otra (las primeras seis), y
   una tarjeta que se vuelve a pintar (un comentario, felicitar) no repite
   su entrada (2026-10-28, Social con más vida). */
.av:nth-child(2) { animation-delay: 55ms; }
.av:nth-child(3) { animation-delay: 110ms; }
.av:nth-child(4) { animation-delay: 165ms; }
.av:nth-child(5) { animation-delay: 220ms; }
.av:nth-child(n+6) { animation-delay: 275ms; }
.av.is-quieta { animation: none; }

.av-cab { display: flex; align-items: center; gap: 12px; }
.av-cab-tx { flex: 1; min-width: 0; }
.av-frase { margin: 0; font-size: 15px; line-height: 1.35; color: var(--text-main); }
.av-frase b, .av-nombre { font-weight: 800; color: var(--text-main); text-decoration: none; }
.av-cuando { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.av-cuando i { font-size: 13px; }
.av-mas { width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; color: var(--text-soft); cursor: pointer; font-size: 20px; }
.av-mas:hover { background: var(--bg-soft); }

/* El avatar: el Pío vestido de cada quien, con su punto si está en línea */
.av-ava { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; overflow: visible; text-decoration: none; }
.av-ava-in { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-weight: 800; color: var(--text-soft); }
.av-ava-pio { display: block; }
.av-ava--chico { width: 32px; height: 32px; }
.av-punto { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--tj-fondo); }

.av-cuerpo { margin: 12px 0 4px; }
.av-cuerpo:empty { display: none; }
.av-titulo { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.3; color: var(--text-main); }
.av-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--text-soft); }
.av-texto { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--text-main); white-space: pre-wrap; overflow-wrap: anywhere; }
.av-barra { height: 8px; border-radius: var(--r-pill); background: var(--bg-soft); overflow: hidden; margin-top: 10px; }
.av-barra { background: color-mix(in srgb, var(--tono, var(--accent)) 16%, transparent); }
.av-barra i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--tono, var(--accent)), color-mix(in srgb, var(--tono, var(--accent)) 70%, #fff)); transition: width .6s cubic-bezier(0.22, 1, 0.36, 1); }
.av--meta .av-titulo::before { content: ''; }
.av-coronas { display: flex; align-items: center; gap: 6px; }
.av-coronas i { color: var(--tono-tinta, var(--accent)); }

.av-fotos { display: grid; gap: 4px; margin-top: 10px; border-radius: var(--r-lg, 16px); overflow: hidden; }
.av-fotos--1 { grid-template-columns: 1fr; }
.av-fotos--2, .av-fotos--4 { grid-template-columns: 1fr 1fr; }
.av-fotos--3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.av-fotos--3 .av-foto:first-child { grid-row: span 2; }
.av-foto { border: 0; padding: 0; background: var(--bg-soft); cursor: zoom-in; aspect-ratio: 1; overflow: hidden; }
.av-fotos--1 .av-foto { aspect-ratio: auto; max-height: 440px; }
.av-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* El pie: me gusta, comentarios y UNA acción */
.av-pie { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.av-b { min-width: 44px; height: 44px; padding: 0 10px; border: 0; background: none; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: background var(--tr), color var(--tr); }
.av-b:hover { background: var(--bg-soft); color: var(--text-main); }
.av-b i { font-size: 21px; }
.av-gusta.is-on { color: var(--red); }
/* El me gusta: el corazón salta con resorte y el número rueda. */
.av-gusta.is-late i { animation: av-late .42s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes av-late { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
.av-n { display: inline-block; min-width: .6em; font-variant-numeric: tabular-nums; }
.av-n.is-rueda { animation: av-rueda .32s cubic-bezier(0.22, 1, 0.36, 1); }
.av-n.is-baja { animation: av-rueda-baja .32s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes av-rueda { from { transform: translateY(70%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes av-rueda-baja { from { transform: translateY(-70%); opacity: 0; } to { transform: none; opacity: 1; } }
/* El corazón grande del doble toque. */
.av-corazon { position: absolute; left: 50%; top: 50%; z-index: 3; font-size: 84px; color: #fff; pointer-events: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .12); transform: translate(-50%, -50%) scale(0); animation: av-corazon .85s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
@keyframes av-corazon { 0% { transform: translate(-50%, -50%) scale(0); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: .95; } 45% { transform: translate(-50%, -50%) scale(.95); } 70% { transform: translate(-50%, -50%) scale(1); opacity: .95; } 100% { transform: translate(-50%, -62%) scale(1); opacity: 0; } }
.av-cuerpo { -webkit-user-select: none; user-select: none; }
.av-texto, .av-titulo { -webkit-user-select: text; user-select: text; }
/* El Pío de quien lo logró brinca cuando le das me gusta o lo felicitas. */
.av-ava.is-brinca .av-ava-in { animation: av-brinca .5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes av-brinca { 0% { transform: none; } 35% { transform: translateY(-7px) rotate(-6deg); } 70% { transform: translateY(0) rotate(3deg); } 100% { transform: none; } }
.av-accion { margin-left: auto; min-width: 0; max-width: 100%; white-space: nowrap; height: 44px; padding: 0 16px; border-radius: var(--r-pill); font: inherit; font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; transition: transform var(--tr), background var(--tr); }
.av-accion:active { transform: translateY(2px); }
.av-accion span { overflow: hidden; text-overflow: ellipsis; }
/* En el teléfono angosto la acción cabe en un renglón: menos aire, nunca dos líneas. */
@media (max-width: 420px) { .av-b { padding: 0 8px; } .av-accion { padding: 0 12px; font-size: 13px; gap: 5px; } }
.av-accion.is-hecho { background: none; border-color: transparent; color: var(--text-soft); cursor: default; }
.av-com1-b { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 2px 4px 6px; cursor: pointer; font: inherit; }
.av-com1 { margin: 0; font-size: 14px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-com1 b { color: var(--text-main); }
.av-com1 i { color: var(--tono-oro-tinta); }

/* El aplauso de tu Pío al felicitar */
.av-aplauso { position: fixed; z-index: 9999; pointer-events: none; width: 0; height: 0; }
.av-aplauso i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: av-chispa 1s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.av-aplauso i:nth-child(even) { background: var(--green); }
.av-aplauso--chico i { width: 5px; height: 5px; background: var(--red); animation-duration: .6s; }
.av-aplauso--chico i:nth-child(even) { background: var(--accent); }
@keyframes av-chispa { from { transform: rotate(var(--a)) translateY(0) scale(1); opacity: 1; } to { transform: rotate(var(--a)) translateY(calc(-1 * var(--d) - 20px)) scale(.4); opacity: 0; } }
.av-aplauso-pio { position: absolute; left: -22px; top: -70px; width: 44px; height: 44px; animation: av-pio-salta 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
@keyframes av-pio-salta { 0% { transform: translateY(20px) scale(.4); opacity: 0; } 30% { transform: translateY(-6px) scale(1.05); opacity: 1; } 45% { transform: translateY(0) rotate(-8deg); } 60% { transform: translateY(-8px) rotate(8deg); } 75% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-14px); opacity: 0; } }

/* ── La hoja: abajo en el teléfono, al centro en la computadora ── */
.av-velo { position: fixed; inset: 0; z-index: 1200; background: rgba(0, 0, 0, .42); display: flex; align-items: flex-end; justify-content: center; animation: av-velo .2s ease both; }
.av-velo.is-sale { animation: av-velo .2s ease reverse both; }
@keyframes av-velo { from { opacity: 0; } to { opacity: 1; } }
.av-hoja { width: 100%; max-width: 560px; max-height: 88dvh; display: flex; flex-direction: column; background: var(--bg-panel); color: var(--text-main); border-radius: var(--r-2xl) var(--r-2xl) 0 0; box-shadow: var(--shadow-xl); padding-bottom: env(safe-area-inset-bottom); animation: av-sube .35s cubic-bezier(0.22, 1, 0.36, 1) both; }
.av-velo.is-sale .av-hoja { animation: av-sube .2s cubic-bezier(0.55, 0, 0.85, 0.4) reverse both; }
@keyframes av-sube { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 761px) {
  .av-velo { align-items: center; }
  .av-hoja { border-radius: var(--r-2xl); max-height: 80vh; }
}
.av-hoja-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 20px; }
.av-hoja-cab b { font-size: 17px; font-weight: 900; }
.av-hoja-x { width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; color: var(--text-soft); font-size: 20px; cursor: pointer; }
.av-hoja-x:hover { background: var(--bg-soft); }
.av-hoja-cuerpo { padding: 6px 20px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.av-hoja--chica .av-hoja-cuerpo { padding-top: 16px; }
.av-hoja-lista { display: flex; flex-direction: column; }
.av-hoja-fila { min-height: 52px; display: flex; align-items: center; gap: 12px; border: 0; background: none; border-radius: var(--r-md, 12px); padding: 0 12px; font: inherit; font-weight: 700; font-size: 15.5px; color: var(--text-main); cursor: pointer; text-align: left; }
.av-hoja-fila:hover { background: var(--bg-soft); }
.av-hoja-fila i { font-size: 20px; color: var(--text-soft); }
.av-hoja-fila--peligro, .av-hoja-fila--peligro i { color: var(--red); }
.av-velo--visor .av-hoja { max-width: 920px; }
.av-visor-img { width: 100%; height: auto; max-height: 72vh; object-fit: contain; border-radius: var(--r-lg, 16px); }

/* Comentarios */
.av-coms { overflow: auto; max-height: 52dvh; display: flex; flex-direction: column; gap: 14px; }
.av-com { display: flex; gap: 10px; align-items: flex-start; }
.av-com-tx p { margin: 0; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.av-com-tx .av-cuando { margin-top: 3px; }
.av-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--text-muted); cursor: pointer; min-height: 24px; }
.av-link:hover { color: var(--text-main); }
.av-vacio { margin: 8px 0; color: var(--text-muted); font-size: 14.5px; text-align: center; }
.av-coms-form { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.av-campo { flex: 1; resize: none; border: 1px solid var(--border-mid); border-radius: 22px; padding: 11px 16px; background: var(--bg-soft); color: var(--text-main); font: inherit; font-size: 15px; line-height: 1.4; min-height: 44px; }
.av-campo:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.av-campo--grande { border-radius: var(--r-lg, 16px); min-height: 120px; }
.av-enviar { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--pri-fondo); color: var(--pri-tinta); font-size: 19px; cursor: pointer; flex: none; }
.av-enviar:disabled { opacity: .5; }

/* El compositor */
.av-compo { display: flex; flex-direction: column; gap: 12px; }
.av-compo-fotos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.av-compo-fotos:empty { display: none; }
.av-compo-mini { position: relative; aspect-ratio: 1; border-radius: var(--r-md, 12px); overflow: hidden; background: var(--bg-soft); }
.av-compo-mini img { width: 100%; height: 100%; object-fit: cover; }
.av-compo-mini.is-sube img { opacity: .5; }
.av-compo-mini button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }
.av-compo-fila { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.av-compo-foto { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: var(--r-pill); background: var(--bg-soft); font-weight: 700; color: var(--text-main); cursor: pointer; }
.av-compo-foto[hidden] { display: none; }
.av-seg { display: inline-flex; background: var(--bg-soft); border-radius: var(--r-pill); padding: 3px; }
.av-seg button { min-height: 38px; padding: 0 14px; border: 0; background: none; border-radius: var(--r-pill); font: inherit; font-weight: 700; color: var(--text-soft); cursor: pointer; }
.av-seg button[aria-checked="true"] { background: var(--bg-panel); color: var(--text-main); box-shadow: var(--shadow-xs); }
.av-cuenta { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.av-primario { min-height: 48px; border: 0; border-radius: var(--r-pill); background: var(--pri-fondo); color: var(--pri-tinta); font: inherit; font-weight: 900; font-size: 16px; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .12); }
.av-primario:disabled { opacity: .45; cursor: default; box-shadow: none; }

/* «Tu semana» (2026-10-27): tus cifras en cajitas (.pf-cifra, cada una
   del tono de lo que cuenta), que entran escalonadas. */
.av-sem { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.av-sem-c { animation: av-sem-entra .45s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.av-sem-lugar { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 700; }
.av-sem-lugar i { color: var(--tono-oro-tinta); }
.av-sem-solo { margin: 8px 0 0; font-size: 12.5px; color: var(--text-muted); }
.av-pie--semana { margin-top: 12px; }
.av-sem-compartir { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@keyframes av-sem-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 380px) { .av-sem { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

body.av-hoja-abierta { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .av, .av-velo, .av-hoja, .av-gusta.is-late i, .av-gusta.is-on i, .av-n, .av-aplauso i, .av-aplauso-pio, .av-ava-in, .av-sem-c { animation: none !important; opacity: 1; transform: none; }
  .av-corazon { display: none; }
  .av-barra i, .av-b, .av-accion { transition: none; }
}
