/* work-ui.css — work-ui.html: UI captures per project (screens in a CSS device frame +
   isolated elements on the project's colour). Builds on work-cards.css (tokens, header,
   chips, nav, Gelion); page markup is generated by scripts/build-work-ui.py. */

/* The site nav is fixed to the bottom edge (work-cards.css .ws-nav, ~62px tall incl. its fade):
   anchor jumps (#ui-<slug>), focus moves and scrollIntoView keep titles, frames and captions clear
   of it — on a ~900px-tall screen a section head + phone + caption still fits above the nav. */
html:has(.ws-pack-ui) { scroll-padding: 24px 0 96px; }
.ws-pack-ui .ws-page { padding-bottom: 132px; }
@media (max-height: 940px) {
  .ws-pack-ui .ws-nav { padding-top: 12px; padding-bottom: 16px; }
}

.ws-pack-ui .wu-index { margin-top: 4px; }
.ws-pack-ui .wu-index .ws-chip:hover { border-color: rgba(255, 255, 255, 0.42); }

/* ---------- project section ---------- */
.wu-project {
  --wu-accent: var(--ws-accent);
  --wu-bg: #0a0a12;
  --wu-ink: #fff;
  min-width: 0;
  margin-top: 56px;
  scroll-margin-top: 24px;
  scroll-margin-bottom: 96px;
}
.wu-project__title { scroll-margin-top: 48px; }

.wu-project__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 18px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 0.5px solid var(--ws-line);
}

.wu-project__meta {
  flex: 1 0 100%;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ws-muted);
}

.wu-project__meta::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--wu-accent);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.4);
  vertical-align: 0.05em;
}

.wu-project__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.wu-project__links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.wu-project__link {
  font-size: 14px;
  color: var(--ws-muted);
  white-space: nowrap;
  transition: color var(--duration-quick) var(--ease-standard);
}

.wu-project__link:hover { color: var(--ws-fg); }

/* ---------- screens: horizontal strip of device frames ---------- */
.wu-strip {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 20px;
  /* bleed to the right edge of the viewport so the strip reads as scrollable */
  margin: 0 calc(50% - 50vw) 0 -20px;
  padding: 6px 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  -webkit-overflow-scrolling: touch;
}

.wu-strip:focus-visible { outline: 1px solid var(--ws-line); outline-offset: -1px; }

.wu-shot {
  flex: none;
  width: var(--wu-w);
  margin: 0;
  scroll-snap-align: start;
}

/* sized so a phone + its caption fit above the fixed site nav on a 900px-tall screen */
.wu-shot--mobile { --wu-w: clamp(168px, 16vw, 208px); }
.wu-shot--desktop { --wu-w: min(720px, calc(100vw - 64px)); }

.wu-device {
  position: relative;
  background: #121214;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.22) inset,
    0 1px 0 rgba(255, 255, 255, 0.10) inset,
    0 18px 48px rgba(0, 0, 0, 0.45);
}

/* phone: thin bezel, radius scales with the frame */
.wu-device--mobile {
  padding: calc(var(--wu-w) * 0.03);
  border-radius: calc(var(--wu-w) * 0.14);
}

.wu-device--mobile .wu-device__screen {
  aspect-ratio: 390 / 844;
  border-radius: calc(var(--wu-w) * 0.11);
}

/* desktop: browser window with a slim title bar */
.wu-device--desktop { border-radius: 12px; overflow: hidden; }

.wu-device__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 11px;
  background: #1c1c1f;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.wu-device__bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.wu-device--desktop .wu-device__screen { aspect-ratio: 1440 / 900; }

.wu-device__screen {
  position: relative;
  overflow: hidden;
  background: var(--wu-bg);
}

.wu-device__screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.wu-shot__label {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ws-muted);
}

.wu-shot__n {
  font-variant-numeric: tabular-nums;
  color: var(--ws-fg);
  margin-right: 4px;
}

/* ---------- isolated elements on the project's colour ---------- */
.wu-elements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: clamp(12px, 2.4vw, 24px);
  border-radius: 16px;
  background: var(--wu-bg);
  color: var(--wu-ink);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.10) inset;
}

.wu-el {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--wu-accent) 9%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--wu-accent) 30%, transparent) inset;
}

.wu-el--on-accent {
  background: var(--wu-accent);
  box-shadow: none;
}

.wu-el--on-accent .wu-el__label { color: rgba(255, 255, 255, 0.78); }

.wu-el--full { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .wu-el--wide { grid-column: span 2; }
}

.wu-el__stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 10px 0 14px;
}

.wu-el__stage img {
  display: block;
  max-width: 100%;
  height: auto;
}

.wu-el__label {
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--wu-ink) 72%, transparent);
}

@media (max-width: 767px) {
  .wu-project { margin-top: 44px; }
  .wu-strip { margin: 0 calc(50% - 50vw) 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding: 0 16px; gap: 14px; }
  .wu-shot--mobile { --wu-w: 58vw; }
  .wu-shot--desktop { --wu-w: calc(100vw - 48px); }
  .wu-el { padding: 12px; }
}

/* ---------- autoplay shot (assets/work/autoplay.js) ---------- */
.wu-auto .wu-device__screen { isolation: isolate; }

.wu-auto__poster { position: relative; z-index: 0; }

.wu-auto__frame {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  border: 0;
  background: var(--wu-bg);
  transform: scale(var(--wu-s, 0.5));
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 450ms var(--ease-standard, ease);
}

.wu-auto.is-live .wu-auto__frame { opacity: 1; }
/* goto step: page change inside the prototype — fade to the project bg, not to the poster */
.wu-auto.is-nav .wu-auto__frame { opacity: 0; }
.wu-auto.is-nav .wu-auto__poster { visibility: hidden; }

.wu-auto__slides { position: absolute; inset: 0; z-index: 1; }

.wu-auto__slides img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 500ms ease;
}

.wu-auto__slides img.is-on { opacity: 1; }

/* touch indicator: a soft fingertip with a ring on tap */
.wu-touch {
  --d: 26px;
  position: absolute;
  top: calc(var(--d) / -2);
  left: calc(var(--d) / -2);
  z-index: 3;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.22), 0 2px 10px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
}

.wu-shot--desktop .wu-touch { --d: 22px; }

.wu-touch::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  opacity: 0;
}

.wu-touch.is-tap { animation: wuTap 820ms cubic-bezier(.3, .7, .3, 1) both; }
.wu-touch.is-tap::after { animation: wuRing 820ms ease-out both; }

@keyframes wuTap {
  0% { opacity: 0; scale: 1.5; }
  30% { opacity: 1; scale: 0.82; }
  55% { opacity: 1; scale: 0.9; }
  100% { opacity: 0; scale: 1; }
}

@keyframes wuRing {
  0%, 30% { opacity: 0; scale: 0.8; }
  36% { opacity: 1; scale: 0.9; }
  100% { opacity: 0; scale: 2.3; }
}

.wu-auto__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  color: var(--ws-fg);
}

.wu-auto__badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4d4d;
  box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.18);
}

.wu-auto[data-state='playing'] .wu-auto__badge::before { animation: wuLive 1.6s ease-in-out infinite; }
.wu-auto.is-paused .wu-auto__badge::before,
.wu-auto[data-state='idle'] .wu-auto__badge::before,
.wu-auto[data-state='static'] .wu-auto__badge::before { animation: none; background: var(--ws-muted); box-shadow: none; }

@keyframes wuLive { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .wu-touch { display: none; }
}
