@layer surfaces {

/* ============================================================================
   Song audio dock v2 (editor-v2 milestone 2): waveform + proportional section
   bar + one continuous playhead, transport gutter on the right. The base
   .editor-track-dock rules above still provide stickiness/panel chrome; --v2
   switches the layout to a column and hides the native player controls (the
   persistent <audio> element stays in the DOM — playback state lives on it).
   ========================================================================= */
.editor-track-dock--v2 {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.375rem;
  padding: 0.5rem 0.625rem 0.375rem;
}

.editor-track-dock--v2 .document-binder-asset-player {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}

.editor-track-dock-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.editor-track-dock-label {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--c-gray-400);
}

.editor-track-dock-spacer {
  flex: 1;
}

.editor-track-dock-time {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-gray-500);
  white-space: nowrap;
}

.editor-track-dock-body {
  display: flex;
  align-items: stretch;
  gap: 0.625rem;
}

.editor-track-dock-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.editor-track-dock-wavewrap {
  position: relative;
  height: 6.5rem;
}

.editor-track-dock--v2 .editor-track-dock-wave {
  width: 100%;
  height: 100%;
  flex: none;
}

.editor-track-dock-cues {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Cue markers: plain color-coded vertical lines, a hair thicker than the playhead. The
   color carries the cue's derived kind — section starts read accent (structural, like the
   bar), line cues green (the follow lens), orphans gray (their line is gone). */
.editor-track-dock-cueline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  padding: 0;
  border: 0;
  background: color-mix(in srgb, var(--c-success) 55%, transparent);
  cursor: pointer;
  pointer-events: auto;
}

.editor-track-dock-cueline:hover,
.editor-track-dock-cueline[data-active="true"] {
  background: var(--c-success);
}

.editor-track-dock-cueline[data-cue-kind="section"] {
  background: color-mix(in srgb, var(--c-accent) 55%, transparent);
}

.editor-track-dock-cueline[data-cue-kind="section"]:hover,
.editor-track-dock-cueline[data-cue-kind="section"][data-active="true"] {
  background: var(--c-accent);
}

.editor-track-dock-cueline[data-cue-kind="orphan"] {
  background: var(--c-gray-300);
}

/* Provenance drift: the timing was taken against a version other than the loaded one.
   The mark goes stitched (dashed) in its kind color — present, but visibly provisional. */
.editor-track-dock-cueline[data-version-drift="true"] {
  width: 0;
  background: none;
  border-left: 3px dashed color-mix(in srgb, var(--c-success) 55%, transparent);
}

.editor-track-dock-cueline[data-version-drift="true"]:hover,
.editor-track-dock-cueline[data-version-drift="true"][data-active="true"] {
  border-left-color: var(--c-success);
  background: none;
}

.editor-track-dock-cueline[data-cue-kind="section"][data-version-drift="true"] {
  border-left-color: color-mix(in srgb, var(--c-accent) 55%, transparent);
}

.editor-track-dock-cueline[data-cue-kind="section"][data-version-drift="true"]:hover,
.editor-track-dock-cueline[data-cue-kind="section"][data-version-drift="true"][data-active="true"] {
  border-left-color: var(--c-accent);
  background: none;
}

.editor-track-dock-sections {
  display: flex;
  align-items: stretch;
  height: 2.375rem;
  border-top: 1px solid var(--c-gray-200);
}

.editor-track-dock-section {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0 0.375rem;
  border: 0;
  border-right: 1px solid var(--c-gray-200);
  background: none;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--c-gray-500);
  cursor: pointer;
}

.editor-track-dock-section:last-child {
  border-right: 0;
}

.editor-track-dock-section:hover {
  background: var(--c-gray-100);
}

.editor-track-dock-section[data-active="true"] {
  background: var(--c-accent-100);
  color: var(--c-accent);
}

.editor-track-dock-section[data-untimed="true"] .editor-track-dock-section-title {
  opacity: 0.6;
}

/* Timed, but against another version — the dashed underline says "provisional". */
.editor-track-dock-section[data-version-drift="true"] .editor-track-dock-section-title {
  text-decoration: underline dashed 1px;
  text-underline-offset: 2px;
  text-decoration-color: var(--c-warning-400);
}

.editor-track-dock-section-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-track-dock-setstart {
  display: none;
  flex: none;
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--c-accent);
  border: 1px solid var(--c-accent-200);
  border-radius: 999px;
  padding: 0.0625rem 0.375rem;
  background: var(--c-accent-50);
}

.editor-track-dock--v2[data-playing="true"] .editor-track-dock-setstart {
  display: inline-block;
}

.editor-track-dock-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: var(--c-gray-900);
  pointer-events: none;
  z-index: 1;
}

.editor-track-dock-gutter {
  flex: 0 0 3.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-left: 1px solid var(--c-gray-200);
  padding: 0.375rem 0 0.25rem 0.625rem;
}

.editor-track-dock-playpause {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  border: 0;
  background: var(--c-ink);
  color: var(--c-white);
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.editor-track-dock-skips {
  display: flex;
  gap: 0.25rem;
}

.editor-track-dock-skip {
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--c-gray-500);
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
}

.editor-track-dock-skip:hover {
  color: var(--c-gray-900);
  background: var(--c-gray-100);
}

/* Song docs as audio dropzones: the hint strip is the dock's empty state — same slot
   (first child of the canvas column), quiet until a track exists or a drag approaches. */
.editor-song-audio-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--c-gray-400);
  border: 1px dashed var(--c-gray-200);
  border-radius: 8px;
}

.editor-song-audio-hint[data-state="error"] {
  color: var(--c-danger);
  border-color: color-mix(in srgb, var(--c-danger) 40%, transparent);
}

.editor-song-audio-hint[data-state="busy"] {
  color: var(--c-gray-600);
}

.editor-song-audio-hint-show {
  border: 0;
  padding: 0.125rem 0.5rem;
  border-radius: 6px;
  background: var(--c-gray-100);
  color: var(--c-gray-700);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.editor-song-audio-hint-show:hover {
  background: var(--c-gray-200);
  color: var(--c-gray-900);
}

/* The drag-over overlay: whole-surface invitation, visual only (pointer-events: none keeps
   the drag events landing on the surface underneath). */
.editor-song-dropzone {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 40;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-ink);
  background: color-mix(in srgb, var(--c-white) 82%, transparent);
  border: 2px dashed var(--c-accent);
  border-radius: 10px;
  pointer-events: none;
}

.editor-surface[data-song-drag="true"] .editor-song-dropzone {
  display: flex;
}

/* Margin audio group: time-coded cards for the docked track (cues + open version notes).
   The card the playhead last crossed reads active; clicking seeks. */
.editor-cues-empty {
  font-size: 0.8125rem;
  color: var(--c-gray-500);
  padding-top: 0.25rem;
}

.editor-margin-audio {
  display: grid;
  gap: 0.375rem;
}

.editor-margin-audio-title {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--c-gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-margin-audio-card {
  display: flex;
  align-items: baseline;
  border-left: 2px solid var(--c-accent-200);
  border-radius: 0 6px 6px 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--c-gray-700);
}

/* The edge color carries the cue's derived kind, matching its waveform line. */
.editor-margin-audio-card[data-cue-kind="line"] { border-left-color: var(--c-success-200); }
.editor-margin-audio-card[data-cue-kind="orphan"] { border-left-color: var(--c-gray-300); }

.editor-margin-audio-seek {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  text-align: left;
  border: 0;
  background: none;
  padding: 0.25rem 0.375rem 0.25rem 0.625rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.editor-margin-audio-card:hover {
  background: var(--c-gray-100);
}

.editor-margin-audio-card[data-active="true"] {
  background: var(--c-accent-50);
  border-left-color: var(--c-accent);
}

.editor-margin-audio-card[data-cue-kind="section"] .editor-margin-audio-text {
  font-weight: 600;
  color: var(--c-gray-800);
}

.editor-margin-audio-card[data-orphan="true"] .editor-margin-audio-text {
  color: var(--c-gray-400);
  font-style: italic;
}

.editor-margin-audio-remove {
  flex: none;
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--c-gray-400);
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.editor-margin-audio-card:hover .editor-margin-audio-remove,
.editor-margin-audio-remove:focus-visible {
  opacity: 1;
}

.editor-margin-audio-remove:hover {
  color: var(--c-danger);
  background: var(--c-gray-100);
}

.editor-margin-audio-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--c-accent);
}

.editor-margin-audio-text {
  min-width: 0;
}

.editor-margin-audio-version {
  font-size: 0.625rem;
  color: var(--c-gray-400);
  white-space: nowrap;
}

/* Provenance drift on a cue card: a quiet fact — this timing belongs to another version.
   Re-cueing the line while the loaded version plays re-takes it and clears the tag. */
.editor-margin-audio-provenance {
  font-size: 0.625rem;
  font-style: italic;
  color: var(--c-warning);
  white-space: nowrap;
}

}
