/* Fonts. To change typeface: put the .woff2 files in public/fonts, point the two
   @font-face rules at them, and leave the rest of this file alone. */
@font-face {
  font-family: "Site Sans";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Site Mono";
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sans: "Site Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Site Mono", ui-monospace, Menlo, monospace;
  --pad: 3rem;
  --dot: rgba(220, 28, 28, 0.33);
}

*, *::before, *::after { box-sizing: border-box; }

/* Type and spacing scale with the window, as on the Cargo site: 1rem = 0.9% of its width. */
html { font-size: 0.9vw; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: var(--sans);
  font-size: 2.15rem;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
}
body[data-overlay] { overflow: hidden; }

a { color: inherit; text-decoration: none; }
a:active { opacity: 0.7; }
a:focus-visible, button:focus-visible { outline: 2px solid #000; outline-offset: 3px; }
img, video { display: block; max-width: 100%; height: auto; }
h2, p, ul, figure { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Small sans text: nav, overlays */
.t { font-size: 1.65rem; line-height: 1.3; font-weight: 400; }
a.t, .t a { transition: filter 0.3s ease; }
a.t:hover, .t a:hover { filter: blur(3px); }

/* Mono captions */
.caption {
  display: block;
  margin-top: 0.5em;
  font-family: var(--mono);
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: 0.05em;
}
.caption-long { margin-top: 1.8em; }
.caption-head { display: block; margin-bottom: 1.3em; text-transform: uppercase; }
.caption-head .dot { --dot: rgba(237, 113, 88, 0.85); margin-left: -0.35em; }

.dot {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin: -1em 0 -0.25em;
  vertical-align: -0.14em;
  background: radial-gradient(circle, var(--dot) 0 0.24em, transparent calc(0.24em + 0.5px));
}

/* Top bar */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--pad);
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.links { display: flex; gap: 3.2rem; margin-right: -1.2rem; }
body[data-overlay] .nav-home { visibility: hidden; }

/* White fade under the top bar on the home page */
.fade {
  position: fixed;
  inset: 0 0 auto 0;
  height: 0;
  z-index: 50;
  box-shadow: 0 0 2rem 7.5rem #fff;
  pointer-events: none;
}

/* Free placement: x, y and w are percentages of the collage width */
.collage { container-type: inline-size; margin: var(--pad); }
.collage-inner { position: relative; height: calc(var(--h) * 1cqw + 6rem); }
.item {
  position: absolute;
  left: calc(var(--x) * 1cqw);
  top: calc(var(--y) * 1cqw);
  width: calc(var(--w) * 1cqw);
  z-index: var(--z);
}
.item > a, .item .zoom { display: block; width: 100%; text-align: left; }
.item .zoom { cursor: zoom-in; }
.item img, .item video { width: 100%; }
.framed img, .framed video { border: 0.1rem solid rgba(0, 0, 0, 0.85); border-radius: 1rem; }

/* Project page */
.hero { display: flex; min-height: 100vh; min-height: 100svh; }
.copy {
  width: 50%;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero-plain .copy { width: 100%; max-width: 50%; }
.copy p { margin-bottom: 1.2em; }
.copy a { transition: filter 0.3s ease; }
.copy a:hover { filter: blur(3px); }
.backdrop { width: 50%; height: 100vh; height: 100svh; }
.backdrop img, .backdrop video { width: 100%; height: 100%; object-fit: cover; }

.roles { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; margin-top: 1.2em; }
.role {
  font-family: var(--mono);
  font-size: 1.2rem;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.85);
  background: #f8f8f8;
  border-radius: 10rem;
  padding: 0.5rem 1rem 0.5rem 0.3rem;
  white-space: nowrap;
}
.role .dot { margin-right: 0.35em; }

.gallery { padding: calc(var(--pad) + 2.58rem) var(--pad) var(--pad); }
.rows { --gap: 1.5rem; container-type: inline-size; }
.row { display: flex; justify-content: center; gap: var(--gap); margin-bottom: var(--gap); }
.cell { flex: calc(var(--a) * 100) 1 0%; min-width: 0; }
.cell img, .cell video { width: 100%; }
/* rowHeight set: rows keep that height and sit centred instead of stretching edge to edge */
.rows[data-align="center"] .cell { max-width: calc(var(--a) * var(--rh) * 1cqw); }

/* Projects and About, shown over the home page */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow-y: auto;
  padding: var(--pad);
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(2rem);
  backdrop-filter: blur(2rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s linear, visibility 0s linear 0.15s;
}
body[data-overlay="projects"] #projects,
body[data-overlay="about"] #about {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s linear;
}
.overlay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--pad); }
#projects .overlay-head { margin-bottom: 4.8rem; }
.about { width: 50%; }
.about p { margin-bottom: 1.3em; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12.5rem 8rem; align-items: end; padding-bottom: 6rem; }
.card { display: block; }
.card img, .card video { width: 100%; margin-bottom: 0.6rem; }
.card .t { display: block; }

/* Enlarged image */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  background: rgba(255, 255, 255, 0.29);
  -webkit-backdrop-filter: blur(2.23rem);
  backdrop-filter: blur(2.23rem);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }

.missing { padding: 12rem var(--pad) var(--pad); }
.missing p { margin-bottom: 1.3em; }

/* Phones: one column, larger type */
@media (max-width: 768px) {
  html { font-size: 2.24vw; }
  body { font-size: 2.5rem; }
  .t { font-size: 2.25rem; }
  .caption, .role { font-size: 1.6rem; }

  .collage-inner { height: auto; }
  .item { position: static; width: 100%; margin-bottom: 2rem; }

  .hero { flex-direction: column; }
  .backdrop { order: -1; width: 100%; height: 50vh; height: 50svh; }
  .copy, .hero-plain .copy { width: 100%; max-width: none; min-height: 50vh; min-height: 50svh; }
  .hero-plain .copy { padding-top: 12rem; }

  .links { margin-right: 0; }
  .gallery { padding-top: var(--pad); }
  .rows { --gap: 1rem !important; }
  .row { display: block; margin: 0; }
  .cell, .rows[data-align="center"] .cell { max-width: none; margin-bottom: var(--gap); }

  .about { width: 100%; }
  #about .overlay-head { flex-direction: column-reverse; }
  #about .overlay-head > a { align-self: flex-end; }
  .grid { grid-template-columns: 1fr; gap: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
