.portfolio-project {
  color: var(--charcoal);
  background: var(--white);
  color-scheme: light;
}
.project-hero {
  padding: clamp(2rem, 5vw, 5.5rem) 0 clamp(3.2rem, 8vw, 8rem);
  background: var(--charcoal);
  color: var(--white);
}
.project-hero h1 {
  max-width: 24ch;
  margin-top: clamp(1.8rem, 4.8vw, 4.4rem);
  font-size: clamp(2.5rem, 6.5vw, 6.6rem);
  font-weight: 560;
  line-height: 1;
  letter-spacing: -.058em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.project-back {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 550;
  text-decoration: none;
}
.project-back span {
  color: #b92d48;
  font-size: 1.35em;
}
.project-hero .project-back span { color: var(--coral); }
.project-back:hover { text-decoration: underline; text-underline-offset: .25em; }
.project-hero .project-back:focus-visible { outline-color: var(--citron); }
.project-content {
  padding-top: clamp(2.6rem, 7vw, 7rem);
  font-size: clamp(1rem, .93rem + .27vw, 1.23rem);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.project-row { margin-bottom: clamp(2rem, 5vw, 5.3rem); }
.project-row--reading { max-width: 68ch; }
.project-row--2, .project-row--3, .project-row--4 {
  display: grid;
  align-items: start;
  gap: clamp(1.8rem, 4.6vw, 5rem);
}
.project-row--2 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.project-row--3, .project-row--4 { gap: clamp(.9rem, 2vw, 2.4rem); }
.project-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.project-column { min-width: 0; }
.project-copy { max-width: 70ch; }
.project-content :is(p, ul, ol, blockquote) { margin: 0 0 1.1em; }
.project-content p:empty { display: none; }
.project-content :is(h2, h3, h4, h5, h6) {
  margin: 1.25em 0 .38em;
  font-size: clamp(1.25rem, 1rem + .95vw, 2rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.032em;
}
.project-content :is(h2, h3, h4, h5, h6):first-child { margin-top: 0; }
.project-content a { text-underline-offset: .21em; text-decoration-color: #b92d48; }
.project-content hr { border: 0; border-top: 1px solid #382d3329; margin: 2em 0; }
.project-content img { max-width: 100%; height: auto; }
.project-image:not(:last-child), .project-video:not(:last-child) { margin-bottom: clamp(1.25rem, 3.2vw, 3rem); }
.project-image a, .project-image-link { display: inline-block; max-width: 100%; vertical-align: top; }
.project-quote { border-inline-start: 3px solid var(--coral); padding-inline-start: 1.25rem; margin-block: 2rem; }
.project-video video { display: block; max-width: 100%; width: auto; height: auto; max-height: 77vh; aspect-ratio: 9 / 16; }
.project-video iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; display: block; }
.project-video iframe + iframe { margin-top: 1rem; }
.project-video .video-consent button[hidden] { display: none; }
.project-video .video-consent iframe { margin-top: 1rem; }
.project-end {
  border-top: 1px solid #382d3333;
  margin-top: 2.5rem;
  padding: 1.2rem 0 clamp(2.6rem, 5vw, 5rem);
}
@media (max-width: 47rem) {
  .project-row--2, .project-row--3, .project-row--4 { grid-template-columns: minmax(0, 1fr); }
  .project-row { margin-bottom: 2.4rem; }
}

.project-image-preview-link {
  display: block;
  width: fit-content;
  max-width: 100%;
}
.project-image a.project-image-preview-link { display: block; }
.project-content a[aria-haspopup="dialog"] { cursor: zoom-in; }
.project-image-preview {
  display: inline-block;
  position: relative;
  max-width: 100%;
  vertical-align: top;
}
.project-image-preview .project-image-enlarge {
  position: absolute;
  inset: auto .5rem .5rem auto;
  cursor: zoom-in;
}

.project-lightbox-open {
  overflow: hidden;
  overscroll-behavior: none;
}
.project-lightbox {
  --lightbox-control-size: var(--button-height);
  --lightbox-edge: max(
    clamp(.75rem, 2vw, 1.5rem),
    env(safe-area-inset-top),
    env(safe-area-inset-right),
    env(safe-area-inset-bottom),
    env(safe-area-inset-left)
  );
  --lightbox-controls: calc(var(--lightbox-control-size) + var(--lightbox-edge) * 2);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--lightbox-controls);
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--white);
  color-scheme: dark;
  touch-action: pan-y pinch-zoom;
}
.project-lightbox[open] {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}
.project-lightbox::backdrop { background: var(--charcoal); }
.project-lightbox-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
}
.project-lightbox button,
.project-image-enlarge {
  display: grid;
  place-items: center;
  width: var(--button-height);
  height: var(--button-height);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--button-radius);
  background: var(--charcoal);
  color: var(--white);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.project-lightbox button { position: absolute; }
:is(.project-lightbox button, .project-image-enlarge):is(:hover, :focus-visible) {
  background: var(--citron);
  color: var(--charcoal);
}
:is(.project-lightbox button, .project-image-enlarge):focus-visible { outline-color: var(--white); }
:is(.project-lightbox button, .project-image-enlarge) svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.project-lightbox-close { inset: var(--lightbox-edge) var(--lightbox-edge) auto auto; }
.project-lightbox-previous { inset: 50% auto auto var(--lightbox-edge); translate: 0 -50%; }
.project-lightbox-next { inset: 50% var(--lightbox-edge) auto auto; translate: 0 -50%; }

@media (max-width: 47rem) and (orientation: portrait) {
  .project-lightbox { padding-inline: var(--lightbox-edge); }
  .project-lightbox-previous,
  .project-lightbox-next { inset-block: auto var(--lightbox-edge); translate: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .project-lightbox[open],
  .project-lightbox[open]::backdrop { animation: project-lightbox-fade-in .16s ease-out; }
  @keyframes project-lightbox-fade-in { from { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  .project-lightbox button, .project-image-enlarge { transition: none; }
}
