/* Shared MacBook projects carousel — used by /coaches and main landing portfolio */

/* ===========================================
   Hero 3D MacBook — closed → opens on load
   Flat face-on view so the screen stays a true rectangle
   =========================================== */
.coaches-macbook {
  --mb-open-duration: 1.45s;
  --mb-open-ease: cubic-bezier(0.22, 1, 0.36, 1);
  width: min(100%, 640px);
  margin: 0.35rem auto 1.65rem;
  perspective: 1400px;
  perspective-origin: 50% 100%;
}

.coaches-macbook-scene {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  /* No scene tilt — tilt was making the screen a trapezoid */
  transform: none;
}

.coaches-macbook.is-open .coaches-macbook-scene {
  transform: none;
}

.coaches-macbook-lid {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 16 / 10.2;
  transform-style: preserve-3d;
  transform-origin: 50% 100%;
  transform: rotateX(-90deg);
  transition: transform var(--mb-open-duration) var(--mb-open-ease);
  will-change: transform;
}

.coaches-macbook.is-open .coaches-macbook-lid {
  transform: rotateX(0deg);
}

.coaches-macbook-screen-front,
.coaches-macbook-screen-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
}

.coaches-macbook-screen-front {
  background: linear-gradient(180deg, #1a1d22 0%, #0c0e12 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 18px 40px rgba(0, 0, 0, 0.35);
  /* No translateZ — keeps screen edges parallel (perfect rectangle) */
  transform: none;
  display: flex;
  padding: 2.2%;
}

.coaches-macbook-screen-back {
  background: linear-gradient(145deg, #d5dae0 0%, #aeb6c0 45%, #8e97a3 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transform: rotateY(180deg);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.12);
}

.coaches-macbook-screen-back::after {
  content: '';
  position: absolute;
  top: 46%;
  left: 50%;
  width: 14%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2f4f6 0%, #9aa3ae 55%, #6d7682 100%);
  opacity: 0.55;
}

.coaches-macbook-bezel {
  position: relative;
  flex: 1;
  background: #05070b;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.coaches-macbook-camera {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: #1a222c;
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.25);
  z-index: 3;
}

.coaches-macbook-display {
  position: relative;
  flex: 1;
  margin-top: 14px;
  background:
    radial-gradient(circle at 30% 35%, rgba(0, 212, 255, 0.14) 0%, transparent 50%),
    radial-gradient(circle at 70% 65%, rgba(78, 205, 196, 0.1) 0%, transparent 48%),
    linear-gradient(145deg, #0a121c 0%, #101e2c 100%);
  overflow: hidden;
}

.coaches-macbook-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: #05070b;
}

.coaches-macbook.has-video .coaches-macbook-video {
  opacity: 1;
}

.coaches-macbook.has-video .coaches-macbook-placeholder {
  opacity: 0;
  pointer-events: none;
}

.coaches-macbook-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  transition: opacity 0.45s ease;
}

.coaches-macbook .video-play-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.35);
}

.coaches-macbook.is-open:not(.has-video) .video-play-icon {
  animation: video-pulse 2.5s ease-in-out infinite;
}

.coaches-macbook .video-placeholder-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f2f8ff !important;
  margin-bottom: 0.25rem;
}

.coaches-macbook .video-placeholder-sub {
  font-size: 0.8rem;
  color: #9eb4c8 !important;
  margin: 0;
}

.coaches-macbook-base {
  position: relative;
  z-index: 1;
  margin-top: -1px;
  height: clamp(10px, 2.2vw, 16px);
  border-radius: 0 0 10px 10px;
  background: linear-gradient(180deg, #dfe3e8 0%, #b4bbc4 40%, #8f98a3 100%);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.35),
    0 2px 0 rgba(255, 255, 255, 0.35) inset;
  transform: translateZ(0);
}

.coaches-macbook-base::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: -1px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.28), transparent);
}

.coaches-macbook-chin {
  position: absolute;
  left: 50%;
  top: 35%;
  width: 16%;
  height: 28%;
  transform: translateX(-50%);
  border-radius: 0 0 3px 3px;
  background: #7d8692;
  opacity: 0.85;
}

.coaches-macbook-keyboard,
.coaches-macbook-trackpad {
  display: none;
}

.coaches-macbook::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -18px;
  height: 28px;
  background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.28) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.6s ease 0.7s;
  pointer-events: none;
  z-index: 0;
}

.coaches-macbook.is-open::after {
  opacity: 1;
}

@media (max-width: 640px) {
  .coaches-macbook {
    margin-bottom: 1.25rem;
  }

  .coaches-macbook-scene {
    transform: rotateX(10deg) rotateY(0deg);
  }

  .coaches-macbook.is-open .coaches-macbook-scene {
    transform: rotateX(6deg) rotateY(0deg);
  }

  .coaches-macbook .video-play-icon {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coaches-macbook-lid,
  .coaches-macbook-scene,
  .coaches-macbook::after {
    transition: none !important;
  }

  .coaches-macbook .coaches-macbook-lid {
    transform: rotateX(0deg) !important;
  }

  .coaches-macbook .coaches-macbook-scene {
    transform: rotateX(6deg) rotateY(0deg) !important;
  }
}

/* ===========================================
   Client projects — MacBook infinite carousel
   =========================================== */
.coaches-projects-section {
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
}

.projects-mac-marquee {
  width: 100%;
  overflow: hidden;
  margin-top: 0.75rem;
  padding: 0.75rem 0 1.75rem;
  /* Soft edge fade — keep captions readable near the sides */
  mask-image: linear-gradient(90deg, transparent 0%, #000 4%, #000 96%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 4%, #000 96%, transparent 100%);
}

.projects-mac-track {
  display: flex;
  align-items: flex-start;
  gap: clamp(2.25rem, 5vw, 3.5rem);
  width: max-content;
  /* JS-driven seamless loop (no CSS animation restart hitch) */
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.projects-mac-item {
  flex: 0 0 auto;
  width: min(440px, 86vw);
  text-align: center;
}

.projects-mac-caption {
  position: relative;
  z-index: 3;
  min-height: 3.6rem;
  margin-top: 0.15rem;
  margin-inline: auto;
  opacity: 1 !important;
  width: 100%;
  max-width: 26rem;
  visibility: visible !important;
  pointer-events: none;
}

.projects-mac-title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.1rem, 2.4vw, 1.25rem);
  font-weight: 700;
  color: #f2f8ff !important;
  letter-spacing: 0.01em;
  opacity: 1 !important;
  visibility: visible !important;
}

.projects-mac-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #9eb4c8 !important;
  max-width: none;
  margin-inline: auto;
  opacity: 1 !important;
  visibility: visible !important;
}

.projects-macbook {
  width: 100%;
  max-width: 440px;
  margin: 0 auto 1.15rem;
  /* Flat view so the screen stays a true rectangle (no trapezoid) */
  perspective: 1400px;
  perspective-origin: 50% 100%;
}

.projects-macbook .coaches-macbook-scene {
  transform: none;
  transition: none;
}

.projects-macbook.is-open .coaches-macbook-scene {
  transform: none;
}

.projects-macbook .coaches-macbook-lid {
  aspect-ratio: 16 / 10.4;
  /* Hinge only — no scene tilt, so bezel/screen stay rectangular */
  transform: rotateX(-90deg);
}

.projects-macbook.is-open .coaches-macbook-lid {
  transform: rotateX(0deg);
}

.projects-macbook .coaches-macbook-screen-front,
.projects-macbook .coaches-macbook-screen-back {
  border-radius: 10px 10px 3px 3px;
}

.projects-macbook .coaches-macbook-bezel {
  border-radius: 4px;
}

.projects-macbook .coaches-macbook-base {
  height: 10px;
}

.projects-macbook::after {
  bottom: -12px;
  height: 18px;
  opacity: 0;
}

.projects-macbook.is-open::after {
  opacity: 0.7;
}

/* Screen shows long site screenshot that auto-pans after open */
.projects-mac-screen {
  margin-top: 12px !important;
  background: #05070b !important;
}

.projects-mac-screen-scroll {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateZ(0);
}

.projects-mac-screen-scroll img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  /* Cover the screen; we pan with object-position (reliable on iOS) */
  object-fit: cover;
  object-position: 50% 0%;
  transform: none;
  image-rendering: auto;
  pointer-events: none;
}

@media (max-width: 1024px) {
  /* Faster lid open on phones */
  .projects-macbook {
    --mb-open-duration: 0.65s;
    --mb-open-ease: cubic-bezier(0.25, 0.9, 0.35, 1);
  }

  /* No side mask on phones — captions stay fully visible */
  .projects-mac-marquee {
    mask-image: none;
    -webkit-mask-image: none;
    padding-bottom: 2rem;
  }
}

.coaches-funnel-v2 .projects-mac-marquee {
  margin-top: 0.35rem;
}

@media (max-width: 640px) {
  .projects-mac-item {
    width: min(340px, 88vw);
  }

  .projects-macbook {
    max-width: 340px;
  }

  .projects-mac-track {
    animation-duration: 50s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .projects-mac-track {
    animation: none !important;
    transform: none !important;
    flex-wrap: wrap;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    justify-content: center;
    gap: 1.5rem;
  }

  .projects-macbook .coaches-macbook-lid {
    transform: rotateX(0deg) !important;
  }

  .projects-mac-screen-scroll img {
    animation: none !important;
    transform: none !important;
  }
}

/* Main landing portfolio section */
.portfolio-section.portfolio-mac-section {
  overflow: hidden;
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.portfolio-mac-section .portfolio-mac-intro {
  max-width: 40rem;
  margin: 0.75rem auto 0;
  text-align: center;
  color: var(--text-secondary, #b0b0b0);
  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.6;
}

.portfolio-mac-section .section-header {
  margin-bottom: 0.5rem;
}

.portfolio-mac-section .projects-mac-marquee {
  margin-top: 0.65rem;
}

.portfolio-mac-group {
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.portfolio-mac-group + .portfolio-mac-group {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: clamp(0.5rem, 2vw, 1rem);
}

.portfolio-mac-group-label {
  margin: 0 0 0.35rem;
  text-align: center;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #00d4ff;
  text-shadow: 0 0 24px rgba(0, 212, 255, 0.28);
}
