/* Portfolio: a ring of project screens seen from inside, dragged sideways, opened on click.
   Eight slots hold the four projects twice so the ring stays full. */

.pf {
  min-height: 100svh;
  padding-top: 118px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.pf-head h1 {
  font-size: clamp(2.4rem, 4.6vw, 4.2rem);
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.035em;
}

.pf-head p {
  max-width: 50ch;
  margin-top: 14px;
  color: var(--text-2);
}

.pf-stage {
  --w: min(760px, 54vw);
  --R: calc(var(--w) * 1.36);
  position: relative;
  min-height: clamp(420px, 60svh, 700px);
  overflow-x: clip;
  overflow-y: visible;
  perspective: calc(var(--w) * 3.1);
  perspective-origin: 50% 38%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.pf-stage:active {
  cursor: grabbing;
}

.pf-stage:focus-visible {
  outline-offset: -6px;
}

/* A faint floor the reflections fall onto. */
.pf-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(199, 168, 107, 0), rgba(199, 168, 107, 0.05) 30%, rgba(17, 24, 33, 0.6));
  pointer-events: none;
}

.pf-ring {
  --rot: 0deg;
  position: absolute;
  left: 50%;
  top: 47%;
  transform-style: preserve-3d;
  transform: rotateX(-4deg) rotateY(var(--rot));
}

.pf-card {
  --i: 0;
  position: absolute;
  left: calc(var(--w) / -2);
  top: calc(var(--w) * -0.31);
  width: var(--w);
  color: var(--text-2);
  text-decoration: none;
  transform: rotateY(calc(var(--i) * 45deg)) translateZ(calc(var(--R) * -1));
  backface-visibility: hidden;
  -webkit-tap-highlight-color: transparent;
}

.pf-card:nth-child(2) { --i: 1; }
.pf-card:nth-child(3) { --i: 2; }
.pf-card:nth-child(4) { --i: 3; }
.pf-card:nth-child(5) { --i: 4; }
.pf-card:nth-child(6) { --i: 5; }
.pf-card:nth-child(7) { --i: 6; }
.pf-card:nth-child(8) { --i: 7; }

.pf-media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 18px;
  background: var(--ink-raise);
  box-shadow:
    inset 0 0 0 1px rgba(244, 240, 232, 0.14),
    0 40px 90px -36px rgba(0, 0, 0, 0.9);
  filter: brightness(0.55) saturate(0.8);
  -webkit-box-reflect: below calc(var(--w) * 0.1) linear-gradient(transparent 64%, rgba(255, 255, 255, 0.16));
  transition:
    filter 500ms ease,
    transform 400ms var(--ease-out),
    box-shadow 400ms ease;
}

.pf-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  pointer-events: none;
  -webkit-user-drag: none;
}

.pf-name {
  display: block;
  margin-top: 16px;
  font-size: clamp(1rem, 1.7vw, 1.5rem);
  font-weight: 650;
  letter-spacing: -0.015em;
  transition: color 400ms ease;
}

.pf-card.is-front .pf-media {
  filter: none;
  box-shadow:
    inset 0 0 0 1px rgba(199, 168, 107, 0.55),
    0 40px 90px -30px rgba(0, 0, 0, 0.9),
    0 0 80px -20px rgba(199, 168, 107, 0.35);
}

.pf-card.is-front .pf-name {
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .pf-card:hover .pf-media {
    filter: none;
    transform: translateY(-6px);
  }
}

.pf-card:focus-visible {
  outline: none;
}

.pf-card:focus-visible .pf-media {
  box-shadow:
    inset 0 0 0 2px var(--gold),
    0 40px 90px -30px rgba(0, 0, 0, 0.9);
}

/* Info bar for the project in front */

.pf-bar {
  margin-top: -40px;
  padding: 16px;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  border-radius: var(--r-surface);
  background: rgba(20, 25, 32, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(244, 240, 232, 0.08),
    inset 0 0 0 1px rgba(244, 240, 232, 0.06);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.pf-info {
  min-width: 0;
  transition: opacity 220ms ease, filter 220ms ease;
}

.pf-info.is-swapping {
  opacity: 0;
  filter: blur(5px);
}

.pf-kind {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pf-info h2 {
  margin-top: 2px;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 720;
  letter-spacing: -0.02em;
}

.pf-desc {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 0.92rem;
}

.pf-arrow {
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(244, 240, 232, 0.07);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  cursor: pointer;
  transition: background-color 180ms ease, transform 160ms var(--ease-out);
}

.pf-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--text);
  border-right: 2px solid var(--text);
  transform: translate(-65%, -50%) rotate(45deg);
}

.pf-arrow-prev::before {
  transform: translate(-35%, -50%) rotate(-135deg);
}

.pf-arrow:hover {
  background: rgba(244, 240, 232, 0.12);
}

.pf-arrow:active {
  transform: scale(0.94);
}

.pf-hint {
  margin-top: 14px;
  margin-bottom: 40px;
  color: var(--text-3);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 760px) {
  .pf {
    padding-top: 104px;
  }

  .pf-stage {
    --w: 74vw;
    min-height: 54svh;
  }

  .pf-bar {
    margin-top: -24px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
  }

  .pf-info {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .pf-open {
    grid-row: 2;
    grid-column: 2;
  }

  .pf-arrow {
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pf-media,
  .pf-info {
    transition: none;
  }
}
