/* ============================================================
   PORTFOLIO — /portfolio.html and /bg/portfolio.html only.
   Kept out of style.css so the showcase can change without
   bumping style.css?v= on every page (and rebuilding the blog).
   Every case sets --pf-accent (the client's own brand colour);
   it is used for glows and dots only, never for text, so
   contrast stays on the theme variables in both themes.
   ============================================================ */

/* ---- index: the line-up under the hero ---- */
.pf-index,
.pf-chapters { list-style: none; }
.pf-index { border-top: 1px solid var(--line); }
.pf-index a {
  display: grid;
  grid-template-columns: 64px 1fr auto 28px;
  align-items: baseline;
  gap: 24px;
  padding: 26px 8px;
  border-bottom: 1px solid var(--line);
  transition: padding 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
}
.pf-index a:hover,
.pf-index a:focus-visible { padding-left: 24px; background: var(--bg-soft); }
.pf-index-num {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--green-d);
}
[data-theme="dark"] .pf-index-num { color: var(--green); }
.pf-index-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(26px, 3.6vw, 48px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}
.pf-index-name::before {
  content: '';
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--pf-accent, var(--green));
  flex: none;
  transform: scale(0);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pf-index a:hover .pf-index-name::before,
.pf-index a:focus-visible .pf-index-name::before { transform: scale(1); }
.pf-index-type {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: right;
}
.pf-index-arrow {
  font-weight: 700;
  color: var(--muted);
  transition: transform 0.3s ease, color 0.3s ease;
}
.pf-index a:hover .pf-index-arrow { transform: translateY(4px); color: var(--ink); }

/* ---- one case study ---- */
.pf-cases { border-top: 1px solid var(--line); }
/* A case reads as a story: the head (visual + who they are), a one-line
   idea in serif, then numbered chapters along a timeline. */
.pf-case {
  padding: 110px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 80px;
}
.pf-case-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 72px;
  align-items: center;
}
.pf-case:nth-child(even) .pf-stage { order: 2; }

/* the visual: a browser window with a phone leaning on it */
.pf-stage {
  position: relative;
  padding: 0 7% 56px 0;
}
.pf-case:nth-child(even) .pf-stage { padding: 0 0 56px 7%; }
.pf-stage::before {
  content: '';
  position: absolute;
  inset: 8% 4% 0;
  background: radial-gradient(closest-side, var(--pf-accent, var(--green)), transparent);
  opacity: 0.28;
  filter: blur(40px);
  z-index: 0;
  pointer-events: none;
}
.pf-browser {
  position: relative;
  z-index: 1;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.35);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pf-case:hover .pf-browser { transform: translateY(-6px); }
.pf-browser-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.pf-browser-bar i {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.pf-browser-bar i:nth-child(1) { background: #FF5F57; }
.pf-browser-bar i:nth-child(2) { background: #FEBC2E; }
.pf-browser-bar i:nth-child(3) { background: #28C840; }
.pf-browser-url {
  margin: 0 auto;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The full-page capture sits in a 16:10 window; hovering the case scrolls
   it top to bottom by animating object-position (no height maths needed).
   --pf-scroll is set per case from the capture's height. */
.pf-screen {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-soft);
}
.pf-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  transition: object-position var(--pf-scroll, 8s) cubic-bezier(0.45, 0.05, 0.55, 0.95);
}
.pf-case:hover .pf-screen img,
.pf-screen:focus-visible img { object-position: 50% 100%; }
.pf-case .pf-screen img { transition-delay: 0.15s; }

.pf-phone {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  width: 25%;
  min-width: 96px;
  aspect-ratio: 390 / 844;
  border-radius: 26px;
  border: 6px solid #111111;
  background: #111111;
  overflow: hidden;
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.45);
  transform: rotate(4deg);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pf-case:nth-child(even) .pf-phone { right: auto; left: 0; transform: rotate(-4deg); }
.pf-case:hover .pf-phone { transform: rotate(0deg) translateY(-10px); }
.pf-phone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  border-radius: 20px;
}

/* the story */
.pf-copy { display: flex; flex-direction: column; gap: 22px; }
.pf-tag {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.pf-tag-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pf-accent, var(--green));
}
.pf-name {
  font-size: clamp(40px, 5.4vw, 76px);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.pf-pitch {
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46ch;
}
.pf-idea {
  margin: 72px auto 0;
  max-width: 30ch;
  text-align: center;
  font-family: 'Cormorant Garamond', 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.15;
  color: var(--ink);
}
.pf-idea::before,
.pf-idea::after { color: var(--green-text); }
.pf-idea::before { content: '“'; }
.pf-idea::after  { content: '”'; }

.pf-chapters {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 64px;
  padding-top: 34px;
}
/* the timeline the chapters hang from */
.pf-chapters::before {
  content: '';
  position: absolute;
  top: 6px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--pf-accent, var(--green)), var(--line) 85%);
  opacity: 0.8;
}
.pf-chapter { position: relative; }
.pf-chapter::before {
  content: '';
  position: absolute;
  top: -34px; left: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--pf-accent, var(--green));
}
.pf-chapter:last-child::before { background: var(--pf-accent, var(--green)); }
.pf-chapter-num {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green-d);
  margin-bottom: 10px;
}
[data-theme="dark"] .pf-chapter-num { color: var(--green); }
.pf-chapter h4 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 10px;
}
.pf-chapter p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
}
.pf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-chips li {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.pf-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.pf-actions .btn { padding: 13px 22px; }

/* ---- small screens ---- */
@media (max-width: 1024px) {
  .pf-case { padding: 80px 0; }
  .pf-case-head { grid-template-columns: 1fr; gap: 44px; }
  .pf-chapters { grid-template-columns: repeat(2, 1fr); row-gap: 48px; }
  .pf-chapters::before { display: none; }
  .pf-chapter { padding-top: 26px; border-top: 2px solid var(--line); }
  .pf-chapter::before { top: -8px; }
  .pf-case:nth-child(even) .pf-stage { order: 0; }
  .pf-stage,
  .pf-case:nth-child(even) .pf-stage { padding: 0 9% 48px 0; }
  .pf-case:nth-child(even) .pf-phone { left: auto; right: 0; transform: rotate(4deg); }
}
@media (max-width: 640px) {
  .pf-index a { grid-template-columns: 40px 1fr 20px; gap: 14px; padding: 20px 4px; }
  .pf-index-type { display: none; }
  .pf-case { padding: 60px 0; }
  .pf-stage,
  .pf-case:nth-child(even) .pf-stage { padding: 0 12% 40px 0; }
  .pf-phone { width: 30%; border-width: 4px; border-radius: 18px; }
  .pf-phone img { border-radius: 14px; }
  .pf-browser-bar { height: 28px; }
  .pf-pitch { font-size: 17px; }
  .pf-idea { margin-top: 48px; }
  .pf-chapters { grid-template-columns: 1fr; row-gap: 36px; margin-top: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-screen img, .pf-phone, .pf-browser, .pf-index a { transition: none; }
  .pf-case:hover .pf-screen img { object-position: 50% 0%; }
}
