/* Work page: portfolio by category. Uses the tokens from site.css. */
html { scroll-behavior: smooth; scroll-padding-top: 8rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.work-hero { padding-bottom: clamp(2rem, 5vh, 3.5rem); }
.proof { display: flex; flex-wrap: wrap; gap: clamp(1.5rem, 5vw, 4rem); margin: 2.5rem 0 0; }
.proof dt, .stats-row dt { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.proof dt { font-size: clamp(2.2rem, 1.7rem + 2vw, 3.4rem); color: var(--accent); }
.proof dd, .stats-row dd { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.92rem; }

.cats { position: sticky; top: 4.25rem; z-index: 40; background: color-mix(in oklab, var(--canvas) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-block: 1px solid var(--hair); }
.cats__row { display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; padding-block: 0.55rem; }
.cats__row::-webkit-scrollbar { display: none; }
.cats a { flex: none; text-decoration: none; font-size: 0.9rem; color: var(--ink-soft); padding: 0.45rem 0.85rem; border-radius: 999px; transition: color 160ms var(--ease), background-color 160ms var(--ease); }
.cats a[aria-current="true"] { color: var(--accent-ink); background: var(--accent); font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .cats a:not([aria-current]):hover { color: var(--ink); } }
@media (max-width: 640px) { .cats { top: 5.6rem; } }

.section-head--sub { margin: clamp(3rem, 7vh, 4.5rem) 0 1.5rem; gap: 0.4rem; }
.section-head--sub h3 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem); letter-spacing: -0.02em; }

/* case study */
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--hair); }
.stats-row div { padding: clamp(1.2rem, 3vw, 2rem); border-left: 1px solid var(--hair); }
.stats-row div:first-child { border-left: 0; }
.stats-row dt { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.8rem); }
.source { font-size: 0.82rem; color: var(--ink-faint); margin: 0.85rem 0 0; }
.source a { color: var(--ink-soft); }
@media (max-width: 640px) { .stats-row { grid-template-columns: 1fr 1fr; } .stats-row div:nth-child(3) { border-left: 0; } .stats-row div:nth-child(n+3) { border-top: 1px solid var(--hair); } }

.logic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(0.75rem, 1.6vw, 1.25rem); margin-top: clamp(2rem, 5vh, 3rem); }
.logic--plain { margin: 0 0 clamp(1.75rem, 4vh, 2.5rem); }
.logic__card { background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--hair); padding: clamp(1.25rem, 2.2vw, 1.75rem); }
.logic__card h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem); }
.logic__card p { margin: 0.5rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.logic__k { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.8rem; }
.logic__card--win { background: var(--surface-2); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 55%, transparent); }
.logic__card--win .logic__k { color: var(--accent); }
@media (max-width: 860px) { .logic { grid-template-columns: 1fr; } }

.chart { margin-top: clamp(2.5rem, 6vh, 4rem); }
.chart h3 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem); letter-spacing: -0.02em; max-width: 28ch; margin-bottom: 1.5rem; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.bars li { display: grid; grid-template-columns: 3.6rem minmax(0, 20rem) minmax(0, 1fr) 3.4rem; gap: 0.9rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--hair); }
.bars__date { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-faint); }
.bars__name b { display: block; font-weight: 500; font-size: 0.95rem; }
.bars__name i { display: block; font-style: normal; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.35; }
.bars__track { height: 0.6rem; background: color-mix(in oklab, var(--ink) 7%, transparent); border-radius: 999px; overflow: hidden; }
.bars__fill { display: block; height: 100%; border-radius: 999px; background: color-mix(in oklab, var(--accent) 55%, var(--surface-2)); }
.is-top .bars__fill { background: var(--accent); }
.bars__num { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.92rem; font-weight: 500; }
@media (max-width: 760px) { .bars li { grid-template-columns: minmax(0, 1fr) 3.2rem; row-gap: 0.4rem; } .bars__date { display: none; } .bars__track { grid-column: 1 / -1; grid-row: 2; } }

/* clips */
.clip { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; }
.clip[hidden] { display: none; }
.clip.reveal { opacity: 0; transform: translateY(14px); transition: opacity 620ms var(--ease), transform 620ms var(--ease); }
.clip.reveal.is-in { opacity: 1; transform: none; }
.clip:focus-visible .clip__frame { outline: 2px solid var(--accent); outline-offset: 3px; }
.clip__frame { position: relative; display: block; overflow: hidden; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); aspect-ratio: 9 / 16; }
.clip--wide .clip__frame { aspect-ratio: 16 / 9; }
.clip__frame img, .clip__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clip__preview { opacity: 0; transition: opacity 180ms var(--ease); }
.is-previewing .clip__preview { opacity: 1; }
.clip__play { position: absolute; left: 0.75rem; bottom: 0.75rem; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--accent); z-index: 2; transition: transform 160ms var(--ease); }
.clip__play::after { content: ""; position: absolute; left: 53%; top: 50%; transform: translate(-50%, -50%); border-style: solid; border-width: 0.42rem 0 0.42rem 0.68rem; border-color: transparent transparent transparent var(--accent-ink); }
@media (hover: hover) and (pointer: fine) { .clip:hover .clip__play { transform: scale(1.1); } }
.clip__title { display: block; margin-top: 0.75rem; font-weight: 600; font-size: 0.98rem; line-height: 1.25; }
.clip__note { display: block; margin-top: 0.15rem; font-size: 0.84rem; color: var(--ink-soft); line-height: 1.35; }

.rail { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(10.5rem, 21vw, 14.5rem); gap: clamp(0.75rem, 1.6vw, 1.25rem); overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 0.9rem; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); scrollbar-color: color-mix(in oklab, var(--ink) 26%, transparent) transparent; scrollbar-width: thin; }
.rail > * { scroll-snap-align: start; }

.filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.filter button { font: inherit; font-size: 0.9rem; cursor: pointer; color: var(--ink-soft); background: transparent; border: 1px solid var(--hair-strong); padding: 0.45rem 0.9rem; border-radius: 999px; transition: color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease); }
.filter button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }

/* storyboard */
.storyboard { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(0.6rem, 1.2vw, 1rem); }
.storyboard__n { display: block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
@media (max-width: 960px) { .storyboard { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .storyboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* photo galleries */
.shot { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: zoom-in; overflow: hidden; border-radius: var(--r); background: var(--surface); }
.shot.reveal { opacity: 0; transform: translateY(14px); transition: opacity 620ms var(--ease), transform 620ms var(--ease); }
.shot.reveal.is-in { opacity: 1; transform: none; }
.shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
@media (hover: hover) and (pointer: fine) { .shot:hover img { transform: scale(1.03); } }
.gallery { display: grid; gap: clamp(0.6rem, 1.2vw, 1rem); grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: dense; }
.gallery--cookies .shot--tall { grid-column: span 2; grid-row: span 2; }
.gallery--cookies .shot--wide { grid-column: span 2; }
.gallery--ice .shot { grid-column: span 2; aspect-ratio: 3 / 2; }
.gallery--ice .shot--sq { aspect-ratio: 1; }
@media (max-width: 760px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery--cookies .shot--tall { grid-column: span 1; grid-row: auto; aspect-ratio: 9 / 16; }
  .gallery--cookies .shot--wide, .gallery--ice .shot { grid-column: span 2; aspect-ratio: 16 / 10; }
  .gallery--ice .shot--sq { grid-column: span 1; aspect-ratio: 1; }
  .gallery--ice .shot--sq:last-child { grid-column: span 2; aspect-ratio: 16 / 10; }
}

/* community */
.community { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr); gap: clamp(1.5rem, 4vw, 3rem); }
.community h3 { font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); }
.community .muted { font-size: 0.95rem; margin: 0.4rem 0 1.25rem; }
.community__event { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(0.75rem, 1.6vw, 1.25rem); align-content: start; }
.community__event h3, .community__event .muted { grid-column: 1 / -1; }
.community__promo .clip { max-width: 17rem; }
@media (max-width: 760px) { .community, .community__event { grid-template-columns: 1fr; } .community__event .clip { margin-bottom: 1rem; } }

/* editing */
.edit { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); }
.edit__item { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: clamp(1rem, 2vw, 1.5rem); align-items: start; }
.moments { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.moments button { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); border-radius: 10px; padding: 0.7rem 0.85rem; font-size: 0.9rem; line-height: 1.35; transition: box-shadow 160ms var(--ease), transform 120ms var(--ease); }
.moments button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.moments button:active { transform: scale(0.98); }
.moments b { display: block; font-family: var(--mono); font-weight: 500; font-size: 0.74rem; color: var(--accent); margin-bottom: 0.2rem; }
@media (hover: hover) and (pointer: fine) { .moments button:hover { box-shadow: inset 0 0 0 1px var(--accent); } }
@media (max-width: 960px) { .edit { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .edit__item { grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); } }

/* before / after */
.ba-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(0.6rem, 1.2vw, 1rem); }
.ba-grid--wide { grid-template-columns: 1fr 1fr; margin-top: clamp(1rem, 2vw, 1.5rem); }
.ba { margin: 0; }
.ba figcaption { margin-top: 0.6rem; font-size: 0.88rem; color: var(--ink-soft); }
.ba__stage { position: relative; overflow: hidden; border-radius: var(--r); background: var(--surface); aspect-ratio: 9 / 16; touch-action: pan-y; }
.ba--wide .ba__stage { aspect-ratio: 3 / 2; }
.ba__stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba__line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.ba__line::after { content: ""; position: absolute; top: 50%; left: 50%; width: 2rem; height: 2rem; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent); box-shadow: 0 2px 10px rgb(0 0 0 / 0.5); }
.ba__tag { position: absolute; top: 0.6rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.2rem 0.45rem; border-radius: 4px; background: rgb(11 10 9 / 0.72); color: var(--ink); pointer-events: none; }
.ba__tag--l { left: 0.6rem; }
.ba__tag--r { right: 0.6rem; }
.ba__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.ba__stage:has(.ba__range:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 960px) { .ba-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ba-grid { grid-template-columns: 1fr 1fr; } .ba-grid--wide { grid-template-columns: 1fr; } }

/* slots still to fill (hidden on the live copy) */
.process__row { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--hair); align-items: center; }
.process__row h4 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.process__slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.slot { aspect-ratio: 16 / 9; border: 1px dashed var(--hair-strong); border-radius: 10px; display: grid; place-content: center; justify-items: center; gap: 0.4rem; padding: 0.5rem; text-align: center; }
.slot__label { font-size: 0.85rem; color: var(--ink-soft); }
@media (max-width: 640px) { .process__row { grid-template-columns: 1fr; } }

.clients-wall .clients { max-width: 44rem; }
.also { margin: 1.25rem 0 0; color: var(--ink-soft); }

/* viewer */
.viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; color: var(--ink); }
.viewer::backdrop { background: rgb(7 6 5 / 0.92); }
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; padding: clamp(0.75rem, 3vh, 2rem); gap: 0.6rem; }
.viewer__stage { min-height: 0; height: 100%; width: 100%; display: grid; place-items: center; }
.viewer__stage video, .viewer__stage img { max-width: 100%; max-height: 100%; border-radius: 10px; object-fit: contain; min-height: 0; }
.viewer__stage video { height: 100%; }
.viewer__title { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }
.viewer__close { position: fixed; top: 0.75rem; right: 0.75rem; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--hair-strong); background: rgb(23 19 15 / 0.85); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }

.community__lead { grid-column: 1 / -1; margin-bottom: 1rem; }
@media (max-width: 760px) {
  .gallery--cookies .shot:nth-child(4) { grid-column: span 2; aspect-ratio: 16 / 10; }
}
@media (max-width: 960px) { .ba-grid:not(.ba-grid--wide) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ba-grid:not(.ba-grid--wide) { grid-template-columns: 1fr 1fr; } .ba-grid:not(.ba-grid--wide) .ba:last-child { grid-column: 1 / -1; } .ba-grid:not(.ba-grid--wide) .ba:last-child .ba__stage { aspect-ratio: 1; } }

/* simple topic layout: a short line on what the videos are for, then every clip */
.topic + .topic { border-top: 1px solid var(--hair); }
.topic { padding-block: clamp(2.75rem, 7vh, 4.5rem); }
.topic__head { display: grid; gap: 0.5rem; max-width: 40rem; }
.topic__head .eyebrow { margin: 0; }
.topic__head h2 { margin: 0; font-size: clamp(1.6rem, 1.25rem + 1.6vw, 2.4rem); letter-spacing: -0.025em; line-height: 1.1; }
.topic__head h2 em { font-style: normal; color: var(--accent); }
.topic__head > p:not(.eyebrow):not(.source) { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.5; }
.topic__head .source { margin: 0.1rem 0 0; }
.topic__count { margin: 1.4rem 0 0.75rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.topic__count span { display: none; }
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); grid-auto-flow: dense; gap: clamp(1rem, 2vw, 1.5rem) clamp(0.75rem, 1.6vw, 1.25rem); align-items: start; }
.clips .clip--wide { grid-column: span 2; }
.work-hero h1 em { font-style: normal; color: var(--accent); }
@media (max-width: 760px) {
  .topic__count span { display: inline; }
  .clips { display: flex; gap: 0.75rem; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) 0.6rem; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .clips::-webkit-scrollbar { display: none; }
  .clips .clip { flex: none; width: 40vw; scroll-snap-align: start; }
  .clips .clip--wide { width: 74vw; }
}
/* the top bar no longer sticks, so the topic chips sit at the very top */
.cats, .cats { top: 0; }
@media (max-width: 640px) { .cats { top: 0; } }
html { scroll-padding-top: 3.5rem; }

/* phones: a compact 4-column grid instead of the swipe row */
@media (max-width: 760px) {
  .topic__count span { display: none; }
  .clips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem 0.4rem; overflow: visible; margin-inline: 0; padding: 0; }
  .clips .clip { width: auto; }
  .clips .clip--wide { width: auto; grid-column: span 2; }
  .clips .clip__frame { border-radius: 8px; }
  .clips .clip__play { left: 0.35rem; bottom: 0.35rem; width: 1.35rem; height: 1.35rem; }
  .clips .clip__play::after { border-width: 0.26rem 0 0.26rem 0.42rem; }
  .clips .clip__title { margin-top: 0.35rem; font-size: 0.7rem; line-height: 1.2; }
  .clips .clip__note { display: none; }
}
.work-note { margin: 0.9rem 0 0; max-width: 36rem; font-size: 0.9rem; color: var(--ink-faint); }
