@font-face {
  font-family: Montserrat;
  src: url("assets/fonts/montserrat.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --red: #d34127;
  --pink: #fff2f2;
  --black: #000;
  --sans: "Space Grotesk", sans-serif;
  --display: Montserrat, sans-serif;
  --column-inset: clamp(24px, 4.1vw, 60px);
  --artwork-ratio: 386 / 265;
  --gallery-gap: clamp(16px, 1.75vw, 32px);
  --gallery-top: clamp(16px, 1.55vw, 28px);
}

* { box-sizing: border-box; }
body, h1, h2, p, figure, ul { margin: 0; }
body {
  background: var(--pink);
  color: var(--black);
  font-family: var(--sans);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

html:has(body.portfolio-page),
body.portfolio-page {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.site {
  display: grid;
  grid-template-rows: clamp(44px, 7.15svh, 58px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: clip;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-inline: calc(var(--column-inset) + 4px) calc(var(--column-inset) + 15px);
  background: var(--red);
}

.wordmark {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--pink);
  font-size: 17px;
  line-height: 24px;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  color: white;
  font-size: 12px;
  line-height: 28px;
  text-transform: uppercase;
}

.site-nav [aria-current], .site-nav a:hover { color: var(--black); }

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

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

.intro {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, calc(13svh - 32px), 65px) var(--column-inset) clamp(18px, 3.5svh, 60px);
  overflow: hidden;
}

.intro h1 {
  width: 421px;
  max-width: 100%;
  flex: none;
  font: 400 clamp(22px, 1.95vw, 28px)/1.4 var(--display);
}

.hero {
  flex: 0 1 auto;
  min-height: 0;
  width: 100%;
  aspect-ratio: var(--artwork-ratio);
  margin-top: clamp(29px, calc(16svh - 42px), 145px);
  overflow: hidden;
}

.hero a { display: block; height: 100%; }
.hero a:focus-visible { outline-offset: -4px; }
.hero img { width: 100%; height: 100%; object-fit: cover; }

.gallery {
  position: relative;
  min-height: 0;
  container-type: size;
  background: var(--black);
  color: white;
}

.gallery__window {
  height: calc(100cqh - var(--gallery-top));
  margin-top: var(--gallery-top);
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #505050 #101010;
}

.gallery[data-loop] .gallery__window { overflow-y: scroll; }

@supports not (scrollbar-color: auto) {
  .gallery__window::-webkit-scrollbar { width: 9px; }
  .gallery__window::-webkit-scrollbar-track { background: #101010; }
  .gallery__window::-webkit-scrollbar-thumb {
    border: 2px solid #101010;
    border-radius: 8px;
    background: #505050;
  }
  .gallery__window::-webkit-scrollbar-thumb:hover { background: #686868; }
}

.gallery__track {
  width: var(--artwork-width, calc(100% - 2 * var(--column-inset)));
  margin-inline-start: var(--column-inset);
}

.gallery[data-loop] .gallery__track { will-change: transform; }

.gallery__list {
  display: grid;
  gap: var(--gallery-gap);
  padding: 0 0 var(--gallery-gap);
  list-style: none;
}

.gallery__list a {
  display: block;
  width: 100%;
  height: var(--artwork-height, auto);
  aspect-ratio: var(--artwork-ratio);
  cursor: pointer;
}

.gallery__list a:focus-visible { outline-offset: -4px; }
.gallery__list img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--art-position, center);
}

.project-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.project-card picture {
  display: block;
  width: 100%;
  height: 100%;
}

.project-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: clamp(20px, 2vw, 40px);
  background: rgb(0 0 0 / 40%);
  color: var(--pink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.project-card__label {
  font: 400 clamp(22px, 2.25vw, 40px)/1.2 var(--display);
  overflow-wrap: anywhere;
}

.project-card:focus-visible .project-card__overlay { opacity: 1; }

.gallery-toggle:not([hidden]) {
  position: absolute;
  z-index: 1;
  top: 4px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: var(--black);
  color: white;
}

.gallery-toggle::before {
  content: "";
  width: 10px;
  height: 12px;
  border-inline: 2px solid currentColor;
}

.gallery-toggle[aria-pressed="true"]::before {
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-left: 9px solid currentColor;
  border-right: 0;
}

@media (hover: hover) {
  .project-card:hover .project-card__overlay { opacity: 1; }
  .gallery-toggle { opacity: 0; }
  .gallery:hover .gallery-toggle,
  .gallery:focus-within .gallery-toggle,
  .gallery-toggle[aria-pressed="true"] { opacity: 1; }
}

dialog {
  padding: 0;
  border: none;
}

dialog::backdrop { background: rgb(0 0 0 / 88%); }
.artwork-dialog {
  max-inline-size: min(92vw, 1260px);
  max-block-size: 92dvh;
  overflow: visible;
  background: transparent;
  color: white;
}

.artwork-dialog__content { position: relative; }
.artwork-dialog img {
  width: auto;
  height: auto;
  max-height: calc(88dvh - 36px);
  margin-inline: auto;
}

.artwork-dialog figcaption {
  margin-top: 10px;
  text-align: center;
}

.dialog-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--black);
  color: white;
  font-size: 29px;
  line-height: 1;
}

@media (min-width: 40rem) and (max-width: 75rem) and (min-height: 32rem),
       (min-width: 40rem) and (min-height: 32rem) and (pointer: coarse) {
  .intro {
    align-self: start;
    max-height: 100%;
    padding-block: clamp(26px, 4.5vw, 54px) clamp(44px, 10vw, 120px);
  }
  .hero {
    flex: 0 1 auto;
    margin-top: clamp(40px, 7.1vw, 85px);
  }
  .gallery__list {
    gap: clamp(15px, 1.35vw, 22px);
    padding-bottom: clamp(15px, 1.35vw, 22px);
  }
}

@media (max-width: 40rem),
       (max-width: 64rem) and (orientation: portrait),
       (max-width: 64rem) and (max-height: 32rem) {
  :root {
    --column-inset: clamp(18px, 5.5vw, 44px);
    --gallery-gap: clamp(15px, 4vw, 22px);
  }

  html:has(body.portfolio-page),
  body.portfolio-page {
    height: auto;
    overflow: visible;
    overscroll-behavior: auto;
  }
  .site { height: auto; min-height: 100dvh; grid-template-rows: 54px auto; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .site-header { padding-inline: var(--column-inset); gap: 12px; }
  .site-nav { gap: clamp(10px, 3vw, 25px); font-size: clamp(10px, 2.7vw, 12px); }
  .wordmark { font-size: clamp(15px, 4.5vw, 17px); }
  .intro { padding-block: clamp(30px, 7vw, 58px); }
  .intro h1 { font-size: clamp(22px, 5.55vw, 28px); line-height: 1.4; }
  .hero { margin-top: clamp(38px, calc(8vw + 4px), 78px); }
  .gallery { container-type: normal; }
  .gallery__window { width: auto; height: auto; margin: 0; overflow: visible; }
  .gallery__track {
    width: calc(100% - 2 * var(--column-inset));
    margin-inline: auto;
    padding-top: var(--column-inset);
  }
  .gallery__list {
    gap: var(--stacked-gallery-gap, var(--gallery-gap));
    padding-bottom: var(--stacked-gallery-gap, var(--gallery-gap));
  }
  .gallery__list a { height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .project-card__overlay { transition: none; }
  .gallery__list[aria-hidden] { display: none; }
}
