.work-screen {
  position: fixed;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  background: #08062b;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.work-screen.is-interactive {
  pointer-events: auto;
}

.work-screen.is-interactive .work-track {
  filter: none;
}

.work-dot-field,
.work-firefly-field {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.work-dot-field {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.68) 0 1px, transparent 1.35px);
  background-position: center bottom;
  background-size: 19px 19px;
  opacity: 0.14;
}

.work-firefly-field .firefly {
  position: absolute;
  bottom: -1.5rem;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, rgba(218, 234, 255, 0.96) 42%, rgba(159, 202, 255, 0.08) 74%);
  box-shadow: 0 0 0.55rem #fff, 0 0 1.35rem rgba(170, 211, 255, 0.92), 0 0 2.6rem rgba(118, 174, 255, 0.45);
  mix-blend-mode: screen;
  opacity: 0;
  animation: work-firefly-rise var(--work-firefly-duration, 17s) linear var(--work-firefly-delay, 0s) infinite;
}

.work-screen:not(.is-visible) .work-firefly-field .firefly {
  animation-play-state: paused;
}

.work-heading {
  position: absolute;
  z-index: 3;
  top: clamp(5.2rem, 9vh, 7rem);
  right: clamp(2.5rem, 5vw, 6rem);
  left: clamp(2.5rem, 5vw, 6rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.work-heading h1,
.work-heading p {
  margin: 0;
  color: #f7f7fb;
  white-space: nowrap;
  pointer-events: auto;
  will-change: opacity, translate;
}

.work-heading h1 {
  font-family: Arial Black, Arial, sans-serif;
  font-size: clamp(2.9rem, 5.8vw, 6.2rem);
  font-weight: 900;
  line-height: 0.88;
}

.work-heading p {
  color: rgba(255, 255, 255, 0.5);
  font-family: Arial, sans-serif;
  font-size: clamp(0.7rem, 0.9vw, 0.9rem);
  letter-spacing: 0.28em;
}

.work-track {
  position: absolute;
  z-index: 2;
  inset: 0;
  filter: blur(var(--work-blur, 18px));
  transition: filter 120ms linear;
  will-change: filter;
  cursor: grab;
}

.work-track::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: rgba(5, 4, 32, 0.7);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.work-screen.is-dragging .work-track {
  cursor: grabbing;
  user-select: none;
}

.work-card {
  --card-width: min(18vw, 13.5rem);
  --card-height: clamp(15rem, 50vh, 24rem);
  --card-x: 0px;
  position: absolute;
  isolation: isolate;
  top: 50%;
  left: 0;
  width: var(--card-width);
  height: var(--card-height);
  margin-top: calc(var(--card-height) / -2);
  margin-left: calc(var(--card-width) / -2);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.28);
  cursor: grab;
  transform: translate3d(var(--card-x), 0, 0);
  transition: width 560ms cubic-bezier(0.22, 0.75, 0.2, 1), height 560ms cubic-bezier(0.22, 0.75, 0.2, 1), margin 560ms cubic-bezier(0.22, 0.75, 0.2, 1), border-color 240ms ease, opacity 320ms ease;
  will-change: transform, width;
}

.work-screen.has-open-artboard .work-heading {
  opacity: 0.16;
  transition: opacity 320ms ease;
}

.work-screen.has-open-artboard .work-track {
  pointer-events: none;
}

.work-screen.is-dragging .work-card {
  cursor: grabbing;
}

.work-card::before,
.work-card::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.work-card::before {
  --work-border-angle: 0deg;
  z-index: 1;
  padding: 2px;
  background: conic-gradient(
    from var(--work-border-angle),
    transparent 0deg 38deg,
    rgba(215, 168, 255, 0.98) 52deg 72deg,
    #ffffff 82deg 88deg,
    rgba(94, 174, 255, 0.98) 98deg 122deg,
    transparent 138deg 218deg,
    rgba(255, 220, 132, 0.98) 234deg 258deg,
    #ffffff 268deg 274deg,
    rgba(182, 112, 255, 0.98) 284deg 308deg,
    transparent 326deg 360deg
  );
  opacity: 0.76;
  filter: drop-shadow(0 0 0.58rem rgba(164, 204, 255, 0.98));
  animation: work-border-rotate 2.8s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.work-card::after {
  z-index: 0;
  inset: 1px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.018));
}

.work-card:hover,
.work-card:focus-within {
  border-color: rgba(255, 255, 255, 0.82);
}

.work-card:hover::before,
.work-card:focus-within::before {
  opacity: 1;
  filter: drop-shadow(0 0 0.7rem rgba(190, 151, 255, 0.98));
}

.work-card:focus-within {
  outline: 2px solid rgba(236, 226, 255, 0.98);
  outline-offset: 3px;
}

.work-image-stage {
  position: absolute;
  z-index: 2;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: grayscale(1);
  transition: filter 260ms ease;
}

.work-card[data-populated="true"] .work-image-stage {
  cursor: pointer;
}

.work-card:hover .work-image-stage,
.work-card:focus-within .work-image-stage {
  filter: grayscale(0);
}

.work-image-stage::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(4, 3, 25, 0.64));
  content: "";
  pointer-events: none;
}

.work-tools {
  position: absolute;
  z-index: 3;
  right: 0.5rem;
  bottom: 0.5rem;
  display: none;
  gap: 0.3rem;
}

.work-card[data-populated="true"]:hover .work-tools,
.work-card[data-populated="true"]:focus-within .work-tools {
  display: flex;
}

.work-tools button,
.work-upload {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(7, 6, 40, 0.76);
  color: #fff;
  cursor: pointer;
}

.work-upload::after { content: "↑"; }
[data-work-action="delete"]::after { content: "×"; }
[data-work-action="reset"]::after { content: "○"; }

.work-upload {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.work-card[data-populated="true"] .work-upload {
  display: none;
}

.work-artboard-overlay {
  position: fixed;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 32, 0.72);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 320ms cubic-bezier(0.22, 0.75, 0.2, 1), visibility 0s linear 320ms;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.work-screen.has-open-artboard .work-artboard-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.work-artboard {
  position: relative;
  width: auto;
  height: min(72vh, 42.5rem);
  max-width: calc(100vw - 6rem);
  max-height: calc(100vh - 6rem);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: rgba(8, 6, 43, 0.96);
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.52), 0 0 2.8rem rgba(157, 195, 255, 0.34);
  opacity: 0;
  transform: scale(0.86);
  transform-origin: center center;
  transition: opacity 300ms cubic-bezier(0.22, 0.75, 0.2, 1), transform 380ms cubic-bezier(0.18, 0.84, 0.22, 1);
  will-change: opacity, transform;
}

.work-screen.has-open-artboard .work-artboard {
  opacity: 1;
  transform: scale(1);
}

.work-artboard::before {
  --work-border-angle: 0deg;
  position: absolute;
  z-index: 2;
  inset: 0;
  padding: 2px;
  background: conic-gradient(
    from var(--work-border-angle),
    rgba(255, 255, 255, 0.18),
    rgba(168, 214, 255, 1),
    rgba(211, 174, 255, 0.98),
    rgba(255, 255, 255, 0.18)
  );
  content: "";
  pointer-events: none;
  animation: work-border-rotate 2.5s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  filter: drop-shadow(0 0 0.8rem rgba(190, 151, 255, 1));
}

.work-artboard-stage {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-color: rgba(255, 255, 255, 0.025);
  cursor: grab;
}

.work-artboard-stage:active {
  cursor: grabbing;
}

.work-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@property --work-border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes work-border-rotate {
  to { --work-border-angle: 360deg; }
}

@keyframes work-heading-drop {
  0% { opacity: 0; translate: 0 -42vh; }
  100% { opacity: 1; translate: 0 0; }
}

@keyframes work-card-drop {
  0% { opacity: 0; translate: 0 -82vh; }
  100% { opacity: 1; translate: 0 0; }
}

.work-screen.is-entering .work-heading h1 {
  animation: work-heading-drop 720ms cubic-bezier(0.2, 0.82, 0.24, 1) both;
}

.work-screen.is-entering .work-heading p {
  animation: work-heading-drop 780ms cubic-bezier(0.2, 0.82, 0.24, 1) 90ms both;
}

.work-screen.is-entering .work-card {
  animation: work-card-drop 860ms cubic-bezier(0.18, 0.84, 0.22, 1) both;
}

.work-screen.is-entering .work-card:nth-child(2n) { animation-delay: 70ms; }
.work-screen.is-entering .work-card:nth-child(3n) { animation-delay: 130ms; }
.work-screen.is-entering .work-card:nth-child(4n) { animation-delay: 190ms; }

@keyframes work-firefly-rise {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.55); }
  10% { opacity: 0.78; }
  27% { opacity: 0.16; transform: translate3d(0.65rem, -28vh, 0) scale(1); }
  46% { opacity: 0.88; }
  68% { opacity: 0.22; transform: translate3d(-0.55rem, -66vh, 0) scale(0.72); }
  84% { opacity: 0.72; }
  100% { opacity: 0; transform: translate3d(0.35rem, -112vh, 0) scale(0.45); }
}

@media (max-width: 700px) {
  .work-card {
    --card-width: min(42vw, 12rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .work-card,
  .work-track,
  .work-artboard-overlay,
  .work-artboard {
    transition: none;
  }

  .work-artboard {
    transform: none;
  }

  .work-card::before {
    animation: work-border-rotate 2.8s linear infinite !important;
  }

  .work-screen.is-entering .work-heading h1 {
    animation: work-heading-drop 720ms cubic-bezier(0.2, 0.82, 0.24, 1) both !important;
  }

  .work-screen.is-entering .work-heading p {
    animation: work-heading-drop 780ms cubic-bezier(0.2, 0.82, 0.24, 1) 90ms both !important;
  }

  .work-screen.is-entering .work-card {
    animation: work-card-drop 860ms cubic-bezier(0.18, 0.84, 0.22, 1) both !important;
  }

  .work-firefly-field .firefly {
    animation: work-firefly-rise var(--work-firefly-duration, 17s) linear var(--work-firefly-delay, 0s) infinite !important;
  }
}

@media (hover: none), (pointer: coarse) {
  .work-screen {
    display: none;
    pointer-events: none;
  }
}
