/* ==========================================================================
   Portfolio page
   ========================================================================== */

/* Shared bits ------------------------------------------------------------- */

.client-tag {
  display: inline-block; padding: 5px 10px; background: var(--ink); color: #fff;
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}

/* 1. Header --------------------------------------------------------------- */
.pf-head { padding-block: var(--page-top) clamp(48px, 7vw, 88px); }
.pf-head__grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
  gap: clamp(32px, 5vw, 72px); align-items: end;
}
.pf-head__title { margin-top: 22px; font-size: var(--fs-display); line-height: .98; }
.pf-head__title .hl {
  /* each wrapped line gets its own black highlight */
  display: inline; padding: 0 .16em .04em; background: var(--ink); color: #fff; box-shadow: 7px 7px 0 var(--accent);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  white-space: nowrap;   /* keep the highlighted phrase together… */
}
@media (max-width: 600px) { .pf-head__title .hl { white-space: normal; } }   /* …except on phones, where it may wrap */
.pf-head__lead { max-width: 34rem; margin-top: 26px; font-size: var(--fs-lead); color: var(--slate); }

.classified { position: relative; padding-top: 34px; font-size: var(--fs-small); color: var(--slate); }
.classified p + p { margin-top: 10px; }
.classified__stamp {
  position: absolute; top: -16px; left: 18px; padding: 5px 12px;
  background: var(--accent); color: #fff; border: var(--bw) solid var(--ink); transform: rotate(-3deg);
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
}

/* 2. Featured slider ------------------------------------------------------ */
.feature { padding-top: var(--section-y); padding-bottom: var(--section-y); background: var(--surface); overflow: hidden; }
.feature__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.feature__title { font-size: var(--fs-h2); }
.feature__arrows { display: flex; gap: 12px; }

.feature__tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: var(--bw) solid var(--ink); margin-bottom: clamp(24px, 3vw, 36px);
}
.feature__tab {
  position: relative; display: block; width: 100%; height: 100%; text-align: left; cursor: pointer;
  padding: 18px 18px 6px 0; background: none; border: 0; color: var(--slate);
  font: inherit; transition: color .2s;
}
.feature__tab::before {
  /* progress bar along the top edge of the active tab */
  content: ""; position: absolute; left: 0; right: 18px; top: calc(var(--bw) * -1); height: 6px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.22,1,.36,1);
}
.feature__tab[aria-selected="true"] { color: var(--ink); }
.feature__tab[aria-selected="true"]::before { transform: scaleX(1); }
.feature__tab:hover { color: var(--ink); }
.feature__tab-num { display: block; font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; color: var(--accent); }
.feature__tab-title { display: block; margin-top: 8px; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h4); line-height: 1.12; }
.feature__tab-sub { display: block; margin-top: 6px; font-size: var(--fs-small); line-height: 1.4; }

/* Stage grows toward full width as it scrolls in (margin set by JS) */
.feature__stage-wrap { will-change: margin; }
.feature__stage {
  position: relative; border: var(--bw) solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
  background: var(--ink); overflow: hidden; touch-action: pan-y;
}
.feature__slides { position: relative; aspect-ratio: 16 / 8; min-height: 380px; }
.fslide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s; }
.fslide.is-active { opacity: 1; visibility: visible; transition: opacity .6s ease, visibility 0s; z-index: 1; }
.fslide__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 6s ease-out; }
.fslide.is-active .fslide__img { transform: scale(1); }
.fslide__card {
  position: absolute; left: clamp(16px, 3vw, 40px); bottom: clamp(16px, 3vw, 40px);
  max-width: min(520px, calc(100% - 32px)); padding: clamp(18px, 2.4vw, 28px);
  background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: 8px 8px 0 var(--accent);
  transform: translateY(18px); opacity: 0; transition: transform .6s cubic-bezier(.22,1,.36,1) .15s, opacity .5s ease .15s;
}
.fslide.is-active .fslide__card { transform: none; opacity: 1; }
.fslide__card h3 { margin: 12px 0 8px; font-size: var(--fs-h3); line-height: 1.08; }
.fslide__card p { color: var(--slate); }
.fslide__card .btn { margin-top: 18px; }

/* 4. Project view ("dive in") --------------------------------------------- */
html.pv-lock, html.pv-lock body { overflow: hidden; }
.pv {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  background: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0; transition: opacity .3s ease;
}
.pv[hidden] { display: none; }
.pv.is-open { opacity: 1; }
.pv__bar {
  flex: none; display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 12px var(--gutter); background: var(--surface); border-bottom: var(--bw) solid var(--ink);
}
.pv__back {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; flex: none;
  background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.pv__back:hover { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.pv__crumbs { flex: 1; min-width: 0; justify-content: center; }
.pv__crumbs [aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.pv__bar-actions { display: flex; gap: 8px; flex: none; }
.pv__scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.pv__hero { height: clamp(260px, 60vh, 640px); background: var(--ink); border-bottom: var(--bw) solid var(--ink); overflow: hidden; }
.pv__hero img { width: 100%; height: 100%; object-fit: cover; }
.pv.is-diving .pv__hero img { visibility: hidden; }

.pv__body { max-width: var(--max); margin: 0 auto; padding: clamp(36px, 6vw, 72px) var(--gutter) clamp(56px, 8vw, 96px); }
/* content builds in after the dive */
.pv__body > * { opacity: 0; transform: translateY(30px); transition: opacity .55s ease, transform .7s cubic-bezier(.22,1,.36,1); }
.pv.is-ready .pv__body > * { opacity: 1; transform: none; }
.pv.is-ready .pv__body > :nth-child(2) { transition-delay: .08s; }
.pv.is-ready .pv__body > :nth-child(3) { transition-delay: .16s; }
.pv.is-ready .pv__body > :nth-child(4) { transition-delay: .24s; }

.pv__intro { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.pv__title { margin: 16px 0 14px; font-size: var(--fs-h1); line-height: 1.02; }
.pv__tagline { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-quote); line-height: 1.35; color: var(--slate); }
.pv__overview { margin-top: 32px; max-width: 44rem; }
.pv__overview p { font-size: var(--fs-body-lg); line-height: 1.7; }
.pv__overview p + p { margin-top: 16px; }

.pv__meta dl { margin: 0; }
.pv__meta dt { font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.pv__meta dd { margin: 6px 0 0; font-weight: 600; }
.pv__meta dd + dt { margin-top: 18px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent); }
.pv__meta ul li { position: relative; padding-left: 16px; font-weight: 500; }
.pv__meta ul li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-size: .8em; top: .15em; }

.pv__gallery-head { margin: clamp(48px, 7vw, 80px) 0 22px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.pv__gallery-head h2 { font-size: var(--fs-h3); }
.pv__gallery-head span { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--slate); }
.pv__gallery { columns: 2 320px; column-gap: 22px; }
.pv__gallery li { break-inside: avoid; margin-bottom: 22px; }
.pv__shot {
  display: block; width: 100%; padding: 0; cursor: zoom-in; background: var(--surface);
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.pv__shot:hover, .pv__shot:focus-visible { transform: translate(-3px, -3px); box-shadow: 7px 7px 0 var(--accent); }
.pv__shot img { width: 100%; height: auto; }

.pv__next {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); margin-top: clamp(48px, 7vw, 80px);
  width: 100%; padding: 0; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.pv__next:hover, .pv__next:focus-visible { transform: translate(-3px, -3px); box-shadow: 13px 13px 0 var(--accent); }
.pv__next-img { border-right: var(--bw) solid var(--ink); overflow: hidden; min-height: 200px; }
.pv__next-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.22,1,.36,1); }
.pv__next:hover .pv__next-img img { transform: scale(1.05); }
.pv__next-body { display: flex; flex-direction: column; justify-content: center; padding: clamp(22px, 3vw, 40px); }
.pv__next-label { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.pv__next-title { display: block; margin-top: 10px; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h3); line-height: 1.08; }

/* The flying image used for the dive transition */
.dive-clone { position: fixed; z-index: 90; object-fit: cover; pointer-events: none; border: var(--bw) solid var(--ink); margin: 0; }

/* 5. Lightbox ------------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px; background: rgba(10, 10, 10, .94);
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1400px, 100%); max-height: calc(100vh - 140px); width: auto; height: auto; border: var(--bw) solid #fff; background: #fff; }
.lightbox__ui { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: min(1400px, 100%); }
.lightbox__count { font-family: var(--font-mono); font-size: var(--fs-mono); color: #fff; letter-spacing: .1em; }
.lightbox__btns { display: flex; gap: 10px; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .pf-head__grid, .pv__intro { grid-template-columns: 1fr; }
  .classified { margin-top: 12px; }
  .feature__tabs { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .feature__tabs::-webkit-scrollbar { display: none; }
  .feature__tabs > li { flex: 0 0 62%; scroll-snap-align: start; }
  .pv__crumbs { display: none; }
}
@media (max-width: 640px) {
  .feature__slides { aspect-ratio: auto; min-height: 0; height: 560px; }
  .fslide__img { height: 56%; bottom: auto; }
  .fslide__card { left: 0; right: 0; bottom: 0; max-width: none; box-shadow: none; border-width: var(--bw) 0 0; }
  .feature__arrows .arrow-btn { width: 42px; height: 42px; }
  .pv__next { grid-template-columns: 1fr; }
  .pv__next-img { border-right: 0; border-bottom: var(--bw) solid var(--ink); min-height: 0; aspect-ratio: 16 / 9; }
  .pv__back { padding: 9px 10px; }
  .pv__back-text { display: none; }
}

/* Fixes / state helpers */
html { scrollbar-gutter: stable; }
.pv__next-img { display: block; }
.pv__hero img { transition: opacity .25s ease; }
.pv.is-swapping .pv__hero img { opacity: 0; }
