/* ===============================
   PROJECT PAGES — STICKY LEFT + SCROLL RIGHT PLATES
   =============================== */

.project-page .project-layout {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;

  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--gap);
  align-items: start;
}

/* Space before footer */
.project-page main {
  padding-bottom: 150px;
}

/* Sticky left plate */
.project-page .project-sticky {
  position: sticky;
  top: var(--sticky-top);
  align-self: start;

  background: #fff;
  min-height: var(--plate-min);
}

.project-page .sticky-inner {
  height: var(--plate-min);
  padding: var(--left-pad-top) 0 var(--left-pad-bottom) 0;
  display: flex;
  flex-direction: column;
}

.project-page .sticky-meta {
  margin: 0 0 60px 0;
  font-family: var(--ui-font);
  font-weight: 300;
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  line-height: 1.4;
  text-transform: uppercase;
}

.project-page .meta-title {
  display: inline-block;
  margin-bottom: 0.6em;
  font-weight: 400;
}

.project-page .sticky-body p {
  margin: 0 0 24px 0;
  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 52ch;
}

.project-page .sticky-caption {
  margin-top: auto;
  padding-top: 10px;

  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 52ch;

  font-family: "beaufort-pro", serif;
  font-weight: 300;
  font-style: normal;

  color: rgba(0, 0, 0, 0.55);

  opacity: 0;
  transform: translateY(1px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.project-page .sticky-caption.is-on {
  opacity: 1;
  transform: translateY(0);
}

/* Right column: plates */
.project-page .project-stream {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-page .plate {
  position: relative;
  height: auto;
  overflow: visible;
  background: #fff;

  margin-right: calc(-1 * var(--axis-y));
  width: calc(100% + var(--axis-y));
}

.project-page .plate-muted {
  background: #e7e7e7;
}

.project-page .plate-figure {
  margin: 0;
  width: 100%;
  height: auto;
}

.project-page .plate-figure img {
  width: 100%;
  height: auto;
  display: block;
}

/* Snapped plate number */
.project-page .plate-num {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 2;

  font-family: var(--ui-font);
  font-weight: 300;
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.75);

  pointer-events: none;

  opacity: 0;
  transform: translateY(2px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.project-page .plate.is-active .plate-num {
  opacity: 1;
  transform: translateY(0);
}

.project-page .back-to-top {
  position: fixed;
  right: 25px;
  bottom: calc(25px + var(--btt-push, 0px));
  z-index: 999;

  background: transparent;
  border: none;

  display: inline-block;
  text-decoration: none;

  font-family: "termina", sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: 23px;
  line-height: 1;

  color: rgba(0, 0, 0, 0.5);

  opacity: 0;
  transform: translateY(6px) scaleY(0.8);
  pointer-events: none;

  transition: opacity 220ms ease, transform 220ms ease, color 180ms ease;
}

.project-page .back-to-top.is-on {
  opacity: 1;
  transform: translateY(0) scaleY(0.8);
  pointer-events: auto;
}

/* Only allow hover feedback on devices that truly support hover */
@media (hover: hover) and (pointer: fine) {
  .project-page .back-to-top:hover {
    color: var(--text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-page .back-to-top {
    transition: none;
    transform: none;
  }
}

/* ===============================
   Scroll reveal (project plates only)
   =============================== */

.project-page .plate {
  opacity: 1;
  transform: none;
}

.reveal-on.project-page .plate {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 420ms ease-out, transform 420ms ease-out;
  will-change: opacity, transform;
}

.reveal-on.project-page .plate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-on.project-page .plate {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .project-page .plate-num {
    transition: none;
    transform: none;
  }

  .project-page .sticky-caption {
    transition: none;
    transform: none;
  }
}

/* ===============================
   MOBILE
   =============================== */

@media (max-width: 860px) {
  .project-page .project-layout {
    grid-template-columns: 1fr;
  }

  .project-page .project-sticky {
    position: static;
    min-height: auto;
  }

  /* On mobile, rely on the global axis padding (body) for left/right alignment.
     Keep this block tight so the title sits closer to the header. */
  .project-page .sticky-inner {
    height: auto;
    padding: 16px 0 0;
  }

  /* Reduce the title block gap on mobile */
  .project-page .sticky-meta {
    margin: 0 0 28px 0;
  }

  .project-page .sticky-body p {
    margin: 0 0 18px 0;
  }

  .project-page .plate {
    margin-right: 0;
    width: 100%;
  }

  .project-page .plate-num {
    left: 14px;
    bottom: 14px;
  }

  /* Defensive: remove any inherited first-child top margins in the sticky column */
  .project-page .project-meta,
  .project-page .project-title,
  .project-page h2:first-child,
  .project-page h3:first-child {
    margin-top: 0;
  }
}

/* PROJECT PAGES — tighten fixed-header clearance (mobile only)
   Your global CSS likely does: main { margin-top: calc(var(--main-offset-y) + 64px); }
   For project pages, we want *only* the 64px clearance. */
@media (max-width: 640px) {
  .project-page {
    --main-offset-y: 0px;
  }

  .project-page main {
    margin-top: 64px;
  }
}
