/* ==========================================================================
   Portfolio page (/portfolio/)

   Selected work: the client projects as stacking cards, 90% of the section
   wide. Each card shows the whole 16:9 client artwork (1920 x 1080), never
   cropped, with the heading and project details underneath. Scrolling drives
   the motion, no arrow buttons (assets/js/pages/portfolio-motion.js): each
   card rises, opening from rounded corners and a slight zoom, sticks at
   --stick-top, and the next slides up over it while it sinks back (--sink)
   and darkens (--shade). The script also wraps each image in .project-media
   and the heading and details in .project-text.

   Our clients: the shared logo strip (includes/client-logos.php), placed
   right under the page heading, styled at the end of this file.
   ========================================================================== */

#work {
  height:auto;
  min-height:0;
  padding:55px 0 clamp(40px,5vw,80px);
  overflow:visible;
}

#work .work-sticky {
  position:relative;
  top:auto;
  height:auto;
  min-height:0;
  padding:0;
  overflow:visible;
}

#work>.work-sticky>.section-label,#work .work-head {
  margin-left:var(--pad);
  margin-right:var(--pad);
}

#work .work-count {
  white-space:nowrap;
}

#work .work-bottom {
  display:none;
}

/* ---------- The stack: 90% of the section, centred ---------- */
#work .work-track {
  display:block;
  width:90%;
  margin:35px auto 0;
  padding:0;
  overflow:visible;
  transform:none!important;
  scroll-snap-type:none;
  will-change:auto;
}

#work .project {
  position:relative;
  width:100%;
  min-width:0;
  margin:0;
  scroll-snap-align:none;
}

#work .project+.project {
  margin-top:clamp(28px,4vw,60px);
}

#work .is-stacked .project {
  position:sticky;
  top:var(--stick-top,72px);
  overflow:hidden;
  background:#171714;
}

/* The card being covered darkens */
#work .is-stacked .project:after {
  content:'';
  position:absolute;
  inset:0;
  z-index:3;
  background:#171714;
  opacity:var(--shade,0);
  pointer-events:none;
}

/* ---------- The card: artwork, then heading and details ---------- */
#work .project-button {
  display:block;
  height:auto;
  min-height:0;
  padding:0;
  overflow:visible;
  clip-path:none;
  container-type:inline-size;
  transform:scale(var(--sink,1));
  transform-origin:50% 100%;
}

#work .project-button:focus-visible {
  outline:none;
}

#work .project-button:focus-visible .project-media {
  outline:3px solid var(--orange);
  outline-offset:-3px;
}

/* The whole artwork at its own 16:9 shape; the zoom stays inside the frame */
#work .project-media {
  display:block;
  overflow:hidden;
  aspect-ratio:16 / 9;
  border-radius:6px;
  background:#22221e;
}

#work .project-button img,#work .project-button:hover img {
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:50% 50%;
  transform:scale(var(--frame-scale,1));
  transition:none;
}

/* Heading (up to two lines on narrow cards, one on wide) and details. The
   reserved height keeps every card the same size, so the stack lines up. */
#work .project-text {
  --hs:clamp(19px,6.4cqw,40px);
  display:block;
  min-height:calc(var(--hs) * 2.45 + 66px);
  padding-top:18px;
}

#work .project-overlay {
  position:static;
  display:-webkit-box;
  max-width:none;
  overflow:hidden;
  color:white;
  padding-bottom:.12em;   /* room for descenders (p, g, y) inside the clipped box */
  font-size:var(--hs);
  font-weight:700;
  letter-spacing:-.025em;
  line-height:1.15;
  text-shadow:none;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  transition:color .3s;
}

#work .project-button:hover .project-overlay,#work .project-button:focus-visible .project-overlay {
  color:var(--orange);
}

#work .project-meta {
  position:static;
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  gap:4px 20px;
  margin:12px 0 0;
  color:white;
  font-size:clamp(11px,1.1cqw,14px);
  letter-spacing:.05em;
  line-height:1.4;
  text-shadow:none;
}

#work .project-meta span:first-child {
  font-weight:700;
  text-transform:uppercase;
}

#work .project-meta span:last-child {
  font-weight:600;
  color:#dedbd4;
}

@container (min-width:600px) {
  #work .project-text {
    --hs:clamp(24px,4cqw,52px);
    min-height:calc(var(--hs) * 1.3 + 66px);
    padding-top:22px;
  }
  #work .project-overlay {
    -webkit-line-clamp:1;
  }
  #work .project-meta {
    margin-top:14px;
  }
}

/* ---------- Reduced motion: the cards simply follow one another ---------- */
@media(prefers-reduced-motion:reduce) {
  #work .is-stacked .project {
    position:relative;
    top:auto;
  }
  #work .project-button img {
    transform:none!important;
  }
}

/* ==========================================================================
   Our clients: the shared logo strip (includes/client-logos.php) right under
   the page heading, compact: the numbered label (its left part is the
   section heading) and the logos, each on its own white card. They drift in
   a loop and pause on hover, on focus or with the pause button.
   ========================================================================== */
.client-logos.client-logos--portfolio {
  padding:clamp(34px,4vw,56px) 0 clamp(40px,5vw,70px);
  border-top:1px solid var(--line);
  border-bottom:0;
}

.client-logos--portfolio .section-label {
  align-items:baseline;
  margin:0 var(--pad) clamp(22px,3vw,36px);
}

/* The label doubles as the heading: label type, not display type */
.client-logos--portfolio .section-label h2 {
  margin:0;
  font-size:inherit;
  font-weight:inherit;
  letter-spacing:inherit;
  line-height:inherit;
}

/* Equal spacing everywhere, including where the two copies of the group meet */
.client-logos--portfolio .logo-group {
  gap:12px;
  padding-right:12px;
}

.client-logos--portfolio .client-wordmark {
  width:200px;
  height:112px;
  padding:10px 14px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
}

.client-logos--portfolio .clients-pause {
  margin-top:22px;
}

@media(max-width:700px) {
  .client-logos.client-logos--portfolio {
    padding:28px 0 34px;
  }
  .client-logos--portfolio .section-label {
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    margin-bottom:18px;
  }
  /* main.css right-aligns the last label at 42% width on phones; here both labels stack, left-aligned */
  .client-logos--portfolio .section-label>*,.client-logos--portfolio .section-label>span:last-child {
    max-width:none;
    margin:0;
    text-align:left;
  }
  .client-logos--portfolio .logo-group {
    gap:8px;
    padding-right:8px;
  }
  .client-logos--portfolio .client-wordmark {
    width:148px;
    height:84px;
    padding:6px 10px;
  }
  .client-logos--portfolio .clients-pause {
    margin-top:16px;
  }
}

/* Reduced motion: the logos stay still and the row scrolls by hand; no second copy */
@media(prefers-reduced-motion:reduce) {
  .client-logos--portfolio .logo-group {
    padding-left:var(--pad);
  }
}

dialog:has(.project-film:hover) .cursor {
  display:none!important;
}
