/* Projects: the filterable grid of completed work, and each project's page with its
   arched cover photo, write-up, "what we made" list, gallery and photo viewer. */

/* ---------- Sector filter ---------- */
.section.projects { padding-top: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.pfilter { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pfilter button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0.5rem 1rem;
  background: transparent; color: var(--ink); cursor: pointer;
  border: 1.5px solid var(--ink);
  font-size: 0.9375rem; font-weight: 600; line-height: 1.2;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.pfilter button:hover { background: var(--cement); }
.pfilter button[aria-pressed="true"] { background: var(--ink); color: var(--lime); }
.pfilter__n { font-size: 0.8125rem; font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }
.pfilter__status { min-height: 1.5em; margin: 1rem 0 2rem; font-size: var(--text--1); color: var(--ink-soft); }
html:not(.js) :is(.pfilter, .pfilter__status) { display: none; }
@media (max-width: 40rem) {
  .pfilter {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
  }
  .pfilter::-webkit-scrollbar { display: none; }
  .pfilter button { flex: none; }
}

/* ---------- Project cards ---------- */
.pgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.25rem 1.25rem; }
@media (min-width: 40rem) { .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.75rem 1.5rem; } }
.pcard[hidden] { display: none; }
@media (min-width: 40rem) { .pcard--lead { grid-column: span 2; } }

.pcard__link { position: relative; display: flex; flex-direction: column; height: 100%; color: var(--ink); text-decoration: none; }
.pcard__link:focus-visible { outline-offset: 6px; }
.pcard__media { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--night); }
.pcard--lead .pcard__media { aspect-ratio: 16 / 10; }
@media (min-width: 72rem) { .pcard--lead .pcard__media { aspect-ratio: 33 / 20; } }
.pcard__media img { width: 100%; height: 100%; object-fit: cover; transition: scale 0.9s var(--ease-out, ease); }
/* Sunset light rises over the photo on hover */
.pcard__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgb(226 69 122 / 0.45), rgb(255 162 76 / 0.12) 45%, transparent 70%);
  opacity: 0; transition: opacity 0.5s ease;
}
.pcard__link:is(:hover, :focus-visible) .pcard__media img { scale: 1.06; }
.pcard__link:is(:hover, :focus-visible) .pcard__media::after { opacity: 1; }
.pcard__drawing {
  display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%;
  padding: 2.5rem 2.5rem 0; background: var(--sky); color: var(--lime); --px: 1.5; --pxd: 0.9;
}
.pcard__drawing .drawing { width: 100%; height: 100%; }

.pcard__sector {
  position: absolute; top: 0.75rem; left: 0.75rem;
  padding: 0.3rem 0.6rem; font-size: 0.8125rem; font-weight: 600; line-height: 1.3;
  background: rgb(26 16 48 / 0.85); color: var(--lime);
}
.pcard__body { position: relative; display: grid; gap: 0.25rem; padding-top: 1rem; }
/* A sunset rule sweeps under the photo on hover */
.pcard__body::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--ochre), var(--pink));
  transform: scaleX(0); transform-origin: left; transition: transform 0.45s var(--ease-out, ease);
}
.pcard__link:is(:hover, :focus-visible) .pcard__body::before { transform: scaleX(1); }
.pcard__name { font-size: var(--text-2); line-height: 1.2; }
.pcard--lead .pcard__name { font-size: var(--text-3); }
.pcard__place { font-weight: 560; color: var(--ink-soft); }
.pcard__work { font-size: 0.9375rem; line-height: 1.45; color: var(--ink-soft); }

/* Cards pour in: the photo fills from the bottom, then the text settles */
.motion .pcard .pcard__media { transition: clip-path 1s var(--ease-in-out, ease) var(--d, 0ms); }
.motion .pcard:not(.in-view) .pcard__media { clip-path: inset(100% 0 0 0); }
.motion .pcard:not(.in-view) .pcard__media img { scale: 1.18; }
.motion .pcard .pcard__body { transition: opacity 0.6s ease calc(var(--d, 0ms) + 0.35s), translate 0.6s var(--ease-out, ease) calc(var(--d, 0ms) + 0.35s); }
.motion .pcard:not(.in-view) .pcard__body { opacity: 0; translate: 0 12px; }

/* Filtering: cards glide to their new places, the rest of the page stays still */
html.is-filtering::view-transition-old(root), html.is-filtering::view-transition-new(root) { animation: none; }
html.is-filtering .site-header { view-transition-name: none; }
::view-transition-group(*) { animation-duration: 0.5s; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }

/* ---------- Project page: header with the arched cover photo ---------- */
.project-head .wrap { align-items: center; }
@media (min-width: 52rem) { .project-head .wrap { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.project-head h1 { max-width: 18ch; font-size: clamp(2.25rem, 1.3rem + 3.6vw, 4.25rem); }
.crumbs { margin-bottom: 1.25rem; font-size: 0.9375rem; font-weight: 600; }
.crumbs a { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--on-ink-soft); text-decoration: none; }
.crumbs a::before { content: ""; width: 0.5rem; height: 0.5rem; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: 45deg; }
.crumbs a:hover { color: var(--lime); text-decoration: underline; text-underline-offset: 0.25em; }
.pfacts { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid rgb(255 244 232 / 0.18); }
.pfacts dt { font-size: var(--text--1); color: var(--on-ink-soft); }
.pfacts dd { font-weight: 640; font-variation-settings: "SHRP" 100; color: var(--lime); }
.pfacts dd a { color: var(--lime); text-decoration-color: var(--ochre); text-underline-offset: 0.25em; }

/* The cover photo stands in an arch, in front of the setting sun */
.pcover {
  position: relative; justify-self: center;
  width: min(100%, 25rem); aspect-ratio: 4 / 5; margin: 1.5rem 0 0;
  box-shadow: 0 2px 0 0 var(--lime);
}
.pcover::before {
  content: ""; position: absolute; left: 50%; bottom: 0; translate: -50% 0;
  width: 136%; aspect-ratio: 2 / 1; border-radius: 999px 999px 0 0;
  background: var(--sun) top / 100% 200%;
  -webkit-mask: linear-gradient(#000 0 34%, transparent 0), repeating-linear-gradient(180deg, #000 0 11px, transparent 11px 17px);
  mask: linear-gradient(#000 0 34%, transparent 0), repeating-linear-gradient(180deg, #000 0 11px, transparent 11px 17px);
  filter: drop-shadow(0 0 3rem rgb(255 120 90 / 0.4));
}
.pcover::after {
  content: ""; position: absolute; inset: -0.85rem -0.85rem 0; pointer-events: none;
  border: 2px solid rgb(255 244 232 / 0.6); border-bottom: 0; border-radius: 999px 999px 0 0;
}
.pcover img { position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 999px 999px 0 0; }
@media (min-width: 52rem) { .pcover { margin-top: 2rem; } }

.motion .pcover img { animation: cover-pour 1.2s var(--ease-in-out, ease) 0.2s both; }
.motion .pcover::before { animation: sun-rise 1.4s var(--ease-out, ease) both; }
.motion .pcover::after { animation: arch-in 0.8s ease 1s both; }
@keyframes cover-pour { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes sun-rise { from { translate: -50% 30%; opacity: 0; } }
@keyframes arch-in { from { opacity: 0; scale: 0.96; } }

/* ---------- Project page: details and gallery ---------- */
.case__grid { display: grid; gap: 3rem; }
@media (min-width: 64rem) {
  .case__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(3rem, 5vw, 5rem); align-items: start; }
}
@media (min-width: 64rem) and (min-height: 58rem) {
  .case__details { position: sticky; top: calc(var(--header-h) + 2rem); }
}
.case__heading { font-size: var(--text-2); margin-bottom: 1rem; }
.case__about p { max-width: 54ch; font-size: 1.1875rem; line-height: 1.6; }
.case__about p + p { margin-top: 1rem; }
.case__about + .case__heading { margin-top: 2.75rem; }
.case__actions { margin-top: 2.5rem; }

.work { display: grid; }
.work__item { display: grid; grid-template-columns: 4.25rem minmax(0, 1fr); gap: 1.1rem; align-items: center; padding-block: 0.85rem; border-top: 1px solid var(--rule); }
.work__item:last-child { border-bottom: 1px solid var(--rule); }
.work__art {
  display: flex; align-items: flex-end; justify-content: center; width: 4.25rem; height: 4.25rem; padding: 0.5rem 0.5rem 0;
  background: var(--cement); border-bottom: 2px solid var(--ink); color: var(--ink); --px: 1.3; --pxd: 0.8;
}
.work__art .drawing { width: 100%; height: 100%; }
/* Line drawings normally hide the jali lattice; here it is what identifies the product */
:is(.work__art, .pcard__drawing) .drawing .jl { display: inline; }
.work__text { display: grid; gap: 0.15rem; }
.work__label { font-weight: 640; font-variation-settings: "SHRP" 100; color: var(--ink); text-decoration-color: var(--pink); text-decoration-thickness: 2px; text-underline-offset: 0.25em; }
.work__label:hover { text-decoration-color: currentColor; }
.work__note { font-size: 0.9375rem; line-height: 1.45; color: var(--ink-soft); }

.pgallery { columns: 2 15rem; column-gap: 1rem; }
.pgallery--single { columns: 1; }
.pphoto { break-inside: avoid; margin-bottom: 1rem; }
.pphoto__link { position: relative; display: block; overflow: hidden; background: var(--night); }
.pphoto__link:focus-visible { outline-offset: 4px; }
.pphoto img { display: block; width: 100%; height: auto; transition: scale 0.8s var(--ease-out, ease); }
.pphoto__link:is(:hover, :focus-visible) img { scale: 1.04; }
.pphoto__zoom {
  position: absolute; right: 0.75rem; bottom: 0.75rem; display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem; background: rgb(26 16 48 / 0.85); color: var(--lime);
  opacity: 0; translate: 0 6px; transition: opacity 0.3s ease, translate 0.3s ease;
}
.pphoto__zoom svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pphoto__link:is(:hover, :focus-visible) .pphoto__zoom { opacity: 1; translate: 0 0; }
@media (hover: none) { .pphoto__zoom { opacity: 1; translate: 0 0; } }
.pgallery__empty { padding: 2rem; background: var(--cement); color: var(--ink-soft); }
.motion .pphoto .pphoto__link { transition: clip-path 1.1s var(--ease-in-out, ease) var(--d, 0ms); }
.motion .pphoto:not(.in-view) .pphoto__link { clip-path: inset(100% 0 0 0); }

/* ---------- More projects and the pager ---------- */
.more__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 2rem; }
.section--cement .pcard__media { background: var(--ink); }
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 3.5rem; padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.pager__link { display: grid; gap: 0.25rem; align-content: start; padding-block: 0.5rem; color: var(--ink); text-decoration: none; }
.pager__link--next { text-align: right; justify-items: end; }
.pager__dir { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--text--1); color: var(--ink-soft); }
.pager__link--prev .pager__dir::before, .pager__link--next .pager__dir::after {
  content: ""; width: 0.45rem; height: 0.45rem; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
}
.pager__link--prev .pager__dir::before { rotate: 45deg; }
.pager__link--next .pager__dir::after { rotate: -135deg; }
.pager__name { font-size: var(--text-1); font-weight: 640; font-variation-settings: "SHRP" 100; line-height: 1.25; }
.pager__link:hover .pager__name { text-decoration: underline; text-decoration-color: var(--pink); text-decoration-thickness: 2px; text-underline-offset: 0.25em; }

/* ---------- Photo viewer ---------- */
.lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  background: radial-gradient(70% 50% at 50% 110%, rgb(226 69 122 / 0.28), transparent 70%), rgb(20 11 38);
  color: var(--lime);
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgb(20 11 38 / 0.6); }
html:has(.lightbox[open]) { overflow: hidden; }
.lightbox :focus-visible { outline-color: var(--ochre); }
.lightbox__figure { display: grid; justify-items: center; gap: 0.85rem; max-width: 100%; margin: 0; padding: 4.5rem 5.5rem 1.5rem; }
.lightbox__img { width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 10rem); object-fit: contain; box-shadow: 0 2rem 4rem -2rem rgb(0 0 0 / 0.7); }
.lightbox__caption { max-width: 60ch; text-align: center; font-size: 0.9375rem; color: var(--on-ink-soft); }
.lightbox__count { position: absolute; top: 1.4rem; left: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lightbox__btn {
  position: absolute; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.9rem; cursor: pointer;
  background: rgb(255 244 232 / 0.08); color: var(--lime); border: 1.5px solid rgb(255 244 232 / 0.35);
  font-weight: 600; transition: background-color 0.2s ease, border-color 0.2s ease;
}
.lightbox__btn:hover { background: rgb(255 244 232 / 0.18); border-color: var(--lime); }
.lightbox__btn svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__step { top: 50%; translate: 0 -50%; width: 3.25rem; height: 3.25rem; padding: 0; }
.lightbox__prev { left: 1rem; }
.lightbox__next { right: 1rem; }
.lightbox.is-single .lightbox__step, .lightbox.is-single .lightbox__count { display: none; }
@media (max-width: 40rem) {
  .lightbox__figure { padding: 4.5rem 1rem 6rem; }
  .lightbox__step { top: auto; bottom: 1.25rem; translate: none; }
  .lightbox__prev { left: calc(50% - 4rem); }
  .lightbox__next { right: calc(50% - 4rem); }
}
.motion .lightbox[open] { animation: lb-in 0.3s ease; }
.motion .lightbox__img.is-entering { animation: lb-photo 0.45s var(--ease-out, ease); }
@keyframes lb-in { from { opacity: 0; } }
@keyframes lb-photo { from { opacity: 0; translate: var(--from, 0) 0; scale: 0.98; } }

@media (prefers-reduced-motion: reduce) {
  .pcard__media img, .pphoto img { transition: none; }
}
