/* ============================================================
   Manolo Solvy · App de música (musica.html)
   Reutiliza los tokens de styles.css. Tema claro cohesionado
   con un dock de reproductor inmersivo en azul profundo.
   ============================================================ */

:root {
  --app-dock:  #0a1c30;   /* azul profundo del reproductor */
  --app-dock2: #102A43;
  --player-h:  88px;
}

/* ---------- layout base ---------- */
body.app {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -5%, rgba(0,102,204,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(58,142,230,.10), transparent 55%),
    var(--bg);
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px) + 14px);
}

/* ---------- APP BAR ---------- */
.appbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 18px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 40px) 12px;
  background: rgba(240,244,248,.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar__brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; color: var(--ink); font-size: 1.06rem; letter-spacing: -.01em;
}
.appbar__back { width: 20px; height: 20px; color: var(--accent); margin-right: 2px; }
.brand__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(0,102,204,.18); }
.appnav { margin-left: auto; display: flex; gap: 4px; }
.appnav a {
  padding: 8px 14px; border-radius: 100px; font-weight: 600; font-size: .94rem;
  color: var(--body); transition: background .2s, color .2s;
}
.appnav a:hover { background: rgba(0,102,204,.08); color: var(--accent); }
.appbar__menu { display: none; margin-left: auto; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 6px; }
.appbar__menu svg { width: 26px; height: 26px; }

/* ---------- MAIN ---------- */
.app__main { width: 100%; max-width: 1000px; margin: 0 auto; padding: clamp(28px,5vw,56px) clamp(16px,4vw,40px) 40px; }
.app__hero { margin-bottom: 26px; }
.app__hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 16px 0 14px; }
.app__lead { color: var(--muted); font-size: 1.08rem; max-width: 60ch; }
.app__lead em { color: var(--body); font-style: italic; }

/* ---------- BUSCADOR ---------- */
.search {
  position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 40;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 100px;
  padding: 6px 8px 6px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  transition: border-color .25s, box-shadow .25s;
}
.search:focus-within { border-color: var(--accent); box-shadow: var(--glow); }
.search__ico { width: 22px; height: 22px; color: var(--muted); flex: none; }
.search:focus-within .search__ico { color: var(--accent); }
.search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font-family: var(--font); font-size: 1.05rem; color: var(--ink); padding: 12px 0;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(0,102,204,.1); color: var(--accent); display: grid; place-items: center;
  transition: background .2s;
}
.search__clear:hover { background: rgba(0,102,204,.2); }
.search__clear svg { width: 16px; height: 16px; }
.search__clear[hidden] { display: none; }

/* ---------- pestañas (sticky, tira horizontal) ---------- */
.app .music-tabs {
  position: sticky; top: calc(124px + env(safe-area-inset-top, 0px)); z-index: 30;
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 0; margin: 0 0 22px;
  background: var(--bg);
  /* difumina los bordes para indicar que hay más pestañas al desplazar */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.app .music-tabs::-webkit-scrollbar { display: none; }
.app .music-tab { flex: 0 0 auto; white-space: nowrap; }

/* ---------- info de búsqueda ---------- */
.search-info { color: var(--muted); font-size: .95rem; margin: -6px 0 18px; }
.search-info[hidden] { display: none; }
.search-info b { color: var(--ink); }

/* lista de una sola columna ancha en escritorio para sensación de app */
.app .tracklist { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.app .track { background: var(--surface-2); }

/* filas de pista + botón de favorito */
.track-row { display: flex; align-items: stretch; gap: 6px; }
.track-row .track { flex: 1; min-width: 0; }
.track__fav { flex: none; width: 46px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); display: grid; place-items: center; transition: color .2s, background .2s, border-color .2s, transform .12s; }
.track__fav:hover { color: #e0245e; border-color: rgba(224,36,94,.4); background: rgba(224,36,94,.06); }
.track__fav:active { transform: scale(.9); }
.track__fav svg { width: 20px; height: 20px; transition: fill .2s; }
.track-row.is-fav .track__fav { color: #e0245e; }
.track-row.is-fav .track__fav svg { fill: #e0245e; }

/* pestaña Favoritas */
.music-tab--fav { display: inline-flex; align-items: center; gap: 6px; }
.music-tab__heart { display: inline-flex; }
.music-tab__heart svg { width: 15px; height: 15px; }
.music-tab--fav.active .music-tab__heart svg { fill: currentColor; }

/* resaltado del término buscado */
.track mark { background: rgba(0,102,204,.18); color: var(--ink); border-radius: 4px; padding: 0 2px; }

/* mensaje sin resultados */
.app__empty { text-align: center; color: var(--muted); padding: 50px 0; }
.app__empty svg { width: 44px; height: 44px; color: var(--line); margin-bottom: 10px; }
.app__loaderr { color: var(--muted); }
.app__loaderr[hidden] { display: none; }

/* ============================================================
   REPRODUCTOR (dock inferior inmersivo)
   ============================================================ */
.app .player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  transform: none; width: 100%; max-width: none; border-radius: 0;
  background:
    linear-gradient(180deg, var(--app-dock2), var(--app-dock));
  border-top: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 -18px 50px rgba(16,42,67,.28);
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  color: #eaf1f8;
}
.player__bar {
  position: relative; height: 5px; margin: 0; border-radius: 0;
  background: rgba(255,255,255,.14); cursor: pointer; overflow: visible;
  touch-action: none; /* el arrastre hace seek, no scroll de la página */
}
/* zona táctil ampliada e invisible: 5 px es imposible de acertar con el dedo */
.player__bar::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; bottom: -10px; }
.player__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--accent-l), var(--accent)); }
.player__head { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); transform: translate(-50%, -50%) scale(0); transition: transform .15s; }
.player__bar:hover .player__head, .player.dragging .player__head { transform: translate(-50%, -50%) scale(1); }

.player__inner { display: flex; align-items: center; gap: 14px; padding: 12px clamp(14px, 4vw, 34px); max-width: 1200px; margin: 0 auto; }

.player__cover { position: relative; flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.35); background: #06121f; }
.player__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player__eq { position: absolute; inset: 0; display: none; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 9px; background: rgba(6,18,31,.45); }
.player.playing .player__eq { display: flex; }
.player__eq i { width: 3px; height: 8px; background: #fff; border-radius: 2px; animation: eq 1s var(--ease) infinite; }
.player__eq i:nth-child(2){ animation-delay:.15s } .player__eq i:nth-child(3){ animation-delay:.3s } .player__eq i:nth-child(4){ animation-delay:.45s }

.player__meta { min-width: 0; flex: 1; }
.player__title { color: #fff; font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__artist { color: #9fb6cc; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player__controls { display: flex; align-items: center; gap: 8px; flex: none; }
.player__nav { background: none; border: 0; cursor: pointer; color: #cfe0f0; padding: 8px; border-radius: 10px; transition: color .2s, background .2s; }
.player__nav:hover { color: #fff; background: rgba(255,255,255,.1); }
.player__nav svg { width: 22px; height: 22px; }
.player__play { flex: none; width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer; background: #fff; color: var(--app-dock); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(0,0,0,.35); transition: transform .18s; }
.player__play:hover { transform: scale(1.07); }
.player__play:active { transform: scale(.96); }
.player__play svg { width: 24px; height: 24px; margin-left: 1px; }

.player__time { font-variant-numeric: tabular-nums; color: #9fb6cc; font-size: .82rem; flex: none; min-width: 92px; text-align: right; }

/* oculto hasta elegir una pista; aparece deslizándose */
.app .player { transform: translateY(115%); transition: transform .45s var(--ease); }
.app .player.show { transform: translateY(0); }
@keyframes dockUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ============================================================
   VISTA «REPRODUCIENDO» A PANTALLA COMPLETA + VISUALIZADOR
   ============================================================ */
.np {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(2%);
  transition: opacity .45s var(--ease), transform .45s var(--ease), visibility .45s;
  overflow: hidden; color: #eaf1f8;
  background: radial-gradient(120% 90% at 50% -10%, #133353, #0a1c30 55%, #06121f);
}
.np.open { opacity: 1; visibility: visible; transform: translateY(0); }
.np__bg {
  position: absolute; inset: -8%; background-size: cover; background-position: center;
  filter: blur(60px) saturate(140%) brightness(.55); opacity: .55; transform: scale(1.1);
  transition: background-image .6s ease;
}
.np__viz { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.np__inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  width: min(560px, 90vw); padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.np__close {
  position: absolute; top: max(18px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.1); border: 0; cursor: pointer; color: #eaf1f8;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; backdrop-filter: blur(8px);
  transition: background .2s;
}
.np__close:hover { background: rgba(255,255,255,.2); }
.np__close svg { width: 24px; height: 24px; }
.np__share {
  position: absolute; top: max(18px, env(safe-area-inset-top, 0px)); right: 18px;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.1); color: #eaf1f8; display: grid; place-items: center;
  backdrop-filter: blur(8px); transition: background .2s; z-index: 3;
}
.np__share:hover { background: rgba(255,255,255,.2); }
.np__share svg { width: 22px; height: 22px; }
.np__toast {
  position: absolute; top: max(72px, calc(env(safe-area-inset-top, 0px) + 54px)); right: 18px; z-index: 3;
  background: rgba(0,0,0,.6); color: #fff; font-size: .85rem; padding: 8px 14px; border-radius: 100px;
  opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s;
}
.np__toast.show { opacity: 1; transform: translateY(0); }
.np__toast[hidden] { display: none; }

.np__stage { position: relative; display: grid; place-items: center; margin: 30px 0 28px; }
.np__art {
  position: relative; z-index: 2;
  width: min(62vw, 300px); aspect-ratio: 1; border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  animation: npFloat 6s var(--ease) infinite;
}
.np__art img { width: 100%; height: 100%; object-fit: cover; }
@keyframes npFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.np__meta { margin-bottom: 22px; max-width: 100%; }
.np__title { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; color: #fff; line-height: 1.2; }
.np__artist { color: #9fb6cc; font-size: 1.02rem; margin-top: 6px; }

.np__bar { width: 100%; max-width: 460px; height: 7px; border-radius: 6px; background: rgba(255,255,255,.16); position: relative; cursor: pointer; touch-action: none; }
.np__bar::before { content: ""; position: absolute; left: -6px; right: -6px; top: -14px; bottom: -14px; }
.np__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent-l), #fff); }
.np__head { position: absolute; top: 50%; left: 0; width: 15px; height: 15px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.np__times { width: 100%; max-width: 460px; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: #9fb6cc; font-size: .82rem; margin: 10px 0 22px; }

.np__controls { display: flex; align-items: center; gap: 26px; }
.np__nav { background: none; border: 0; cursor: pointer; color: #cfe0f0; padding: 8px; border-radius: 12px; transition: color .2s, transform .15s; }
.np__nav:hover { color: #fff; transform: scale(1.08); }
.np__nav svg { width: 30px; height: 30px; }
.np__play { width: 74px; height: 74px; border-radius: 50%; border: 0; cursor: pointer; background: #fff; color: var(--app-dock); display: grid; place-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.4); transition: transform .18s; }
.np__play:hover { transform: scale(1.06); }
.np__play:active { transform: scale(.95); }
.np__play svg { width: 34px; height: 34px; margin-left: 2px; }

@media (prefers-reduced-motion: reduce) { .np, .np__art { animation: none; transition: opacity .2s; } }

/* ============================================================
   BANNER DE INSTALACIÓN PWA (usado en index.html y musica.html)
   ============================================================ */
.pwa-banner {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(140%);
  z-index: 90; width: min(460px, calc(100vw - 28px));
  display: flex; align-items: center; gap: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; box-shadow: var(--shadow-lg);
  transition: transform .45s var(--ease);
}
.pwa-banner.show { transform: translateX(-50%) translateY(0); }
.pwa-banner__ico { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent-l), var(--accent)); color: #fff; }
.pwa-banner__ico svg { width: 24px; height: 24px; }
.pwa-banner__txt { flex: 1; min-width: 0; }
.pwa-banner__txt b { display: block; color: var(--ink); font-size: .98rem; }
.pwa-banner__txt span { color: var(--muted); font-size: .85rem; }
.pwa-banner__btn { flex: none; border: 0; cursor: pointer; background: var(--accent); color: #fff; font-family: var(--font); font-weight: 700; font-size: .9rem; padding: 10px 16px; border-radius: 100px; transition: background .2s, transform .2s; }
.pwa-banner__btn:hover { background: var(--accent-d); transform: translateY(-1px); }
.pwa-banner__close { flex: none; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.pwa-banner__close:hover { color: var(--ink); }
.pwa-banner__close svg { width: 18px; height: 18px; }

/* hoja de instrucciones iOS */
.ios-sheet { position: fixed; inset: 0; z-index: 95; display: none; place-items: end center; background: rgba(16,42,67,.5); backdrop-filter: blur(4px); padding: 0 0 24px; }
.ios-sheet.open { display: grid; animation: fade .3s ease both; }
.ios-sheet__card { background: var(--surface-2); border-radius: 20px 20px 0 0; padding: 26px 24px 30px; width: min(520px, 100%); box-shadow: var(--shadow-lg); animation: dockUp .4s var(--ease) both; }
.ios-sheet__card h3 { color: var(--ink); font-size: 1.2rem; margin-bottom: 6px; }
.ios-sheet__card p { color: var(--muted); font-size: .95rem; }
.ios-sheet__card ol { color: var(--body); padding-left: 20px; margin: 14px 0 0; }
.ios-sheet__card li { margin-bottom: 10px; }
.ios-sheet__card .share { display: inline-flex; vertical-align: -4px; width: 18px; height: 18px; color: var(--accent); }
.ios-sheet__close { margin-top: 18px; width: 100%; border: 0; cursor: pointer; background: var(--accent); color: #fff; font-family: var(--font); font-weight: 700; padding: 13px; border-radius: 100px; }

/* ============================================================
   Galería inmersiva — lightbox cinematográfico (index.html)
   ============================================================ */
#lbImg { opacity: 0; transform: scale(.94); transition: opacity .4s var(--ease), transform .5s var(--ease); will-change: opacity, transform; }
#lbImg.in { opacity: 1; transform: scale(1); }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(8px); transition: background .2s, transform .2s; z-index: 2;
}
.lightbox__nav:hover { background: rgba(255,255,255,.25); transform: translateY(-50%) scale(1.08); }
.lightbox__prev { left: max(16px, 3vw); }
.lightbox__next { right: max(16px, 3vw); }
.lightbox__nav svg { width: 26px; height: 26px; }
.lightbox__cap {
  position: absolute; left: 0; right: 0; bottom: max(22px, 4vh); text-align: center;
  color: #fff; font-weight: 600; font-size: 1.02rem; text-shadow: 0 2px 14px rgba(0,0,0,.7);
  padding: 0 60px; z-index: 2; pointer-events: none;
}
@media (max-width: 600px) { .lightbox__nav { width: 44px; height: 44px; } }
@media (prefers-reduced-motion: reduce) { #lbImg, #lbImg.in { transition: opacity .2s; transform: none; } }

/* ============================================================
   Hero cinematográfico (index.html)
   ============================================================ */
.hero__spot {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity .6s ease;
  background: radial-gradient(420px 420px at var(--mx, 50%) var(--my, 38%), rgba(58,142,230,.20), transparent 68%);
}
.hero:hover .hero__spot { opacity: 1; }
.hero__portrait { animation: heroGlow 5.5s var(--ease) infinite; will-change: box-shadow; }
@keyframes heroGlow {
  0%, 100% { box-shadow: var(--shadow-lg); }
  50%      { box-shadow: var(--shadow-lg), 0 0 70px rgba(0,102,204,.28); }
}
@media (prefers-reduced-motion: reduce) { .hero__portrait { animation: none; } .hero__spot { display: none; } }

/* ============================================================
   CTA de música en la home (index.html)
   ============================================================ */
.music-cta {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(24px, 4vw, 48px); align-items: center;
  background: linear-gradient(135deg, var(--app-dock2), var(--app-dock));
  border-radius: 24px; padding: clamp(26px, 4vw, 52px); color: #eaf1f8;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.music-cta .eyebrow { color: #8fc0f3; background: rgba(127,179,236,.14); border-color: rgba(127,179,236,.3); }
.music-cta .eyebrow::before { background: #8fc0f3; box-shadow: 0 0 0 4px rgba(127,179,236,.2); }
.music-cta__text h2 { color: #fff; font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin: 16px 0 12px; }
.music-cta__text p { color: #9fb6cc; max-width: 46ch; margin-bottom: 22px; }
.music-cta__text em { color: #cfe0f0; font-style: italic; }
.music-cta__art { position: relative; display: block; border-radius: 18px; overflow: hidden; box-shadow: 0 18px 40px rgba(0,0,0,.4); aspect-ratio: 16 / 10; }
.music-cta__art img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.music-cta__art:hover img { transform: scale(1.05); }
.music-cta__play { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--app-dock); display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: transform .25s; }
.music-cta__art:hover .music-cta__play { transform: scale(1.08); }
.music-cta__play svg { width: 30px; height: 30px; margin-left: 3px; }
@media (max-width: 760px) { .music-cta { grid-template-columns: 1fr; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .appnav {
    position: absolute; top: 100%; right: clamp(16px,4vw,40px); margin: 0;
    flex-direction: column; gap: 2px; align-items: stretch;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
    padding: 8px; box-shadow: var(--shadow-lg); min-width: 180px;
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all .25s var(--ease);
  }
  .appnav.open { opacity: 1; visibility: visible; transform: translateY(8px); }
  .appbar__menu { display: block; }
  .search { top: 60px; }
  .app .music-tabs { top: 118px; }
  .player__time { display: none; }
  .player__inner { gap: 10px; padding: 10px 14px; }
  .player__cover { width: 48px; height: 48px; }
  .player__play { width: 46px; height: 46px; }
  .player__nav svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .app .player, .ios-sheet__card, .pwa-banner { animation: none; }
  .player__eq i { animation: none; height: 8px; }
}
