/* Work cards (docs/docs-plan-revision-dec2.md 1.5): real projects in their own colours, on /work and in the homepage's
   Work row. What keeps mixed palettes composed is the frame, never a filter: the same 16:10 plate, the same inner hairline,
   the same caption. Each card is one link; hover and focus lock the corner brackets on and nudge the arrow. */

.work-grid { --hgrid-bg: var(--ink); grid-template-columns: minmax(0, 1fr); margin: 0; padding: 0; border-radius: var(--r-md); overflow: hidden; }
@media (min-width: 40rem) and (max-width: 59.99rem) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* no empty cell: a card left alone in its row takes the whole row */
  .work-grid > li:last-child:nth-child(odd), .work-grid--home > li:last-child { grid-column: 1 / -1; }
  /* and lays out like the wide card, so its plate does not grow to the full width */
  :is(.work-grid > li:last-child:nth-child(odd), .work-grid--home > li:last-child) > .work-card:not(.work-card--text) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto; align-items: center; gap: var(--s-5); }
}
@media (min-width: 60rem) { .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.work-grid > li { display: flex; }

.work-card { flex: 1; display: grid; grid-template-rows: auto 1fr; gap: var(--s-4); padding: var(--s-3) var(--s-3) var(--s-5); color: var(--paper); text-decoration: none; }
/* the brackets sit inside the cell, so they never cross into the next card */
.work-card.brackets::after { inset: 4px; }
.work-card:focus-visible { outline-offset: -3px; border-radius: var(--r-md); }

.work-shot { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r-sm); background: var(--ink-2); }
.work-shot picture { display: contents; }
/* an inner hairline gives a dark screenshot an edge on the dark page and a light one an edge on the light page */
.work-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; border-radius: inherit;
  outline: 1px solid color-mix(in srgb, var(--paper) 12%, transparent); outline-offset: -1px; }

.work-body { display: flex; flex-direction: column; gap: var(--s-1); padding-inline: var(--s-2); }
.work-tag { font: 500 var(--t-label)/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: var(--s-1); }
.work-name { font-size: var(--t-lg); font-weight: 500; letter-spacing: -.015em; line-height: 1.3; }
.work-line { font-size: var(--t-sm); line-height: 1.5; color: var(--mist); max-width: 40ch; text-wrap: pretty; }
.work-url { display: inline-flex; align-items: center; gap: var(--s-2); margin-top: auto; padding-top: var(--s-3); font: 400 var(--t-sm)/1.2 var(--f-mono); color: var(--dim); }
.work-card .arrow { width: 1rem; height: 1rem; transition: transform var(--t-move) var(--ease); }
.work-card:hover .arrow, .work-card:focus-visible .arrow { transform: translateX(3px); }
.work-card:hover .work-url, .work-card:focus-visible .work-url { color: var(--paper); }

/* Text card: no plate, the caption centred in its cell */
.work-card--text { grid-template-rows: 1fr; align-items: center; padding: var(--s-6); }
.work-card--text .work-body { justify-content: center; }
.work-card--text .work-url { margin-top: var(--s-3); }

/* Wide card (homepage): plate and caption side by side */
@media (min-width: 46rem) {
  .work-li--wide { grid-column: 1 / -1; }
  .work-card--wide { grid-template-columns: minmax(0, 62fr) minmax(0, 38fr); grid-template-rows: auto; align-items: center; gap: var(--s-6); padding: var(--s-3); }
  .work-card--wide .work-body { padding: var(--s-4); }
  .work-card--wide .work-name { font-size: var(--t-xl); }
  .work-card--wide .work-url { margin-top: var(--s-4); }
}

/* Homepage row: intro in the content column, the grid across the whole container */
.work-intro { font: var(--w-display) clamp(1.375rem, 1.1rem + 1vw, 2rem)/1.2 var(--f-display); letter-spacing: -.025em; max-width: 36ch; }
.work-grid--home { grid-column: 1 / -1; margin-top: var(--s-4); }
.work-more { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 60rem) { .work-more { grid-column: -2 / -1; } }

/* /work: labelled groups of three */
.work-group { display: grid; gap: var(--s-4); }
.work-groups { display: grid; gap: var(--s-8); }

@media (forced-colors: active) { .work-grid { border: 1px solid CanvasText; } .work-shot img { outline-color: CanvasText; } }
