/* ==========================================================================
   S · Work. Every project in one place: the search and filters in the first
   third, sticky; the projects in the other two as a masonry wall. On a phone:
   the search and filters, then one column.
   ========================================================================== */

.wk {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap);
  padding: var(--page-top) var(--gutter) 0;
}

/* --- Find: count, a line, the search, the filters --------------------------------- */

.wk-side {
  position: sticky;
  top: calc(var(--bar) + 40px);
  align-self: start;
  max-width: 400px;
}

.wk-side h1 span { color: var(--fg); font-variant-numeric: tabular-nums; }
.wk-side > p { text-wrap: pretty; }

.wk-search { display: block; margin-top: 28px; }

.wk-search input {
  width: 100%;
  height: var(--pill-h);
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  /* 16px or more, so a phone doesn't zoom in on focus. */
  font-size: max(16px, var(--t-ui));
  font-weight: var(--strong);
  outline: none;
  transition: background-color 150ms ease-out, box-shadow 150ms ease-out;
}

.wk-search input::placeholder { color: var(--muted); }
.wk-search input:focus-visible { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--fg); }

.wk-filters { margin-top: 12px; gap: 8px; }

/* As tall as the pills at the top. */
.page-s .wk-filters .pill {
  height: 44px;
  padding: 0 20px;
  background: var(--surface);
  color: var(--fg);
  font-size: var(--t-ui);
  font-weight: var(--strong);
  transition: background-color 150ms ease-out, color 150ms ease-out, scale 150ms ease-out;
}

.page-s .wk-filters .pill[aria-pressed="true"] { background: var(--fg); color: #fff; }
.page-s .wk-filters .pill:active { scale: 0.97; }

@media (hover: hover) and (pointer: fine) {
  .page-s .wk-filters .pill[aria-pressed="false"]:hover { background: var(--surface-hover); }
}

/* --- The projects: two to a row ----------------------------------------------------- */

/* Two columns; square and tall pieces take turns so the rows never line up. */
.wk-grid {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}

.wk-col { display: grid; gap: 40px; }

.wk-tile { display: block; }

.wk-tile[hidden] { display: none; }
.wk-tile .media { border-radius: var(--radius); }

.wk-tile .media img,
.wk-tile .media video { transition: transform 600ms var(--expo-out); }

/* A label: one step down from the text. */
.wk-tile__caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 10px 2px 0;
  font-size: var(--t-sm);
}

.wk-tile__caption > span:first-child { font-weight: var(--strong); }

@media (hover: hover) and (pointer: fine) {
  .wk-tile:hover .media img,
  .wk-tile:hover .media video { transform: scale(1.02); }
}

.wk-empty { grid-column: 1 / -1; color: var(--muted); }
.wk-empty a { color: var(--fg); text-decoration: underline; text-decoration-color: rgb(0 0 0 / 0.2); text-underline-offset: 3px; }

.page-s:has(.wk) { --foot-gap: clamp(160px, 22vh, 260px); }

@media (prefers-reduced-motion: reduce) {
  .wk-tile .media img,
  .wk-tile .media video,
  .wk-search input,
  .page-s .wk-filters .pill { transition: none; }
}

/* --- In between: one column of work, in the projects' order ---------------------------- */

@media (max-width: 1180px) {
  .wk-grid { grid-template-columns: minmax(0, 1fr); row-gap: 40px; }
  .wk-col { display: contents; }
}

/* --- Phone ------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .wk {
    grid-template-columns: minmax(0, 1fr);
  }

  .wk-side { position: static; max-width: none; }
  .wk-grid { grid-column: 1; grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 40px; }
  /* One column on a phone, back in the projects' own order. */
  .wk-col { display: contents; }
  .page-s .wk-filters .pill { padding: 0 16px; }
}
