/* All work (work.js): a big title with the count, a filter by kind of work, and every project as a card,
   three to a row. Cards reuse the home grid's look and hover (style.css, cards.js). */
.wk { padding: 22vh var(--gutter) 16vh; }

.wk-head { display: grid; gap: 40px; margin-bottom: 10vh; }
.wk-head__top { display: flex; align-items: flex-start; gap: 0.25em; }
.wk-title { font-size: clamp(64px, 11vw, 184px); font-weight: 400; line-height: 0.92; letter-spacing: -0.045em; }
.wk-count { font-size: clamp(20px, 2vw, 32px); color: var(--grey); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.wk-head__row { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; }
.wk-lead { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.4; color: var(--grey); max-width: 34ch; }

/* filter: one glass track; a dark thumb slides under the picked option, so nothing changes width */
.wk-filter { min-width: 0; max-width: 100%; }
.seg {
  position: relative; display: inline-flex; max-width: 100%; padding: 4px; border-radius: 999px;
  overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.5));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(12, 12, 14, 0.07), 0 8px 24px rgba(12, 12, 14, 0.06);
}
.seg::-webkit-scrollbar { display: none; }
/* two animatable edges: the leading one moves first, the trailing one follows (delays set by work.js) */
@property --l { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --r { syntax: "<length>"; inherits: true; initial-value: 0px; }
.seg__thumb {
  position: absolute; z-index: 2; top: 4px; bottom: 4px; left: 0; overflow: hidden; border-radius: 999px;
  width: calc(var(--r) - var(--l)); transform: translateX(var(--l));
  /* dark glass: a lighter top, a highlight on the upper edge */
  background: linear-gradient(180deg, #34343a, #0c0c0e 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.4), 0 8px 20px rgba(12, 12, 14, 0.22);
  pointer-events: none;
  transition: --l .6s var(--ease) var(--dl, 0ms), --r .6s var(--ease) var(--dr, 0ms);
}
/* the white labels inside the thumb, held still against the track while the thumb moves over them */
.seg__ghost { position: absolute; top: 0; left: 4px; display: flex; transform: translateX(calc(-1 * var(--l))); }
.seg__ghost span { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; font-size: 15px; white-space: nowrap; color: var(--white); }
.seg__ghost em { font-style: normal; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.55); }
.seg__opt { position: relative; z-index: 1; flex: none; cursor: pointer; }
.seg__opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg__opt span {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  font-size: 15px; white-space: nowrap; color: var(--ink); transition: color .45s var(--ease);
}
.seg__opt em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--grey); transition: color .45s var(--ease); }
.seg__opt:hover span { color: var(--grey); }
.seg__opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* the grid: three across, smaller captions than the home page */
.wk-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; row-gap: 80px; }
.wk-grid .card:nth-child(even) .card__frame, .wk-grid .card:nth-child(even) { transition-delay: 0ms; }
.wk-grid .card:nth-child(3n + 2), .wk-grid .card:nth-child(3n + 2) .card__frame { transition-delay: 90ms; }
.wk-grid .card:nth-child(3n), .wk-grid .card:nth-child(3n) .card__frame { transition-delay: 180ms; }
.wk-grid .card__title { font-size: clamp(20px, 1.6vw, 26px); }
.wk-grid .card__cap { margin-top: 18px; }
.wk-grid .card__year, .wk-grid .card__tags { font-size: 14px; }
.wk-grid .card[hidden] { display: none; }
/* the filter swap itself (shrink out, glide, rise in) runs in work.js with the Web Animations API */
@media (prefers-reduced-motion: reduce) {
  .seg__thumb { transition: none; }
}

.wk-empty { padding: 10vh 0; font-size: 20px; color: var(--grey); text-align: center; }

@media (max-width: 1100px) {
  .wk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .wk { padding-top: 16vh; }
  .wk-head { gap: 28px; margin-bottom: 7vh; }
  .wk-head__row { display: grid; gap: 24px; }
  .wk-filter { width: 100%; }
  .seg__opt span, .seg__ghost span { height: 40px; padding: 0 14px; font-size: 14px; }
  .wk-grid { grid-template-columns: 1fr; row-gap: 56px; }
}
