.work-index-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.work-index-bar > p,
.work-project-date {
  color: var(--muted);
  font-size: 14px;
}

.work-view-toggle {
  display: inline-flex;
  gap: 4px;
}

.work-view-toggle[hidden] { display: none; }

.work-view-toggle button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.work-view-toggle button:hover,
.work-view-toggle button[aria-pressed="true"] { color: var(--ink); }
.work-view-toggle button[aria-pressed="true"]::after {
  position: absolute;
  inset: auto 12px 5px;
  height: 1px;
  background: var(--blue);
  content: "";
}
.work-view-toggle button:focus-visible { outline-offset: 3px; z-index: 1; }
.work-view-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.3; }

.work-projects {
  list-style: none;
  padding: 0;
  margin: 0;
}

.work-project > a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  column-gap: 12px;
  color: var(--ink);
}

.work-project > a:hover h3,
.work-project > a:focus-visible h3 { color: var(--blue); }
.work-project .project-summary,
.work-project .project-meta { margin: 0; }
.work-project .project-image { grid-area: image; }
.work-project h3 { grid-area: title; }
.work-project .project-summary { grid-area: summary; }
.work-project .project-meta { grid-area: meta; }
.work-project-date { grid-area: date; white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-project-arrow { grid-area: arrow; color: var(--blue); }

.work-projects[data-view="gallery"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(36px, 5vw, 64px);
}

[data-view="gallery"] .work-project:first-child { grid-column: 1 / -1; }
[data-view="gallery"] .work-project > a {
  grid-template-areas: "image image image" "title title arrow" "summary summary summary" "meta date date";
  row-gap: 8px;
}

[data-view="gallery"] .project-image {
  aspect-ratio: 3 / 2;
  margin-bottom: 8px;
  background: var(--ground);
}

[data-view="gallery"] .work-project:first-child .project-image {
  aspect-ratio: 2.65;
  max-height: 460px;
}

[data-view="gallery"] .project-image img { display: block; object-fit: contain; }
.work-projects .project-image img.work-cover-dark { display: none; }
:root[data-color-mode="dark"] .work-projects .project-image img.work-cover-light { display: none; }
:root[data-color-mode="dark"] .work-projects .project-image img.work-cover-dark { display: block; }
[data-view="gallery"] #protobench .project-image { aspect-ratio: 1512 / 982; }
.work-project-date { justify-self: end; }

@media (min-width: 581px) {
  :root:not([data-color-mode="dark"]) [data-view="gallery"] #pocketlab .project-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: clamp(12px, 2vw, 22px);
  }
}

.work-projects[data-view="list"] { border-top: 1px solid var(--control-border); }
[data-view="list"] .work-project { border-bottom: 1px solid var(--control-border); }
[data-view="list"] .work-project > a {
  grid-template-areas: "title date arrow" "meta meta meta";
  gap: 5px clamp(10px, 2.5vw, 26px);
  padding-block: 16px;
}
[data-view="list"] .work-project .project-image,
[data-view="list"] .work-project .project-summary { display: none; }
[data-view="list"] .work-project h3 { font-size: clamp(19px, 2.4vw, 26px); }

@media (max-width: 580px) {
  .work-projects[data-view="gallery"] { grid-template-columns: minmax(0, 1fr); }
  [data-view="gallery"] .work-project:first-child .project-image { aspect-ratio: 3 / 2; }
  [data-view="gallery"] #pocketlab .project-image { aspect-ratio: 1; }
}
