/* ═══════════════════════════════════════════════════════════════
   porsche.css — Taycan card fan section
   ═══════════════════════════════════════════════════════════════ */

/* ── INTRO TEXT — absolutely positioned so it NEVER participates
   in flex/grid layout and therefore NEVER moves regardless of what
   the content below it does ───────────────────────────────────── */
.pc-intro-inner {
  position: absolute;
  top: max(2rem, calc(max(200px, 50vh - 170px) - 210px));
  /* reveal class was removed so GSAP won't touch transform — safe to use */
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, calc(100% - 2 * var(--gutter)));
  text-align: center;
  z-index: 1;
  pointer-events: auto;
}

.pc-intro-inner .proj-section-title,
.pc-intro-inner .proj-body {
  text-align: center;
}

.pc-intro-inner .proj-body {
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.75rem;
  /* project.css sets max-width:540px on .proj-body — override so the
     paragraph fills the full 900px container and wraps to 2 lines */
  max-width: none;
  margin-inline: auto;
}

/* ── CONTENT ROW — holds fan cards (spread) or cards+feature (detail) ── */
.pc-content-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
  width: 100%;
}

/* ── SECTION ──────────────────────────────────────────────────── */
.pc-section {
  background: var(--dark);
}

/* Scale the fan container to keep cards within the viewport on narrower screens.
   Only active in spread/fan state — detail mode (.pc-inner--detail) bypasses this
   so the mini card column renders at its natural size. */
.pc-inner:not(.pc-inner--detail) .pc-cards {
  transform-origin: center top;
  transform: scale(var(--fan-scale, 1));
}

.pc-inner {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: max(200px, calc(50vh - 170px)) var(--gutter) clamp(3rem, 5vw, 5rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* ── CARD STAGE (spread/fan mode) ────────────────────────────── */
.pc-cards {
  position: relative;
  /* 4 × 340px cards + 3 × 30px gaps = 1450px */
  width: 1450px;
  height: 505px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── CARD ─────────────────────────────────────────────────────── */
.pc-card {
  position: absolute;
  width: 340px;
  background: hsl(0 0% 16%);
  border-radius: 24px;
  padding: 4px;
  box-shadow:
    0 1px 0 0 hsl(0 0% 100% / 0.08) inset,
    0 0 0 1px hsl(0 0% 100% / 0.06),
    0 12px 48px -8px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  will-change: transform;
  transform-origin: 50% 50%;
  transition: box-shadow 0.3s ease, scale 0.3s ease;
  user-select: none;
}

.pc-card:hover {
  box-shadow:
    0 1px 0 0 hsl(0 0% 100% / 0.1) inset,
    0 0 0 1px hsl(0 0% 100% / 0.1),
    0 20px 60px -8px rgba(0, 0, 0, 0.9);
  /* CSS scale property is independent of transform — won't fight GSAP */
  scale: 1.04;
}

/* ── EXPLORE HINT — fades into footer on hover ───────────────── */
.pc-explore {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #0057B8);
  margin-top: 5px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.pc-card:hover .pc-explore {
  opacity: 1;
  transform: translateY(0);
}

/* Hide in detail mini-card column */
.pc-inner--detail .pc-explore { display: none; }

.pc-card.pc-card--active {
  box-shadow:
    0 0 0 2px var(--accent),
    0 12px 40px rgba(51, 133, 232, 0.3);
}

/* ── CAROUSEL ─────────────────────────────────────────────────── */
.pc-carousel {
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  position: relative;
  background: hsl(0 0% 10%);
}

/* gradient overlay removed — no dots on cards any more */

.pc-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pc-track::-webkit-scrollbar { display: none; }

.pc-slide {
  flex-shrink: 0;
  width: 100%;
  scroll-snap-align: center;
  /* aspect-ratio drives height from width so the image frame is always
     proportional regardless of card size — eliminates FLIP scale jolt */
  aspect-ratio: 302 / 235;
  position: relative;
}

.pc-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}

.pc-slide--360 {
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(0 0% 10%);
}

.pc-slide--360 span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── INDICATORS ───────────────────────────────────────────────── */
.pc-indicators {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  align-items: center;
  z-index: 2;
  background: none;
  border: none;
  padding: 0;
}

.pc-dot {
  height: 7px;
  width: 7px;
  border-radius: 99px;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.3s ease;
  position: relative;
}

.pc-dot::before {
  content: '';
  position: absolute;
  inset: -8px -5px;
}

.pc-dot.active {
  width: 26px;
  background: #fff;
}

/* ── FOOTER ───────────────────────────────────────────────────── */
.pc-footer {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1;
}

.pc-model {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.1;
}


/* ═══════════════════════════════════════════════════════════════
   DETAIL VIEW
   .pc-inner layout is UNCHANGED — intro text is position:absolute
   and never participates in layout, so it never moves.
   Only the content row changes: fan → mini cards + feature panel.
   ═══════════════════════════════════════════════════════════════ */

.pc-inner--detail .pc-cards {
  position: static;
  width: 140px;
  height: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  justify-content: flex-start;
  /* Push cards down to align with the feature image top, not the back button.
     .pc-back (~20px) + gap (20px) = ~40px offset before the image starts. */
  margin-top: 44px;
}

.pc-inner--detail .pc-card {
  position: relative;
  width: 100%;
  cursor: pointer;
  aspect-ratio: 310 / 307;
  overflow: hidden;
  /* Proportional: 24px on 310px ≈ 7.7% → 140px × 7.7% ≈ 11px */
  border-radius: 11px;
}

.pc-inner--detail .pc-carousel {
  /* Proportional: 20px on 310px ≈ 6.5% → 140px × 6.5% ≈ 9px */
  border-radius: 9px 9px 0 0;
}

.pc-inner--detail .pc-track {
  overflow: hidden;
  scroll-snap-type: none;
}

.pc-inner--detail .pc-indicators {
  display: none;
}

.pc-inner--detail .pc-footer {
  padding: 3px 8px 4px;
  gap: 1px;
}

.pc-inner--detail .pc-brand {
  font-size: 7px;
}

.pc-inner--detail .pc-model {
  font-size: 10px;
}

/* ── DETAIL UI ────────────────────────────────────────────────── */
.pc-detail-ui {
  display: none;
}

.pc-detail-ui.pc-detail-ui--visible {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;   /* fills remaining width in .pc-content-row */
  min-width: 0;  /* prevents flex overflow */
}

.pc-back {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  transition: color 0.2s;
}

.pc-back:hover { color: #fff; }

.pc-feature {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pc-feature-img-wrap {
  border-radius: 16px;
  overflow: hidden;
  contain: paint;
  aspect-ratio: 16 / 9;
  background: hsl(0 0% 10%);
  position: relative;
}

/* ── FEATURE PANEL VIEWERS ────────────────────────────────────── */

/* Both viewers hidden by default; JS adds .pc-active to show.
   Use visibility:hidden (not display:none) so WebGL canvas stays in
   the layout — display:none causes context loss on rapid switches. */
.pc-feature-canvas,
.pc-feature-int {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  pointer-events: none;
}

/* White icon with black outline — double-path in SVG (CSS filter can't apply to native cursors) */
.pc-feature-canvas.pc-active {
  visibility: visible;
  pointer-events: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='32' viewBox='0 0 64 32'%3E%3Cpath d='M14 16 L4 16 M4 16 L9 11 M4 16 L9 21' stroke='black' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='32' cy='16' r='4' fill='none' stroke='black' stroke-width='4.5'/%3E%3Cpath d='M50 16 L60 16 M60 16 L55 11 M60 16 L55 21' stroke='black' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 16 L4 16 M4 16 L9 11 M4 16 L9 21' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='32' cy='16' r='4' fill='none' stroke='white' stroke-width='2.5'/%3E%3Cpath d='M50 16 L60 16 M60 16 L55 11 M60 16 L55 21' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 32 16, crosshair;
}

.pc-feature-canvas.pc-dragging {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='32' viewBox='0 0 64 32'%3E%3Cpath d='M14 16 L4 16 M4 16 L9 11 M4 16 L9 21' stroke='black' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='32' cy='16' r='4' fill='black' stroke='black' stroke-width='4.5'/%3E%3Cpath d='M50 16 L60 16 M60 16 L55 11 M60 16 L55 21' stroke='black' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 16 L4 16 M4 16 L9 11 M4 16 L9 21' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='32' cy='16' r='4' fill='white' stroke='white' stroke-width='2.5'/%3E%3Cpath d='M50 16 L60 16 M60 16 L55 11 M60 16 L55 21' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 32 16, crosshair;
}

/* Hide site's JS cursor ring/dot while SVG cursor is active on exterior canvas */
body.pc-ext-hover .cursor-dot,
body.pc-ext-hover .cursor-ring { opacity: 0 !important; }

/* Interior 360: use site's custom cursor (cursor:none lets the JS cursor ring show) */

.pc-feature-int.pc-active {
  visibility: visible;
  pointer-events: auto;
}

#pc-feature-int-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: none; /* site custom cursor ring shows through */
}

#pc-feature-int-canvas.pc-dragging { cursor: none; }

/* ── LOADING SPINNER ──────────────────────────────────────────── */
.pc-rotator-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(0 0% 8%);
  z-index: 2;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.pc-rotator-loader.pc-hidden {
  opacity: 0;
  pointer-events: none;
}

.pc-rotator-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: pc-spin 0.8s linear infinite;
}

@keyframes pc-spin {
  to { transform: rotate(360deg); }
}

/* ── EXTERIOR DRAG CTA — animated swipe indicator ───────────── */
.pc-drag-cta {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  /* No frame — just the blue icon itself */
}

/* Show when canvas is active */
.pc-feature-canvas.pc-active ~ .pc-drag-cta {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fade in when idle (pc-rotated removed) */
.pc-feature-img-wrap:not(.pc-rotated) .pc-drag-cta {
  opacity: 1;
}

.pc-drag-cta__icon {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
  animation: pc-drag-sweep 1.6s ease-in-out infinite;
}

@keyframes pc-drag-sweep {
  0%   { transform: translateX(-10px); opacity: 0.5; }
  50%  { transform: translateX(10px);  opacity: 1;   }
  100% { transform: translateX(-10px); opacity: 0.5; }
}

/* ── INTERIOR ORBIT CTA — quad-arrow, slow spin ─────────────── */
.pc-int-cta {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Visible when interior is active and user hasn't dragged yet */
.pc-feature-int.pc-active:not(.pc-used) .pc-int-cta {
  opacity: 1;
}

.pc-int-cta__icon {
  animation: pc-int-orbit 1.8s ease-in-out infinite;
  display: block;
}

@keyframes pc-int-orbit {
  0%   { transform: translateY(-7px); opacity: 0.5; }
  50%  { transform: translateY(7px);  opacity: 1;   }
  100% { transform: translateY(-7px); opacity: 0.5; }
}

/* ── INTERIOR DRAG HINT ──────────────────────────────────────── */
.pc-feature-int-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.5s ease;
}

.pc-feature-int.pc-used .pc-feature-int-hint {
  opacity: 0;
}

/* ── RENDER TABS ──────────────────────────────────────────────── */
.pc-render-tabs {
  display: flex;
  gap: 8px;
}

.pc-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pc-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.pc-tab.active {
  background: var(--accent, #0057B8);
  border-color: var(--accent, #0057B8);
  color: #fff;
}


/* ── MOBILE — Option A: vertical card stack, tap to expand ──── */
@media (max-width: 1024px) {

  /* Intro text: back in normal flow */
  .pc-intro-inner {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    text-align: center;
  }

  /* Section: natural height, no pin */
  .pc-inner {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: auto;
    padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) clamp(2rem, 5vw, 3rem);
    gap: 1.25rem;
  }

  /* No overflow-x: hidden needed — vertical stack has no horizontal overflow */
  .pc-content-row { width: 100%; }

  /* Vertical card list — no fan stage dimensions needed */
  .pc-cards {
    position: static;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* Each card: full width, natural height from image ratio */
  .pc-card {
    position: relative;
    width: 100%;
    transform: none !important;
    scale: 1 !important;
    border-radius: 16px;
  }

  /* Use a more cinematic crop on mobile cards */
  .pc-slide { aspect-ratio: 16 / 9; }

  /* Carousel rounded top corners to match card */
  .pc-carousel { border-radius: 14px 14px 0 0; }

  /* Show footer on vertical stack cards */
  .pc-footer {
    display: flex;
    padding: 12px 16px 14px;
  }

  /* Model name at readable size */
  .pc-model { font-size: 16px; }

  /* Explore hint visible on mobile */
  .pc-explore { margin-top: 3px; font-size: 10px; }

  /* ── DETAIL VIEW (mobile) ─────────────────────────────── */

  /* Hide intro text — viewer needs the space */
  .pc-inner--detail .pc-intro-inner { display: none; }

  .pc-inner--detail .pc-content-row {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  /* Dissolve pc-detail-ui so pc-back and pc-feature become direct
     siblings of pc-cards — enabling free ordering */
  .pc-inner--detail .pc-detail-ui.pc-detail-ui--visible {
    display: contents;
  }

  /* Order: back (1) → cards (2) → feature (3) */
  .pc-inner--detail .pc-back    { order: 1; }
  .pc-inner--detail .pc-cards   { order: 2; }
  .pc-inner--detail .pc-feature { order: 3; }

  /* Back button: centred, easy tap target */
  .pc-inner--detail .pc-back {
    font-size: 13px;
    padding: 8px 0 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    width: 100%;
    justify-content: center;
    align-self: stretch;
  }

  /* Mini card strip — 4px vertical padding + 4px horizontal so the 2px
     active box-shadow on the first and last card isn't clipped */
  .pc-inner--detail .pc-cards {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px 4px;
    gap: 8px;
    margin-top: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .pc-inner--detail .pc-cards::-webkit-scrollbar { display: none; }

  /* Mini cards: flex:1 so all 4 share available width equally at any viewport.
     No fixed width means no overflow, so the 4px strip padding always gives the
     2px active box-shadow clearance on both the first and last card.
     aspect-ratio: auto overrides the desktop rule (310/307) so the card
     grows naturally to fit the image + footer without clipping. */
  .pc-inner--detail .pc-card {
    position: relative;
    flex: 1;
    min-width: 0;
    height: auto;
    aspect-ratio: auto;
    transform: none !important;
    scale: 1 !important;
    border-radius: 10px;
    overflow: hidden;
  }

  .pc-inner--detail .pc-slide    { aspect-ratio: 302 / 235; }
  .pc-inner--detail .pc-carousel { border-radius: 8px 8px 0 0; }
  .pc-inner--detail .pc-footer   { padding: 5px 8px 7px; display: flex; }
  .pc-inner--detail .pc-brand    { font-size: 7px; }
  .pc-inner--detail .pc-model    { font-size: 9px; }
  .pc-inner--detail .pc-explore  { display: none; }

  /* Feature: full-width flex column */
  .pc-inner--detail .pc-feature {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-self: stretch;
  }

  .pc-feature-img-wrap { aspect-ratio: 16 / 9; }
  .pc-render-tabs { justify-content: center; }
}
