/*
 * Dhangaa Torbanii — THE PROGRAMS INSTRUMENTS (Wave 10)
 * One archive, three views: the view switcher, the dense TABLE with
 * thumbnails, and the TIMELINE — the archive spine as a traveling
 * instrument. Plus the card play affordance (pcard-playbtn) shared by
 * every program card surface. Motion honors reduced-motion; every
 * surface rides the same dark archive palette + corner-anchor grammar.
 */

/* ---------------- the view switcher ---------------- */
.pv-switch {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(6, 17, 12, 0.7);
  border: 1px solid rgba(138, 200, 160, 0.22);
  margin-bottom: 18px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.pv-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid transparent;
  background: none; color: rgba(216, 238, 224, 0.8);
  font: 650 12px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.24s ease;
}
.pv-btn svg { width: 14px; height: 14px; }
.pv-btn:hover { color: #fff; background: rgba(138, 200, 160, 0.08); }
.pv-btn.is-on {
  color: #06110c;
  background: linear-gradient(135deg, #9fd4b2, #7dbb96);
  border-color: rgba(138, 200, 160, 0.7);
  box-shadow: 0 6px 18px -6px rgba(138, 200, 160, 0.5);
}
.pv-btn:focus-visible { outline: 2px solid #8ac8a0; outline-offset: 2px; }

/* ---------------- the card play affordance ---------------- */
.pcard { position: relative; height: 100%; }
.pcard > a { height: 100%; }
.pcard-playbtn {
  position: absolute; right: 14px; bottom: 14px;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(224, 133, 133, 0.55);
  background: rgba(8, 16, 12, 0.88);
  color: #ffd9d9;
  cursor: pointer; z-index: 3;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), inset 0 0 14px rgba(224, 133, 133, 0.08);
  opacity: 0; transform: translateY(6px) scale(0.9);
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.22, 1.15, 0.32, 1), background 0.2s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.pcard-playbtn svg { width: 15px; height: 15px; margin-left: 2px; }
.pcard:hover .pcard-playbtn, .pcard-playbtn:focus-visible {
  opacity: 1; transform: translateY(0) scale(1);
}
.pcard-playbtn:hover { background: rgba(224, 133, 133, 0.24); }
.pcard-playbtn:active { transform: scale(0.92); }
.pcard-playbtn:focus-visible { outline: 2px solid #e08585; outline-offset: 2px; }
@media (hover: none) {
  .pcard-playbtn { opacity: 1; transform: none; width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .pcard-playbtn { transition: opacity 0.15s ease; transform: none; }
}

/* ---------------- THE TABLE ---------------- */
.ptv-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.ptv-filter {
  flex: 1; min-width: 220px; max-width: 380px;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid rgba(138, 200, 160, 0.28);
  background: rgba(6, 17, 12, 0.7); color: #e7f5ec;
  font-size: 13px; outline: none;
  transition: border-color 0.2s ease;
}
.ptv-filter:focus { border-color: rgba(138, 200, 160, 0.6); }
.ptv-count { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(169, 216, 187, 0.8); }
/* ---------------- FULL-BLEED INSTRUMENTS (Wave 11, owner direction) ----
 * The Table and Timeline are NOT boxed cards — they break the page column
 * edge-to-edge: content separation comes from THIN DIGITAL LINES (hairline
 * gradients with a slow traveling scan) and edge fade masks, never borders
 * or boxes. The instrument reads as etched into the page. */
[data-pv-panel="table"],
[data-pv-panel="timeline"] {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-left: max(16px, calc(50vw - 37rem));
  padding-right: max(16px, calc(50vw - 37rem));
}
/* the thin digital separator — one grammar for both instruments */
.dline {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138, 200, 160, 0.35) 12%, rgba(138, 200, 160, 0.35) 88%, transparent);
  overflow: visible;
}
.dline::after {
  content: '';
  position: absolute; top: -1px; left: 0; height: 3px; width: 90px;
  background: linear-gradient(90deg, transparent, rgba(138, 200, 160, 0.85), transparent);
  animation: dline-scan 5.5s linear infinite;
  pointer-events: none;
}
@keyframes dline-scan { 0% { transform: translateX(-100px); } 100% { transform: translateX(100vw); } }
@media (prefers-reduced-motion: reduce) { .dline::after { animation: none; opacity: 0; } }

.ptv-table {
  background: none;
  border: 0;
  border-radius: 0;
  overflow: visible;
}
.ptv-row {
  display: grid;
  grid-template-columns: 84px 1fr 118px 74px 52px;
  align-items: center; gap: 12px;
  padding: 9px 14px;
  border-bottom: 0;
  background-image: linear-gradient(90deg, transparent, rgba(138, 200, 160, 0.14) 18%, rgba(138, 200, 160, 0.14) 82%, transparent);
  background-size: 100% 1px;
  background-position: bottom;
  background-repeat: no-repeat;
  text-decoration: none; color: #e7f5ec;
  opacity: 0; animation: ptv-in 0.4s ease forwards;
  animation-delay: calc(var(--ptv-i, 0) * 18ms);
  transition: background-color 0.16s ease;
}
@keyframes ptv-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ptv-row { animation: none; opacity: 1; } }
.ptv-row:last-child { background-image: none; }
.ptv-row:not(.ptv-head):hover { background: rgba(138, 200, 160, 0.06); }
.ptv-row.ptv-head {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(180deg, rgb(6 15 11 / 0.98), rgb(6 15 11 / 0.92));
  border-bottom: 0;
  animation: none; opacity: 1;
  font: 650 10.5px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(169, 216, 187, 0.9);
  padding-top: 11px; padding-bottom: 11px;
  box-shadow: 0 1px 0 rgba(138, 200, 160, 0.28), 0 8px 18px -12px rgb(3 9 6 / 0.9);
}
.ptv-head button {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0; color: inherit; font: inherit;
  cursor: pointer; padding: 0; letter-spacing: inherit; text-transform: inherit;
}
.ptv-head button:hover { color: #fff; }
.ptv-head button i { font-style: normal; font-size: 10px; }
.ptv-c { min-width: 0; }
.ptv-c-thumb img {
  width: 84px; height: 47px; object-fit: cover; display: block;
  border-radius: 7px; background: #06110c;
  border: 1px solid rgba(138, 200, 160, 0.14);
  transition: border-color 0.2s ease, transform 0.24s ease;
}
.ptv-row:hover .ptv-c-thumb img { border-color: rgba(138, 200, 160, 0.45); }
.ptv-c-title { text-decoration: none; }
.ptv-c-title b {
  display: block; font-size: 13.5px; font-weight: 600; color: #f0f7f2; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.18s ease;
}
.ptv-row:hover .ptv-c-title b { color: #fff; }
.ptv-c-title i {
  display: block; font-style: normal; font-size: 11px; color: rgba(196, 222, 206, 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.ptv-c-date, .ptv-c-dur {
  font-size: 12px; color: rgba(196, 222, 206, 0.78);
  font-variant-numeric: tabular-nums;
}
.ptv-play {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(224, 133, 133, 0.45);
  background: rgba(224, 133, 133, 0.1); color: #ffd9d9;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.16s ease, border-color 0.18s ease;
}
.ptv-play svg { width: 13px; height: 13px; margin-left: 1px; }
.ptv-play:hover { background: rgba(224, 133, 133, 0.24); border-color: rgba(224, 133, 133, 0.7); }
.ptv-play:active { transform: scale(0.92); }
@media (max-width: 640px) {
  .ptv-row { grid-template-columns: 64px 1fr 44px; padding: 9px 10px; gap: 9px; }
  .ptv-row .ptv-c-date, .ptv-row .ptv-c-dur { display: none; }
  .ptv-head .ptv-c[data-sort] { display: none; }
  .ptv-c-thumb img { width: 64px; height: 36px; }
}

/* ---------------- THE TIMELINE — the archive spine ---------------- */
.ptl-hint { font-size: 12px; color: rgba(196, 222, 206, 0.6); margin-bottom: 12px; }
.ptl-scope {
  position: relative;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(20, 58, 42, 0.18), transparent 55%);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  /* the spine floats edge-to-edge with digital hairlines above and below;
     the far edges fade — the archive continues beyond the screen */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 34px, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 34px, #000 calc(100% - 34px), transparent);
}
.ptl-spine {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 46px 22px 16px;
  min-width: min-content;
  position: relative;
}
.ptl-spine::before {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 52px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138, 200, 160, 0.4) 6%, rgba(138, 200, 160, 0.4) 94%, transparent);
}
.ptl-node {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  width: 46px; flex: none;
  background: none; border: 0; padding: 0;
  cursor: pointer;
  color: #cfe4d6;
  opacity: 0; animation: ptv-in 0.5s ease forwards;
  animation-delay: calc(var(--ptl-i, 0) * 22ms);
}
@media (prefers-reduced-motion: reduce) { .ptl-node { animation: none; opacity: 1; } }
.ptl-year {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  font: 700 13px/1 ui-sans-serif, system-ui, sans-serif;
  color: rgba(169, 216, 187, 0.95);
  letter-spacing: 0.06em;
}
.ptl-year-blank { opacity: 0; pointer-events: none; }
.ptl-bar {
  width: 14px; height: calc(var(--ptv-h, 30) * 0.66px);
  min-height: 8px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(138, 200, 160, 0.85), rgba(138, 200, 160, 0.25));
  box-shadow: inset 0 0 6px rgba(138, 200, 160, 0.25);
  transition: transform 0.22s cubic-bezier(0.22, 1.15, 0.32, 1), box-shadow 0.22s ease, background 0.22s ease;
  transform-origin: bottom;
}
.ptl-node:hover .ptl-bar {
  transform: scaleY(1.12);
  background: linear-gradient(180deg, rgba(138, 200, 160, 1), rgba(138, 200, 160, 0.4));
  box-shadow: 0 0 14px rgba(138, 200, 160, 0.4);
}
.ptl-node.is-live .ptl-bar {
  background: linear-gradient(180deg, #e08585, rgba(224, 133, 133, 0.35));
  box-shadow: 0 0 16px rgba(224, 133, 133, 0.5);
  animation: ptl-live 1.8s ease-in-out infinite;
}
@keyframes ptl-live { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.14); } }
@media (prefers-reduced-motion: reduce) { .ptl-node.is-live .ptl-bar { animation: none; } }
.ptl-dot {
  position: relative;
  width: 9px; height: 9px; border-radius: 50%;
  background: #0a1f16;
  border: 1.6px solid rgba(138, 200, 160, 0.8);
  margin: 4px 0 6px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.ptl-node:hover .ptl-dot { transform: scale(1.35); border-color: #8ac8a0; }
.ptl-node.is-live .ptl-dot { border-color: #e08585; background: rgba(224, 133, 133, 0.35); }
.ptl-dot i {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  font: 700 9px/1 ui-sans-serif, system-ui, sans-serif; font-style: normal;
  color: rgba(216, 238, 224, 0.85);
  background: rgba(4, 12, 8, 0.85);
  border: 1px solid rgba(138, 200, 160, 0.25);
  border-radius: 5px; padding: 2px 4px;
  opacity: 0; transition: opacity 0.16s ease;
  pointer-events: none;
}
.ptl-node:hover .ptl-dot i { opacity: 1; }
.ptl-m {
  font: 600 9.5px/1.1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: rgba(196, 222, 206, 0.65);
}
/* THE MONTH DETAIL CARD — springs up above the spine's month */
.ptl-detail {
  position: relative;
  margin-top: 14px;
  border: 1px solid rgba(138, 200, 160, 0.24);
  border-radius: 16px;
  background: rgba(8, 18, 13, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: ptl-detail-in 0.34s cubic-bezier(0.22, 1.15, 0.32, 1);
}
.ptl-detail[hidden] { display: none; }
@keyframes ptl-detail-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ptl-detail { animation: none; } }
.ptl-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(138, 200, 160, 0.35);
  background: rgba(6, 17, 12, 0.85); color: #cfe4d6;
  cursor: pointer;
}
.ptl-close svg { width: 13px; height: 13px; }
.ptl-detail-inner { padding: 16px 16px 14px; max-height: 46vh; overflow-y: auto; scrollbar-width: thin; }
.ptl-detail-h {
  font: 700 14px/1.2 ui-sans-serif, system-ui, sans-serif;
  color: #f0f7f2; margin: 0 40px 10px 2px;
  display: flex; align-items: baseline; gap: 8px;
}
.ptl-detail-h i {
  font: 600 10.5px/1 ui-sans-serif, system-ui, sans-serif; font-style: normal;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(169, 216, 187, 0.85);
  padding: 3px 8px; border-radius: 999px;
  background: rgba(138, 200, 160, 0.12);
  border: 1px solid rgba(138, 200, 160, 0.25);
}
.ptl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 8px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.ptl-row:hover { background: rgba(138, 200, 160, 0.06); border-color: rgba(138, 200, 160, 0.18); }
.ptl-row.is-live { border-color: rgba(224, 133, 133, 0.45); background: rgba(224, 133, 133, 0.06); }
.ptl-row img {
  width: 88px; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 8px; display: block; flex: none;
  background: #06110c; border: 1px solid rgba(138, 200, 160, 0.16);
}
.ptl-row-b { flex: 1; min-width: 0; }
.ptl-row-b b {
  display: block; font-size: 12.5px; font-weight: 600; color: #f0f7f2; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ptl-row-b i { font-style: normal; font-size: 10.5px; color: rgba(196, 222, 206, 0.6); font-variant-numeric: tabular-nums; }
.ptl-row-a { display: flex; align-items: center; gap: 7px; flex: none; }
.ptl-row .ptl-play { width: 36px; height: 36px; }
.ptl-open {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(138, 200, 160, 0.4);
  background: rgba(138, 200, 160, 0.1); color: #cfe4d6;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.ptl-open svg { width: 13px; height: 13px; }
.ptl-open:hover { background: rgba(138, 200, 160, 0.22); border-color: rgba(138, 200, 160, 0.6); color: #fff; }

/* ---------------- THE ERA CHIPS (Wave 11 timeline drill) ----------------
 * Years as travel chips above the spine — tap to glide to an era; the
 * active era lights while you travel. */
.ptl-eras {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 0 10px;
  overflow-x: auto; scrollbar-width: none;
}
.ptl-eras::-webkit-scrollbar { display: none; }
.ptl-era {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 0; border-radius: 999px;
  background: rgba(138, 200, 160, 0.07);
  box-shadow: inset 0 0 0 1px rgba(138, 200, 160, 0.22);
  color: rgba(216, 238, 224, 0.82);
  font: 650 12px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.24s ease, transform 0.18s ease;
}
.ptl-era i { font-style: normal; font-size: 9px; opacity: 0.65; letter-spacing: 0.06em; }
.ptl-era:hover { background: rgba(138, 200, 160, 0.14); color: #fff; transform: translateY(-1px); }
.ptl-era:active { transform: scale(0.96); }
.ptl-era.is-active {
  background: linear-gradient(135deg, rgba(138, 200, 160, 0.28), rgba(138, 200, 160, 0.12));
  box-shadow: inset 0 0 0 1px rgba(138, 200, 160, 0.65), 0 6px 20px -8px rgba(138, 200, 160, 0.45);
  color: #fff;
}
@media (prefers-reduced-motion: reduce) { .ptl-era { transition: none; transform: none; } }

/* ---------------- THE ARCHIVE'S PULSE (Wave 15 heat glow) ----------------
 * Month nodes glow by real listening heat — the community's last 14 days
 * of position samples. The warmth rides the bar and the dot; honest
 * zeros stay dark. */
.ptl-node.is-hot .ptl-bar {
  background:
    linear-gradient(180deg, rgba(224, 133, 133, calc(0.25 + var(--ptl-heat, 0) * 0.75)), rgba(224, 133, 133, calc(0.08 + var(--ptl-heat, 0) * 0.3))),
    linear-gradient(180deg, rgba(138, 200, 160, 0.85), rgba(138, 200, 160, 0.25));
  box-shadow: 0 0 calc(6px + var(--ptl-heat, 0) * 14px) rgba(224, 133, 133, calc(0.2 + var(--ptl-heat, 0) * 0.5));
}
.ptl-node.is-hot .ptl-dot {
  border-color: rgba(224, 133, 133, calc(0.5 + var(--ptl-heat, 0) * 0.5));
  box-shadow: 0 0 calc(4px + var(--ptl-heat, 0) * 10px) rgba(224, 133, 133, calc(0.25 + var(--ptl-heat, 0) * 0.55));
}
.ptl-node.is-hot::after {
  content: '';
  position: absolute; left: 50%; top: 8px;
  width: 2px; height: calc(var(--ptl-heat, 0) * 14px + 2px);
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(224, 133, 133, 0.0), rgba(224, 133, 133, calc(0.2 + var(--ptl-heat, 0) * 0.7)));
  pointer-events: none;
}
