/* dfrnt. — 3D phone social showcase (production_05)
   ────────────────────────────────────────────────────────────────────────────
   Replaces the production_02 "real feeds" carousel on both homepages.
   A CSS 3D iPhone (front, stacked titanium edge, purple back) shows a playlist
   of real accounts: Instagram profile grids for 10s each, Reels for their full
   length. feeds-phone.js runs the playlist; anime.js (loaded by script.js)
   only adds the choreography. Without it the phone still works: slides
   cross-fade with CSS and the idle float is a CSS keyframe.

   Layer stack (every level keeps preserve-3d):
     .fp-stage   perspective + scale for small screens
     .fp-tilt    pointer tilt (anime animatable, springs)
     .fp-float   idle float (CSS keyframes, compositor only)
     .fp-spin    swings and full spins on slide change (anime)
     .fp-phone   the model: .fp-edge × 12, .fp-back, .fp-front           */

.fp {
  --ph-w: 300px; --ph-h: 614px; --ph-r: 52px; --ph-scale: 1;
  background: var(--bg-mid); position: relative; overflow: hidden;
  padding: 110px 60px 100px; border-top: 1px solid rgba(255,255,255,.05);
  scroll-margin-top: 80px;
}
.fp-inner {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: 56px; align-items: center;
}
.fp-copy .v2-section-sub { max-width: 520px; }


/* Section heading styles, so the section also works outside the homepage
   (case-studies uses it since 24 Oct). Same values as the homepage. */
.fp .v2-section-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(40px, 5vw, 72px); letter-spacing: -.04em; text-transform: lowercase; line-height: .98; color: var(--white); margin: 12px 0 16px; }
.fp .v2-section-title em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--em-soft); -webkit-text-stroke: 0; }
.fp .v2-section-sub { font-size: 15px; color: rgba(255,255,255,.55); line-height: 1.7; max-width: 520px; }

/* ── Playlist (the accessible, crawlable version of what the phone shows) ── */
.fp-list-label { margin: 38px 0 12px; font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: #a68ad6; }
.fp-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(255,255,255,.08); max-width: 560px; }
.fp-item { position: relative; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.fp-item-btn {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 4px 12px;
  padding: 15px 4px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.fp-item-num { grid-row: span 2; font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: 1px; color: rgba(255,255,255,.4); font-variant-numeric: tabular-nums; transition: color .3s; }
.fp-item-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; text-transform: lowercase; color: rgba(255,255,255,.62); line-height: 1.2; transition: color .3s; }
.fp-item-meta { grid-column: 2; font-size: 12px; color: rgba(255,255,255,.6); }
.fp-item-type { grid-row: 1 / span 2; grid-column: 3; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.62); }
.fp-item[data-type="reel"] .fp-item-type { border-color: rgba(184,144,255,.45); color: var(--accent); }
.fp-item-out { flex: 0 0 44px; height: 44px; display: grid; place-items: center; color: rgba(255,255,255,.55); text-decoration: none; font-size: 16px; border-radius: 50%; transition: color .25s, background .25s; }
.fp-item-out:hover, .fp-item-out:focus-visible { color: var(--white); background: rgba(255,255,255,.06); }
.fp-item-bar { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--accent), var(--accent-strong)); opacity: 0; }
.fp-item.is-current .fp-item-num { color: var(--accent); }
.fp-item.is-current .fp-item-name { color: var(--white); }
.fp-item.is-current .fp-item-bar { opacity: 1; }
.fp-item-btn:hover .fp-item-name, .fp-item-btn:focus-visible .fp-item-name { color: var(--white); }
.fp-item-btn:focus-visible, .fp-ctrl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }



/* ── Stage ── */
.fp-stagecol { position: relative; display: flex; flex-direction: column; align-items: center; }
.fp-stage {
  position: relative; width: calc(var(--ph-w) * var(--ph-scale)); height: calc(var(--ph-h) * var(--ph-scale) + 40px);
  perspective: 1500px; perspective-origin: 50% 40%;
}
.fp-glow {
  position: absolute; left: 50%; top: 46%; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.42) 0%, rgba(139,92,246,.12) 42%, transparent 70%);
  filter: blur(30px); pointer-events: none;
}
.fp-shadow {
  position: absolute; left: 50%; bottom: 0; width: 210px; height: 26px; margin-left: -105px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%); filter: blur(6px);
  transform: scale(calc(var(--ph-scale) * 1)); animation: fpShadow 7s ease-in-out infinite alternate;
}
.fp-scale { position: absolute; left: 50%; top: 0; width: var(--ph-w); height: var(--ph-h); margin-left: calc(var(--ph-w) / -2); transform: scale(var(--ph-scale)); transform-origin: 50% 0; transform-style: preserve-3d; }
.fp-tilt, .fp-float, .fp-spin, .fp-phone { position: absolute; inset: 0; transform-style: preserve-3d; }
.fp-float { animation: fpFloat 7s ease-in-out infinite alternate; }
@keyframes fpFloat {
  0%   { transform: translate3d(0, 0, 0) rotateY(-16deg) rotateX(4deg) rotateZ(-1deg); }
  100% { transform: translate3d(0, -14px, 0) rotateY(10deg) rotateX(-2deg) rotateZ(1deg); }
}
@keyframes fpShadow { 0% { opacity: .9; } 100% { opacity: .55; transform: scale(.88); } }

/* ── The phone model ── */
.fp-edge, .fp-front, .fp-back { position: absolute; inset: 0; border-radius: var(--ph-r); }
.fp-edge {
  background: linear-gradient(90deg, #5d5866 0%, #c9c3d1 9%, #8c8695 22%, #77717f 50%, #8c8695 78%, #d3cdd9 91%, #5d5866 100%);
  transform: translateZ(calc(var(--z) * -1px));
}
.fp-btn { position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #8f8999, #d9d3df); }
.fp-btn-a { left: -3px; top: 104px; height: 26px; }
.fp-btn-b { left: -3px; top: 150px; height: 52px; }
.fp-btn-c { left: -3px; top: 212px; height: 52px; }
.fp-btn-d { right: -3px; top: 176px; height: 80px; }

.fp-back {
  transform: translateZ(-12px) rotateY(180deg); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background:
    radial-gradient(120% 80% at 30% 10%, rgba(255,255,255,.16), transparent 50%),
    linear-gradient(160deg, #4a2577 0%, #2a1145 55%, #1a0a2c 100%);
  box-shadow: inset 0 0 0 3px #9a93a3, inset 0 0 0 5px #2a1645;
}
.fp-cam { position: absolute; left: 16px; top: 16px; width: 116px; height: 116px; border-radius: 34px; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 8px 18px rgba(0,0,0,.35); }
.fp-cam i { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3b3550 0%, #0c0a12 55%, #000 100%); box-shadow: 0 0 0 4px #1d1726, 0 0 0 5px rgba(255,255,255,.2); }
.fp-cam i:nth-child(1) { left: 10px; top: 10px; }
.fp-cam i:nth-child(2) { left: 10px; top: 62px; }
.fp-cam i:nth-child(3) { left: 62px; top: 36px; }
.fp-cam b { position: absolute; right: 14px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: #f1e9ff; opacity: .55; }
.fp-back-logo { position: absolute; left: 0; right: 0; top: 52%; text-align: center; font-family: var(--font-display); font-weight: 900; font-size: 44px; letter-spacing: -.04em; color: rgba(255,255,255,.9); }
.fp-back-logo span { color: var(--accent); }

.fp-front {
  background: #050407; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: inset 0 0 0 3px #a49dad, inset 0 0 0 4px #3a3540, 0 0 0 1px rgba(0,0,0,.4);
}
.fp-screen {
  position: absolute; inset: 11px; border-radius: 42px; overflow: hidden; background: #000;
  contain: layout paint; color: #fff; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased; isolation: isolate;
}
.fp-screen-link { position: absolute; inset: 0; z-index: 6; }
.fp-glare {
  position: absolute; inset: 0; z-index: 7; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.10) 45%, rgba(255,255,255,.02) 55%, transparent 70%);
  background-size: 250% 100%; background-position: var(--gx, 70%) 0;
}
.fp-sweep { position: absolute; inset: -20% -60%; z-index: 8; pointer-events: none; opacity: 0; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.28) 50%, transparent 60%); }

/* status bar + island */
.fp-status { position: absolute; left: 0; right: 0; top: 0; height: 46px; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 6px 26px 0 30px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; pointer-events: none; }
.fp-island { position: absolute; left: 50%; top: 10px; width: 92px; height: 27px; margin-left: -46px; border-radius: 20px; background: #000; z-index: 9; }
.fp-status svg { width: 62px; height: 12px; fill: currentColor; }

/* ── Slides ── */
/* Fade, not cross-fade: a cross-fade dips through black halfway (both layers
   at ~50% over a black screen). The leaving slide stays fully opaque
   underneath and the new one fades in on top of it. */
.fp-slide { position: absolute; inset: 0; visibility: hidden; z-index: 1; background: #000; transition: visibility 0s .6s; }
.fp-slide.is-active { visibility: visible; z-index: 2; transition: none; animation: fpIn .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes fpIn { from { opacity: 0; } to { opacity: 1; } }
.fp.is-anime .fp-slide { transition: visibility 0s .9s; }
.fp.is-anime .fp-slide.is-active { animation: none; transition: none; } /* must out-rank the rule above, or the new slide stays hidden for .9s */

/* Instagram profile */
.ig-nav { position: absolute; left: 0; right: 0; top: 46px; height: 40px; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #000; font-size: 15px; font-weight: 700; }
.ig-nav b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-nav svg, .ig-tabbar svg, .ig-tabs svg, .rl-rail svg, .rl-top svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.ig-nav .ig-back { width: 20px; height: 20px; }
.ig-view { position: absolute; left: 0; right: 0; top: 86px; bottom: 50px; overflow: hidden; }
.ig-scroll { will-change: transform; }
.ig-head { display: flex; align-items: center; gap: 14px; padding: 8px 14px 6px; }
.ig-ava { flex: 0 0 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: #fff; background: var(--ava, linear-gradient(135deg, #b890ff, #8b5cf6)); box-shadow: 0 0 0 2px #000, 0 0 0 3.5px rgba(255,255,255,.22); overflow: hidden; }
.ig-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-id { min-width: 0; }
.ig-id b { display: block; font-size: 14px; font-weight: 700; line-height: 1.25; }
.ig-id small { display: block; font-size: 12px; color: rgba(255,255,255,.55); line-height: 1.35; }
.ig-id p { margin: 2px 0 0; font-size: 12px; line-height: 1.35; color: rgba(255,255,255,.9); }
.ig-btns { display: flex; gap: 6px; padding: 8px 14px 10px; }
.ig-btns span { flex: 1; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: #262329; }
.ig-btns span:first-child { background: #4f5bf5; }
.ig-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,.08); }
.ig-tabs span { flex: 1; height: 38px; display: grid; place-items: center; color: rgba(255,255,255,.45); }
.ig-tabs span:first-child { color: #fff; box-shadow: inset 0 -1.5px 0 #fff; }
.ig-tabs svg { width: 20px; height: 20px; }
.ig-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5px; }
.ig-more { margin: 14px auto 0; width: max-content; padding: 7px 14px; border-radius: 8px; background: #262329; font-size: 12px; font-weight: 600; color: rgba(255,255,255,.85); }
.ig-tiles img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; background: #151218; }
.ig-tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: 50px; z-index: 3; display: flex; justify-content: space-around; align-items: flex-start; padding-top: 9px; background: #000; border-top: 1px solid rgba(255,255,255,.06); }
.ig-tabbar .ig-me { width: 24px; height: 24px; border-radius: 50%; background: var(--ava); box-shadow: 0 0 0 1.5px #fff; overflow: hidden; }
.ig-tabbar .ig-me img { width: 100%; height: 100%; object-fit: cover; }
.fp-home { position: absolute; left: 50%; bottom: 7px; width: 112px; height: 4px; margin-left: -56px; border-radius: 4px; background: rgba(255,255,255,.85); z-index: 9; pointer-events: none; }

/* Reel */
.fp-reel video, .fp-reel .rl-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fp-reel .rl-poster { background: #000; }
/* The video stays invisible until it has a real frame, so the poster shows
   instead of the black frame mobile browsers paint while a video starts. */
.fp-reel video { opacity: 0; transition: opacity .25s; }
.fp-reel video.is-playing { opacity: 1; }
.fp-reel::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.6) 0%, rgba(0,0,0,.25) 14%, transparent 24%, transparent 60%, rgba(0,0,0,.65) 100%); }
.rl-top { position: absolute; left: 16px; right: 16px; top: 50px; z-index: 2; display: flex; justify-content: space-between; align-items: center; font-size: 19px; font-weight: 700; }
.rl-rail { position: absolute; right: 10px; bottom: 92px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.rl-rail svg { width: 25px; height: 25px; }
.rl-meta { position: absolute; left: 14px; right: 54px; bottom: 30px; z-index: 2; font-size: 13px; line-height: 1.35; }
.rl-who { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 7px; }
.rl-who .ig-ava { flex-basis: 30px; height: 30px; font-size: 11px; box-shadow: none; }
.rl-follow { font-weight: 600; font-size: 12px; padding: 3px 9px; border: 1px solid rgba(255,255,255,.55); border-radius: 7px; }
.rl-meta p { margin: 0 0 6px; }
.rl-meta small { font-size: 12px; opacity: .85; }
.rl-bar { position: absolute; left: 0; right: 0; bottom: 20px; height: 2px; z-index: 3; background: rgba(255,255,255,.25); }
.rl-bar i { display: block; height: 100%; background: #fff; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.rl-muted { position: absolute; left: 50%; top: 50%; z-index: 3; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .35s; pointer-events: none; }
.rl-muted svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.8; }
.fp-slide.is-flash .rl-muted { opacity: 1; }

/* ── Controls under the phone ── */
.fp-ctrls { margin-top: 26px; display: flex; align-items: center; gap: 10px; }
.fp-ctrl { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.03); color: var(--white); cursor: pointer; display: grid; place-items: center; transition: border-color .25s, background .25s, opacity .25s; }
.fp-ctrl:hover { border-color: var(--accent); background: rgba(184,144,255,.12); }
.fp-ctrl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fp-ctrl .ico-play, .fp-ctrl.is-paused .ico-pause { display: none; }
.fp-ctrl.is-paused .ico-play { display: block; }
.fp-ctrl .ico-sound-on, .fp-ctrl.is-on .ico-sound-off { display: none; }
.fp-ctrl.is-on .ico-sound-on { display: block; }
.fp-sound[hidden] { display: none; }
.fp-count { min-width: 64px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: 2px; color: rgba(255,255,255,.55); font-variant-numeric: tabular-nums; }
.fp-hint { margin: 14px 0 0; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,.5); text-align: center; }

/* Desktop: the list is long, so the phone stays in view while it scrolls. */
@media (min-width: 901px) and (min-height: 880px) {
  .fp-inner { align-items: start; }
  .fp-stagecol { position: sticky; top: 96px; }
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .fp-inner { grid-template-columns: minmax(0, 1fr) 380px; gap: 36px; }
}
@media (max-width: 900px) {
  .fp { padding: 72px 24px 64px; --ph-scale: .84; }
  .fp-inner { grid-template-columns: 1fr; gap: 0; }
  .fp-copy { display: contents; }
  .fp-head { order: 1; }
  .fp-stagecol { order: 2; margin: 34px 0 6px; }
  .fp-playlist { order: 3; }
  .fp-list-label { margin-top: 30px; }
  .fp-glow { width: 400px; height: 400px; margin: -200px 0 0 -200px; }
  /* Phone + controls fit in one screen (feeds-phone.js sets --ph-scale from
     the screen height); tighter spacing around them. */
  .fp-stagecol { margin: 26px 0 0; }
  .fp-stage { height: calc(var(--ph-h) * var(--ph-scale) + 18px); }
  .fp-ctrls { margin-top: 14px; }
  .fp-hint { display: none; }
  .fp-shadow { width: 160px; margin-left: -80px; height: 18px; }
}
@media (max-width: 600px) {
  .fp-item-btn { padding: 12px 2px; grid-template-columns: 28px 1fr auto; }
  .fp-item-meta { display: none; }
  .fp-item-num { grid-row: auto; }
  .fp-item-type { grid-row: auto; }
  }
@media (max-width: 420px) {
  .fp-item-name { font-size: 16px; }
  .fp-item-type { padding: 4px 8px; letter-spacing: 1.5px; }
}

/* ── Reduced motion: still, manual, no autoplay ── */
@media (prefers-reduced-motion: reduce) {
  .fp-float, .fp-shadow { animation: none; }
  .fp-float { transform: rotateY(-12deg) rotateX(3deg); }
  .fp-slide, .fp-slide.is-active { transition: none; animation: none; }
}

/* 14 Nov: a tile (or avatar) shows only when its picture has fully loaded, and
   fades in. Until then the dark placeholder shows, never a half-drawn photo.
   Only applies once feeds-phone.js is running (.fp-tiles-js). */
.ig-tiles { background: #151218; }
.fp.fp-tiles-js .fp-slide img { opacity: 0; transition: opacity .3s ease; }
.fp.fp-tiles-js .fp-slide img.is-ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .fp.fp-tiles-js .fp-slide img { transition: none; } }

/* 14 Nov, iPhone fix: the screen sits 1px in front of the phone body instead of
   exactly on it, so Safari never has to decide which of the two is in front
   (that decision is what left half the screen black). The slides no longer
   carry their own backface / will-change hints for the same reason. */
.fp-front { transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.fp-screen { transform: translateZ(1px); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
