/* ===========================================================================
   Credits — the public credits board and client CV, portfolio item pages
   (/work/{slug}) and the board editor in the admin. Tokens from flayr.css
   only; no borders, depth from surface contrast.
   ======================================================================== */

/* ------------------------------------------------------------ hero ---- */
.credits-hero { padding-bottom: clamp(24px, 4vw, 40px); }
.credits-hero .figures { margin-top: clamp(32px, 5vw, 56px); }

/* Sticky filter bar under the global nav: segmented control + search */
.credits-filter {
  position: sticky; top: 52px; z-index: 80;
  background: rgba(250, 250, 252, .82);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 12px 0;
}
.credits-filter-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.credits-filter .segmented { background: var(--surface-3); }
.credits-filter .search { flex: 1 1 240px; max-width: 360px; margin-left: auto; }
.credits-filter .search input { background: var(--surface); min-height: 38px; }
.credits-count { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- year groups ---- */
.credits-years { padding-top: 16px; padding-bottom: clamp(64px, 10vw, 120px); }  /* sides come from .container-wide */
.credits-year { padding-top: clamp(32px, 5vw, 56px); scroll-margin-top: 120px; }
.credits-year-title { display: flex; align-items: baseline; gap: 14px; font-size: var(--fs-2); margin-bottom: 20px; font-variant-numeric: tabular-nums; }
.credits-year-title span { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); letter-spacing: -0.01em; }
.credits-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }

/* One role on one job */
.credit {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-radius: var(--r-lg); padding: 22px 22px 20px;
  scroll-margin-top: 130px; transition: transform .3s var(--ease);
}
.credit:target { box-shadow: var(--ring); }
.credit-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 8px; }
.credit-meta time { font-variant-numeric: tabular-nums; }
.credit-cat { color: var(--teal-ink); font-weight: 500; text-align: right; }
.credit-client { font-size: var(--fs-4); line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
.credit-role { font-size: var(--fs-sm); color: var(--ink); font-weight: 500; margin: 2px 0 0; }
.credit-project { font-size: var(--fs-sm); color: var(--text); margin: 0; }
.credit-desc { font-size: var(--fs-sm); color: var(--muted); margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.credit-foot { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: auto; padding-top: 14px; font-size: var(--fs-xs); }
.credit-foot a:not(.link-arrow) { color: var(--muted); }
.credit-foot a:not(.link-arrow):hover { color: var(--ink); }
.credit-foot .link-arrow { margin-left: auto; font-size: var(--fs-xs); }

/* ------------------------------------------------------------- CV ---- */
.cv-list { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.cv-list .credit { padding: 26px 28px; }
.cv-list .credit-desc { -webkit-line-clamp: unset; display: block; }
.cv-actions { display: flex; justify-content: center; gap: 12px; margin-top: 28px; }

@media print {
  .credits-filter, .cv-actions { display: none !important; }
  .credit { break-inside: avoid; padding: 12px 0; background: none; }
  .credits-hero { padding: 0 0 16px; }
}

/* ------------------------------------------------------ work pages ---- */
.work-hero { padding-bottom: clamp(28px, 4vw, 48px); }
.work-hero .eyebrow { font-size: var(--fs-sm); }
.work-media { border-radius: var(--r-xl); overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; }
.work-media img, .work-media video { width: 100%; height: 100%; object-fit: cover; }
.work-media-empty { display: grid; place-items: center; background: var(--mint-soft); color: var(--teal-ink); font-size: var(--fs-3); font-weight: 600; letter-spacing: -0.02em; }
.work-facts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.work-fact { background: var(--surface); border-radius: var(--r-lg); padding: 20px 22px; }
.work-fact dt { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 6px; }
.work-fact dd { margin: 0; font-size: var(--fs-body); font-weight: 600; color: var(--ink); letter-spacing: -0.015em; }
.work-fact dd span { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.work-story { font-size: var(--fs-lead); line-height: 1.5; color: var(--text); margin: 0 auto; }
.work-story p { margin-bottom: .9em; }
.work-gallery { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.work-gallery figure { margin: 0; }
.work-gallery figure:only-child, .work-gallery figure:nth-child(3n+1):last-child { grid-column: 1 / -1; }
.work-gallery .media { aspect-ratio: 3 / 2; border-radius: var(--r-xl); }
.work-gallery figcaption { font-size: var(--fs-xs); color: var(--muted); margin-top: 8px; text-align: center; }
@media (max-width: 640px) { .work-gallery { grid-template-columns: minmax(0, 1fr); } }
.work-credit { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--surface); border-radius: var(--r-xl); padding: clamp(22px, 3vw, 32px); }
.work-credit .grow p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.work-more .media { aspect-ratio: 16 / 10; margin-bottom: 14px; }
.work-more a { color: inherit; text-decoration: none; display: block; }
.work-more a:hover { text-decoration: none; }
.work-more a .media img { transition: transform .6s var(--ease); }
.work-more a:hover .media img { transform: scale(1.03); }
.work-more h3 { font-size: var(--fs-body); margin: 0 0 2px; }
.work-more p { font-size: var(--fs-sm); color: var(--muted); margin: 0; }

/* =========================================================== admin ==== */

/* Board editor: year rows × category columns, as on the old board */
.board-wrap { overflow: auto; max-height: calc(100vh - 210px); border-radius: var(--r-lg); background: var(--surface); overscroll-behavior: contain; }
.board { display: grid; min-width: min-content; }
.board-corner, .board-col, .board-year { background: var(--surface); }
.board-corner { position: sticky; top: 0; left: 0; z-index: 4; }
.board-col { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 14px 10px 10px 14px; box-shadow: inset 0 -1px 0 var(--hairline); }
.board-col h2 { font-size: var(--fs-sm); margin: 0; letter-spacing: -0.01em; }
.board-col .count { font-size: var(--fs-2xs); color: var(--faint); font-variant-numeric: tabular-nums; }
.board-col[draggable="true"] { cursor: grab; }
.board-col.is-dragging { opacity: .45; }
.board-col.is-over { background: var(--mint-soft); }
.board-col.is-orphan h2 { color: var(--warn); }
.board-year { position: sticky; left: 0; z-index: 2; padding: 16px 8px 0 16px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 0 var(--hairline); }
.board-cell { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 64px; box-shadow: inset 0 1px 0 var(--hairline); transition: background .15s; }
.board-cell.is-over { background: var(--mint-soft); }
.board-add { border: 0; background: none; color: var(--faint); font-size: var(--fs-2xs); padding: 6px; border-radius: var(--r-sm); text-align: left; opacity: 0; transition: opacity .15s, background .15s; }
.board-cell:hover .board-add, .board-add:focus-visible { opacity: 1; }
.board-add:hover { background: var(--surface-2); color: var(--ink); }
.board-block { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; cursor: pointer; font-size: var(--fs-xs); line-height: 1.35; transition: background .15s, transform .15s var(--ease); }
.board-block:hover { background: var(--surface-3); }
.board-block[draggable="true"] { cursor: grab; }
.board-block.is-dragging { opacity: .4; }
.board-block strong { display: block; font-size: var(--fs-sm); color: var(--ink); font-weight: 600; }
.board-block .role { color: var(--ink); }
.board-block .proj, .board-block .date { color: var(--muted); }
.board-block .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.board-block .tags .pill { font-size: 10px; padding: 1px 8px; }
.board-block.is-hidden { display: none; }

/* Draggable lists: client CV, portfolio items, gallery images */
.sort-list { list-style: none; margin: 0; padding: 0; }
.sort-list > li { display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: var(--surface); }
.sort-list > li + li { box-shadow: inset 0 1px 0 var(--hairline); }
.sort-list > li.is-dragging { opacity: .45; }
.sort-list > li.is-over { background: var(--mint-soft); }
.sort-handle { cursor: grab; color: var(--faint); display: grid; place-items: center; width: 24px; }
.sort-handle:hover { color: var(--ink); }
.sort-thumb { width: 96px; flex: none; aspect-ratio: 16 / 10; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.sort-thumb img { width: 100%; height: 100%; object-fit: cover; }

.picker-results { max-height: 50vh; overflow-y: auto; margin-top: 12px; }
.picker-results .list > li { padding: 10px 2px; }

.gallery-edit > li { align-items: flex-start; padding: 14px 0; background: none; }
.gallery-edit .sort-thumb { width: 140px; }
.gallery-edit .fields { display: grid; gap: 8px; flex: 1; min-width: 0; }
.cover-preview { width: 100%; max-width: 360px; aspect-ratio: 16 / 10; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.slug-field { display: flex; align-items: center; gap: 6px; }
.slug-field span { color: var(--muted); font-size: var(--fs-sm); }
