/* The projects page: photobooks and print series, each on a plate that the next one covers. */

/* * === heading: written on the first plate, with no band or rule of its own */

.plates-wrap {
  position: relative;
}

/* Not sticky like the plates, so it scrolls away as soon as the page moves. */
.plates-head {
  position: absolute;
  inset: clamp(64px, 6vw, 88px) var(--gutter) auto;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  color: #f4efe6;
  pointer-events: none;
}

.plates-head h1 {
  font: 600 clamp(28px, 3.4vw, 52px) / 0.9 var(--display);
  letter-spacing: -0.045em;
}

.plates-head h1 em {
  font: italic 400 1.05em/0.9 var(--serif);
  letter-spacing: -0.01em;
}

.plates-head .label {
  color: rgba(244, 239, 230, 0.72);
}

/* Without a plate behind it the heading sits on the page, so it takes the page's colours. */
.plates-wrap.is-empty .plates-head {
  color: var(--ink);
}

.plates-wrap.is-empty .plates-head .label {
  color: var(--ink-soft);
}

.plates-empty {
  padding: clamp(140px, 14vw, 200px) var(--gutter) clamp(80px, 9vw, 136px);
  color: var(--ink-soft);
}

/* * === projects: one full-screen plate each, stacking as the page scrolls */

/* Sticky, so each plate stays put while the next one slides up over it. The framed photo and
   the title sit together in the middle; every other plate swaps their sides. The colours are
   fixed, as on the landing: the type is always on a darkened photo, whatever the theme. */
.plate {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100svh;
  padding: var(--plate-top) var(--gutter) var(--plate-bottom);
  overflow: hidden;
  color: #f4efe6;
  background: #10130f;
  --plate-top: clamp(120px, 11vw, 168px);
  --plate-bottom: clamp(40px, 5vw, 72px);
  --mat: clamp(8px, 1vw, 16px);
  --moulding: clamp(4px, 0.45vw, 7px);
  /* The mat, the moulding and the hairline around it. */
  --frame: calc(var(--mat) + var(--moulding) + 1px);
  /* The room the framed photo has: the plate without its padding and without the frame. */
  --photo-height: calc(100svh - var(--plate-top) - var(--plate-bottom) - 2 * var(--frame));
  --photo-width: 52vw;
}

/* The framed photo and the title, side by side. Only as tall as the photo, so the plate
   centres a landscape, and the title always ends level with the foot of the frame. */
.plate-pair {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: clamp(28px, 5vw, 96px);
  min-width: 0;
}

.plate:nth-child(even) .plate-pair {
  flex-direction: row-reverse;
}

/* A landscape from the project fills the plate, out of focus and darkened, so the framed
   photo in front is the one thing in focus. Scaled up to hide the blur's soft edges. */
.plate-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(7px) brightness(0.55) saturate(0.9);
  scale: 1.06;
}

/* Darker at the foot, where the title is, and in a band at the top, the same as on the
   landing: the header inverts whatever is behind it, which over a mid-tone photo left it
   close to unreadable. */
.plate::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(10, 12, 9, 0.88), rgba(10, 12, 9, 0.6) 64px, transparent 150px),
    linear-gradient(transparent 35%, rgba(10, 12, 9, 0.55));
  pointer-events: none;
}

/* The padding leaves room for the frame, which is drawn outside the photo and would otherwise
   be clipped when the photo unveils. */
.plate .frame {
  flex: none;
  padding: var(--frame);
}

/* The photo shows whole: as tall as the plate allows, unless that makes it too wide. The frame
   is spread shadows, not padding and a border, so the photo keeps its exact shape: a narrow
   off-white mat, a dark moulding, and a hairline so the moulding reads on a dark backdrop. */
.plate .frame img {
  width: min(var(--photo-width), calc(var(--photo-height) * var(--ratio)));
  height: auto;
  box-shadow:
    0 0 0 var(--mat) #f4efe6,
    0 0 0 calc(var(--mat) + var(--moulding)) #141311,
    0 0 0 var(--frame) rgba(244, 239, 230, 0.4);
  transition: scale 1.4s var(--ease-out);
}

/* `scale`, not `transform`: the unveil animation owns the photo's transform, so a transform
   here never showed, and its transition re-eased every frame of the unveil. GSAP also writes
   `scale: none` on every element it animates, in the element's own style attribute, and only
   `!important` gets past that. */
@media (prefers-reduced-motion: no-preference) {
  .plate:hover .frame img {
    scale: 1.02 !important;
  }
}

/* Level with the foot of the frame. */
.plate-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 34vw;
  padding-bottom: var(--frame);
}

.plate-text .label {
  color: rgba(244, 239, 230, 0.72);
}

/* The footer's lighter vermilion, since --accent is too dark to read on a photo. */
.plate-text .plate-status {
  color: #ff8a65;
}

.plate-text h2 {
  font: 500 clamp(40px, 5.4vw, 104px) / 0.9 var(--display);
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
  margin: 8px 0 4px;
  padding-bottom: 0.06em;
}

.plate-cta {
  margin-top: clamp(12px, 2vw, 32px);
  font-weight: 500;
  opacity: 0.85;
}

/* The last plate runs straight into the footer: a strip of paper between two dark photos
   would break the page in two. */
.site-footer {
  margin-top: 0;
}

/* * === small screens */

/* One column: the framed photo on top, the title under it, on every plate. The photo gives up
   some height for the text. */
@media (max-width: 760px) {
  /* Smaller on a phone, so the framed photo stays the larger thing on the plate. */
  .plate-text h2 {
    font-size: 24px;
  }

  .plate-pair,
  .plate:nth-child(even) .plate-pair {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .plate {
    --plate-top: 112px;
    --photo-height: calc(100svh - var(--plate-top) - var(--plate-bottom) - 2 * var(--frame) - 210px);
    --photo-width: calc(100vw - 2 * var(--gutter) - 2 * var(--frame));
  }

  .plate-text {
    align-self: stretch;
    max-width: none;
    padding-bottom: 0;
  }
}
