@font-face {
  font-family: "Junicode Condensed";
  src: url("assets/fonts/Junicode-Cond.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "TeX Gyre Heros Condensed";
  src: url("assets/fonts/texgyreheroscn-regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --edge: clamp(20px, 2.1vw, 32px);
  --footer-space: 72px;
  font-family: "TeX Gyre Heros Condensed", "Arial Narrow", sans-serif;
  font-synthesis: none;
  color: #000;
  background: #fff;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: #fff;
}

.masthead {
  position: fixed;
  z-index: 2;
  top: 0;
  right: 0;
  width: min(900px, 100%);
  padding: 14px var(--edge) 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: transparent;
}

h1,
h2 {
  margin: 0;
  font-family: "Junicode Condensed", "Times New Roman", serif;
  font-style: normal;
  font-weight: 400;
}

h1 {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: clamp(76px, 15vw, 150px);
  line-height: 1;
  white-space: nowrap;
}

h2 {
  font-size: 40px;
  line-height: 1.05;
}

.home-link {
  display: flex;
  justify-content: space-between;
  gap: inherit;
  width: 100%;
  text-decoration: none;
}

.portfolio {
  width: min(1120px, calc(100% - 2 * var(--edge)));
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(18px, 3vw, 42px);
  row-gap: clamp(56px, 7vw, 100px);
  align-items: start;
  text-align: left;
}

.gallery-tile {
  min-width: 0;
}

.gallery-tile:nth-child(1) { grid-column: 1 / span 7; }
.gallery-tile:nth-child(2) { grid-column: 9 / span 4; margin-top: 90px; }
.gallery-tile:nth-child(3) { grid-column: 1 / span 4; }
.gallery-tile:nth-child(4) { grid-column: 6 / span 6; margin-top: 48px; }
.gallery-tile:nth-child(5) { grid-column: 1 / span 3; }
.gallery-tile:nth-child(6) { grid-column: 5 / span 4; margin-top: 90px; }
.gallery-tile:nth-child(7) { grid-column: 10 / span 3; margin-top: 24px; }
.gallery-tile:nth-child(8) { grid-column: 1 / span 4; }
.gallery-tile:nth-child(9) { grid-column: 6 / span 6; margin-top: 95px; }
.gallery-tile:nth-child(10) { grid-column: 1 / span 6; }
.gallery-tile:nth-child(11) { grid-column: 9 / span 4; margin-top: 80px; }

.gallery-link {
  display: block;
  text-decoration: none;
}

.gallery-link img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-caption {
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.gallery-title {
  font-size: 28px;
  line-height: 1.05;
}

.gallery-caption p {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.2;
}

.gallery-link:hover .gallery-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.1em;
}

.gallery-open {
  overflow: hidden;
}

.project-dialog {
  width: min(1120px, calc(100% - 2 * var(--edge)));
  max-width: none;
  max-height: calc(100vh - 2 * var(--edge));
  max-height: calc(100dvh - 2 * var(--edge));
  margin: auto;
  padding: clamp(20px, 3vw, 40px);
  overflow: auto;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font-family: inherit;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.18;
}

.project-dialog::backdrop {
  background: rgb(255 255 255 / 94%);
}

.project-dialog .project {
  margin: 0;
  padding: 0;
  border: 0;
}

.dialog-toolbar {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
  background: #fff;
}

.dialog-close {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #0000ee;
  font: inherit;
  font-size: 18px;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
}

.project {
  padding-top: 18px;
  border-top: 1px solid #000;
  scroll-margin-top: 190px;
}

.project + .project {
  margin-top: 72px;
}

.project-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  margin-bottom: 24px;
}

.project-publication {
  margin-top: 6px;
}

.project-article a {
  color: #0000ee;
}

.project-credits {
  margin: 0;
  font-size: 18px;
}

.project-credits dt {
  margin-top: 18px;
  font-size: 15px;
}

.project-credits dt:first-child {
  margin-top: 0;
}

.project-credits dd {
  margin: 4px 0 0;
}

.project-gallery {
  display: grid;
  gap: 16px;
}

.project-gallery + .project-gallery {
  margin-top: 16px;
}

.columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-gallery img {
  display: block;
  width: 100%;
  height: auto;
}

.project-video iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}

main {
  width: min(720px, calc(100% - 2 * var(--edge)));
  padding-top: clamp(240px, 34svh, 380px);
  padding-bottom: calc(var(--footer-space) + env(safe-area-inset-bottom));
  margin-left: var(--edge);
  font-size: clamp(21px, 1.6vw, 24px);
  line-height: 1.18;
}

.work-nav {
  position: fixed;
  z-index: 4;
  top: 50%;
  right: var(--edge);
  transform: translateY(-50%);
  font-size: clamp(21px, 1.6vw, 24px);
  line-height: 1.18;
  text-align: right;
}

.work-nav a {
  color: #0000ee;
  white-space: nowrap;
}

.link-arrow {
  width: 0.8em;
  height: 0.8em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

p {
  margin: 0;
}

p + p {
  margin-top: 1.15em;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 4px;
}

footer {
  position: fixed;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 8px 12px 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: transparent;
  line-height: 1;
}

small {
  font-size: 18px;
}

@media (min-width: 601px) and (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .gallery-tile:nth-child(n) {
    grid-column: span 3;
    margin-top: 0;
  }

  .gallery-tile:nth-child(4n + 1) { grid-column: span 4; }
  .gallery-tile:nth-child(4n + 2) { grid-column: span 2; margin-top: 48px; }
  .gallery-tile:nth-child(4n + 3) { grid-column: span 2; }
  .gallery-tile:nth-child(4n) { grid-column: span 4; margin-top: 32px; }
}

@media (max-width: 600px) {
  .masthead {
    padding-top: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .work-nav {
    position: static;
    margin-top: 12px;
    transform: none;
  }

  main {
    width: auto;
    margin-right: var(--edge);
    padding-right: 0;
    padding-top: clamp(190px, 29svh, 270px);
  }

  .portfolio {
    width: auto;
  }

  .gallery-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    column-gap: 18px;
    row-gap: 48px;
  }

  .gallery-tile:nth-child(n) {
    grid-column: auto;
    margin-top: 0;
  }

  .gallery-tile:nth-child(even) {
    margin-top: 48px;
  }

  .gallery-title {
    font-size: 22px;
  }

  .gallery-caption p {
    font-size: 14px;
  }

  .project-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .project-gallery.columns-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-gallery.columns-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  h1 {
    gap: 16px;
    font-size: clamp(56px, 21.25vw, 68px);
  }
}
