:root {
  --bg: #ffffff;
  --ink: #0F0F0E;
  --muted: #66665F;
  --line: #D9D9D3;
  --fill: #F4F4F1;
  --scrim: rgba(15, 15, 14, 0.4);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.modal-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--muted); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.wrap { max-width: 1440px; margin: 0 auto; padding-inline: 64px; }
.label {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Placeholder text, still to be written. */
.ph { color: var(--muted); }
.u { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* Hero: name and links on the left, portrait on the right. */
.hero {
  padding-block: 120px 96px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 64px;
  align-items: end;
}
.hero-text { display: flex; flex-direction: column; gap: 28px; }
.hero h1 {
  margin: 0;
  font-size: clamp(56px, 8vw, 112px);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.045em;
}

/* Portrait: a tilted print, black and white until you hover, then colour. */
/* Sits in from the right edge on wide screens; no shift below 1100px, where the text needs the room. */
.me { margin: 0 clamp(0px, calc((100vw - 1100px) * 0.3), 96px) 0 0; width: 300px; justify-self: end; }
.me-photo {
  position: relative;
  display: block;
  padding: 12px 12px 48px;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 15, 14, 0.05), 0 14px 36px rgba(15, 15, 14, 0.1);
  transform: rotate(-3deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s ease;
  animation: settle 1s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
.me-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }
.me-photo .color { position: absolute; top: 12px; left: 12px; width: calc(100% - 24px); opacity: 0; transition: opacity 0.5s ease; }
.me:hover .me-photo { transform: rotate(0deg) translateY(-6px); box-shadow: 0 2px 4px rgba(15, 15, 14, 0.06), 0 22px 48px rgba(15, 15, 14, 0.14); }
.me:hover .color { opacity: 1; }
@keyframes settle { from { opacity: 0; transform: translateY(28px) rotate(-10deg); } }
.inline-links { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 17px; }

/* On the side: a loose wall of photos that settle into place as you scroll. */
.side { padding-top: 120px; }
.snaps { columns: 3; column-gap: 32px; padding-top: 12px; }
.snaps.masonry { columns: auto; display: flex; gap: 32px; align-items: flex-start; }
.snap-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.snap {
  break-inside: avoid;
  margin: 0 0 36px;
  padding: 10px 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 15, 14, 0.04), 0 10px 28px rgba(15, 15, 14, 0.07);
  transform: rotate(var(--r, 0deg));
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s ease;
}
.snap-img {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  background: var(--fill);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.snap-img:has(img), .snap-img:has(video) { padding: 0; }
.snap-img img, .snap-img video { width: 100%; height: auto; display: block; }
.snap figcaption { margin-top: 10px; font-size: 14px; line-height: 1.4; }
/* Hidden only when script runs, so without it the photos just show. */
.js .reveal { opacity: 0; transform: translateY(56px) rotate(calc(var(--r, 0deg) * 4)) scale(0.96); }
.js .reveal.in {
  opacity: 1;
  transform: rotate(var(--r, 0deg));
  transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}
.snap:hover, .js .reveal.in:hover {
  transform: translateY(-6px) rotate(0deg);
  box-shadow: 0 2px 4px rgba(15, 15, 14, 0.05), 0 18px 40px rgba(15, 15, 14, 0.12);
  transition-delay: 0ms;
}

/* Project grid. Cells overlap by 1px so the lines stay single. */
.section-head { padding-bottom: 20px; }
/* Fills column by column: Linkrunner work on the left, co-founded companies in
   the middle, everything else on the right. */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  padding: 0 1px 1px 0;
}
.cell {
  min-height: 280px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  border: 1px solid var(--line);
  margin: 0 -1px -1px 0;
  background: var(--bg);
}
a.cell:hover { background: var(--fill); color: var(--ink); }
.cell-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.plus { font-size: 26px; line-height: 1; font-weight: 300; transition: transform 0.2s ease; }

/* Tags: one soft colour per kind of project. */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  background: var(--tag-bg);
  color: var(--tag-fg);
}
.t-job { --tag-bg: #E6ECFB; --tag-fg: #1D3A8A; }
.t-internal { --tag-bg: #ECEEF2; --tag-fg: #3A4150; }
.t-rev { --tag-bg: #F8EDD7; --tag-fg: #6B4200; }
.t-side { --tag-bg: #EEE8FB; --tag-fg: #4A2C8F; }
.t-cofounder { --tag-bg: #FAE6EA; --tag-fg: #862038; }
.t-social { --tag-bg: #E0F1E6; --tag-fg: #1D5A34; }
.meta-head .tag { align-self: flex-start; }
a.cell:hover .plus { transform: rotate(90deg); }
.cell-body { display: flex; flex-direction: column; gap: 10px; }
.cell-name { font-size: 27px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.cell-desc { font-size: 16px; line-height: 1.45; color: var(--muted); min-height: 2.9em; } /* two lines, so names line up across a row */

.foot { padding-block: 96px 48px; font-size: 14px; color: var(--muted); }

/* Pop-up */
.modal {
  width: min(1200px, calc(100% - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; animation: pop 0.18s ease-out; }
.modal::backdrop { background: var(--scrim); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal-bar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px 8px 32px;
  border-bottom: 1px solid var(--line);
}
.close {
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.close:hover { color: var(--muted); }
.modal-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 40px 32px 32px; }
.modal-foot {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
}
.modal-foot a { min-height: 44px; display: inline-flex; align-items: center; }

/* Project detail, inside the pop-up */
.project { display: flex; gap: 56px; align-items: flex-start; }
.meta { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; }
.meta-head { display: flex; flex-direction: column; gap: 12px; }
.meta h2 { margin: 0; font-size: 44px; line-height: 1.05; font-weight: 500; letter-spacing: -0.03em; text-wrap: balance; }
.meta-head p { margin: 0; font-size: 18px; line-height: 1.45; color: var(--muted); }
.facts { margin: 0; font-size: 15px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.facts div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.facts dd { margin: 0; text-align: right; }
.facts dd.stack { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.muted { color: var(--muted); }
.body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 40px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); row-gap: 20px; border-top: 1px solid var(--ink); }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 0 0; }
.stat-n { font-size: 40px; line-height: 1.1; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shot {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fill);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.shot img, .shot video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Where there is no screenshot, the box shows the client count instead. */
.shot-note { aspect-ratio: 16 / 7; flex-direction: column; gap: 10px; color: var(--ink); }
.shot-note .stat-n { font-family: var(--sans); font-size: 64px; letter-spacing: -0.03em; text-transform: none; font-variant-numeric: normal; }
.shot-note .label { color: var(--muted); }
@media (max-width: 640px) { .shot-note { aspect-ratio: 16 / 9; } .shot-note .stat-n { font-size: 48px; } }
/* A real screenshot keeps its own shape and opens full size on click. */
.shot.media { aspect-ratio: auto; display: block; background: none; }
.shot.media img { height: auto; }
.media-fig { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.media-fig figcaption { font-size: 14px; }
/* One column: the answers are paragraphs, so they read top to bottom. */
.parts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.part p { max-width: 66ch; }
.part { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--ink); }
.part h3 { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.part p { margin: 0; font-size: 17px; line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
  .modal[open] { animation: none; }
  .plus { transition: none; }
  .snap, .js .reveal, .js .reveal.in { opacity: 1; transform: rotate(var(--r, 0deg)); transition: none; }
  .me-photo { animation: none; transition: none; }
  .me-photo .color { transition: none; }
}

/* Nine projects: three across fills every row. Between 800 and 930px the
   names shrink a little so the longest one stays on one line; below 800px
   the boxes stack in a single column. */
@media (min-width: 800px) and (max-width: 930px) {
  .cell-name { font-size: min(27px, calc(4.15vw - 11.3px)); }
  .cell-desc { font-size: 15px; min-height: 4.35em; } /* room for three lines, so names stay level */
}
@media (max-width: 799px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .me { order: -1; width: 190px; justify-self: start; margin-left: 6px; }
  .me-photo { padding: 8px 8px 32px; }
  .me-photo .color { top: 8px; left: 8px; width: calc(100% - 16px); }
  .side { padding-top: 80px; }
  .snaps { columns: 2; column-gap: 16px; }
  .snaps.masonry { gap: 16px; }
  .snap { margin-bottom: 20px; padding: 6px 6px 10px; }
  .snap figcaption { font-size: 13px; margin-top: 8px; }
  .snap-img { font-size: 10px; }
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
  .cell { min-height: 0; padding: 20px; gap: 16px; }
  .cell-name { font-size: 24px; }
  .cell-desc { font-size: 15px; min-height: 0; }
}

@media (max-width: 1100px) {
  .project { flex-direction: column; gap: 32px; }
  .meta { width: 100%; position: static; }
}

@media (max-width: 640px) {
  .wrap { padding-inline: 20px; }
  .hero { padding-block: 48px 56px; gap: 24px; }
  .inline-links { font-size: 16px; }
  .foot { padding-block: 64px 40px; }

  /* The pop-up takes the whole screen on a phone. */
  .modal { width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; }
  .modal-bar { padding: calc(4px + env(safe-area-inset-top, 0px)) 8px 4px 20px; }
  .modal-scroll { padding: 28px 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .meta h2 { font-size: 34px; }
  .meta-head p { font-size: 16px; }
  .body { gap: 28px; }
  .stat-n { font-size: 23px; }
  .shot { font-size: 11px; }
  .parts { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .part p { font-size: 16px; }
  .modal-foot { margin-top: 40px; }
}

/* Numbered points inside a pop-up section (Outbound tool challenges). */
.part ol.points { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; max-width: 66ch; }
.part ol.points > li { padding-left: 4px; }
.part ol.points > li::marker { font-family: var(--mono); font-size: 13px; }
.part ol.points > li > p + ul, .part ol.points > li > ul + p { margin-top: 8px; }
.part ol.points ul { margin: 0; padding-left: 20px; font-size: 17px; line-height: 1.55; }
@media (max-width: 799px) { .part ol.points ul { font-size: 16px; } }
