/* Song DNA light table (dna-light-table.js). Loaded after nordic.css.
   Chrome stays nordic ink; colour is data — each song's own palette:
   --dna-night (flood) and --c per tile (emotion / theme / symbol accent). */

html[data-theme="nordic"] .dna-lamp.is-light-table {
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-nested);
  background: var(--nordic-surface);
}

/* One stacking context for the whole table so layers interleave:
   tile surface < flood < dot canvas < labels < threads < read-out. */
html[data-theme="nordic"] .dna-lamp.is-light-table .dna-lamp-grid { z-index: auto; }
html[data-theme="nordic"] .dna-lamp.is-light-table .dna-lamp-spot {
  display: block;
  z-index: 2;
  opacity: 1;
  background: none;
}

html[data-theme="nordic"] .is-light-table .dna-lamp-tile {
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini);
  background: var(--nordic-surface);
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.35s ease, opacity 0.35s ease;
}
html[data-theme="nordic"] .is-light-table .dna-lamp-tile:focus-visible {
  outline: 2px solid var(--glass-ink);
  outline-offset: 1px;
}

/* 01 develop: the tile floods with the song's night from the entry point. */
.dna-lamp-flood {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: var(--dna-night, #0b1220);
  clip-path: circle(0 at var(--ox, 50%) var(--oy, 50%));
  transition: clip-path 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.dna-lamp-tile.is-lit .dna-lamp-flood,
.dna-lamp-tile.is-open .dna-lamp-flood {
  clip-path: circle(150% at var(--ox, 50%) var(--oy, 50%));
}
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-lit,
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-open {
  border-color: var(--dna-night, #0b1220);
}

html[data-theme="nordic"] .is-light-table .dna-lamp-kind,
html[data-theme="nordic"] .is-light-table .dna-lamp-tile em {
  z-index: 3;
  opacity: 1;
  transition: color 0.3s ease, opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
}
html[data-theme="nordic"] .is-light-table .dna-lamp-kind { color: var(--glass-label); }
html[data-theme="nordic"] .is-light-table .dna-lamp-tile em { color: var(--glass-body); }
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-lit .dna-lamp-kind,
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-open .dna-lamp-kind,
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-linked .dna-lamp-kind { color: var(--c); }
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-lit em { color: #ffffff; }

/* 03 threads: the chain stays readable, everything else steps back. */
html[data-theme="nordic"] .is-light-table.has-open .dna-lamp-tile:not(.is-open):not(.is-linked):not(.is-lit) { opacity: 0.32; }
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-linked:not(.is-lit) {
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 6%, var(--nordic-surface));
}
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-linked:not(.is-lit) em { color: var(--glass-ink); }

.dna-lamp-links {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.dna-lamp-links path { fill: none; stroke-linecap: round; }
.dna-lamp-links .halo { stroke-width: 7; opacity: 0.1; }
.dna-lamp-links .base {
  stroke-width: 1.25;
  opacity: 0.6;
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  animation: dna-thread-draw 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.dna-lamp-links .flow {
  stroke-width: 2.2;
  stroke-dasharray: 0.01 11;
  opacity: 0;
  animation: dna-thread-flow 1.1s linear infinite, dna-thread-fade 0.3s 0.55s forwards;
}
.dna-lamp-links .node {
  fill: var(--nordic-surface, #ffffff);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: dna-thread-pop 0.35s 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.dna-lamp-links .hub { stroke: #ffffff; stroke-width: 1.5; }
.dna-lamp-links .pulse {
  fill: none;
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: dna-thread-pulse 1.8s ease-out infinite;
}
@keyframes dna-thread-draw { to { stroke-dashoffset: 0; } }
@keyframes dna-thread-flow { to { stroke-dashoffset: -11.01; } }
@keyframes dna-thread-fade { to { opacity: 1; } }
@keyframes dna-thread-pop { from { transform: scale(0); } }
@keyframes dna-thread-pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(3.4); opacity: 0; }
}

/* 02 lyric tokens: the open tile's label dissolves; its lyric line rises
   out of the label strip letter by letter and stays with the threads. */
.dna-lamp-quote {
  position: absolute;
  left: 10px;
  right: 8px;
  top: 24px;
  z-index: 3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  pointer-events: none;
}
.dna-lamp-word { display: inline-block; white-space: nowrap; }
.dna-lamp-token {
  display: inline-block;
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s ease;
}
.dna-lamp-tile.is-open.has-quote .dna-lamp-token { opacity: 1; transform: none !important; }
.dna-lamp-tile:not(.is-open.has-quote) .dna-lamp-quote { visibility: hidden; }
html[data-theme="nordic"] .is-light-table .dna-lamp-tile.is-open.has-quote em {
  opacity: 0;
  transform: translateY(-6px);
  filter: blur(4px);
}

html[data-theme="nordic"] .is-light-table .dna-lamp-read { z-index: 5; }
html[data-theme="nordic"] .is-light-table .dna-lamp-read-meta { color: var(--glass-label); }
html[data-theme="nordic"] .is-light-table .dna-lamp-read-quote { color: var(--glass-ink); }

@media (prefers-reduced-motion: reduce) {
  .dna-lamp-flood,
  .dna-lamp-token { transition: none; }
  .dna-lamp-links .base { animation: none; stroke-dashoffset: 0; }
  .dna-lamp-links .flow { animation: none; opacity: 1; }
  .dna-lamp-links .pulse { display: none; }
  .dna-lamp-links .node { animation: none; }
}
