/* Projects page: a split banner (Architecture | Interiors), then the two kinds of work
   (2.1 Architecture, 2.2 Interiors), each a grid of project cards.
   The cards are the same as the home page's project grid (see the Projects styles in index.html):
   when you change the cards there, change them here too.
   Loaded after css/site.css, which holds the banner, section heads, reveals, call to action and footer. */

:root { --stagger: clamp(64px, 10vw, 160px); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Split banner ----------
   Two full-bleed halves under the header, Architecture and Interiors. Each half cycles through
   photographs of its own projects (site.js); the one under the pointer widens a little. */
.pj-split {
  display: flex;
  height: clamp(420px, 60svh, 640px);
  margin-top: var(--header-h);
  overflow: hidden;
  background: var(--night);
}
.pj-half {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  transition: flex-grow .9s var(--ease-out), clip-path 1.3s var(--ease-out) var(--d, 0s);
}
.pj-half + .pj-half { --d: .14s; }
.pj-half:focus-visible { outline: 2px solid #fff; outline-offset: -8px; }

.pj-slides { position: absolute; inset: 0; }
.pj-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.4s ease, transform 7s linear;
}
.pj-slide.is-active { opacity: 1; transform: none; }

.pj-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(24, 19, 16, 0) 30%, rgba(24, 19, 16, .16) 50%, rgba(24, 19, 16, .55) 100%);
  transition: opacity .7s ease;
}

.pj-half-label {
  position: absolute;
  z-index: 1;
  left: clamp(20px, 2.8vw, 40px);
  top: 50%;
  display: inline-flex;
  align-items: flex-start;
  font: 600 clamp(1.25rem, .7vw + 1rem, 1.625rem)/1 var(--sans);
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(20, 14, 10, .35), 0 2px 18px rgba(20, 14, 10, .5);
  transform: translateY(-50%);
}
.pj-half-label sup {
  margin: -.2em 0 0 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: .04em;
  opacity: .8;
}
.pj-half-arrow {
  align-self: center;
  width: 12px;
  height: 14px;
  margin-left: 14px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .4s ease, transform .6s var(--ease-out);
}
.pj-half-arrow svg { display: block; width: 100%; height: 100%; }

.pj-half-caption {
  position: absolute;
  z-index: 1;
  left: clamp(20px, 2.8vw, 40px);
  right: clamp(20px, 2.8vw, 40px);
  bottom: clamp(20px, 2.8vw, 36px);
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 0.8125rem/1.4 var(--sans);
  color: rgba(255, 255, 255, .84);
}
.pj-half-caption::before {
  content: "";
  flex: none;
  width: 28px;
  height: 1px;
  background: currentColor;
}
.pj-half-caption-text { transition: opacity .35s ease; }
.pj-half-caption-text.is-out { opacity: 0; }

@media (hover: hover) and (min-width: 761px) {
  .pj-half:hover { flex-grow: 1.35; }
  .pj-half:hover .pj-tint { opacity: .55; }
  .pj-half:hover .pj-half-arrow { opacity: 1; transform: none; }
}
.pj-half:focus-visible .pj-half-arrow { opacity: 1; transform: none; }

/* Page load: each half wipes up in turn, then its label and caption fade in */
.js .pj-half { clip-path: inset(100% 0 0 0); }
.js .pj-half-label,
.js .pj-half-caption {
  opacity: 0;
  transition: opacity .9s ease calc(var(--d, 0s) + .6s);
}
.is-loaded .pj-half { clip-path: inset(0 0 0 0); }
.is-loaded .pj-half-label,
.is-loaded .pj-half-caption { opacity: 1; }

/* ---------- Sections ---------- */
.pj-section--plaster { background: var(--plaster); }
.pj-section--plaster .project-media { background: #e6e2dc; }

/* ---------- Project grid (as on the home page) ----------
   Two columns; the right-hand one starts lower and catches up as you scroll (--shift, set in site.js) */
.project-grid {
  --shift: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(20px, 3vw, 40px);
  row-gap: clamp(48px, 6vw, 88px);
  margin: 0;
  padding: 0 0 calc(var(--stagger) * .3);
  list-style: none;
}
.project:nth-child(even) {
  --d: .12s;
  transform: translate3d(0, calc(var(--stagger) * var(--shift)), 0);
}

.project-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
.project-card:focus-visible { outline-offset: 8px; }

.project-media {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--plaster);
  isolation: isolate;
}
.project-zoom { position: absolute; inset: 0; }
.project-zoom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.4s var(--ease-out);
}

.project-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: clamp(18px, 2.2vw, 28px);
  color: #fff;
}
.project-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg,
    rgba(36, 28, 23, .3) 0%,
    rgba(36, 28, 23, 0) 30%,
    rgba(36, 28, 23, .5) 60%,
    rgba(36, 28, 23, .88) 100%);
  transition: opacity .7s var(--ease-out);
}

.project-type {
  padding: 7px 14px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  transition: opacity .5s ease, transform .7s var(--ease-out);
}

.project-arrow {
  position: absolute;
  top: clamp(14px, 1.8vw, 22px);
  right: clamp(14px, 1.8vw, 22px);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--ink);
  transition: opacity .5s ease, transform .8s var(--ease-out);
}

.project-details { width: 100%; }
.project-details > * {
  transition: opacity .6s ease, transform .9s var(--ease-out);
}
.project-details > .project-facts { transition-delay: .06s; }

.project-desc {
  margin: 0;
  max-width: 36ch;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, .94);
}

.project-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .32);
}
.project-facts dt {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, .72);
}
.project-facts dd {
  margin: 2px 0 0;
  font-size: 0.9375rem;
  font-weight: 500;
}

.project-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 18px;
}
.project-name {
  margin: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(1.125rem, 1.3vw, 1.3125rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.project-name span {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .7s var(--ease-out);
  padding-bottom: 2px;
}
.project-scope {
  font-size: 0.875rem;
  color: var(--stone);
  white-space: nowrap;
}
/* A longer subtitle sits on its own line under the name */
.project-caption--sub {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.project-caption--sub .project-scope {
  white-space: normal;
  line-height: 1.45;
}

/* Details stay hidden until hover or keyboard focus on devices that can hover */
@media (hover: hover) {
  .project-overlay::before { opacity: 0; }
  .project-type { opacity: 0; transform: translateY(-10px); }
  .project-arrow { opacity: 0; transform: scale(.5) rotate(-45deg); }
  .project-details > * { opacity: 0; transform: translateY(28px); }

  .project-card:hover .project-overlay::before,
  .project-card:focus-visible .project-overlay::before { opacity: 1; }
  .project-card:hover .project-type,
  .project-card:focus-visible .project-type,
  .project-card:hover .project-details > *,
  .project-card:focus-visible .project-details > * { opacity: 1; transform: none; }
  .project-card:hover .project-arrow,
  .project-card:focus-visible .project-arrow { opacity: 1; transform: none; }
  .project-card:hover .project-zoom img,
  .project-card:focus-visible .project-zoom img { transform: scale(1.06); }
  .project-card:hover .project-name span,
  .project-card:focus-visible .project-name span { background-size: 100% 1px; }
}

@media (hover: none) {
  .project-desc, .project-arrow { display: none; }
  .project-overlay::before {
    background: linear-gradient(180deg, rgba(36, 28, 23, 0) 55%, rgba(36, 28, 23, .78) 100%);
  }
  .project-facts { border-top: 0; padding-top: 0; }
}

/* Reveal: the photograph wipes up and settles from a zoom, then the caption rises */
.js .project .project-media {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.4s var(--ease-out) var(--d, 0s);
}
.js .project .project-zoom {
  transform: scale(1.18);
  transition: transform 1.9s var(--ease-out) var(--d, 0s);
}
.js .project .project-caption {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .9s var(--ease-out) calc(var(--d, 0s) + .35s), transform 1s var(--ease-out) calc(var(--d, 0s) + .35s);
}
.project.is-in .project-media { clip-path: inset(0 0 0 0); }
.project.is-in .project-zoom { transform: none; }
.project.is-in .project-caption { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root { --stagger: 72px; }
}

/* Narrow screens: the halves stack, one above the other */
@media (max-width: 760px) {
  .pj-split {
    flex-direction: column;
    height: calc(100svh - var(--header-h));
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; padding-bottom: 0; }
  .project:nth-child(even) { transform: none; --d: 0s; }
  .project-media { aspect-ratio: 3 / 2; }
}

@media (prefers-reduced-motion: reduce) {
  .js .project .project-caption { opacity: 1; transform: none; transition: none; }
  .js .project .project-zoom { transform: none; transition: none; }
  .js .project .project-media { clip-path: none; transition: none; }
  .js .pj-half { clip-path: none; }
  .pj-half,
  .pj-slide,
  .pj-tint,
  .pj-half-arrow,
  .js .pj-half-label,
  .js .pj-half-caption { transition: none; }
  .pj-slide { transform: none; }
  .js .pj-half-label,
  .js .pj-half-caption { opacity: 1; }
  .project:nth-child(even) { transform: translate3d(0, var(--stagger), 0); }
  .project-grid { padding-bottom: var(--stagger); }
}
@media (prefers-reduced-motion: reduce) and (max-width: 640px) {
  .project:nth-child(even) { transform: none; }
  .project-grid { padding-bottom: 0; }
}
