/* ==========================================================
   portfolio.css — Colony Creative
   Horizontal snap carousel — clean project showcase
   Full-bleed screenshots with phone companion
   ========================================================== */

/* ── Section ── */

.portfolio {
  position: relative;
  width: 100%;
  padding-top: clamp(100px, 16vh, 200px);
  padding-bottom: clamp(100px, 16vh, 200px);
  background: var(--bg);
  overflow: hidden;
}

.portfolio__container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 80px);
}

/* ── Header ── */

.portfolio__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  will-change: transform, opacity;
}

.portfolio__header-text {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.portfolio__headline {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin: 0;
}

/* ── Arrows ── */

.portfolio__arrows {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.portfolio__arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: none;
  transition: border-color 0.3s ease, color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (hover: none), (max-width: 768px) {
  .portfolio__arrow-btn { cursor: pointer; }
}

.portfolio__arrow-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ── Track ── */

.portfolio__track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.5rem 0 2rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.portfolio__track::-webkit-scrollbar {
  display: none;
}

/* ── Card — screenshot is the entire top, edge-to-edge ── */

.portfolio__card {
  position: relative;
  flex: 0 0 auto;
  width: calc(33.333% - 1rem);
  min-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.4s ease, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.portfolio__card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
}

/* ── Screenshot area — relative container for phone overlay ── */

.portfolio__card-devices {
  position: relative;
  overflow: visible;
}

/* ── Desktop screenshot — full bleed, no browser chrome ── */

.portfolio__card-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  aspect-ratio: 16 / 10;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.portfolio__card:hover .portfolio__card-img {
  transform: scale(1.03);
}

/* ── Phone mockup — overlaps screenshot/info boundary ── */

.portfolio__card-phone {
  position: absolute;
  bottom: -28px;
  right: 16px;
  width: 80px;
  background: #000;
  border-radius: 12px;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 2;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.portfolio__card:hover .portfolio__card-phone {
  transform: translateY(-4px);
}

.portfolio__card-phone-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 19.5;
  object-fit: cover;
  object-position: top;
}

/* ── Deliverable toggle pills ── */

.portfolio__card-toggles {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 4;
}

.portfolio__card-toggle {
  font-family: 'DM Mono', monospace;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

@media (hover: none), (max-width: 768px) {
  .portfolio__card-toggle { cursor: pointer; }
}

.portfolio__card-toggle:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.portfolio__card-toggle.is-active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ── Gallery (photos/video layer) ── */

.portfolio__card-gallery {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.portfolio__card-gallery.is-active {
  opacity: 1;
  pointer-events: auto;
}

.portfolio__card-gallery-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 1;
}

.portfolio__card-gallery-img.is-active {
  opacity: 1;
}

/* Showcase mode — full photo with blurred darkened backdrop */
.portfolio__card-gallery-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 1;
  overflow: hidden;
}

.portfolio__card-gallery-slide.is-active {
  opacity: 1;
}

.portfolio__card-gallery-backdrop {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.4);
  transform: scale(1.1);
}

.portfolio__card-gallery-img--showcase {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  opacity: 1;
  z-index: 1;
}

/* Gallery dot indicators */
.portfolio__card-gallery-dots {
  position: absolute;
  bottom: 10px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 5;
  pointer-events: auto;
}

.portfolio__card-gallery-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px;
  background-clip: content-box;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.portfolio__card-gallery-dot.is-active {
  background: #fff;
  background-clip: content-box;
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.15);
}

/* Video embed */
/* Video thumbnail with play button (click-to-load iframe) */
.portfolio__card-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  background: #000;
  overflow: hidden;
}

.portfolio__card-video.is-active {
  opacity: 1;
  pointer-events: auto;
}

.portfolio__card-video-thumb {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  object-fit: cover;
  display: block;
}

.portfolio__card-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.portfolio__card-video-play:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%) scale(1.08);
}

.portfolio__card-video-play svg {
  width: 20px;
  height: 20px;
  fill: #fff;
  margin-left: 2px;
}

/* Iframe replaces thumbnail after click */
.portfolio__card-video iframe {
  position: absolute;
  top: -2px;
  left: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  border: none;
  z-index: 3;
  background: #000;
}

/* Hide site content when gallery/video is active */
.portfolio__card-devices.gallery-active .portfolio__card-img,
.portfolio__card-devices.gallery-active .portfolio__card-phone {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Dark background for the devices area so no light bleed */
.portfolio__card-devices {
  background: #000;
}

/* ── Info section ── */

.portfolio__card-info {
  padding: clamp(1rem, 1.5vw, 1.25rem) clamp(1rem, 1.5vw, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.portfolio__card-client {
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.portfolio__card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.portfolio__card-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0;
}

.portfolio__card-arrow {
  font-size: 1rem;
  color: var(--text-muted);
  transition: color 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
}

.portfolio__card:hover .portfolio__card-arrow {
  color: var(--text-primary);
  transform: translate(2px, -2px);
}

.portfolio__card-desc {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: clamp(0.75rem, 0.85vw, 0.8125rem);
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Tags ── */

.portfolio__card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 0.375rem;
}

.portfolio__card-tag {
  font-family: 'DM Mono', monospace;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.portfolio__card:hover .portfolio__card-tag {
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

/* Hide mobile arrows by default — shown inside 600px media query */
.portfolio__arrows--mobile {
  display: none;
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 960px) {
  .portfolio__card {
    width: calc(50% - 0.75rem);
    min-width: 340px;
  }

  .portfolio__card-phone {
    width: 68px;
    right: 12px;
    bottom: -24px;
  }

}

@media (max-width: 600px) {
  .portfolio__card {
    min-width: 300px;
    width: calc(100vw - 3rem);
    border-radius: 12px;
  }

  .portfolio__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .portfolio__header-text {
    align-items: center;
  }


  /* Move arrows below the carousel on mobile */
  .portfolio__arrows {
    order: 1;
    display: none;
  }

  .portfolio__arrows--mobile {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .portfolio__headline {
    font-size: clamp(2rem, 9vw, 2.5rem);
  }

  .portfolio__card-phone {
    width: 60px;
    right: 10px;
    bottom: -20px;
    border-radius: 10px;
    border-width: 2px;
  }

  .portfolio__card-video-play {
    width: 56px;
    height: 56px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .portfolio__card-video.is-active {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

}

@media (prefers-reduced-motion: reduce) {
  .portfolio__card,
  .portfolio__card-img,
  .portfolio__card-phone {
    transition: none !important;
    transform: none !important;
  }

  .portfolio__track {
    scroll-behavior: auto;
  }
}
