/* Escuchar — estética zen: papel de arroz, tinta suave, musgo. Mucho aire, poco ruido. */

@font-face {
  font-family: "Cormorant";
  src: url(fonts/cormorant.woff2) format("woff2");
  font-style: normal; font-weight: 300 500; font-display: swap;
}
@font-face {
  font-family: "Cormorant";
  src: url(fonts/cormorant-italic.woff2) format("woff2");
  font-style: italic; font-weight: 300; font-display: swap;
}

:root {
  --bg: #f2efe7;          /* washi */
  --surface: #f8f6f0;
  --ink: #1d1c19;         /* sumi */
  --soft: #45433d;
  --muted: #6f6b61;
  --line: #d8d1c2;
  --moss: #4f6348;
  --moss-soft: #e4e7dc;
  --on-moss: #f6f4ee;
  --clay: #a0724f;
  --err: #a24b3c;
  --serif: "Cormorant", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 18px 50px -20px rgb(60 50 30 / .30);
  --grain: .03;
  --w-body: 400;
  --w-serif: 500;
  --w-title: 400;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171714;
    --surface: #1e1e1a;
    --ink: #e7e3d8;
    --soft: #bdb8ab;
    --muted: #7e7a70;
    --line: #2a2a25;
    --moss: #a3b39a;
    --moss-soft: #262b23;
    --on-moss: #171714;
    --clay: #d09a72;
    --err: #e0907f;
    --shadow: 0 18px 50px -20px rgb(0 0 0 / .8);
    --grain: .035;
    --w-body: 300;
    --w-serif: 400;
    --w-title: 300;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: var(--w-body) 16px/1.65 var(--sans);
  letter-spacing: .01em;
}
/* Grano de papel, casi imperceptible */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
svg text { font: 500 6.5px var(--sans); fill: currentColor; stroke: none; text-anchor: middle; }
b { font-weight: 500; }

/* ---------- Cabecera ---------- */
header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 28px 12px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand {
  font: 400 .78rem var(--sans); letter-spacing: .38em; text-transform: lowercase; color: var(--soft);
}
#net { font-size: .72rem; color: var(--clay); letter-spacing: .08em; }
#sync {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 4;
  max-width: 78vw; padding: 7px 16px; border-radius: 99px;
  background: var(--surface); color: var(--soft); box-shadow: var(--shadow);
  font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: fade .6s ease;
}
#sync:empty { display: none; }

main { padding: 4px 28px 56px; max-width: 640px; margin: 0 auto; animation: fade .7s ease; }
body.has-player main { padding-bottom: 250px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Portada ---------- */
.enso { display: block; width: 116px; height: 116px; margin: 34px auto 8px; color: var(--ink); opacity: .82; }
.enso path { stroke-width: 7; fill: none; stroke-linecap: round; }
.enso .brush { stroke-dasharray: 330; stroke-dashoffset: 330; animation: draw 2.6s cubic-bezier(.5, 0, .2, 1) .2s forwards; }
.enso .dry { stroke-width: 1.2; opacity: .45; stroke-dasharray: 330; stroke-dashoffset: 330; animation: draw 2.8s cubic-bezier(.5, 0, .2, 1) .3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.home-title { text-align: center; }
.home-title h1 { margin: 10px 0 2px; }
.home-title p { margin: 0 0 26px; color: var(--soft); font: italic 300 1.2rem var(--serif); }

/* ---------- Tipografía ---------- */
h1 {
  font: var(--w-title) 2.5rem/1.1 var(--serif);
  letter-spacing: -.005em;
  margin: 22px 0 12px;
  text-wrap: balance;
}
.label {
  margin: 48px 0 8px;
  font-size: .68rem; font-weight: 400; letter-spacing: .3em; text-transform: uppercase;
  color: var(--muted);
}
.back {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px; font-size: .82rem; color: var(--muted); letter-spacing: .03em;
}
.back svg { width: 15px; height: 15px; }
.lede { display: flex; align-items: center; gap: 6px; color: var(--muted); margin: 0 0 6px; font-size: .92rem; }
.note { font-size: .88rem; color: var(--muted); margin: 14px 0; }
.note.warn { color: var(--clay); }
.note.err { color: var(--err); }
.empty { text-align: center; color: var(--muted); margin: 30px 0; font-size: .95rem; }
.empty em { font: italic 300 1.25em var(--serif); color: var(--soft); }
.foot { margin-top: 64px; text-align: center; font-size: .72rem; color: var(--muted); letter-spacing: .04em; }
.foot.warn { color: var(--clay); }

/* Espera: un punto que respira */
.loading { display: flex; align-items: center; gap: 12px; color: var(--soft); font-size: .92rem; margin: 28px 0; }
.loading::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--moss);
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(.7); opacity: .35; } 50% { transform: scale(1.3); opacity: 1; } }

/* ---------- Buscador ---------- */
.search {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0 4px; padding: 6px 4px 6px 2px;
  border-bottom: 1px solid var(--line);
  transition: border-color .4s;
}
.search:focus-within { border-color: var(--moss); }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input {
  flex: 1; min-width: 0; padding: 10px 0;
  border: 0; outline: 0; background: none; color: var(--ink);
  font: var(--w-serif) 1.2rem var(--serif); letter-spacing: .01em;
}
.search input::placeholder { color: var(--muted); font-style: italic; }
.search input::-webkit-search-cancel-button { display: none; }
.search button {
  border: 0; background: none; padding: 8px 4px; cursor: pointer;
  font: 400 .72rem var(--sans); letter-spacing: .25em; text-transform: uppercase; color: var(--moss);
}

/* ---------- Botones ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 22px 0 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--moss); border-radius: 99px; padding: 10px 22px;
  background: none; color: var(--moss);
  font: 400 .85rem var(--sans); letter-spacing: .04em; cursor: pointer;
  transition: background .4s, color .4s;
}
.btn:active { background: var(--moss); color: var(--on-moss); }
.btn svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .45; }
.btn-text {
  border: 0; background: none; padding: 8px 0; cursor: pointer;
  font: 400 .82rem var(--sans); color: var(--muted); letter-spacing: .03em;
}
.btn-text.danger:active { color: var(--err); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
  transition: background .3s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:active { background: var(--moss-soft); }

/* ---------- Listas ---------- */
ol.rows { list-style: none; margin: 0; padding: 0; }
ol.rows > li + li { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }

/* canales */
a.ch { display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: center; padding: 16px 0; }
a.ch img, a.ch .avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  filter: saturate(.7);
  background: var(--moss-soft); color: var(--moss);
  display: grid; place-items: center; font: italic 300 1.5rem var(--serif);
}
a.ch .name { font: var(--w-serif) 1.25rem/1.25 var(--serif); }
a.ch .sub { display: block; font-size: .78rem; color: var(--muted); }
a.ch .desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .82rem; color: var(--soft); margin-top: 4px; line-height: 1.5;
}

/* listas de reproducción */
a.pl { display: grid; grid-template-columns: 84px 1fr auto; gap: 3px 16px; align-items: center; padding: 16px 0; }
a.pl .thumb { grid-row: 1 / span 2; align-self: start; }
a.pl .n, .tracks .n { font: italic 300 1.15rem var(--serif); color: var(--soft); font-variant-numeric: tabular-nums; }
a.pl .t { font: var(--w-serif) 1.18rem/1.3 var(--serif); }
a.pl .chev { color: var(--muted); opacity: .5; align-self: center; }
a.pl .chev svg { width: 15px; height: 15px; }
a.pl .st-row { grid-column: 2; }
a.pl .st-row:empty { display: none; }

/* pistas */
.tracks li {
  display: grid; grid-template-columns: 1.7rem 64px 1fr auto; gap: 4px 12px; align-items: start;
  padding: 16px 0;
}
.tracks .n { grid-column: 1; grid-row: 1; padding-top: 2px; }
.tracks .thumb { grid-column: 2; grid-row: 1 / span 3; }
.tracks .tt { grid-row: 1; }
.tracks .tt { grid-column: 3; }
.tracks .tt { font: var(--w-serif) 1.12rem/1.35 var(--serif); }
.tracks .meta { grid-row: 2; grid-column: 3; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .76rem; color: var(--muted); }
.tracks .icon-btn { grid-row: 1 / span 2; grid-column: 4; align-self: center; }
.tracks li.playing .thumb { box-shadow: 0 0 0 2px var(--moss); }
.tracks li.local { cursor: pointer; }
.tracks li.off { opacity: .55; }
.tracks li.playing .tt { color: var(--moss); }
.tracks li.playing .n { color: transparent; position: relative; }
.tracks li.playing .n::after {
  content: ""; position: absolute; left: 3px; top: .5em; width: 9px; height: 9px; border-radius: 50%;
  background: var(--moss); animation: breathe 3.2s ease-in-out infinite;
}
.bar { display: block; grid-row: 3; grid-column: 3; height: 1px; margin-top: 8px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--moss); transition: width 1s ease; }

/* estados: punto + texto */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: .76rem; color: var(--muted); letter-spacing: .02em; }
.st::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.st:empty { display: none; }
.st-ok { color: var(--moss); }
.st-busy { color: var(--soft); }
.st-busy::before { animation: breathe 3.2s ease-in-out infinite; }
.st-wait { color: var(--muted); }
.st-err { color: var(--err); }
.st-off::before { background: none; border: 1px solid currentColor; }
.st + .st { margin-left: 12px; }

/* ---------- Reproductor ---------- */
footer#player {
  position: fixed; z-index: 3;
  left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 616px; margin: 0 auto;
  padding: 18px 20px 12px;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--line); border-radius: 26px;
  box-shadow: var(--shadow);
  animation: fade .6s ease;
}
.np { display: flex; align-items: center; gap: 14px; min-width: 0; }
.np-text { min-width: 0; flex: 1; }
#np-art {
  width: 48px; height: 48px; flex: none; border-radius: 12px; object-fit: cover;
  background: var(--moss-soft); filter: saturate(.75);
}
#np-title { font: var(--w-serif) 1.3rem/1.25 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#np-sub { font-size: .72rem; color: var(--muted); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

#seek {
  --p: 0%;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; margin: 10px 0 0; background: none; cursor: pointer;
}
#seek::-webkit-slider-runnable-track {
  height: 2px; border-radius: 2px;
  background: linear-gradient(var(--moss) 0 0) 0 / var(--p) 100% no-repeat, var(--line);
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4.5px;
  border-radius: 50%; background: var(--moss); border: 0;
}
#seek::-moz-range-track { height: 2px; background: var(--line); }
#seek::-moz-range-progress { height: 2px; background: var(--moss); }
#seek::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--moss); border: 0; }
.times { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .04em; }

.controls { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.controls button {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: none; color: var(--soft); cursor: pointer;
  transition: background .3s;
}
.controls button:active { background: var(--moss-soft); }
.controls svg { width: 23px; height: 23px; }
/* El botón central respira mientras suena */
.controls .play { position: relative; width: 58px; height: 58px; background: var(--moss); color: var(--on-moss); }
.controls .play::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 1px solid var(--moss); opacity: 0;
}
.controls .play.playing::before { animation: halo 6s ease-in-out infinite; }
@keyframes halo { 0%, 100% { transform: scale(.92); opacity: 0; } 50% { transform: scale(1.12); opacity: .5; } }
.controls .play:active { background: var(--moss); opacity: .85; }
.controls .play svg { width: 24px; height: 24px; }
.controls .play .i-pause, .controls .play.playing .i-play { display: none; }
.controls .play.playing .i-pause { display: block; }
.controls .play .i-pause { stroke-width: 2.2; }
.controls .speed { font: 400 .76rem var(--sans); color: var(--muted); letter-spacing: .02em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .enso .brush, .enso .dry { stroke-dashoffset: 0; }
}

/* ---------- Imágenes: pequeñas, suaves, sin estridencias ---------- */
.thumb {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 7px; object-fit: cover;
  background: var(--moss-soft); filter: saturate(.72) contrast(.96);
}
.cover { margin: 20px 0 0; }
.cover-img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px;
  background: var(--moss-soft); filter: saturate(.72) contrast(.96);
}
.cover-img.blank { display: none; }
@media (prefers-color-scheme: dark) {
  .thumb, .cover-img, #np-art { filter: saturate(.6) brightness(.85); }
}
