/* Portfolio page — builds on style.css tokens and components */

html.pv-open { overflow: hidden; }

/* ---------- Hero ---------- */
.pf-hero {
  position: relative;
  overflow: clip visible;   /* see .hero in style.css */
  padding: 40px var(--gutter) 32px;
  display: flex;
  justify-content: center;
  text-align: center;
}
.pf-glow { top: 110px; opacity: .3; }
.pf-hero-content {
  width: 720px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pf-title { margin-top: 14px; }
.pf-sub { width: 700px; max-width: 100%; margin-top: 12px; }

/* ---------- Filters (sticky) ---------- */
.pf-filters {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px var(--gutter);
  transition: background-color .25s ease, box-shadow .25s ease;
}
.pf-filters.is-stuck {
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 rgba(17, 17, 17, .07), 0 8px 24px rgba(17, 17, 17, .04);
}
.pf-filters-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px 0 18px;
  border: .8px solid rgba(17, 17, 17, .12);
  border-radius: 14px;
  background: #fff;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  color: #111;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.pf-chip:hover { border-color: rgba(17, 17, 17, .28); }
.pf-chip.is-active { background: #191816; border-color: #191816; color: #fff; }
.pf-chip-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(17, 17, 17, .06);
  font-weight: 600;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pf-chip.is-active .pf-chip-count { background: rgba(255, 255, 255, .16); }
.pf-chip[data-empty] { opacity: .45; }

.pf-format {
  display: flex;
  padding: 5px;
  border-radius: 20px;
  background: #f4f4f5;
  flex: none;
}
.pf-seg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border-radius: 15px;
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  color: #56565c;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.pf-seg:hover { color: #111; }
.pf-seg.is-active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .05);
}
.pf-chip:focus-visible, .pf-seg:focus-visible, .pj-design:focus-visible, .pj-view:focus-visible,
.pv-close:focus-visible, .pv-viewport:focus-visible, .pv .btn:focus-visible {
  outline: 2px solid #fd22a0;
  outline-offset: 3px;
}

/* ---------- Grid ---------- */
.pf-work { padding: 20px var(--gutter) var(--section-y); }
.pf-status { margin-bottom: 20px; font-size: 14px; line-height: 20px; color: #727272; }

/* Gallery: every design as its own tile; a click opens that client's viewer at the design. */
.pd-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 24px;
}
.pd {
  position: relative;
  display: block;
  padding: 0;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: #f4f4f5;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 6px 18px rgba(20, 20, 40, .06);
  cursor: zoom-in;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
}
.pd[hidden] { display: none; }
.pd img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pd:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 16px 34px rgba(20, 20, 40, .14); }
.pd:focus-visible { outline: 2px solid #fd22a0; outline-offset: 3px; }
.pd.is-entering { animation: pf-enter .45s cubic-bezier(.2, .7, .2, 1) both; }
.pd-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: rgba(25, 24, 22, .86);
  color: #fff;
  font-weight: 500;
  font-size: 12px;
  line-height: 28px;
}
.pd-badge svg { width: 12px; height: 12px; fill: #fff; stroke: none; }
@media (max-width: 1180px) { .pd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .pd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; } .pd { border-radius: 12px; } }
/* Project (client) cards: a tinted panel with a tilted, fanned stack of the client's designs.
   portfolio.js sets data-pos on each design (0 = front) and rotates the stack on a timer. */
.pj-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 40px 32px;
}
.pj { grid-column: span 2; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pj[data-span="3"] { grid-column: span 3; }
.pj[data-span="6"] { grid-column: span 6; }
.pj[hidden] { display: none; }
.pj.is-entering { animation: pf-enter .45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes pf-enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.pj-panel {
  position: relative;
  height: 430px;
  border-radius: 20px;
  background: var(--tint, #f4f4f5);
  overflow: hidden;
  isolation: isolate;
}
.pj-top {
  position: absolute;
  z-index: 10;
  inset: 20px 20px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pj-pill {
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  font-weight: 500;
  font-size: 14px;
  line-height: 32px;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pj-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 14px;
  border-radius: 12px;
  background: #191816;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  transition: background-color .2s ease, transform .2s ease;
}
.pj-view:hover { background: #2c2b29; }
.pj-view:active { transform: scale(.97); }

.pj-stack { position: absolute; inset: 0; --dw: 60%; }
.pj[data-span="3"] .pj-stack { --dw: 40%; }
.pj[data-span="6"] .pj-stack { --dw: 24%; }
.pj-design {
  position: absolute;
  left: 50%;
  top: 76px;
  width: var(--dw);
  aspect-ratio: 4 / 5;
  padding: 0;
  border-radius: 5px;
  cursor: zoom-in;
  /* Default: tucked behind the stack (any design beyond the third) */
  --x: -76%;
  --y: 34%;
  --r: -20deg;
  opacity: 0;
  z-index: 0;
  transform: translate(calc(-50% + var(--x)), var(--y)) rotate(var(--r));
  transition: transform .9s cubic-bezier(.22, .8, .22, 1), opacity .6s ease, filter .6s ease;
}
.pj-design img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .14), 0 18px 40px rgba(17, 17, 17, .12);
}
.pj-design[data-pos="0"] { --x: 18%; --y: 6%; --r: -8deg; z-index: 3; opacity: 1; }
.pj-design[data-pos="1"] { --x: -30%; --y: 16%; --r: -14deg; z-index: 2; opacity: 1; filter: brightness(.97); }
.pj-design[data-pos="2"] { --x: -76%; --y: 26%; --r: -20deg; z-index: 1; opacity: 1; filter: brightness(.94); }
.pj-design[data-pos="out"] { --x: 95%; --y: -4%; --r: 2deg; z-index: 4; opacity: 0; }
.pj-design.no-anim { transition: none; }

/* A single design sits centred and floats gently */
.pj-stack[data-count="1"] .pj-design[data-pos="0"] { --x: 6%; --y: 4%; --r: -7deg; }
.pj-stack[data-count="1"] .pj-design img { animation: pj-float 6s ease-in-out infinite; }
@keyframes pj-float {
  50% { transform: translateY(-8px) rotate(1deg); }
}

/* Hover: fan the stack out a little */
.pj-panel:hover .pj-design[data-pos="0"] { --x: 26%; --y: 2%; --r: -5deg; }
.pj-panel:hover .pj-design[data-pos="1"] { --x: -38%; --y: 14%; --r: -15deg; }
.pj-panel:hover .pj-design[data-pos="2"] { --x: -90%; --y: 24%; --r: -23deg; }
.pj-panel:hover .pj-stack[data-count="1"] .pj-design[data-pos="0"] { --x: 6%; --y: 0%; --r: -4deg; }

.pj-body { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.pj-name {
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: 24px;
  line-height: 32px;
  letter-spacing: -0.013em;
  color: #000;
}
.pf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  color: #727272;
}
.pf-topic { color: #111; font-weight: 500; }
.pj-about::before { content: "·"; margin-right: 8px; color: #c7c7cc; }
.pj-count { font-size: 14px; line-height: 20px; color: #727272; }

.pf-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: #f4f4f5;
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
  color: #111;
}
.pf-badge--animated::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: url(../assets/img/gradient-pill.webp) center / cover;
  animation: pf-pulse 1.6s ease-in-out infinite;
}
@keyframes pf-pulse { 50% { opacity: .35; } }

.pf-empty {
  padding: 72px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.pf-empty[hidden] { display: none; }
.pf-empty-title {
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: 24px;
  line-height: 32px;
}
.pf-empty .btn { margin-top: 8px; }

/* ---------- Logo strip ---------- */
.pf-brands {
  padding: 0 0 var(--section-y);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.pf-logo-strip {
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.pf-logo-track { display: flex; align-items: center; width: max-content; }
.pf-logo-track img { flex: none; margin-right: 80px; }
.pf-logo-track.is-animated { animation: work-marquee 40s linear infinite reverse; }
@media (prefers-reduced-motion: reduce) {
  .pf-logo-track.is-animated { animation: none; }
  .pj.is-entering { animation: none; }
  .pj-design { transition: none; }
  .pj-stack[data-count="1"] .pj-design img { animation: none; }
  .pf-badge--animated::before { animation: none; }
}

/* ---------- Project viewer ---------- */
/* Full-screen panel in the client's tint; portfolio.js scrolls the track continuously. */
.pv {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--tint, #eef2f7);
  color: #111;
  overscroll-behavior: contain;
  overflow: hidden;
}
.pv[open] { display: flex; flex-direction: column; animation: pv-in .35s cubic-bezier(.2, .7, .2, 1); }
@keyframes pv-in { from { opacity: 0; transform: scale(.985); } }
.pv::backdrop { background: rgba(17, 17, 17, .35); }

.pv-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--gutter);
}
.pv-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pv-pill {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  font-family: var(--display);
  font-weight: var(--fw-display);
  font-size: 18px;
  line-height: 40px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.pv-meta { font-size: 14px; line-height: 20px; color: #56565c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-close {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  transition: transform .2s ease;
}
.pv-close:hover { transform: rotate(90deg); }

.pv-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  outline: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.pv-viewport.is-dragging { cursor: grabbing; }
.pv-track {
  display: flex;
  gap: 24px;
  padding: 0 12px;
  will-change: transform;
}
.pv-item {
  flex: none;
  height: clamp(260px, calc(100dvh - 190px), 680px);
  aspect-ratio: 4 / 5;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .12), 0 24px 48px rgba(17, 17, 17, .14);
  user-select: none;
  -webkit-user-drag: none;
}
.pv-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

.pv-bottom {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter) 20px;
}
.pv-hint { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; line-height: 20px; color: #56565c; }
.pv-hint kbd {
  display: inline-block;
  min-width: 20px;
  margin-right: 3px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .8);
  box-shadow: inset 0 0 0 .8px rgba(17, 17, 17, .12);
  font: 500 11px/18px var(--text);
  text-align: center;
  color: #3c3c43;
}
.pv-cta { flex: none; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1180px) {
  .pj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj, .pj[data-span] { grid-column: span 1; }
  .pj .pj-stack, .pj[data-span] .pj-stack { --dw: 58%; }
  .pf-filters-inner { flex-direction: column; align-items: stretch; }
  /* Let the chips scroll edge to edge rather than stopping at the gutter. */
  .pf-topics {
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
  }
  .pf-topics::-webkit-scrollbar { display: none; }
  .pf-format { align-self: center; }
}
@media (max-width: 860px) {
  .pv-hint { display: none; }
  .pv-meta { display: none; }
}
@media (max-width: 760px) {
  .pf-hero { padding: 24px var(--gutter) 24px; }
  .pf-glow { top: 70px; opacity: .26; }
  .pf-sub { margin-top: 10px; }

  .pf-filters { padding: 10px var(--gutter); }
  .pf-filters-inner { gap: 10px; }
  .pf-chip { height: 38px; padding: 0 10px 0 14px; font-size: 13px; }
  .pf-chip-count { min-width: 20px; height: 20px; line-height: 20px; }
  .pf-seg { height: 40px; padding: 0 18px; font-size: 15px; }

  .pf-work { padding-top: 20px; }
  .pf-status { margin-bottom: 14px; }
  .pj-grid { grid-template-columns: 1fr; gap: 32px; }
  .pj { gap: 14px; }
  .pj-panel { height: 340px; }
  .pj .pj-stack, .pj[data-span] .pj-stack { --dw: 48%; }
  .pj-design { top: 68px; }
  .pj-top { inset: 14px 14px auto; }
  .pj-name { font-size: 21px; line-height: 29px; }

  .pf-brands { gap: 24px; }
  .pf-logo-track img { margin-right: 44px; }

  /* Viewer: size the artwork off the shorter of the two axes so a tall
     phone never crops it sideways. */
  .pv-top { padding: 14px var(--gutter); }
  .pv-pill { height: 36px; padding: 0 13px; font-size: 16px; line-height: 36px; }
  .pv-close { width: 42px; height: 42px; border-radius: 12px; }
  .pv-track { gap: 14px; padding: 0 8px; }
  .pv-item { height: min(calc(100dvh - 170px), 111vw); }
  .pv-bottom { padding: 12px var(--gutter) 16px; justify-content: center; }
  .pv-cta { width: 100%; justify-content: center; }
}

/* Viewer pause state (click or Space toggles) */
.pv-hint-paused, .pv.is-paused .pv-hint-play { display: none; }
.pv.is-paused .pv-hint-paused { display: inline; color: #111; font-weight: 500; }
