/* --- Single post page --- */

.listening-post {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 5rem;
}

.listening-post h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.listening-post .date {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.listening-post .genres {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.listening-post .post-summary {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
}

.listening-post .post-body {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-body);
  margin: 1.5rem 0;
  text-align: justify;
}

.listening-post .post-body p {
  margin-bottom: 1rem;
}

.listening-post .post-body .track-mention {
  font-family: var(--text-display);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
  font-size: 0.8rem;
}

.listening-post .post-body .track-mention:hover {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
  color: var(--accent);
  opacity: 1;
}

/* --- Player container --- */

.pl-container {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: all 0.3s ease;
}

/* --- Video --- */

.pl-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  display: none;
}

.pl-video.is-visible {
  display: block;
}

.pl-video iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* --- Now-playing label (collapsed) --- */

.pl-now-playing {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  margin-left: 0.5rem;
}

.pl-container.is-collapsed .pl-now-playing {
  display: inline;
}

/* --- Now-playing info bar --- */

.pl-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 1rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.pl-info.is-visible {
  max-height: 2rem;
  padding: 0.75rem 1rem 0.35rem;
}

.pl-info-left {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}

.pl-info-name {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-info-artist {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.03em;
}

.pl-info-time {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.pl-loading-dots span {
  animation: pl-dot-pulse 1.2s infinite ease-in-out;
  opacity: 0.2;
}

.pl-loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.pl-loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pl-dot-pulse {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* --- Progress bar --- */

.pl-progress-wrap {
  padding: 0 1rem;
  margin: 0;
  cursor: pointer;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease, margin 0.25s ease;
}

.pl-progress-wrap.is-visible {
  padding: 8px 1rem;
  margin: -8px 0;
  max-height: 2rem;
}

.pl-progress {
  height: 3px;
  background: var(--border);
  transition: height 0.15s ease, border-radius 0.3s ease;
}

.pl-progress-wrap:hover .pl-progress {
  height: 5px;
}

.pl-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s linear;
}

.pl-container.is-collapsed .pl-progress {
  border-radius: 3px;
  height: 3px;
}

/* --- Controls bar --- */

.pl-controls {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}

.pl-left,
.pl-right {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
}

.pl-left {
  justify-content: flex-start;
}

.pl-right {
  justify-content: flex-end;
  gap: 0.25rem;
}

.pl-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pl-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.pl-btn:hover:not(:disabled) {
  color: var(--accent);
}

.pl-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.pl-btn-play {
  color: var(--text-dim);
  padding: 0.4rem;
}

.pl-btn-play.is-active {
  color: var(--text);
}

.pl-btn-sm {
  padding: 0.3rem;
}

.pl-btn-sm.is-active {
  color: var(--text);
}

/* --- Now-playing equalizer --- */

.tracklist-eq {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25em;
  color: var(--accent);
}

.tracklist-item.is-active::before {
  display: none;
}

.eq-bars .eq-bar {
  animation: eq-bounce 0.8s ease infinite alternate;
  transform-origin: bottom;
}

.eq-bars.is-paused .eq-bar {
  animation: none;
  transform: scaleY(1);
}

.eq-bars .eq-bar:nth-child(1) {
  animation-delay: 0s;
}

.eq-bars .eq-bar:nth-child(2) {
  animation-delay: 0.2s;
}

.eq-bars .eq-bar:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes eq-bounce {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* --- Micro-animations --- */

.pl-eq svg path {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.pl-eq:not(.is-active) svg path:nth-child(1) {
  transform: translateX(3px);
}
.pl-eq:not(.is-active) svg path:nth-child(2) {
  transform: translateX(2px);
}
.pl-eq:not(.is-active) svg path:nth-child(3) {
  transform: translateX(1px);
}
.pl-eq:not(.is-active) svg path:nth-child(4) {
  transform: translateX(-1px) rotate(-4deg);
  transform-origin: bottom left;
}

@keyframes pl-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.pl-btn-play.is-popping {
  animation: pl-pop 0.25s ease;
}

@keyframes pl-nudge-left {
  0% { transform: translateX(0); }
  40% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

@keyframes pl-nudge-right {
  0% { transform: translateX(0); }
  40% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.pl-btn.is-nudge-left {
  animation: pl-nudge-left 0.2s ease;
}

.pl-btn.is-nudge-right {
  animation: pl-nudge-right 0.2s ease;
}

@keyframes pl-wiggle {
  0% { transform: rotate(0); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
  100% { transform: rotate(0); }
}

.pl-btn.is-wiggling {
  animation: pl-wiggle 0.35s ease;
}

@keyframes pl-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pl-btn.is-spinning svg {
  animation: pl-spin 0.35s ease;
}

/* --- Volume popover --- */

.pl-volume {
  display: flex;
  align-items: center;
}

.pl-vol-popover {
  position: fixed;
  z-index: 2000;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  transform: translateY(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 100px;
}

.pl-vol-popover.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.pl-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transform: rotate(-90deg);
}

.pl-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-accent);
  border: none;
  transition: background 0.15s;
}

.pl-vol-slider::-webkit-slider-thumb:hover {
  background: var(--text-dim);
}

.pl-vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-accent);
  border: none;
}

.pl-vol-slider::-moz-range-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  border: none;
}

/* --- Tracklist --- */

.tracklist {
  list-style: none;
  counter-reset: track;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.tracklist-item {
  counter-increment: track;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.tracklist-item:hover {
  background: var(--bg-raised);
}

.tracklist-item:last-child {
  border-radius: 0 0 10px 10px;
}

.tracklist-item.is-active {
  background: var(--bg-raised);
}

.tracklist-item::before {
  content: counter(track);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  min-width: 1.25em;
  text-align: right;
}

.tracklist-item.is-active::before {
  color: var(--accent);
}

.tracklist-play-hint {
  display: none;
  min-width: 1.25em;
  text-align: center;
  color: var(--text);
  line-height: 0;
}

.tracklist-item:hover::before {
  display: none;
}

.tracklist-item:hover .tracklist-play-hint {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tracklist-item.is-active:hover .tracklist-play-hint {
  color: var(--accent);
}

.tracklist-item.is-active:hover .tracklist-eq {
  display: none;
}

.tracklist-name {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.tracklist-fill {
  flex: 1;
  border-bottom: 1px solid var(--border);
  min-width: 1.5rem;
  position: relative;
  top: -0.2em;
}

.tracklist-artist {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 2;
  min-width: 0;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.tracklist-duration {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.tracklist-item.is-active .tracklist-name {
  color: var(--accent);
  font-weight: 500;
}

.tracklist-item.is-active .tracklist-artist,
.tracklist-item.is-active .tracklist-duration {
  color: var(--accent);
}

/* --- PiP mode --- */

.pl-container.is-pip {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1000;
  width: 360px;
  border: none;
  border-radius: 0;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: none;
}

.pl-container.is-pip .pl-video {
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.35rem;
}

.pl-container.is-pip .pl-controls {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  padding: 0.5rem 0.75rem;
  gap: 0.35rem;
  border-bottom-color: var(--border);
}

.pl-container.is-pip .pl-info.is-visible ~ .pl-progress-wrap ~ .pl-controls {
  border-radius: 0 0 10px 10px;
  border-top: none;
}

.pl-container.is-pip .pl-left {
  margin-left: -0.25rem;
}

.pl-container.is-pip .pl-right {
  margin-right: -0.25rem;
}

.pl-container.is-pip .pl-btn svg {
  width: 16px;
  height: 16px;
}

.pl-container.is-pip .pl-btn-play svg {
  width: 18px;
  height: 18px;
}

.pl-container.is-pip .pl-btn {
  padding: 0.25rem;
}

.pl-container.is-pip .pl-btn-play {
  padding: 0.3rem;
}

.pl-container.is-pip .pl-center {
  gap: 0.2rem;
}

.pl-container.is-pip .pl-info {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  background: var(--bg);
  border: none;
  border-radius: 10px 10px 0 0;
}

.pl-container.is-pip .pl-info.is-visible {
  max-height: none;
  overflow: visible;
  padding: 0.75rem 0.75rem 0;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
}

.pl-container.is-pip .pl-progress-wrap {
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  background: var(--bg);
  border: none;
}

.pl-container.is-pip .pl-progress-wrap.is-visible {
  max-height: none;
  overflow: visible;
  padding: 4px 0.75rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.pl-container.is-pip .pl-progress {
  border-radius: 3px;
}

.pl-container.is-pip .tracklist {
  display: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  margin-top: 0.35rem;
}

.pl-container.is-pip .tracklist.is-pip-open {
  display: flex;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.pl-container.is-pip .tracklist.is-pip-open::-webkit-scrollbar {
  width: 6px;
}

.pl-container.is-pip .tracklist.is-pip-open::-webkit-scrollbar-track {
  background: transparent;
}

.pl-container.is-pip .tracklist.is-pip-open::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.pl-container.is-pip .tracklist.is-pip-open::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.pl-container.is-pip .tracklist-item {
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
}

.pl-container.is-pip .tracklist-name {
  font-size: 0.75rem;
}

.pl-container.is-pip .tracklist-artist {
  font-size: 0.65rem;
}

.pl-container.is-pip .tracklist-duration {
  font-size: 0.65rem;
}

.pl-container.is-pip .tracklist-item::before {
  font-size: 0.65rem;
  min-width: 1em;
}

.pl-container.is-pip .tracklist-item:first-child,
.pl-container.is-pip .tracklist-item:last-child {
  border-radius: 0;
}

.pl-container.is-pip .tracklist-item:only-child {
  border-radius: 10px;
}

/* --- Back link --- */

.back-link {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--accent);
}

@media (max-width: 600px) {
  .listening-post { padding: 1.5rem 1rem 3.5rem; }
  .listening-post h1 { font-size: 1.3rem; }
  .pl-controls { padding: 0.6rem 0.75rem; }
  .pl-volume { display: none; }

  .pl-container.is-pip {
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}
