/* Work: a full-width reel of project cards (screenshots that scroll on
   hover) and an in-page viewer with the whole homepage, details and a link
   out, so nobody has to leave the page (js/work.js). */

.wk, .vw { --line: color-mix(in srgb, var(--ink) 12%, transparent); --dim: color-mix(in srgb, var(--ink) 58%, transparent); font-family: var(--font); color: var(--ink); }
.wk .mono, .vw .mono { font: 600 11px/1.3 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- section ---------- */
.wk { --gut: 24px; padding: var(--section-gap) 0 0; overflow: hidden; }
.wk-head { box-sizing: border-box; }
.wk-head { margin: 0 0 24px; padding: 0 var(--gut); display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
/* the "Selected work" heading is kept for screen readers and the page outline, but not shown */
.wk-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wk-side { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.arw { all: unset; cursor: pointer; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 18px; transition: border-color .2s, color .2s, opacity .2s; }
.arw:hover { border-color: var(--accent); color: var(--accent); }
.arw:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.arw:disabled { opacity: .25; cursor: default; border-color: var(--line); color: inherit; }
.arws { display: flex; gap: 8px; }

/* ---------- the reel ---------- */
/* full width: heading and reel run to the same small gutter */
.rl { display: flex; align-items: flex-start; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: var(--gut);
  padding: 0 var(--gut) 36px; overflow-y: hidden; cursor: grab; }  /* sideways only */
/* a thin, always-visible scrollbar under the cards: a gold thumb on a faint
   track, inset to the page gutters (Chrome / Safari) */
.rl::-webkit-scrollbar { height: 4px; }
.rl::-webkit-scrollbar-track { margin: 0 var(--gut); border-radius: 4px; background: var(--line); }
.rl::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--accent); }
.rl::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent), #fff 20%); }
/* Firefox has no track inset, just the colours */
@supports not selector(::-webkit-scrollbar) { .rl { scrollbar-width: thin; scrollbar-color: var(--accent) var(--line); } }
.rl.drag { cursor: grabbing; scroll-snap-type: none; }
.rl.drag .card { pointer-events: none; }

/* grid layout (.wk.grid) on desktops and tablets: every card on show, three
   to a row (two on tablets), no sideways scrolling, so no arrows or scrollbar.
   Phones keep the swipeable reel. Remove the "grid" class from the section
   to use the reel everywhere. */
@media (min-width: 641px) {
  .wk.grid .wk-head { display: none; }
  .wk.grid .rl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 64px 24px; overflow: visible; padding-bottom: 0; cursor: auto; scroll-snap-type: none; }
  .wk.grid .card { flex: none; }
}
@media (min-width: 641px) and (max-width: 1100px) { .wk.grid .rl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* phones: iOS Safari hides scrollbars until you scroll and ignores the styles
   above, so the reel gets a drawn one instead (js/work.js moves the thumb) */
.rl-bar { display: none; }
@media (max-width: 640px) {
  .rl { padding-bottom: 32px; scrollbar-width: none; }
  .rl::-webkit-scrollbar { display: none; }
  .rl-bar { display: block; height: 4px; margin: 0 var(--gut); border-radius: 4px; background: var(--line); overflow: hidden; }
  .rl-bar span { display: block; height: 100%; border-radius: 4px; background: var(--accent); will-change: transform; }
}

.card { all: unset; box-sizing: border-box; flex: 0 0 clamp(280px, calc((100vw - var(--gut) * 2 - 72px) / 3.4), 640px); scroll-snap-align: start; cursor: none; display: block; position: relative; }
/* cascading reveal (js/work.js adds .rv, then .in with a per-card delay) */
.card.rv { opacity: 0; transform: translateY(40px); transition: opacity .7s, transform .9s cubic-bezier(.2,.8,.2,1); }
.card.rv.in { opacity: 1; transform: none; }
.card:focus-visible .shot { outline: 2px solid var(--accent); outline-offset: 4px; }
/* the screenshot tile: no browser chrome, just the page, scrolling on hover
   (cards are buttons, so their parts are spans set to block) */
.shot, .meta { display: block; }
.shot { position: relative; aspect-ratio: 1 / 1.1; border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--bg), #fff 6%);
  box-shadow: 0 0 0 1px var(--line), 0 30px 60px -34px rgba(0,0,0,.7); transform: translateZ(0); }
.shot img { display: block; width: 100%; height: auto; will-change: transform; }   /* moved by js/work.js on hover */
.meta { margin-top: 24px; }
.meta b { display: block; font: 900 clamp(32px, 3vw, 50px)/.95 var(--font); font-variation-settings: "wdth" 112; letter-spacing: -.02em; text-transform: uppercase; transition: color .25s; }
.card:hover .meta b { color: var(--accent); }
.meta span { display: block; margin-top: 14px; color: var(--dim); }
.meta .mono { font-size: clamp(13px, 1.05vw, 16px); }
/* the role reads as a line of text: main font, normal spacing, sentence case */
.meta .role { margin-top: 10px; font: 500 clamp(14px, 1vw, 15px)/1.35 var(--font); letter-spacing: -.005em; text-transform: none; color: color-mix(in srgb, var(--ink) 72%, transparent); }
/* the emphasised "@": the site's accent italic (as on "bold" / "big brands"),
   a size up from the text; line-height 0 so it doesn't push the line apart */
.at { font: italic 300 1.6em/0 var(--font); font-variation-settings: "wdth" 100; letter-spacing: 0; text-transform: none; color: var(--accent); vertical-align: -.06em; margin: 0 .06em; }
.meta .at { display: inline; margin-top: 0; color: var(--accent); }
/* order under the photo: name, role @ Adcetera, then platform and year in the accent colour */
.meta .plat { margin-top: 6px; font: 600 clamp(14px, 1.1vw, 16px)/1.35 var(--font); letter-spacing: 0; text-transform: none; color: var(--accent); }
.card.soon { cursor: default; }
.card.soon .shot { box-shadow: none; border: 1.5px dashed color-mix(in srgb, var(--ink) 18%, transparent); background: transparent; display: grid; place-items: center; }
.card.soon .shot b { font: 900 64px/1 var(--font); color: color-mix(in srgb, var(--ink) 10%, transparent); }
.card.soon .meta b { color: color-mix(in srgb, var(--ink) 35%, transparent); }


/* a round "view" cursor that follows the pointer over live projects */
.cur { position: fixed; z-index: 90; left: 0; top: 0; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%; background: var(--accent); color: var(--deep);
  display: grid; place-items: center; font: 800 12px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; pointer-events: none;
  transform: scale(0); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.cur.on { transform: scale(1); }
.rl.drag ~ .cur, body.viewing .cur { transform: scale(0); }
@media (hover: none) { .cur { display: none; } .card { cursor: pointer; } }

/* ---------- viewer ---------- */
.vw { position: fixed; inset: 0; z-index: 150; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); gap: 0;
  background: var(--bg); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
/* visible straight away on open (so focus can move in); fades out on close */
.vw.open { opacity: 1; visibility: visible; transition: opacity .35s, visibility 0s; }
/* the full page, scrolled by the visitor; no browser chrome */
.vw-shot { position: relative; margin: 20px 0 20px 20px; border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--bg), #fff 4%); box-shadow: 0 0 0 1px var(--line); }
.vw-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.vw-scroll img { display: block; width: 100%; height: auto; }
/* the page dissolves into the background at the bottom of the frame, hinting
   there's more below; it clears once the visitor starts scrolling */
.vw-shot::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--bg) 85%, transparent)); transition: opacity .5s; }
.vw-shot.scrolled::after { opacity: 0; }

.vw-info { padding: 24px 40px 24px 44px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.vw-info > * { flex-shrink: 0; }   /* long projects scroll the column instead of squashing the button */
.vw-top { display: flex; justify-content: flex-end; align-items: center; gap: 20px; }   /* previous / next, then close: always in reach */
.vw-info h3 { margin: auto 0 18px; padding-top: 0; font: 900 clamp(44px, 5vw, 84px)/.9 var(--font); font-variation-settings: "wdth" 112; letter-spacing: -.03em; text-transform: uppercase; }
.vw-info p { margin: 0 0 26px; font: 400 18px/1.55 var(--font); color: color-mix(in srgb, var(--ink) 82%, transparent); max-width: 46ch; }
/* role, platform and year as a list between hairlines; the role brightest */
.facts { margin: 0 0 30px; border-top: 1px solid var(--line); }
.facts > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dd { margin: 0; font: 500 17px/1.3 var(--font); color: color-mix(in srgb, var(--ink) 70%, transparent); }
.facts .role dd { color: var(--ink); }
.visit { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 24px; border-radius: 6px; background: var(--accent); color: var(--deep); text-decoration: none;
  font: 800 12px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; }
.visit:hover { filter: brightness(1.08); }
.visit .ic { width: 26px; height: 26px; margin-right: -4px; }
.arw .ic { width: 22px; height: 22px; }
/* the viewer's next / previous: just big arrows, no circles */
.vw-nav .arw { width: 56px; height: 56px; border: 0; }
.vw-nav .arw .ic { width: 40px; height: 40px; }
.vw-nav .arw:hover .ic.left { transform: translateX(3px); }   /* rotated, so +x points left */
/* every project as a thumbnail, for jumping around */
/* the details are centred between the arrows and close above and the thumbnails at the bottom */
.thumbs { display: flex; gap: 8px; margin-top: auto; }
.vw-top { margin-bottom: 32px; } .visit { margin-bottom: 32px; }   /* least room around the centred details */
.thumb { all: unset; cursor: pointer; flex: 1; max-width: 64px; aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden; opacity: .4; box-shadow: 0 0 0 1px var(--line); transition: opacity .2s, box-shadow .2s; }
.thumb img { width: 100%; display: block; }
.thumb:hover { opacity: .8; }
.thumb[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vw-nav { display: flex; align-items: center; gap: 4px; }

@media (max-width: 860px) {
  .wk { --gut: 16px; }
  .wk-head { margin: 0; }  /* nothing visible in it on phones (arrows hidden) */
  .wk-side .arws { display: none; }
  .rl { gap: 14px; }
  .card { flex-basis: 78vw; }
  .vw { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .vw-shot { margin: 88px 12px 0; }   /* clear of the arrows and close above */
  .vw-info { padding: 16px; overflow: visible; }
  .vw-top { position: absolute; top: 12px; left: 16px; right: 12px; }
  .vw-nav { position: fixed; right: 12px; bottom: 16px; }   /* in thumb's reach, level with Visit site */
  .vw-info h3 { margin: 0 0 8px; padding: 0; font-size: 38px; }
  /* phones drop the summary and thumbnails; the role (always "@ Adcetera"), platform and year stay */
  .vw-info p, .thumbs { display: none; }
  .facts { margin: 0 0 14px; }
  .facts > div { padding: 9px 0; }
  .visit { height: 46px; margin-bottom: 0; }
  }
/* shorter laptop screens: tighter type and spacing so the details,
   button and thumbnails fit without scrolling the column */
@media (min-width: 861px) and (max-height: 850px) {
  .vw-info h3 { margin-bottom: 12px; font-size: clamp(40px, 4.2vw, 64px); }
  .vw-info p { margin-bottom: 18px; font-size: 16px; }
  .facts { margin-bottom: 22px; }
  .facts > div { padding: 8px 0; }
  .facts dd { font-size: 16px; }
  .visit { height: 46px; }
  .thumb { max-width: 48px; }
}
@media (prefers-reduced-motion: reduce) { .vw, .cur { transition: none !important; } }
