.work-main {
  background: var(--paper-hard);
  color: var(--ink-hard);
  padding-top: 24px;
  padding-bottom: 100px;
}

.site-nav a.is-active {
  background: var(--accent);
  color: var(--ink-hard);
}

/* [REVERT POINT] was clamp(40px, 8vw, 96px) — hero-scale, out of line with
   every other page's h1 (About tops out at 48px). This is a listing-page
   title, not a hero, so it's sized down to match. */
.work-title {
  font-family: var(--font-hard);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(26px, 3.5vw, 48px);
  line-height: 1.02;
  text-align: center;
  margin: 20px 0 28px;
}

/* ---------- toolbar: search + grid/list toggle ---------- */

.work-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ink-hard);
  margin-bottom: 20px;
}

.work-search {
  flex: 1 1 auto;
  border: 1px solid var(--ink-hard);
  padding: 12px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  background: var(--paper-hard);
  color: var(--ink-hard);
}

.work-search::placeholder { color: var(--ink-hard); opacity: 0.5; }

.work-search:focus {
  outline: none;
  border-color: var(--accent);
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--ink-hard);
  flex-shrink: 0;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: var(--paper-hard);
  color: var(--ink-hard);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.view-btn-icon { width: 14px; height: 14px; flex-shrink: 0; }

.view-btn + .view-btn { border-left: 1px solid var(--ink-hard); }

.view-btn.is-active { background: var(--ink-hard); color: var(--paper-hard); }
.view-btn:not(.is-active):hover { background: var(--accent); }

/* ---------- filter chip rows ---------- */

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hard-line);
}

.filter-row-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 4px;
  flex-shrink: 0;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--ink-hard);
  background: var(--paper-hard);
  color: var(--ink-hard);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.filter-chip:hover { background: rgba(13, 13, 13, 0.08); }
.filter-chip.is-active { background: var(--ink-hard); color: var(--paper-hard); }
.filter-chip.is-active:hover { background: var(--accent); }

.filter-clear-all {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: auto;
  padding: 8px 4px;
  border: none;
  background: none;
  color: var(--ink-hard);
  opacity: 0.6;
  cursor: pointer;
}

.filter-clear-all:hover { opacity: 1; color: var(--accent); }

.work-result-line {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  opacity: 0.6;
  margin: 0 0 32px;
}

/* ---------- masonry-ish grid ---------- */

.work-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 260px;
  grid-auto-flow: dense;
  gap: 24px;
}

.work-card {
  position: relative;
  border: 3px solid var(--ink-hard);
  box-shadow: 8px 8px 0 var(--ink-hard);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
  background: var(--paper-hard);
  background-image: repeating-linear-gradient(135deg, var(--hard-line) 0 1px, transparent 1px 10px);
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2);
}

.work-card:not(.has-logo) {
  flex-direction: row;
  gap: 0;
}

/* [REVERT POINT] a card with a caption needs its title stacked above the
   caption, not side-by-side — the row layout above was fine when a
   non-logo card only ever had one visible text child (the name; .meta is
   pulled out of flow via position:absolute). */
.work-card.has-caption {
  flex-direction: column;
  gap: 4px;
}

.work-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 13, 0.35);
  pointer-events: none;
  z-index: 2;
}

/* [REVERT POINT] the 0.35 wash above is fine over the plain paper/hatch
   background (has-logo / no-image cards), but on real screenshots it let
   too much busy, varied-contrast photo through — dark text over it was
   inconsistently legible depending on what part of the image sat behind
   it. For photo-backed cards specifically: a darker scrim + white text
   with a dark halo (same reliable pattern as the homepage shelf cards)
   instead of black text hoping a light halo is enough. */
.work-card.has-image::before {
  background: rgba(13, 13, 13, 0.65);
}

.work-card.has-image .work-card-name,
.work-card.has-image .work-card-caption {
  color: var(--paper-hard);
  text-shadow: 0 1px 10px rgba(13, 13, 13, 0.9), 0 1px 3px rgba(13, 13, 13, 0.9);
}

.work-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 12px 12px 0 var(--accent);
}

.work-card.is-linked { cursor: pointer; }

/* real <a> covering the whole card — see js/work.js buildCardEl — so the
   card is a genuine link (works with no JS, reachable by crawlers and
   keyboard) rather than a div with a JS click handler bolted on. */
.work-card-hit {
  position: absolute;
  inset: 0;
  z-index: 6;
}

.work-card.is-soon { opacity: 0.55; }
.work-card.is-soon:hover { transform: none; box-shadow: 8px 8px 0 var(--ink-hard); }

.work-card-soon {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
  background: var(--ink-hard);
  color: var(--paper-hard);
}

.work-grid.is-list .work-card-soon { position: static; margin-right: 8px; }

.work-card-logo {
  position: relative;
  z-index: 3;
  font-family: var(--font-hard);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 36px);
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink-hard);
  text-align: center;
  max-width: 85%;
  margin: 0;
}

.work-card.is-soon .work-card-logo { opacity: 0.6; }

.work-card.has-logo .work-card-name {
  z-index: 3;
  font-size: clamp(10px, 1.2vw, 13px);
  line-height: 1.2;
  opacity: 0.75;
}

/* masonry rhythm: a repeating 4-card block that closes itself out every
   2 rows, so tall and wide cards can coexist without the gap they caused
   before (a row-spanning card blocking the column underneath it, stranding
   grid-auto-flow: dense on a hole nothing left in the list fits back into).
   Per block: card 1 is tall (column 1, both rows), card 2 is wide (fills
   the remaining row-1 width), cards 3-4 are regular (fill what's left of
   row 2) — 2+2+1+1 = 6 cells = exactly a 3-col x 2-row block, every time,
   so blocks never carry a partial row into the next one. PAGE_SIZE is a
   multiple of 4 (see js/work.js) so a full page is a whole number of
   blocks; only the last, partial page can fall short of that. */
.work-card:nth-child(4n+1) {
  grid-row: span 2;
}

.work-card:nth-child(4n+2) {
  grid-column: span 2;
}

/* [REVERT POINT] first block only: the tall card normally lands in column
   1 (the default dense-packing behavior every other block still uses).
   Forcing it to column 3 here flips just this one block so it sits on the
   right instead of the left — dense packing then auto-fills the wide card
   and the two regular cards into the now-free columns 1-2 on its own,
   no other overrides needed. Scoped to the 3-column desktop grid only;
   at 900px/600px the columns collapse and this would place the card in a
   column that doesn't exist. To revert: delete this media block. */
@media (min-width: 901px) {
  .work-card:nth-child(1) {
    grid-column: 3;
  }
}

/* [REVERT POINT] was missing z-index entirely on cards without a brand
   logo (the real-screenshot cards, e.g. Coreloops, Fundall) — .work-card
   is a flex container, so z-index applies to its children even at
   position:static, and the ::before dark overlay sits at z-index:2. With
   no z-index here the title painted BEHIND that overlay, so it was
   present in the DOM but invisible/washed out over busy photo
   backgrounds (has-logo cards worked by accident, since only that variant
   set z-index:3 on its own .work-card-name override below). Lifting it
   above the overlay + a text-shadow here makes titles legible on every
   card, image-backed or not. */
.work-card-name {
  position: relative;
  z-index: 3;
  font-family: var(--font-hard);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(18px, 2.2vw, 30px);
  color: var(--ink-hard);
  text-shadow: 0 1px 10px rgba(242, 240, 235, 0.9), 0 1px 2px rgba(242, 240, 235, 0.9);
}

/* one-line descriptive tagline under the title (e.g. "Sending Money To
   People, Not Accounts") — only rendered for projects with a real cover
   image + caption in data.js, same z-index/halo treatment as the title
   so it stays legible over busy photo backgrounds. */
.work-card-caption {
  position: relative;
  z-index: 3;
  display: block;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-hard);
  opacity: 0.85;
  text-shadow: 0 1px 10px rgba(242, 240, 235, 0.9), 0 1px 2px rgba(242, 240, 235, 0.9);
}

.work-card-meta {
  position: absolute;
  bottom: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-hard);
}

.work-card-meta span {
  background: var(--paper-hard);
  border: 1px solid var(--ink-hard);
  padding: 4px 8px;
}

/* SHIPPED / CONCEPT badge — same mono metadata treatment as the category
   badge next to it, just color-coded so shipped-vs-concept reads at a
   glance without having to open the case study. SHIPPED gets the bold
   accent fill (Higher specificity than the generic ".work-card-meta span"
   rule above so it wins); CONCEPT just inherits that same opaque
   paper/ink badge look — legible over any card — dimmed slightly to read
   as the quieter of the two. */
.work-card-meta .work-card-status--shipped {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.work-card-meta .work-card-status--concept {
  opacity: 0.7;
}

/* ---------- list view ---------- */

.work-grid.is-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.work-grid.is-list .work-card {
  grid-column: unset;
  grid-row: unset;
  height: auto;
  flex-direction: row;
  justify-content: flex-start;
  gap: 20px;
  padding: 22px;
  text-align: left;
  border-width: 1px;
  border-bottom-width: 0;
  box-shadow: none;
  background-image: none;
}

.work-grid.is-list .work-card:first-child { border-top: 1px solid var(--ink-hard); }
.work-grid.is-list .work-card:last-child { border-bottom: 1px solid var(--ink-hard); }

.work-grid.is-list .work-card:hover {
  transform: none;
  box-shadow: none;
  background: var(--accent);
}

.work-grid.is-list .work-card-name { font-size: 18px; }

.work-grid.is-list .work-card-meta {
  position: static;
  margin-left: auto;
  flex-shrink: 0;
}

/* [REVERT POINT] was a single bare "No projects match" line — same
   reassurance + clear-action treatment as the 404 page, scaled down for
   an in-page empty state rather than a full lost-visitor screen. */
.work-empty {
  text-align: center;
  margin-top: 60px;
  padding: 56px 24px;
  border: 1px solid var(--hard-line);
}

.work-empty-title {
  font-family: var(--font-hard);
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.work-empty-copy {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.75;
  max-width: 44ch;
  margin: 0 auto 26px;
}

.work-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 13px 20px;
  border: 2px solid var(--ink-hard);
  background: var(--ink-hard);
  color: var(--paper-hard);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease,
              transform 0.12s ease, box-shadow 0.12s ease;
}

.work-empty-btn:hover,
.work-empty-btn:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translate(-3px, -3px);
  box-shadow: 5px 5px 0 var(--ink-hard);
}

.work-empty-btn:active { transform: translate(0, 0); box-shadow: none; }

/* ---------- pagination ---------- */

.work-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.page-btn {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  padding: 9px 14px;
  border: 1px solid var(--ink-hard);
  background: var(--paper-hard);
  color: var(--ink-hard);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.page-btn:hover:not(:disabled):not(.is-active) { background: rgba(13, 13, 13, 0.08); }
.page-btn.is-active { background: var(--ink-hard); color: var(--paper-hard); cursor: default; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.page-btn-nav { text-transform: uppercase; }

@media (max-width: 900px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 220px; }
}

@media (max-width: 600px) {
  .work-main { padding-top: 16px; padding-bottom: 60px; }

  /* single column: every card becomes a plain square, no wide/tall spans */
  .work-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .work-card {
    height: auto;
    aspect-ratio: 1;
  }
  .work-card:nth-child(4n+1) {
    grid-row: span 1;
  }
  .work-card:nth-child(4n+2) {
    grid-column: span 1;
  }

  .work-toolbar { flex-wrap: wrap; }
  .work-search { flex: 1 1 100%; }
  .view-toggle { margin-left: auto; }
  .view-btn-label { display: none; }
  .filter-row-label { flex-basis: 100%; margin-bottom: 2px; }
  .filter-clear-all { margin-left: 0; flex-basis: 100%; text-align: left; padding-left: 0; }
}
