/* =========================================================
   THOMPSON SORTED — RECENT WORK SLIDER (js/workslider.js)
   Only applies once the script adds .work-slider-on, so without
   JavaScript the project cards stay in their normal stack.
   ========================================================= */

.work-grid.work-slider-on {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 24px;
  align-items: center;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 2px 0;
}
.work-grid.work-slider-on::-webkit-scrollbar { display: none; }
.work-grid.work-slider-on:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: var(--radius); }

.work-slider-on > .work-card {
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
/* One at a time, so keep the text on the left and the picture on the right for every project */
.work-slider-on > .work-card:nth-child(even) .work-card-text { order: 0; }

/* Controls under the slider */
.work-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}

.work-arrow {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--charcoal-900);
  border-radius: 50%;
  background: var(--white);
  color: var(--charcoal-900);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, opacity .2s ease;
}
.work-arrow:hover:not(:disabled) { background: var(--charcoal-900); color: var(--white); }
.work-arrow:disabled { opacity: .35; cursor: default; }
.work-arrow:focus-visible, .work-dot:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.work-dots { display: flex; gap: 10px; }
.work-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease, width .2s ease, border-radius .2s ease;
}
.work-dot:hover { background: #c9c6bd; }
.work-dot[aria-current="true"] { width: 30px; border-radius: 6px; background: var(--teal); }

/* Autoplay: the active dot fills over the interval, then the slider advances */
.work-autoplay .work-dot[aria-current="true"] {
  position: relative;
  overflow: hidden;
  background: rgba(31, 138, 130, .28);
}
.work-autoplay .work-dot[aria-current="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--teal);
  transform-origin: left center;
  transform: scaleX(0);
  animation: work-fill var(--work-dur, 6500ms) linear forwards;
}
.work-autoplay.work-paused .work-dot[aria-current="true"]::after { animation-play-state: paused; }
@keyframes work-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.work-play {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--teal-light);
  color: var(--teal-dark);
  cursor: pointer;
  transition: background-color .2s ease;
}
.work-play:hover { background: #cfe8e4; }
.work-play:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.work-play .i-play { display: none; }
.work-user-paused .work-play .i-play { display: block; }
.work-user-paused .work-play .i-pause { display: none; }

.work-counter { min-width: 44px; text-align: right; font-size: .9rem; font-weight: 600; color: var(--charcoal-500); }

@media (max-width: 520px) {
  .work-counter { display: none; }
  .work-controls { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .work-dot, .work-arrow { transition: none; }
}
