@font-face {
  font-family: "Instrument Sans";
  src: url("fuentes/instrument-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122,
    U+2190-2193, U+2212;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("fuentes/instrument-sans-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF;
}

:root {
  --tinta: #202962;
  --accion: #485ace;
  --ladrillo: #c85b32;
  --fondo: #ffffff;
  --texto: #15181f;
  --texto2: #687385;
  --linea: #e6e8ef;
  --boton: #eff1f6;
  --boton-hover: #e3e6ee;
  --link: #3b4bb8;
  --cuadro: #f4f6fc;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b0e12;
    --texto: #f2f4f8;
    --texto2: #9aa3b4;
    --linea: #232834;
    --boton: #1c212b;
    --boton-hover: #262c38;
    --link: #8097f5;
    --cuadro: #151a24;
    --accion: #5b6dde;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 400 15px/1.4 "Instrument Sans", system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.bloqueado { overflow: hidden; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accion); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.saltar { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--fondo); padding: 8px 12px; border-radius: 8px; }
.saltar:focus { left: 8px; }

.icono-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.icono-btn svg { width: 24px; height: 24px; }

/* ---------- Perfil ---------- */
.barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 8px 0 16px;
  background: color-mix(in srgb, var(--fondo) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.barra-usuario { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }

.perfil { max-width: 935px; margin: 0 auto; }
.cabecera {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "avatar datos" "bio bio" "botones botones";
  column-gap: 20px;
  padding: 8px 16px 0;
}
.avatar { grid-area: avatar; border-radius: 50%; align-self: center; }
/* El anillo de "hay algo para ver" con los dos colores de la marca, no con el degradé de ninguna red. */
.avatar-anillo {
  display: block; width: 88px; height: 88px; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 200deg, var(--ladrillo), var(--accion), var(--tinta), var(--ladrillo));
}
.avatar-anillo img {
  width: 100%; height: 100%; border-radius: 50%;
  border: 3px solid var(--fondo); background: var(--tinta);
}
.datos { grid-area: datos; align-self: center; min-width: 0; }
.usuario { display: none; }
.nombre { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.contadores { margin: 4px 0 0; font-size: 15px; }
.contadores b { font-weight: 700; }
.bio { grid-area: bio; margin-top: 12px; font-size: 14.5px; line-height: 1.42; }
.bio p { margin: 0; }
.bio .categoria { color: var(--texto2); }
.bio-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--link); font-weight: 600; text-decoration: none; }
.bio-link svg { width: 15px; height: 15px; stroke-width: 2.2; }
.botones { grid-area: botones; display: flex; gap: 8px; margin-top: 14px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 16px; border-radius: 9px;
  background: var(--boton); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background 0.15s;
}
.btn:hover { background: var(--boton-hover); }
.btn-principal { background: var(--accion); color: #fff; }
.btn-principal:hover { background: #3c4dbd; }

.destacadas {
  display: flex; gap: 16px; overflow-x: auto; padding: 18px 16px 6px;
  scrollbar-width: none; scroll-padding: 0 16px;
}
.destacadas::-webkit-scrollbar { display: none; }
.destacada { flex: none; width: 76px; display: grid; justify-items: center; gap: 6px; font-size: 12px; text-align: center; }
.destacada-circulo {
  width: 66px; height: 66px; border-radius: 50%; padding: 3px;
  border: 1px solid var(--linea); display: grid; place-items: center; transition: transform 0.15s;
}
.destacada:active .destacada-circulo { transform: scale(0.95); }
.destacada-circulo span {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: var(--tinta); color: #fff;
}
.destacada:nth-child(even) .destacada-circulo span { background: var(--cuadro); color: var(--tinta); box-shadow: inset 0 0 0 1px var(--linea); }
@media (prefers-color-scheme: dark) { .destacada:nth-child(even) .destacada-circulo span { color: #fff; } }
.destacada svg { width: 26px; height: 26px; stroke-width: 1.8; }
.destacada-nombre { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pestanas { display: flex; margin-top: 12px; border-top: 1px solid var(--linea); }
.pestanas button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; color: var(--texto2); position: relative;
}
.pestanas button svg { width: 24px; height: 24px; }
.pestanas button span { display: none; }
.pestanas button[aria-selected="true"] { color: var(--texto); }
.pestanas button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--texto);
}

/* La grilla de perfil hoy recorta cada publicación a 3:4: así se va a ver de verdad, no en cuadrado. */
.grilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.celda {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; overflow: hidden;
  background: var(--cuadro);
}
.grilla-reels .celda { aspect-ratio: 9 / 16; }
.celda img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease, filter 0.2s; }
.celda::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0); transition: background 0.2s; }
@media (hover: hover) {
  .celda:hover::after { background: rgba(0, 0, 0, 0.12); }
}
.celda-tipo { position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 6px; color: #fff; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4)); }
.celda-tipo svg { width: 20px; height: 20px; stroke-width: 2; }
.celda-tipo .fijada { fill: #fff; stroke: none; }
.celda-pie {
  position: absolute; left: 8px; bottom: 7px; z-index: 1; display: flex; align-items: center; gap: 4px;
  color: #fff; font-size: 13px; font-weight: 600; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.celda-pie svg { width: 14px; height: 14px; fill: #fff; stroke: none; }

.pie { padding: 28px 16px 40px; text-align: center; color: var(--texto2); font-size: 13px; }
.pie a { color: var(--texto2); }

/* ---------- Compu: el perfil al estilo escritorio ---------- */
@media (min-width: 736px) {
  .barra { display: none; }
  .perfil { padding: 0 20px; }
  .cabecera {
    grid-template-columns: 290px 1fr;
    grid-template-areas: "avatar datos" "avatar bio" "avatar botones";
    padding: 44px 0 0;
    column-gap: 0;
  }
  .avatar { justify-self: center; align-self: start; }
  .avatar-anillo { width: 162px; height: 162px; padding: 5px; }
  .avatar-anillo img { border-width: 5px; }
  .usuario { display: block; margin: 0 0 14px; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
  .nombre { display: none; }
  .contadores { margin: 0; font-size: 16px; }
  .bio { margin-top: 16px; font-size: 15px; }
  .bio::before { content: "Alquiladmin"; display: block; font-weight: 700; }
  .botones { margin-top: 18px; max-width: 360px; }
  .destacadas { gap: 44px; padding: 44px 0 10px 50px; }
  .destacada { width: 87px; font-size: 13px; font-weight: 600; }
  .destacada-circulo { width: 87px; height: 87px; padding: 4px; }
  .destacada svg { width: 32px; height: 32px; }
  .pestanas { justify-content: center; gap: 60px; margin-top: 36px; }
  .pestanas button { flex: none; height: 52px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
  .pestanas button svg { width: 14px; height: 14px; stroke-width: 2.2; }
  .pestanas button span { display: inline; }
  .pestanas button[aria-selected="true"]::after { top: -1px; bottom: auto; height: 1px; }
  .grilla { gap: 4px; }
  .celda-tipo svg { width: 22px; height: 22px; }
}
@media (min-width: 736px) and (hover: hover) {
  .celda:hover img { transform: scale(1.03); }
}

/* ---------- Visor ---------- */
.visor { position: fixed; inset: 0; z-index: 20; background: #000; color: #fff; }
.visor-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(6px, env(safe-area-inset-top)) 6px 6px;
  pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0.35), transparent);
}
.visor-top > * { pointer-events: auto; }
.visor-top .icono-btn { width: 44px; height: 44px; }
.visor-top .icono-btn svg { width: 26px; height: 26px; stroke-width: 2.1; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.visor-titulo { font-size: 18px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
[data-sonido] .ico-sonido { display: none; }
[data-sonido][aria-pressed="true"] .ico-sonido { display: block; }
[data-sonido][aria-pressed="true"] .ico-mute { display: none; }

.visor-lista {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scrollbar-width: none;
}
.visor-lista::-webkit-scrollbar { display: none; }
.slide {
  position: relative; height: 100vh; height: 100dvh;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
}
.marco { position: relative; width: 100%; height: 100%; background: #000; overflow: hidden; }
.marco video { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* En el celu el video entra entero (contain): los reels tienen texto cerca del borde y "cover" lo cortaba. */
.toque { position: absolute; inset: 0; z-index: 1; }
.estado-pausa {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center;
  opacity: 0; transform: scale(0.8); transition: opacity 0.18s, transform 0.18s; pointer-events: none;
}
.estado-pausa svg { width: 32px; height: 32px; fill: #fff; stroke: none; margin-left: 4px; }
.slide.pausado .estado-pausa { opacity: 1; transform: none; }
.corazon-grande {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 110px; height: 110px; margin: -55px 0 0 -55px;
  pointer-events: none; opacity: 0;
}
.corazon-grande svg { width: 100%; height: 100%; fill: #fff; stroke: none; filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.35)); }
.corazon-grande.late { animation: latido 0.85s ease-out; }
@keyframes latido {
  0% { opacity: 0; transform: scale(0.4); }
  20% { opacity: 1; transform: scale(1.12); }
  35% { transform: scale(0.95); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05) translateY(-20px); }
}

.info {
  position: absolute; left: 0; right: 64px; bottom: 0; z-index: 2;
  padding: 0 12px calc(18px + env(safe-area-inset-bottom));
}
.recorte { position: absolute; inset: 0; overflow: hidden; }
.recorte::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 24%; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.autor { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 14.5px; }
.autor img { width: 32px; height: 32px; border-radius: 50%; background: var(--tinta); border: 1.5px solid rgba(255, 255, 255, 0.9); }
.autor a { text-decoration: none; }
.autor .btn-sistema {
  margin-left: 4px; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
}
.leyenda {
  margin-top: 10px; font-size: 14px; line-height: 1.4; text-align: left; display: block; width: 100%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
/* Cerrada: un renglón con "más" al lado, como en las apps; abierta: el texto completo con sus saltos. */
.leyenda { display: flex; gap: 4px; }
.leyenda-texto { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leyenda-mas { flex: none; }
.leyenda-mas { color: rgba(255, 255, 255, 0.75); font-weight: 600; }
.leyenda-tags { display: none; color: #b9c4ff; margin-top: 8px; font-weight: 500; }
.slide.abierta .leyenda { display: block; }
.slide.abierta .leyenda-texto { white-space: pre-line; }
.slide.abierta .leyenda-tags { display: block; }
.slide.abierta .leyenda-mas { display: none; }
.slide.abierta .leyenda { max-height: 46vh; overflow-y: auto; }
.slide.abierta .recorte::after { height: 75%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 45%); }
.duracion-pie { margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, 0.7); display: flex; align-items: center; gap: 6px; }
.duracion-pie svg { width: 13px; height: 13px; }

.acciones {
  position: absolute; right: 6px; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 2;
  display: grid; gap: 14px; justify-items: center;
}
.accion { display: grid; justify-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; width: 52px; }
.accion svg { width: 29px; height: 29px; stroke-width: 1.9; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45)); transition: transform 0.15s; }
.accion:active svg { transform: scale(0.88); }
.accion[aria-pressed="true"] svg { fill: #ff3b4f; stroke: #ff3b4f; animation: pop 0.35s ease-out; }
@keyframes pop { 50% { transform: scale(1.25); } }

.progreso {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: 18px; cursor: pointer;
  display: flex; align-items: flex-end;
}
.progreso span { display: block; width: 100%; height: 3px; background: rgba(255, 255, 255, 0.28); }
.progreso i { display: block; height: 100%; width: 0; background: #fff; }

/* Publicación de imagen dentro del visor: la foto (o el carrusel) centrada, con puntitos. */
.carrusel-caja { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); }
.carrusel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.carrusel::-webkit-scrollbar { display: none; }
.carrusel img { flex: none; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; scroll-snap-align: center; scroll-snap-stop: always; }
.puntos { display: flex; justify-content: center; gap: 5px; margin-top: 10px; }
.puntos i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); transition: background 0.2s, transform 0.2s; }
.puntos i.on { background: #fff; transform: scale(1.15); }
/* Las láminas ya traen su "2/4" dibujado: el contador queda solo para lectores de pantalla. */
.contador-lamina { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.flecha-lamina {
  position: absolute; top: 50%; z-index: 2; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); color: #15181f; display: none; place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.flecha-lamina svg { width: 18px; height: 18px; stroke-width: 2.4; }
.flecha-lamina.ant { left: 10px; }
.flecha-lamina.sig { right: 10px; }
.slide-imagen .toque { display: none; }

.visor-nav { display: none; }
.aviso-sonido {
  position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); z-index: 4; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 9px 12px; border-radius: 999px;
  background: rgba(20, 22, 30, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  animation: aparecer 0.3s ease-out;
}
.aviso-sonido svg { width: 18px; height: 18px; }
@keyframes aparecer { from { opacity: 0; transform: translate(-50%, -6px); } }

/* Compu: el video en formato teléfono, centrado sobre fondo oscuro, con las acciones al costado y flechas. */
@media (min-width: 736px) {
  .visor { background: #0d0f14; }
  .visor-top { background: none; padding: 14px 18px; }
  .visor-titulo { display: none; }
  .slide { padding: 22px 0; }
  .marco {
    height: 100%; width: auto; aspect-ratio: 9 / 16; max-width: calc(100vw - 220px);
    border-radius: 14px; overflow: visible;
  }
  .marco video { object-fit: cover; }
  .recorte { border-radius: 14px; }
  .info { right: 0; }
  .acciones { right: -70px; bottom: 8px; }
  .accion { color: #fff; }
  .accion svg { filter: none; }
  .progreso { border-radius: 0 0 14px 14px; overflow: hidden; }
  .flecha-lamina { display: grid; }
  .flecha-lamina[disabled] { display: none; }
  .visor-nav {
    position: absolute; right: 26px; top: 50%; z-index: 3; transform: translateY(-50%);
    display: grid; gap: 12px;
  }
  .visor-nav .icono-btn { width: 44px; height: 44px; background: rgba(255, 255, 255, 0.12); }
  .visor-nav .icono-btn:hover { background: rgba(255, 255, 255, 0.2); }
  .visor-nav .icono-btn[disabled] { opacity: 0.25; cursor: default; }
  .aviso-sonido { top: 30px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(60px + env(safe-area-inset-top)); z-index: 40;
  transform: translateX(-50%); max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px;
  background: #1c1f27; color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); animation: subir 0.25s ease-out;
}
.toast { white-space: nowrap; }
.toast a { color: #9fb0ff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.toast code { font-size: 12px; word-break: break-all; }
@keyframes subir { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- Guía para publicar (#publicar) ---------- */
.guia { position: fixed; inset: 0; z-index: 30; background: var(--fondo); overflow-y: auto; }
.guia-int { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.guia h2 { font-size: 26px; letter-spacing: -0.02em; margin: 8px 0 6px; }
.guia .intro { color: var(--texto2); margin: 0 0 18px; font-size: 15px; }
.guia ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.guia li {
  display: grid; grid-template-columns: 28px 66px 1fr; gap: 12px; align-items: start;
  padding: 12px; border: 1px solid var(--linea); border-radius: 14px;
}
.guia .n { width: 28px; height: 28px; border-radius: 50%; background: var(--ladrillo); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.guia li img { width: 66px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; }
.guia .t { font-weight: 700; }
.guia .m { color: var(--texto2); font-size: 13.5px; margin-top: 2px; }
.guia .acc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.guia .acc .btn { flex: none; height: 30px; font-size: 13px; padding: 0 12px; }
.guia .cerrar-guia { position: sticky; top: 0; display: flex; justify-content: flex-end; }

/* En las publicaciones de imagen el degradé oscurecía el pie de la lámina: ahí el texto ya va sobre negro. */
.slide-imagen:not(.abierta) .recorte::after { display: none; }
