/* Self-hosted fonts (SIL OFL, licences in assets/fonts): no third-party requests */
@font-face { font-family: "Familjen Grotesk"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(assets/fonts/familjen-grotesk-latin.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(assets/fonts/instrument-serif-italic-latin.woff2) format("woff2"); }

:root {
  --paper: #f3f2ee;
  --ink: #121212;
  --muted: #6b6a66;
  --line: #d6d4ce;
  --accent: #fef301; /* Derelict yellow: the one pop colour, used as fills/marks, never as text on paper */
  --gutter: clamp(16px, 3vw, 40px);
  --gap: 24px;
  --sans: "Familjen Grotesk", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
html:has(dialog[open]) { overflow: hidden; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
ol, ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.wrap { padding: 0 var(--gutter); }
.label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.desk { display: none; }
/* highlighter hover, the accent's main job */
.hl:hover, header nav a:hover, .links a:hover, .back:hover, .p-nav a:hover, .contact .big:hover { box-shadow: inset 0 -.45em var(--accent); }

/* Header */
header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--gutter); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); font-weight: 500; }
header nav { display: flex; gap: clamp(14px, 2.5vw, 32px); }
header a { padding: 8px 0; }
.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 30; padding: 10px 16px; background: var(--accent); color: var(--ink); font-weight: 500; }
.skip:focus { top: 8px; }
header > a { white-space: nowrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--ink); margin-right: 8px; vertical-align: 1px; }

/* Hero: Derelict signature sprayed behind the headline */
.hero { position: relative; padding: clamp(56px, 12vw, 160px) 0 clamp(40px, 6vw, 72px); isolation: isolate; }
.hero h1 { font-weight: 500; font-size: clamp(40px, 8.2vw, 132px); line-height: .95; letter-spacing: -.035em; max-width: 14ch; }
.sig { position: absolute; z-index: -1; top: clamp(70px, 9vw, 120px); right: -2vw; width: min(78vw, 980px); aspect-ratio: 1600 / 501;
  background: var(--accent); -webkit-mask: url(assets/marks/signature.webp) center / contain no-repeat; mask: url(assets/marks/signature.webp) center / contain no-repeat;
  transform: rotate(-7deg); animation: draw 1.4s var(--ease-out) .2s both; }
@keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.arrow { display: none; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px;
  margin-top: clamp(40px, 6vw, 80px); padding-top: 20px; border-top: 1px solid var(--ink); }
.meta p { margin-top: 6px; }

/* Section: rail (title) + content */
.sec { border-top: 1px solid var(--ink); scroll-margin-top: 56px; }
.rail { display: flex; justify-content: space-between; align-items: baseline; padding: 20px 0; }
.rail h2 { font-size: clamp(28px, 4vw, 48px); font-weight: 500; letter-spacing: -.02em; line-height: 1.05; }

/* Work cards */
.grid { display: grid; grid-template-columns: 1fr; gap: 48px 24px; padding-bottom: 96px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
.card { scroll-margin-top: 90px; }
.card .frame { position: relative; overflow: hidden; background: #e4e2dc; aspect-ratio: 4 / 5; }
.card.feature { grid-column: 1 / -1; }
.card.feature .frame { aspect-ratio: 2 / 1; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.card .caption { margin-top: 12px; }
.card .caption .label { display: block; }
.card .caption h3 { display: inline; font-weight: 500; font-size: 20px; line-height: 1.35; letter-spacing: -.01em;
  text-decoration: underline 1px var(--line); text-underline-offset: 5px; }
.card.feature .caption h3 { font-size: clamp(24px, 3vw, 40px); }
.card:hover h3 { box-shadow: inset 0 -.45em var(--accent); }
@media (hover: hover) and (pointer: fine) { .card:hover img { transform: scale(1.03); } }

/* Index table */
.ix { padding-bottom: 96px; }
.ix .head, .ix a { display: grid; grid-template-columns: 3.5em 1fr auto; gap: 16px; align-items: baseline; }
.ix .head { padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.ix a { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: clamp(17px, 1.6vw, 22px); font-weight: 500; text-transform: uppercase; letter-spacing: -.01em; }
.ix .c-client, .ix .c-go { display: none; }
.ix a:hover { background: var(--accent); }
.ix a .c-kind { color: var(--muted); font-size: 14px; font-weight: 400; }
.ix a:hover .c-kind { color: var(--ink); }
.pv { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; will-change: transform; }
.pv img { width: 260px; translate: -50% -50%; opacity: 0; scale: .9; transition: opacity .2s var(--ease-out), scale .2s var(--ease-out); }
.pv.show img { opacity: 1; scale: 1; }

/* About */
.about { display: grid; gap: 40px; padding: 4px 0 96px; }
.about .lede { font-size: clamp(22px, 2.6vw, 34px); line-height: 1.2; letter-spacing: -.015em; }
.jobs li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.jobs li:first-child { border-top: 1px solid var(--line); }
.jobs span { color: var(--muted); font-size: 14px; }
.skills { color: var(--muted); }
.rail .mark { display: none; }

/* Contact */
.contact-body { padding: 4px 0 40px; }
.contact .big { display: inline-block; font-size: clamp(24px, 4.2vw, 64px); font-weight: 500; letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-top: 40px; }
.links a { border-bottom: 1px solid currentColor; }
footer { display: flex; justify-content: space-between; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* Project view */
#project { padding-bottom: 96px; }
.p-top { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; }
.count { font-size: clamp(16px, 1.6vw, 22px); letter-spacing: -.01em; }
/* the artwork comes first: fills the screen below the header, centred */
.p-hero { display: grid; place-items: center; width: 100%; padding-bottom: 48px; cursor: zoom-in; }
.p-hero img { max-height: calc(100svh - 56px - 52px - 48px); width: auto; }
.p-body h1 { font-size: clamp(32px, 4vw, 56px); font-weight: 500; letter-spacing: -.03em; line-height: 1; margin-bottom: 28px; }
.p-body .rail { display: block; padding-bottom: 40px; }
.p-body .meta { margin-top: 0; padding-top: 0; border: 0; }
.p-body .desc { max-width: 60ch; font-size: 18px; margin-top: 28px; }
.p-images { display: grid; gap: 48px; }
.g-label { font: inherit; display: flex; align-items: center; gap: 16px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.g-label img { height: 26px; width: auto; }
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.th { display: block; position: relative; cursor: zoom-in; background: #e4e2dc; overflow: hidden; }
.th img { width: 100%; transition: transform .5s var(--ease-out); }
.th.long img { aspect-ratio: 3 / 4; object-fit: cover; object-position: top; }
.n1 .th, .th.p { grid-column: 1 / -1; }
@media (hover: hover) and (pointer: fine) { .th:hover img { transform: scale(1.03); } }
.p-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--ink); font-weight: 500; }

/* Lightbox: the rest blurs away, the artwork comes forward */
.lb { width: 100vw; height: 100dvh; max-width: none; max-height: none; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: auto;
  opacity: 0; transition: opacity .25s var(--ease-out), overlay .25s allow-discrete, display .25s allow-discrete; }
.lb[open] { opacity: 1; }
@starting-style { .lb[open] { opacity: 0; } }
.lb::backdrop { background: color-mix(in srgb, var(--paper) 60%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.lb figure { min-height: 100%; display: grid; place-items: center; padding: 64px var(--gutter);
  transform: scale(.96); transition: transform .25s var(--ease-out); }
.lb[open] figure { transform: none; }
@starting-style { .lb[open] figure { transform: scale(.96); } }
.lb figure img { max-height: calc(100dvh - 128px); width: auto; box-shadow: 0 30px 80px -30px rgb(0 0 0 / .45); cursor: zoom-out; }
.lb figure img.long { max-height: none; width: min(1000px, 100%); }
.lb-bar { position: fixed; inset: 0 0 auto; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 16px var(--gutter); font-weight: 500; }
.lb-bar nav { display: flex; gap: 8px; }
.lb-bar button { min-width: 44px; min-height: 44px; padding: 0 14px; background: var(--paper); border: 1px solid var(--ink); }
.lb-bar button:hover { background: var(--accent); }

/* Scroll reveal, only when JS is on to undo it */
@media (scripting: enabled) {
  .rv { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: var(--d, 0ms); }
  .rv.in { opacity: 1; transform: none; }
}

/* ---------- Desktop: 12-column Swiss grid. Rail = cols 1–3, content = cols 4–12 ---------- */
@media (min-width: 1000px) {
  .desk { display: block; }
  .g12, header, .sec, .hero .meta, .p-body { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); }

  header > :nth-child(1) { grid-column: 1 / 4; }
  header > :nth-child(2) { grid-column: 4 / 7; }
  header > :nth-child(3) { grid-column: 7 / 10; }
  header nav { grid-column: 10 / 13; }
  header span.desk { font-weight: 400; color: var(--muted); }

  .hero h1 { max-width: 83%; }
  .arrow { display: block; position: absolute; right: 0; bottom: clamp(140px, 13vw, 190px); width: clamp(90px, 9vw, 150px); }
  .arrow path { stroke: var(--ink); stroke-width: 9; fill: none; }
  .arrow:hover path { stroke-width: 12; }
  .hero .meta > * { grid-column: span 3; }
  .hero .meta > :first-child { grid-column: 1 / 4; }

  .sec { padding-top: 20px; }
  .rail { grid-column: 1 / 4; display: block; padding: 0 0 40px; }
  .rail h2 { font-size: 32px; }
  .rail .label { display: block; margin-top: 10px; }
  .sec > :not(.rail) { grid-column: 4 / 13; }

  /* Work: sticky title in the rail, staggered cards on a 9-col sub-grid */
  #work .rail, #about .rail { position: sticky; top: 76px; align-self: start; }
  .grid { grid-template-columns: repeat(9, 1fr); gap: 72px var(--gap); padding-bottom: 140px; }
  .card:nth-child(4n+2) { grid-column: 1 / 6; }
  .card:nth-child(4n+3) { grid-column: 7 / 10; margin-top: 18vw; }
  .card:nth-child(4n+4) { grid-column: 2 / 5; }
  .card:nth-child(4n+5) { grid-column: 6 / 10; margin-top: 8vw; }

  /* Index table: year / title / type / client, columns on the 9-col content */
  .ix .head, .ix a { grid-template-columns: repeat(9, 1fr); column-gap: var(--gap); }
  .ix .c-year { grid-column: 1; } .ix .c-title { grid-column: 2 / 6; } .ix .c-kind { grid-column: 6 / 8; }
  .ix .c-client { display: block; grid-column: 8 / 10; }
  .ix a .c-client { font-size: 14px; font-weight: 400; color: var(--muted); }
  .ix a:hover .c-client { color: var(--ink); }
  .ix { padding-bottom: 140px; }

  /* About */
  .rail .mark { display: block; width: 72px; margin-top: 40px; }
  .about { grid-template-columns: repeat(9, 1fr); column-gap: var(--gap); row-gap: 56px; padding-bottom: 140px; }
  .about .lede { grid-column: 1 / 8; }
  .about .skills { grid-column: 1 / 5; }
  .jobs { grid-column: 1 / -1; }
  .jobs li { grid-template-columns: repeat(3, 1fr); column-gap: var(--gap); }
  .jobs li > * { grid-row: 1; }
  .jobs li span:last-child { grid-column: 2; color: var(--ink); font-size: 16px; }
  .jobs li span:first-of-type { grid-column: 3; text-align: right; }

  /* Project: meta + description stick in the rail, thumbnails on the 9-col content */
  .p-body { border-top: 1px solid var(--ink); padding-top: 20px; }
  .p-body.solo .rail { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); }
  .p-body.solo h1 { grid-column: 1 / 4; }
  .p-body.solo .meta { grid-column: 4 / 10; grid-template-columns: repeat(4, 1fr); }
  .p-body.solo .desc { grid-column: 10 / 13; margin-top: 0; }
  .p-body .rail { position: sticky; top: 76px; align-self: start; }
  .p-body .meta { grid-template-columns: 1fr 1fr; row-gap: 20px; }
  .p-body .desc { font-size: 16px; margin-top: 32px; }
  .p-images { grid-column: 4 / 13; row-gap: 72px; }
  .thumbs { grid-template-columns: repeat(9, 1fr); gap: 40px var(--gap); }
  .th { grid-column: span 3; }
  .th.p { grid-column: span 6; }
  .n1 .th { grid-column: 1 / 7; }
  .series .thumbs .th.th { grid-column: span 3; margin-top: 0; }
  .lead .th:first-child { grid-column: 1 / 4; grid-row: span 2; }
  .lead .th.p { grid-column: 4 / 10; }
  .n2 .th:nth-child(1) { grid-column: 1 / 5; }
  .n2 .th:nth-child(2) { grid-column: 6 / 10; margin-top: 8vw; }
  .p-nav { margin-left: calc((100% + var(--gap)) / 4); }

  .contact-body { padding-bottom: 72px; }
  footer { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); }
  footer > :first-child { grid-column: 1 / 4; }
  footer > :last-child { grid-column: 4 / 13; }
}

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sig { animation: none; }
  .rv, .lb figure, .pv img { transform: none; scale: 1; }
  .card img, .th img { transition: none; }
}
