/* ==========================================================================
   2.1 OPTICAL WORK CONSOLE
   The player is the centerpiece. Discs are records; tracks are evidence.
   No outer box around the hardware.
   ========================================================================== */

#work > .work-console {
  position: relative;
  z-index: 1;
}

#work .work-console {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(390px, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  margin-top: 24px;
  contain: layout style;
}

#work .work-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  contain: layout style; /* Layout containment only: preserves 104% width on radial glow */
}

#work .work-stage::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 6%;
  width: 104%;
  aspect-ratio: 1.25;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse at 50% 48%,
    rgba(255, 77, 90, 0.09),
    rgba(255, 255, 255, 0.022) 38%,
    transparent 74%
  );
}

#work .work-stage-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  margin: 0;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#work .work-stage-head b {
  color: var(--accent);
  font-weight: 700;
}

#work .work-player {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 8px 0 0;
  isolation: isolate;
  contain: layout style;
}

#work .work-player::before {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 1%;
  height: 13%;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 45%,
    rgba(0, 0, 0, 0.55),
    rgba(0, 0, 0, 0.22) 42%,
    transparent 72%
  );
}

#work .work-player .cdp {
  width: 100%;
  max-width: 100%;
}

#work .work-player:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 8px;
}


#work .work-player.is-swapping::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 77, 90, 0.14), transparent 54%);
  animation: work-disc-flash 0.9s ease-out;
}

@keyframes work-disc-flash {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.05);
  }
}

#work .work-record-rail {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(4px, 0.8vw, 12px);
  width: 100%;
  min-height: 96px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}

#work .work-record-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.35;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

#work .work-record-btn:hover {
  color: var(--fg);
}

#work .work-record-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

#work .work-record-disc {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  contain: strict;
  transform: translateZ(0);
  backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

#work .work-record-disc svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#work .work-record-btn.active .work-record-disc {
  transform: scale(1.08) rotate(12deg);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(255, 77, 90, 0.42),
    0 0 22px rgba(255, 77, 90, 0.16);
}

#work .work-record-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#work .work-record-id {
  color: var(--accent);
  font-size: 8px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

#work .work-record-name {
  display: -webkit-box;
  overflow: hidden;
  color: inherit;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.12;
  white-space: normal;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#work .work-record-btn.active .work-record-name {
  color: var(--fg);
}

#work .work-record-year {
  color: var(--muted);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  opacity: 0.7;
  white-space: nowrap;
}

#work .work-readout {
  --work-gutter: clamp(24px, 3vw, 42px);
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 0 0 var(--work-gutter);
  border-top: 0;
  border-left: 1px solid var(--border);
  contain: layout style;
}

#work .work-readout.is-updating {
  animation: work-readout-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes work-readout-in {
  from {
    opacity: 0.35;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#work .work-readout-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-left: calc(-1 * var(--work-gutter));
  padding: 0 0 12px var(--work-gutter);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#work .work-readout-top b {
  color: var(--accent);
  font-weight: 700;
}

#work .work-readout-top > span:nth-child(2) {
  margin-left: auto;
}

#work .work-readout-body {
  display: block;
  margin-top: 30px;
}

#work .work-identity {
  min-width: 0;
}

#work .work-year {
  margin: 0 0 6px;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(3.8rem, 5.8vw, 6.2rem);
  line-height: 0.74;
  letter-spacing: -0.055em;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.15);
}

#work .work-role {
  max-width: 15ch;
  margin: 0;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 2.55vw, 2.9rem);
  line-height: 0.94;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  text-wrap: balance;
}

#work .work-org,
#work .work-dates {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#work .work-org {
  color: var(--accent);
}

#work .work-desc {
  max-width: 42ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-family: var(--font-spec-body, var(--font-body, inherit));
  font-size: 13px;
  line-height: 1.7;
}

#work .work-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 18px 0 0 calc(-1 * var(--work-gutter));
  padding: 0;
  border-top: 1px solid var(--border);
}

#work .work-stats > div {
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
}

#work .work-stats > div:nth-child(odd) {
  padding-left: var(--work-gutter);
  border-right: 1px solid var(--border);
}

#work .work-stats > div:nth-child(even) {
  padding-right: 0;
}

#work .work-stats dt {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#work .work-stats dd {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#work .work-cue {
  margin: 18px 0 0 calc(-1 * var(--work-gutter));
  padding: 12px 0 0 var(--work-gutter);
  border-top: 1px solid var(--border);
}

#work .work-cue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#work .work-cue-head span:last-child {
  color: var(--accent);
  font-size: 8px;
}

#work .work-cue-list {
  margin: 6px 0 0 calc(-1 * var(--work-gutter));
  padding: 0;
  list-style: none;
}

#work .work-cue-btn {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 25px;
  padding: 4px 0 4px var(--work-gutter);
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

#work .work-cue-btn:hover {
  color: var(--fg);
}

#work .work-cue-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

#work .work-cue-btn.is-active {
  color: var(--fg);
  background: rgba(255, 77, 90, 0.035);
  box-shadow: inset 2px 0 var(--accent);
}

#work .work-cue-no {
  color: var(--accent);
  font-size: 8px;
}

#work .work-cue-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#work .work-cue-time {
  color: var(--muted);
  font-size: 8px;
  opacity: 0.75;
}

#work .work-evidence {
  margin-top: 18px;
  padding: 16px 18px;
  border-left: 2px solid var(--accent);
  background: rgba(255, 77, 90, 0.035);
}

#work .work-evidence-label {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#work .work-proof {
  display: grid;
  gap: 7px;
  margin: 11px 0 0;
  padding: 0;
}

#work .work-proof > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

#work .work-proof dt {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#work .work-proof dd {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

#work .work-readout-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 0 calc(-1 * var(--work-gutter));
  padding: 14px 0 0 var(--work-gutter);
  border-top: 1px solid var(--border);
}

#work .work-dossier {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

#work .work-dossier:hover {
  color: var(--fg);
}

#work .work-barcode-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#work .work-barcode {
  display: inline-block;
  width: 74px;
  height: 17px;
  background-image: repeating-linear-gradient(
    90deg,
    currentColor 0 1px,
    transparent 1px 3px,
    currentColor 3px 5px,
    transparent 5px 7px
  );
  opacity: 0.45;
}

/* Keep the room quiet around the work. The atmosphere slot accepts a future
   image via --work-atmosphere-image; until then it renders only a faint edge
   dither, never a competing illustration. */
#work .archive-backdrop {
  --work-atmosphere-image: none;
  background:
    radial-gradient(ellipse at 22% 43%, rgba(226, 235, 225, 0.055), transparent 48%),
    #07080b;
  box-shadow: inset 0 0 180px 50px rgba(0, 0, 0, 0.55);
}

#work .archive-grid {
  opacity: 0.38;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 15%, transparent 85%, #000 100%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 15%, transparent 85%, #000 100%);
}

#work .archive-dither {
  opacity: 0.07;
}

#work .archive-hatch {
  opacity: 0.08;
}

#work .archive-big-index {
  opacity: 0.16;
}

#work .archive-orbit {
  opacity: 0.07;
}

#work .archive-bg-specimen {
  opacity: 0.06;
}

#work .work-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    var(--work-atmosphere-image),
    radial-gradient(circle, rgba(255, 255, 255, 0.4) 0.55px, transparent 0.85px);
  background-position: center, 0 0;
  background-size: cover, 4px 4px;
  opacity: 0.1;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse at 82% 28%, #000 0, transparent 62%);
  mask-image: radial-gradient(ellipse at 82% 28%, #000 0, transparent 62%);
}

#work .archive-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 24% 44%, rgba(226, 235, 225, 0.08), transparent 46%),
    radial-gradient(ellipse at 78% 50%, rgba(0, 0, 0, 0.22), transparent 60%);
}

@media (max-width: 1150px) {
  #work .work-console {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  #work .work-stage {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
  }

  #work .work-readout {
    --work-gutter: 0;
    padding: 22px 0 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  #work .work-readout-body {
    display: block;
  }
}

@media (max-width: 720px) {
  #work .stream-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 24px;
  }

  #work .stream-head h2 {
    max-width: 100%;
    font-size: clamp(1.9rem, 8.8vw, 2.5rem);
    line-height: 0.95;
  }

  #work .stream-head .coord {
    margin-left: auto;
    font-size: 9px;
  }

  #work .archive-intro-label {
    min-width: 0;
    white-space: normal;
    text-align: right;
    font-size: 8.5px;
    line-height: 1.4;
  }

  #work .work-stage,
  #work .work-readout {
    width: 100%;
  }

  #work .work-stage-head {
    gap: 8px;
    padding: 0 1px 10px;
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  #work .work-stage-head span:last-child {
    display: none;
  }

  #work .work-player {
    margin-top: 4px;
  }

  #work .work-record-rail {
    display: flex;
    width: 100%;
    min-height: 84px;
    gap: 10px;
    overflow-x: auto;
    padding: 12px 2px 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  #work .work-record-rail::-webkit-scrollbar {
    display: none;
  }

  #work .work-record-btn {
    flex: 0 0 168px;
    padding: 3px 2px;
    scroll-snap-align: start;
  }

  #work .work-record-disc {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  #work .work-readout {
    margin-top: 0;
    padding-top: 14px;
  }

  #work .work-readout-top {
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 8.5px;
    line-height: 1.5;
  }

  #work .work-readout-top > span:nth-child(2) {
    margin-left: auto;
  }

  #work .work-readout-body {
    display: block;
    margin-top: 18px;
  }

  #work .work-year {
    font-size: 4.4rem;
  }

  #work .work-role {
    max-width: 15ch;
    font-size: clamp(1.7rem, 8vw, 2.5rem);
  }

  #work .work-stats {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 20px;
  }

  #work .work-stats > div,
  #work .work-stats > div:nth-child(odd),
  #work .work-stats > div:nth-child(even) {
    padding: 11px 0;
    border-right: 0;
  }

  #work .work-cue {
    margin-top: 16px;
  }

  #work .work-cue-btn {
    min-height: 30px;
    padding: 7px 0;
  }

  #work .work-proof > div {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 8px;
  }

  #work .work-evidence {
    margin-top: 20px;
  }

  #work .work-readout-foot {
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 20px;
  }

  #work .work-barcode-wrap {
    flex: 1 0 100%;
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  #work .work-record-disc {
    transition: none;
  }

  #work .archive-orbit {
    animation: none;
  }

  #work .work-readout.is-updating,
  #work .work-player.is-swapping::after {
    animation: none;
  }
}
