/* Lienzo del perfil: todo se tiñe con variables CSS puestas solo en este contenedor */
.perfil-canvas { container-type: inline-size; color: var(--ink); background: var(--paper); border-radius: var(--r, 14px); padding: clamp(10px, 3cqi, 28px) clamp(8px, 2.5cqi, 20px) 30px; min-height: 240px; }
.perfil-canvas.themed { border-radius: 0; }
.perfil-canvas :where(h1, h2, h3, p) { margin: 0; }
.perfil-canvas button { font: inherit; }
.perfil-canvas a { color: var(--accent-dark); }
.pf-shell { width: min(780px, 100%); margin: 0 auto; display: grid; gap: 16px; }
.pf-shell.cols-2 { width: min(1160px, 100%); }
.pf-body { display: grid; gap: 16px; }
.pf-main, .pf-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.pf-side { order: -1; }
@container (min-width: 900px) {
  .pf-shell.cols-2 .pf-body { grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
  .pf-shell.cols-2.side-left .pf-body { grid-template-columns: 320px minmax(0, 1fr); }
  .pf-shell.cols-2 .pf-side { order: 0; }
  .pf-shell.cols-2.side-left .pf-side { order: -1; }
}

/* Tarjetas: sólida, cristal, papel o minimal */
.perfil-canvas .pf-card, .perfil-canvas .card { background: color-mix(in srgb, var(--card) var(--card-a, 100%), transparent); border: 1px solid var(--edge); border-radius: var(--r, 14px); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); overflow: hidden; margin: 0; color: var(--ink); }
.perfil-canvas.cs-glass .pf-card, .perfil-canvas.cs-glass .card { backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); border-color: color-mix(in srgb, var(--edge) 70%, transparent); box-shadow: 0 8px 30px rgba(0, 0, 0, .12); }
.perfil-canvas.cs-paper .pf-card, .perfil-canvas.cs-paper .card { box-shadow: 0 2px 0 var(--edge), 0 8px 18px rgba(0, 0, 0, .06); background-image: linear-gradient(transparent 27px, color-mix(in srgb, var(--edge) 55%, transparent) 28px); background-size: 100% 28px; background-position: 0 6px; }
.perfil-canvas.cs-minimal .pf-card, .perfil-canvas.cs-minimal .card { background: transparent; border: 0; border-bottom: 1px solid var(--edge); border-radius: 0; box-shadow: none; }
.perfil-canvas.cs-minimal .pf-hero { border-bottom: 0; }

/* Cabecera */
.pf-hero .cover { height: clamp(120px, 26cqi, 230px); background: var(--accent-soft) center / cover no-repeat; }
.pf-id { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; padding: 0 clamp(14px, 3cqi, 26px) 18px; align-items: end; }
.pf-id .pic { width: clamp(84px, 14cqi, 124px); height: clamp(84px, 14cqi, 124px); margin-top: calc(clamp(84px, 14cqi, 124px) / -2); border: 4px solid var(--card); border-radius: 50%; background: var(--accent) center / cover no-repeat; color: var(--accent-ink); display: grid; place-items: center; font-size: 44px; font-weight: 800; position: relative; }
.pf-id .ident { padding-top: 12px; min-width: 0; }
.pf-id h1 { font-size: clamp(22px, 4cqi, 30px); line-height: 1.15; overflow-wrap: anywhere; }
.pf-id .handle { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.pf-id .quote { margin: 10px 0 0; padding-left: 12px; border-left: 3px solid var(--accent); font-size: clamp(15px, 2.4cqi, 18px); font-style: italic; overflow-wrap: anywhere; }
.pf-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 6px; }
.pf-actions .ghost { border: 1px solid var(--edge); background: transparent; color: var(--ink); }
.pf-actions .solid { background: var(--accent); color: var(--accent-ink); }
.perfil-canvas .seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--edge); border-radius: 999px; background: color-mix(in srgb, var(--card) 60%, transparent); }
.perfil-canvas .seg button { padding: 4px 12px; border-radius: 999px; font-size: 13px; color: var(--text-soft); background: transparent; }
.perfil-canvas .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.perfil-canvas :is(.pf-actions, .pf-tabs) button, .perfil-canvas .more, .perfil-canvas .chipbtn { border-radius: 999px; }

/* Bloques */
.pf-card { padding: 16px 18px; }
.pf-hero { padding: 0; }
.pf-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; font-weight: 800; }
.pf-about .bio { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.pf-about .facts { margin-top: 8px; color: var(--muted); font-size: 14px; }
.pf-mood .mood { display: flex; gap: 12px; align-items: center; }
.pf-mood small, .pf-com small { color: var(--muted); display: block; font-size: 12.5px; }
.pf-mood .music { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pf-mood .mood + .music { margin-top: 12px; }
.pf-mood .play { padding: 6px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; flex: none; }
.pf-mood .music .meta { min-width: 0; display: grid; flex: 1; }
.pf-mood .music .meta small { color: var(--muted); }
.pf-mood .music b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-mood .embed { display: block; width: 100%; margin-top: 12px; border: 0; border-radius: calc(var(--r, 14px) - 2px); background: var(--panel); }
.pf-mood .embed.youtube { aspect-ratio: 16 / 9; height: auto; }
.pf-mood .embed.spotify { height: 152px; }
.pf-mood .embed.soundcloud { height: 120px; }
.eq { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.eq i { width: 4px; height: 6px; background: var(--accent); border-radius: 2px; }
.music.on .eq i { animation: pf-eq 0.9s ease-in-out infinite; }
.music.on .eq i:nth-child(2) { animation-delay: .2s; } .music.on .eq i:nth-child(3) { animation-delay: .4s; } .music.on .eq i:nth-child(4) { animation-delay: .1s; }
@keyframes pf-eq { 0%, 100% { height: 5px; } 50% { height: 22px; } }
.sw-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swwrap { display: grid; justify-items: center; gap: 3px; }
.swwrap .sw { width: 38px; height: 38px; border-radius: 50%; padding: 0; box-shadow: 0 0 0 1px var(--edge); }
.swwrap small { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.taglist { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tag { padding: 0; background: none; color: var(--accent-dark); font-weight: 700; font-size: 14.5px; }
.tag.on { text-decoration: underline; }
.pf-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pf-links a { font-weight: 700; overflow-wrap: anywhere; }
.pf-com .state { font-weight: 800; font-size: 16px; }
.pf-com.open .state { color: #1f9d63; }
.pf-com p + p { margin-top: 4px; }
.pf-com.big { display: grid; gap: 12px; padding: 20px; }
.pf-com.big p { overflow-wrap: anywhere; }
.pf-spot .imgbtn { display: block; width: 100%; padding: 0; border-radius: calc(var(--r, 14px) - 2px); overflow: hidden; background: var(--panel); }
.pf-spot img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: var(--panel); }
.pf-spot .cap { margin-top: 8px; color: var(--text-soft); overflow-wrap: anywhere; }
.pins { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pins.big { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pin { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--edge); border-radius: calc(var(--r, 14px) - 2px); color: var(--ink) !important; text-decoration: none; background: color-mix(in srgb, var(--card) 70%, transparent); }
.pin b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pin small { color: var(--muted); }
.pin:hover { border-color: var(--accent); }

/* Pestañas y contenido */
.pf-content { display: grid; gap: 12px; align-content: start; }
.pf-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--edge); }
.pf-tabs button { padding: 9px 14px; font-size: 14.5px; font-weight: 700; color: var(--muted); background: transparent; border-radius: 8px 8px 0 0; border-bottom: 3px solid transparent; }
.pf-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pf-tabbody { display: grid; gap: 12px; }
.pf-tabbody .empty { color: var(--muted); padding: 14px 2px; }
.pf-tabbody .filter { color: var(--text-soft); font-size: 14px; }
.perfil-canvas .linkish { background: none; padding: 0; color: var(--accent-dark); text-decoration: underline; font-size: 14px; }
.perfil-canvas .more { justify-self: center; padding: 8px 22px; border: 1px solid var(--edge); background: var(--card); color: var(--ink); }
.galbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.galbar .grow { flex: 1; }
.perfil-canvas .chipbtn { padding: 4px 12px; border: 1px solid var(--edge); background: var(--card); color: var(--ink); font-size: 13px; }
.perfil-canvas .chipbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mosaic { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mosaic .tile { aspect-ratio: 1; padding: 0; overflow: hidden; border-radius: calc(var(--r, 14px) - 2px); background: var(--panel); border: 1px solid var(--edge); display: block; }
.mosaic .tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.mosaic .tile:hover img { transform: scale(1.04); }
.perfil-canvas .post .imgbtn { display: block; width: 100%; padding: 0; background: none; border-radius: calc(var(--r, 14px) - 2px); overflow: hidden; margin-top: 10px; }
.perfil-canvas .post .imgbtn img { margin: 0; cursor: zoom-in; }
.perfil-canvas .post .meta select { padding: 3px 8px; font-size: 13px; background: var(--card); color: var(--ink); border: 1px solid var(--edge); border-radius: 8px; }
.perfil-canvas .post .meta button:not(.likebtn) { margin-left: 0; border: 1px solid var(--edge); background: transparent; color: var(--text-soft); }
.perfil-canvas .post .meta button:last-child:not(.likebtn) { margin-left: auto; }
.likebtn { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--edge); background: transparent; color: var(--text-soft); font-size: 13px; }
.likebtn .n { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--edge); font-variant-numeric: tabular-nums; }
.likebtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.likebtn[aria-pressed="true"] .n { border-left-color: currentColor; }

/* Avatares con forma (también en las publicaciones) */
.perfil-canvas.av-rounded .pic, .perfil-canvas.av-rounded .pic.small { border-radius: 24% !important; }
.perfil-canvas.av-hex .pic, .perfil-canvas.av-hex .pic.small { border-radius: 0 !important; border-width: 0 !important; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.perfil-canvas.av-star .pic, .perfil-canvas.av-star .pic.small { border-radius: 0 !important; border-width: 0 !important; clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

/* Visor, ventana de publicar y avisos (fuera del lienzo: usan el tema neutro de la app) */
.pf-lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 14, .9); display: grid; place-items: center; padding: 20px; }
.pf-lightbox .frame { max-width: min(1100px, 100%); max-height: 100%; display: grid; gap: 10px; justify-items: center; }
.pf-lightbox img { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: 8px; background: #fff; }
.pf-lightbox .cap { color: #e8eaee; text-align: center; max-width: 60ch; overflow-wrap: anywhere; }
.pf-lightbox button { position: absolute; background: rgba(255, 255, 255, .14); color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 28px; line-height: 1; padding: 0; }
.pf-lightbox button:hover { background: rgba(255, 255, 255, .28); }
.pf-lightbox .prev { left: 14px; top: 50%; translate: 0 -50%; } .pf-lightbox .next { right: 14px; top: 50%; translate: 0 -50%; } .pf-lightbox .x { right: 14px; top: 14px; }
dialog.pf-modal { width: min(620px, calc(100% - 24px)); padding: 20px; position: fixed; }
dialog.pf-modal h2 { margin: 0 0 10px; font-size: 20px; }
dialog.pf-modal .x { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; padding: 0; font-size: 22px; }
dialog.pf-modal .composer { box-shadow: none; border: 0; padding: 0; }
.pf-toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 70; background: #1f2a37; color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transition: opacity .4s; }
.pf-toast.out { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .music.on .eq i { animation: none; height: 14px; } .mosaic .tile img { transition: none; } }

.perfil-page main { display: block; padding: 0 0 30px; }
.perfil { width: 100%; }.perfil .perfil-canvas { min-height: calc(100dvh - 100px); border-radius: 0; }
