/* Layout: a quiet drawing-sheet grid. Images carry the page; text sits in a
   narrow column; project data is set like a title block in mono. */
:root {
  --bg: #f2f2ef;        /* paper, slightly cool */
  --fg: #1b1c1a;        /* graphite */
  --muted: #6c6e69;
  --line: #d4d5cf;
  --plate: #e4e5e0;     /* image placeholder */
  --accent: #2c46b8;    /* drafting blue, used sparingly */
  --font-sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.6rem, 1.2rem + 1.8vw, 2.5rem);
  --gutter: clamp(16px, 3vw, 40px);
  --maxw: 1440px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141513; --fg: #e8e8e3; --muted: #9a9c95; --line: #2e302c;
    --plate: #20221f; --accent: #8fa2ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141513; --fg: #e8e8e3; --muted: #9a9c95; --line: #2e302c;
  --plate: #20221f; --accent: #8fa2ff; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--step-0)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2 { font-weight: 500; text-wrap: balance; margin: 0; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap {
  max-width: var(--maxw); margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--bg); padding: 8px 12px; z-index: 9; }
.label, .data, dt {
  font-family: var(--font-mono); font-size: var(--step--1); font-weight: 400;
  letter-spacing: 0.02em; color: var(--muted);
}
.label { text-transform: uppercase; letter-spacing: 0.08em; }
.muted { color: var(--muted); }

/* Header */
.site-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 12px 32px; padding-block: 28px 0;
}
.mark { text-decoration: none; font-weight: 600; font-size: var(--step-1); letter-spacing: -0.01em; display: flex; gap: 10px; align-items: baseline; }
.mark span { font: 400 var(--step--1) var(--font-mono); color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.nav { display: flex; gap: 24px; }
.nav a { text-decoration: none; }
.nav a[aria-current] { text-decoration: underline; }

/* Home */
.intro { padding-block: clamp(48px, 8vw, 112px) clamp(32px, 4vw, 56px); }
.intro h1 { font-size: var(--step-2); line-height: 1.15; letter-spacing: -0.02em; max-width: 20ch; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 24px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.chip {
  font: inherit; font-size: var(--step--1); font-family: var(--font-mono);
  background: none; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.chip:hover { color: var(--fg); border-color: var(--fg); }
.chip[aria-pressed="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.no-js .filters { display: none; }

.grid { display: grid; gap: 48px clamp(16px, 2vw, 32px); grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid { grid-template-columns: minmax(0, 1fr); gap: 36px; } }
.card[hidden] { display: none; }
.card a { text-decoration: none; display: grid; gap: 6px; }
.thumb { margin: 0 0 8px; aspect-ratio: 1 / 1; background: var(--plate); overflow: hidden; max-width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: scale 1.2s var(--ease), filter 0.6s var(--ease); }
.card a:hover .thumb img { scale: 1.045; }
.card h2 { font-size: var(--step-0); font-weight: 500; justify-self: start;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px; transition: background-size 0.5s var(--ease); }
.card a:hover h2 { background-size: 100% 1px; }
.card a:hover h2 { color: var(--accent); }

.credits { padding-block: clamp(72px, 10vw, 140px) 0; display: grid; gap: 16px; }
.credits .label:not(:first-child) { margin-top: 32px; }
.names { display: flex; flex-wrap: wrap; gap: 6px 0; font-size: var(--step-1); line-height: 1.4; max-width: 70rem; }
.names li:not(:last-child)::after { content: "/"; color: var(--line); padding-inline: 0.55em; }

/* Project */
.project { padding-top: clamp(32px, 5vw, 72px); }
.project-head {
  display: grid; gap: 24px 48px;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas: "back back" "title text" "tb text";
  align-items: start; padding-bottom: clamp(40px, 6vw, 80px);
}
.back { grid-area: back; text-decoration: none; font-size: var(--step--1); font-family: var(--font-mono); color: var(--muted); }
.project h1 { grid-area: title; font-size: var(--step-2); line-height: 1.1; letter-spacing: -0.02em; }
.titleblock { grid-area: tb; margin: 0; border-top: 1px solid var(--fg); }
.titleblock div { display: grid; align-items: baseline; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 12px; padding-block: 9px; border-bottom: 1px solid var(--line); }
.titleblock dd { margin: 0; font-size: 0.9375rem; }
.project-text { grid-area: text; display: grid; gap: 16px; max-width: 38rem; font-size: var(--step-1); line-height: 1.5; }
.credit { font-size: var(--step-0); color: var(--muted); }
@media (max-width: 800px) {
  .project-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: "back" "title" "text" "tb"; }
}
.plates { display: grid; gap: clamp(16px, 2vw, 32px); }
.plates figure { margin: 0; }
.plates img { width: 100%; max-height: 92vh; object-fit: contain; object-position: left center; background: var(--plate); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(48px, 6vw, 96px); border-top: 1px solid var(--line); }
.pager a { display: grid; gap: 4px; padding-block: 20px; text-decoration: none; font-size: var(--step-1); }
.pager a:last-child { text-align: right; }

/* Text pages */
.textpage { padding-top: clamp(48px, 7vw, 104px); display: grid; gap: 24px; }
.textpage > h1 { font-size: var(--step-2); letter-spacing: -0.02em; margin-bottom: 16px; }
.textpage section { display: grid; gap: 12px; margin-top: 32px; }
.textpage > .label { margin-top: 56px; }
.prose { display: grid; gap: 1em; max-width: 40rem; font-size: var(--step-1); line-height: 1.55; }
.press { border-top: 1px solid var(--fg); max-width: 60rem; }
.press a { display: grid; grid-template-columns: 10rem minmax(0, 1fr) 3rem; gap: 16px; padding-block: 12px; border-bottom: 1px solid var(--line); text-decoration: none; }
.press .outlet { color: var(--muted); }
.press .data { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .press a { grid-template-columns: minmax(0, 1fr) 3rem; } .press .outlet { grid-column: 1 / -1; } }

.cv { border-top: 1px solid var(--fg); max-width: 60rem; }
.cv li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 16px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.cv .when { font-variant-numeric: tabular-nums; padding-top: 2px; }
.cv .what { font-weight: 500; }
.cv .detail { color: var(--muted); margin-top: 4px; max-width: 44rem; }
@media (max-width: 560px) { .cv li { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; max-width: 64rem; align-items: start; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.form { display: grid; gap: 6px; }
.form label { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); margin-top: 10px; }
.form input, .form textarea {
  font: inherit; color: var(--fg); background: transparent; width: 100%;
  border: 0; border-bottom: 1px solid var(--line); padding: 8px 0; border-radius: 0;
}
.form input:focus, .form textarea:focus { outline: none; border-bottom-color: var(--accent); }
.form button {
  justify-self: start; margin-top: 20px; font: inherit; cursor: pointer;
  background: var(--fg); color: var(--bg); border: 0; padding: 10px 22px;
}
.form button:hover { background: var(--accent); }
.hp { position: absolute; left: -9999px; }

/* Footer */
.site-foot {
  display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between;
  padding-block: clamp(72px, 10vw, 140px) 32px;
  font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted);
}
.site-foot a { text-decoration: none; }

/* Motion. Only active when JS adds .motion (never with reduced motion). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.35s var(--ease) both; }
::view-transition-new(root) { animation: vt-in 0.6s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

.motion .rv { opacity: 0; transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0ms); }
.motion .rv.in { opacity: 1; transform: none; }

/* Headings: words rise from behind a mask */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.w > span { display: inline-block; }
.motion h1.rv { opacity: 1; transform: none; }
.motion h1.rv .w > span { transform: translateY(105%); transition: transform 1s var(--ease); transition-delay: var(--d, 0ms); }
.motion h1.rv.in .w > span { transform: none; }

/* Images: a curtain lifts while the photo settles */
.motion .thumb.rv, .motion .plates figure.rv { opacity: 1; transform: none; overflow: hidden; }
.motion .thumb.rv img, .motion .plates figure.rv img { clip-path: inset(100% 0 0 0); transform: scale(1.14);
  transition: clip-path 1.2s var(--ease), transform 1.8s var(--ease), scale 1.2s var(--ease); transition-delay: var(--d, 0ms); }
.motion .thumb.rv.in img, .motion .plates figure.rv.in img { clip-path: inset(0 0 0 0); transform: none; }

/* Lines draw from left to right, like a sheet being drafted */
.motion .titleblock.rv, .motion .cv.rv, .motion .press.rv, .motion .pager.rv { opacity: 1; transform: none; position: relative; border-top-color: transparent; }
.motion .titleblock.rv::before, .motion .cv.rv::before, .motion .press.rv::before, .motion .pager.rv::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--fg);
  transform: scaleX(0); transform-origin: left; transition: transform 1.1s var(--ease); }
.motion .pager.rv::before { background: var(--line); }
.motion .rv.in::before { transform: scaleX(1); }
.motion .titleblock > div.rv, .motion .cv > li.rv, .motion .press > li.rv, .motion .pager > a.rv { position: relative; border-bottom-color: transparent; transform: translateY(8px); }
.motion .press > li.rv > a { border-bottom-color: transparent; }
.motion .titleblock > div.rv::after, .motion .cv > li.rv::after, .motion .press > li.rv::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--line);
  transform: scaleX(0); transform-origin: left; transition: transform 1s var(--ease); transition-delay: var(--d, 0ms); }
.motion .rv.in::after { transform: scaleX(1); }
.motion .rv.rv.in { transform: none; }

/* Pointer label over project images */
.cursor { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none;
  margin: -32px 0 0 -32px; width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; background: var(--fg); color: var(--bg);
  font: 500 var(--step--1) var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
  scale: 0; transition: scale 0.35s var(--ease); }
.cursor.on { scale: 1; }
.motion .thumb { cursor: none; }

/* Reading progress on project pages */
.progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 20; background: var(--accent);
  transform: scaleX(0); transform-origin: left; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  @view-transition { navigation: none; }
}
