/* --------------------------------------------------------------------------
   Carousels (work.html). Posted carousels you can actually swipe.
   One carousel on the stage at a time (tabs pick which), the slide in focus
   centred and its neighbours peeking in from the sides. The track is a native
   scroll-snap strip, so touch swipes and trackpads work without JS;
   carousels.js adds mouse drag, arrows, keys, the progress bar and the cue.
   -------------------------------------------------------------------------- */

.cx-band { scroll-margin-top: 72px; }
/* an ink band sitting on the ink closing band; keep a seam between them */
.cx-band + .band--ink { border-top: 1px solid var(--ink-rule); }

.cxs { margin: 0; }
.cx { margin: 0; min-width: 0; scroll-margin-top: 96px; }
.cx:not(.is-current) { display: none; }
.cx.is-current { animation: cx-in 0.6s var(--ease); }
@keyframes cx-in { from { opacity: 0; transform: translateY(12px); } }

/* ------------------------------------------------------------------- tabs */
.cx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.cx-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--ink-rule);
  border-radius: 3px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.cx-tab span { color: var(--red); }
.cx-tab:hover { color: var(--paper); border-color: rgba(244, 242, 238, 0.4); }
.cx-tab[aria-selected="true"] { color: var(--paper); border-color: var(--paper); background: var(--ink-sheet); }
.cx-tab:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ------------------------------------------------------------ account line */
.cx__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  margin-bottom: 1.25rem;
}
.cx__avatar {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--ink-rule);
}
.cx__who { display: grid; gap: 0.15rem; min-width: 0; }
.cx__handle {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx__meta {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

@media (min-width: 900px) {
  .cx__head,
  .cx-tabs { justify-content: center; }
}

/* ------------------------------------------------------------------ stage */
/* full bleed strip, the slide in focus centred, its neighbours peeking */
.cx__view {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.cx__track {
  --sw: min(460px, 76vw);
  position: relative;
  display: flex;
  gap: clamp(0.9rem, 2vw, 1.5rem);
  margin: 0;
  padding: 0 calc((100% - var(--sw)) / 2);
  scroll-padding-inline: calc((100% - var(--sw)) / 2);
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  outline: none;
}
.cx__track::-webkit-scrollbar { display: none; }
.cx__track.is-drag { scroll-snap-type: none; cursor: grabbing; }
.cx__track.is-drag .cx__slide { pointer-events: none; }
.cx__track:focus-visible .cx__slide.is-on img { outline: 2px solid var(--red); outline-offset: 4px; }

.cx__slide {
  flex: 0 0 var(--sw);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  opacity: 0.32;
  transform: scale(0.94);
  transition: opacity 0.45s var(--ease), transform 0.55s var(--ease);
}
.cx__slide.is-on { opacity: 1; transform: none; }
.cx__slide img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 4px;
  background: var(--ink-sheet);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* ----------------------------------------------------------------- arrows */
.cx__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  margin-top: -26px;
  padding: 0;
  border: 1px solid rgba(244, 242, 238, 0.4);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: opacity 0.25s var(--ease), background 0.2s, border-color 0.2s;
}
.cx__arrow svg { width: 18px; height: 18px; }
.cx__arrow--prev { left: calc(50% - var(--sw-px, 230px) - 92px); }
.cx__arrow--next { right: calc(50% - var(--sw-px, 230px) - 92px); }
.cx__arrow:hover { background: var(--red); border-color: var(--red); }
.cx__arrow:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.cx__arrow[disabled] { opacity: 0; pointer-events: none; }

/* ----------------------------------------------------------- progress bar */
.cx__bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  width: min(460px, 76vw);
  margin: 1.5rem auto 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.cx__bar-line { position: relative; height: 1px; background: var(--ink-rule); }
.cx__bar-fill {
  position: absolute; left: 0; top: -1px;
  height: 3px;
  width: 0;
  background: var(--red);
  transition: width 0.45s var(--ease);
}

/* ---------------------------------------------------------------- caption */
.cx figcaption {
  display: grid;
  gap: 0.3rem;
  justify-items: center;
  width: min(460px, 76vw);
  margin: 1.25rem auto 0;
  text-align: center;
}
.cx__hint {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cx__hint svg { width: 14px; height: 14px; color: var(--red); }

/* ------------------------------------------------- swipe cue, touch only.
   A fingertip slides right to left across a pill on the slide in focus, and
   keeps going until the visitor swipes. Replaces the caption hint on phones,
   so the instruction sits once, on the thing you swipe. */
.cx__cue { display: none; }

@media (hover: none), (pointer: coarse) {
  .cx__cue {
    position: absolute;
    left: 50%;
    bottom: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.95rem 0.6rem 0.75rem;
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.84);
    box-shadow: 0 0 0 1px rgba(244, 242, 238, 0.16), 0 8px 24px rgba(0, 0, 0, 0.45);
    color: #fff;
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1;
    transform: translateX(-50%);
    pointer-events: none;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  }
  .cx.is-touched .cx__cue { opacity: 0; transform: translateX(-50%) translateY(8px); }
  .cx__hint { display: none; }
  /* a wider peek of the next slide, and less dimmed, so the strip reads as more */
  .cx__track { --sw: min(460px, 70vw); }
  .cx__slide { opacity: 0.55; }
  .cx__bar, .cx figcaption { width: min(460px, 70vw); }
}

.cx__cue-track {
  position: relative;
  width: 40px; height: 16px;
  flex: none;
}
/* the trail the fingertip leaves */
.cx__cue-track::before {
  content: "";
  position: absolute;
  top: 50%; left: 4px; right: 4px;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(224, 53, 43, 0), var(--red));
  transform-origin: right center;
  animation: cx-trail 1.6s var(--ease) infinite;
}
.cx__cue-track i {
  position: absolute;
  top: 50%; right: 0;
  width: 14px; height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
  animation: cx-tip 1.6s var(--ease) infinite;
}
@keyframes cx-tip {
  0% { transform: translateX(0) scale(0.6); opacity: 0; }
  15% { transform: translateX(0) scale(1); opacity: 1; }
  70% { transform: translateX(-26px) scale(1); opacity: 1; }
  100% { transform: translateX(-26px) scale(0.6); opacity: 0; }
}
@keyframes cx-trail {
  0%, 15% { transform: scaleX(0); opacity: 0; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

@media (max-width: 899px) {
  .cx__arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cx__slide,
  .cx__bar-fill { transition: none; }
  .cx.is-current { animation: none; }
  .cx__cue-track i { animation: none; right: 13px; }
  .cx__cue-track::before { animation: none; }
}
