:root {
  --pad: clamp(18px, 2.6vw, 44px);
  --fg: #111;
  --line: #d8dadc;
  --muted: #93969a;
  --soft: #65686c;
  --bg: #f0f1f2;
  --fs: 12px;
  --row: clamp(36px, 5.6vh, 46px);
  --slide-h: min(max(340px, 36vw), 64vh);
  --gap: 12px;
  --cols: 24% 48% 1fr 22px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-feature-settings: "calt" 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--fs);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { opacity: .5; }
.tile:hover { opacity: 1; }
.bar a { font-weight: 500; }

/* fixed header: name/contact + column titles in one block */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  transition: background-color .3s ease;
  padding-top: clamp(10px, 2vh, 18px);
}
.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 var(--pad) clamp(10px, 2vh, 18px);
}

main { padding: 0 0 120px; }

/* table rows */
.row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  min-height: var(--row);
}
.row.head {
  padding: 0 var(--pad) clamp(5px, 1vh, 8px);
  font-weight: 400;
  color: var(--muted);
  min-height: 0;
}
.project { border-bottom: 1px solid var(--line); margin: 0 var(--pad); }
.project > .row { cursor: pointer; user-select: none; }
.project > .row:focus { outline: none; }
.project > .row:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
.project > .row:hover .c-client,
.project > .row:hover .c-role { opacity: .55; }
.project .c-client { font-weight: 500; text-transform: lowercase; }
.project .c-role { color: var(--soft); }
.project .c-year { color: var(--soft); font-variant-numeric: tabular-nums; }
.project.open .c-role, .project.open .c-year { color: var(--fg); }
.c-role { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.c-toggle { justify-self: end; line-height: 1; transition: transform .45s var(--ease); }
/* seen: once a project has been opened and closed, its line gets a neon highlighter mark */
.project > .row { position: relative; }
.project > .row::after {
  content: ''; position: absolute; left: -6px; right: -6px; top: 50%;
  height: calc(1.35em + 8px); transform: translateY(-50%) scaleX(0); transform-origin: left center;
  background: rgba(57, 255, 20, .42); mix-blend-mode: multiply;
  pointer-events: none; transition: transform .45s var(--ease);
}
.project.seen:not(.open) > .row::after { transform: translateY(-50%) scaleX(1); }
.project.open .c-toggle { transform: rotate(45deg); }
/* the open project's row stays pinned under the header while its content scrolls past */
.project.open > .row {
  position: sticky; top: var(--top-h, 90px); z-index: 5;
  background: var(--bg);
}
.project.open > .row::before {          /* cover the full width, incl. the bleeding slider */
  content: ''; position: absolute; z-index: -1;
  top: 0; bottom: 0; left: calc(-1 * var(--pad)); right: calc(-1 * var(--pad));
  background: var(--bg);
}

/* accordion */
.panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .7s var(--ease);
  margin: 0 calc(-1 * var(--pad));          /* bleed both sides */
}
.project.open .panel { grid-template-rows: 1fr; }
.panel-inner { overflow: hidden; min-height: 0; }

.desc {
  display: grid;
  grid-template-columns: var(--cols);
  padding: clamp(6px, 1.6vh, 14px) var(--pad) clamp(14px, 3.6vh, 32px);
  color: var(--muted);
  line-height: 1.45;
}
.desc p { grid-column: 2; padding-right: 48px; }

/* slider */
.slider {
  position: relative;
  height: var(--slide-h);
  min-height: 160px;
  max-height: 94vh;
  overflow: hidden;
  touch-action: pan-y;
}
/* resize zone: bottom edge of the images down to the line — drag to set the height */
.resizer {
  position: relative; z-index: 2;
  height: 30px; margin-top: -6px;
  cursor: ns-resize;
  touch-action: none;
}
body.resizing, body.resizing * { cursor: ns-resize !important; user-select: none; }
.slider.draggable { cursor: grab; }
.slider.dragging { cursor: grabbing; }
.track {
  position: absolute; top: 0; left: 0; height: 100%;
  display: flex; gap: var(--gap);
  will-change: transform;
}
.slide {
  position: relative; flex: 0 0 auto; height: 100%;
  background: #e3e5e7;
  overflow: hidden;
}
.slide img, .slide video {
  display: block; width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}

#sentinel, #grid-sentinel { height: 1px; }

/* grid: header turns transparent once you scroll; name, icons, about and contact sit on light
   frosted-glass chips, all the same height (drawn behind each item so nothing moves) */
.bar > a, .bar .views, .bar .contact, .bar .about-btn, .bar .about-close, .bar .gfilter { position: relative; isolation: isolate; }
.bar > a::before, .bar .views::before, .bar .contact::before, .bar .about-btn::before, .bar .about-close::before, .bar .gfilter::before {
  content: ''; position: absolute; z-index: -1; left: -8px; right: -8px; top: 50%; height: 24px; transform: translateY(-50%);
  background: rgba(240, 241, 242, .72);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  opacity: 0; transition: opacity .3s ease; pointer-events: none;
}
.bar .views::before { left: -6px; right: -6px; }
body.view-grid.scrolled .top { background: transparent; }
body.view-grid.scrolled .bar > a::before,
body.view-grid.scrolled .bar .views::before,
body.view-grid.scrolled .bar .contact::before,
body.view-grid.scrolled .bar .about-btn::before,
body.view-grid.scrolled .bar .about-close::before,
body.view-grid.scrolled .bar .gfilter::before { opacity: 1; }

/* view selector */
.right { display: flex; align-items: center; gap: 28px; }
.views { display: flex; gap: 10px; }
.views button {
  display: grid; place-items: center; width: 18px; height: 18px;
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted);
  transition: color .2s;
}
.views button:hover, .views button.active { color: var(--fg); }
.views svg { width: 12px; height: 12px; }
.views svg rect { fill: currentColor; }
.views svg path { stroke: currentColor; stroke-width: 1.2; fill: none; }

/* grid view: full bleed masonry, locked columns */
:root { --gcols: 5; }
#grid { display: none; position: relative; width: 100%; overflow: hidden; }
.grid-inner { position: absolute; left: 0; top: 0; width: 100%; }
#grid.edge, body.col-resizing, body.col-resizing * { cursor: col-resize !important; }
body.col-resizing { user-select: none; }
html { overflow-anchor: none; }
body.view-grid #grid { display: block; }
body.view-grid #list, body.view-grid #sentinel, body.view-grid .row.head { display: none; }
body:not(.view-grid) #grid-sentinel { display: none; }
body.view-grid main { padding-bottom: 0; }
body.view-grid .bar { padding-bottom: clamp(10px, 2vh, 18px); }
.tile { position: absolute; overflow: hidden; background: #e3e5e7; display: block; -webkit-user-drag: none; }
.tile img, .tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
#grid.animating .tile { transition: left .22s cubic-bezier(.2,.7,.1,1), top .22s cubic-bezier(.2,.7,.1,1), width .22s cubic-bezier(.2,.7,.1,1), height .22s cubic-bezier(.2,.7,.1,1); }
/* resize seam: a visible line on the edge being grabbed */
.seam {
  position: fixed; z-index: 20; width: 2px;
  background: var(--fg); pointer-events: none;
  opacity: 0; transition: opacity .2s ease;
}
.seam::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: var(--fg);
  -webkit-mask: none;
}
.seam::before {
  content: '\2194'; position: absolute; top: 50%; left: 50%; z-index: 1;
  transform: translate(-50%, -52%); color: var(--bg); font-size: 13px; line-height: 1;
}
.seam.on { opacity: .9; }
@media (max-width: 1200px) { :root { --gcols: 4; } }
@media (max-width: 900px)  { :root { --gcols: 3; } }
@media (max-width: 560px)  { :root { --gcols: 3; } .right { gap: 18px; } }

/* mobile */
@media (max-width: 760px) {
  :root { --fs: 12.5px; --pad: 18px; --row: 50px; --slide-h: min(115vw, 70vh); --gap: 8px; }
  .top { padding-top: 22px; }
  .bar { padding-bottom: 20px; }
  /* the year column starts where "about" starts in the header (--year-x is measured in app.js) */
  .row { grid-template-columns: calc(var(--year-x, 62%) - 12px) 1fr 22px; column-gap: 12px; padding: 12px 0; }
  .row .c-year { justify-self: start; text-align: left; }
  .row.head { padding: 0 var(--pad) 8px; }
  .row.head .c-role { display: none; }
  .project .row .c-client { grid-column: 1; grid-row: 1; }
  .project .row .c-role { grid-column: 1; grid-row: 2; color: var(--muted); gap: 2px 12px; margin-top: 5px; }
  .project .row .c-year { grid-column: 2; grid-row: 1; }
  .project .row .c-toggle { grid-column: 3; grid-row: 1; }
  .row.head .c-year { grid-column: 2; }
  .desc { display: block; }
  .project > .row::after { top: 6px; bottom: 6px; height: auto; transform: scaleX(0); }
  .project.seen:not(.open) > .row::after { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .c-toggle { transition: none; }
}

/* tags */
.c-role .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px;
  transform: scale(0); width: 0; margin-right: 0; transition: transform .3s var(--ease), width .3s var(--ease), margin .3s var(--ease); }
.project.open .c-role .dot { transform: scale(1); width: 7px; margin-right: 6px; }
.stags { position: absolute; left: 10px; top: 10px; display: flex; gap: 0; z-index: 2; transition: opacity .25s ease; }
@media (hover: hover) { .stags { opacity: 0; } .slide:hover .stags { opacity: 1; } }
.stags span { display: inline-flex; align-items: center; color: #000;
  font-size: 10px; line-height: 1; padding: 5px; border-radius: 9px; cursor: default; }
.stags .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.stags b { font-weight: 400; white-space: nowrap; overflow: hidden; max-width: 0; opacity: 0; margin-left: 0;
  transition: max-width .32s var(--ease), opacity .2s ease, margin .32s var(--ease); }
.stags span:hover { padding-right: 8px; }
.stags span:hover b { max-width: 140px; opacity: 1; margin-left: 5px; }
.stags span { transition: padding .32s var(--ease); }
.stags.on-dark span { color: #fff; }
/* the o's of the name are the tag dots */
.name .o { display: inline-block; width: .52em; height: .52em; border-radius: 50%; background: var(--c); margin: 0 .04em; vertical-align: -.02em; }
/* row dots are grey; they take their colour while hovering a piece with that tag. Dots on images keep their colour */
.dot { background: var(--c); }
.c-role .dot { background: transparent; box-shadow: inset 0 0 0 1px #b4b7ba; transition: transform .3s var(--ease), width .3s var(--ease), margin .3s var(--ease), background-color .2s ease, box-shadow .2s ease; }
.c-role .dot.lit { background: var(--c); box-shadow: inset 0 0 0 1px var(--c); }

/* loose images in the grid: no link */
.tile.nolink { cursor: default; }

/* sites, mobiles and stories are never cropped: shown whole on their own edge colour */
.tile.whole { background: var(--bg, #fff); }
.tile.whole img, .tile.whole video { object-fit: contain; }

/* about panel: one default grid column wide, under the fixed header; the page (not the header)
   moves aside to make room. Same type as the list, no borders. */
:root { --about-w: calc(100vw / var(--gcols, 5)); --about-top: 0px; }
.bar .about-btn { font: inherit; font-weight: 500; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.bar { position: relative; }
/* close arrow: in the header row, lined up with the left edge of the photo */
.bar .about-close { display: none; align-items: center; background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
  position: absolute !important; left: calc(100% - var(--about-w) + var(--pad)); top: 50%; transform: translateY(calc(-50% - clamp(5px, 1vh, 9px))); }
body.about-on .bar .about-close { display: inline-flex; }
body.about-on .bar .views, body.about-on .bar .about-btn { display: none; }
main, .row.head { transition: padding-right .52s var(--ease), margin-right .52s var(--ease); }
/* gaps: list rows → photo, photo → screen edge, photo → bottom are all var(--pad) */
body.about-open main { padding-right: calc(var(--about-w) - var(--pad)); }
body.about-open .row.head { margin-right: calc(var(--about-w) - var(--pad)); }
body.view-grid.about-open main { padding-right: var(--about-w); }
body.about-snap main { transition: none; }
#grid.about-anim { overflow: visible; }
.about {
  position: fixed; top: var(--about-top); right: 0; bottom: 0; z-index: 9; width: var(--about-w);
  background: var(--bg);
  transform: translateX(100%); transition: transform .52s var(--ease);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
}
.about::-webkit-scrollbar { display: none; }
.about.open { transform: none; }
.about-in { padding: 0 var(--pad) var(--pad); }   /* photo + text sit at the bottom, same padding left / bottom / right */
.about-ph { display: block; width: 100%; height: auto; margin-bottom: 26px; }
.about-ph.empty { aspect-ratio: 4 / 5; background: #e3e5e7; }
.about-h { font-weight: 500; margin-bottom: 2px; }
.about-in p { color: var(--muted); line-height: 1.45; }
@media (max-width: 760px) {
  :root { --about-w: 100vw; }
  body.about-open main { padding-right: 0; }
  body.about-open .row.head { margin-right: 0; }
  body.about-cover { overflow: hidden; }
  body.about-cover .row.head { display: none; }
  .bar .about-close { position: static !important; transform: none !important; }
  .about-ph { width: 40%; }
  .about { left: 0; width: auto; }
  /* the header stays solid while the about covers the page (no glass chips over it) */
  body.about-cover .top { background: var(--bg) !important; }
  body.about-cover .bar > a::before, body.about-cover .bar .contact::before, body.about-cover .bar .about-close::before { opacity: 0 !important; }
  .about-in { padding: 0 var(--pad) var(--pad); }
  body.about-open main, body.about-open .row.head { padding-right: 0; margin-right: 0; }
}
@media (prefers-reduced-motion: reduce) { main, .about { transition: none; } }


/* phones: slider arrows, shorter slider, full-screen gallery */
.sl-arr { display: none; }
@media (max-width: 760px) {
  :root { --slide-h: min(96vw, 58vh); }
  .slider { position: relative; }
  .slider.draggable .sl-arr {
    display: grid; place-items: center; position: absolute; top: 50%; z-index: 2; width: 30px; height: 30px; margin-top: -15px;
    border: 0; border-radius: 50%; padding: 0; color: var(--fg); cursor: pointer;
    background: rgba(240, 241, 242, .72); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
  }
  .sl-arr.prev { left: 8px; }
  .sl-arr.next { right: 8px; }
}
.gallery { position: fixed; inset: 0; z-index: 60; background: var(--bg); opacity: 0; transition: opacity .25s ease; }
.gallery.on { opacity: 1; }
body.gallery-open { overflow: hidden; }
.g-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.g-track::-webkit-scrollbar { display: none; }
.g-it { flex: 0 0 100%; height: 100%; scroll-snap-align: center; display: grid; place-items: center; padding: 56px 12px 44px; }
.g-it img, .g-it video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.g-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--fg); padding: 0; cursor: pointer; }
.g-n { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: var(--muted); font-size: var(--fs); }

/* phones have no hover: role dots stay filled, and each piece shows its tag dots top-left (no text) */
.sdots { display: none; }
@media (max-width: 760px) {
  .project.open .c-role .dot { background: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
  .sdots { display: flex; gap: 4px; position: absolute; top: 8px; left: 8px; z-index: 1; pointer-events: none; }
  .sdots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
}

/* grid filter: one line "art direction, generative ai and web" right after the name; each part filters */
.gfilter { display: none; align-items: center; white-space: pre; margin: 0 auto 0 clamp(18px, 3vw, 40px); color: var(--muted); font-weight: 500; }
body.view-grid .gfilter { display: flex; }
.gfilter button { font: inherit; font-weight: 500; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; transition: color .2s; }
.gfilter button:hover, .gfilter button.on { color: var(--fg); }
body.about-on .gfilter { visibility: hidden; }
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; }
  body.view-grid .gfilter { display: none; }   /* no filter line on phones */
}

.gfilter .gf-x { display: none; margin-right: 6px; color: var(--fg); align-items: center; }
.gfilter.active .gf-x { display: inline-flex; }
