/* AIDEV-NOTE: SSR-owned styles for BOTH detail pages (wrap /gallery/{slug} + concept /gallery/concepts/{id}) — values copied from the Replit mock's
   /project/concept-* page (Tailwind gray/neutral palette as literals on purpose). Breakpoints mirror the
   mock: sm 640, md 768, lg 1024. JS: project-detail.js (carousel, videos, comparison, spotlight, viewer). */

.project-detail {
  box-sizing: border-box;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--nav-height, 64px) + var(--banner-height, 0px) + 20px) 16px
    12px;
  color: #171717;
  font-family: Inter, system-ui, sans-serif;
}

.project-detail__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -8px 0 16px;
  padding: 8px 0;
  color: #737373;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}

.project-detail__back:hover {
  color: #171717;
}

.project-detail__back svg {
  display: block;
  width: 16px;
  height: 16px;
}

.project-detail__layout {
  display: flex;
  flex-direction: column;
}

.project-detail__media {
  flex: 1;
  min-width: 0;
}

/* AIDEV-NOTE: Pills scroll horizontally edge-to-edge below 768px, wrap at ≥768px */
.project-detail__pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 -16px 16px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.project-detail__pills::-webkit-scrollbar {
  display: none;
}

.project-detail__pill {
  display: inline-flex;
  flex-shrink: 0;
  box-sizing: border-box;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #374151;
  font-family: Inter, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
}

.project-detail__pill svg {
  display: block;
  width: 12px;
  height: 12px;
}

.project-detail__image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  background: #f5f5f5;
}

.project-detail__image img,
.project-detail__frame > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* --- Media carousel (mock: Embla, drag disabled — dots/thumbnails only) --- */
.project-detail__carousel {
  position: relative;
}

.project-detail__viewport {
  overflow: hidden;
  border-radius: 12px;
}

.project-detail__track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.project-detail__slide {
  flex: 0 0 100%;
  min-width: 0;
}

.project-detail__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f5f5f5;
}

.project-detail__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
  z-index: 10;
  padding: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  pointer-events: none;
}

.project-detail__caption p {
  margin: 0;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
}

.project-detail__caption[hidden] {
  display: none;
}

.project-detail__dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 10;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.project-detail__dot {
  width: 8px;
  height: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-detail__dot[aria-current='true'] {
  background: #fff;
}

.project-detail__thumbs {
  display: flex;
  gap: 8px;
  margin: 12px -16px 0;
  padding: 0 16px 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
  scrollbar-width: none;
}

.project-detail__thumbs::-webkit-scrollbar {
  display: none;
}

.project-detail__thumb {
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 64px;
  height: 64px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-detail__thumb:hover {
  border-color: rgba(115, 115, 115, 0.5);
}

.project-detail__thumb[aria-current='true'] {
  border-color: #171717;
}

.project-detail__thumb > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-detail__thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.project-detail__thumb-play svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.project-detail__thumb-split {
  position: absolute;
  inset: 0;
  display: flex;
}

.project-detail__thumb-split > div {
  width: 50%;
  height: 100%;
  overflow: hidden;
}

.project-detail__thumb-split img {
  height: 100%;
  width: 200%;
  object-fit: cover;
}

.project-detail__thumb-split > div:first-child img {
  object-position: left;
}

.project-detail__thumb-split > div:nth-child(2) img {
  object-position: right;
}

.project-detail__thumb-split-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.project-detail__thumb-split-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.project-detail__tri {
  width: 0;
  height: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

.project-detail__tri--l {
  border-right: 3px solid #4b5563;
}

.project-detail__tri--r {
  border-left: 3px solid #4b5563;
}

/* --- YouTube slide: thumbnail + red play button, swapped for an autoplaying iframe --- */
.project-detail__yt {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.project-detail__yt > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-detail__yt-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
}

.project-detail__yt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: #dc2626;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.project-detail__yt-btn svg {
  width: 32px;
  height: 32px;
  margin-left: 4px;
  color: #fff;
  fill: #fff;
}

.project-detail__frame > iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Uploaded video: muted loop autoplay on the active slide, play/pause overlay, progress --- */
.project-detail__video {
  position: relative;
  width: 100%;
  height: 100%;
}

.project-detail__video > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-detail__video-toggle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 1;
  cursor: pointer;
  transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-detail__video.is-playing .project-detail__video-toggle {
  background: rgba(0, 0, 0, 0);
  opacity: 0;
}

.project-detail__video.is-playing:hover .project-detail__video-toggle {
  background: rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.project-detail__video-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.project-detail__video-toggle svg {
  width: 28px;
  height: 28px;
  fill: #000;
}

.project-detail__video-toggle .is-play {
  margin-left: 2px;
}

.project-detail__video .is-pause,
.project-detail__video.is-playing .is-play {
  display: none;
}

.project-detail__video.is-playing .is-pause {
  display: block;
}

.project-detail__video-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.project-detail__video-progress > div {
  width: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  transition: width 0.15s linear;
}

/* --- Before/after comparison slider --- */
.project-detail__compare {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}

.project-detail__compare.is-dragging {
  cursor: grabbing;
}

.project-detail__compare img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.project-detail__compare-before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 50% 0 0);
  transition: clip-path 80ms;
}

.project-detail__compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  transition: left 80ms;
}

.project-detail__compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: #fff;
  transform: translateX(-50%) translateY(-50%);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
  transition: left 80ms;
}

.project-detail__compare.is-dragging .project-detail__compare-before,
.project-detail__compare.is-dragging .project-detail__compare-line,
.project-detail__compare.is-dragging .project-detail__compare-handle {
  transition-duration: 0ms;
}

.project-detail__compare-handle .project-detail__tri {
  border-top-width: 6px;
  border-bottom-width: 6px;
}

.project-detail__compare-handle .project-detail__tri--l {
  border-right: 6px solid #6b7280;
}

.project-detail__compare-handle .project-detail__tri--r {
  border-left: 6px solid #6b7280;
}

.project-detail__compare-label {
  position: absolute;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  pointer-events: none;
}

.project-detail__compare-label--before {
  left: 12px;
}

.project-detail__compare-label--after {
  right: 12px;
}

/* --- Side column: description + business spotlight --- */
.project-detail__desc {
  margin: 12px 0 0;
  color: #737373;
  font-size: 16px;
  line-height: 26px;
}

.project-detail__spotlight {
  margin-top: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #171717;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.project-detail__spotlight-inner {
  padding: 16px;
}

.project-detail__spotlight-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: default;
}

.project-detail__spotlight.is-collapsible .project-detail__spotlight-toggle {
  cursor: pointer;
}

.project-detail__spotlight-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-detail__spotlight-heading svg {
  width: 20px;
  height: 20px;
  color: #111827;
}

.project-detail__spotlight-heading h3 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.project-detail__spotlight-chevron {
  display: none;
  width: 20px;
  height: 20px;
  color: #737373;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-detail__spotlight.is-collapsible .project-detail__spotlight-chevron {
  display: block;
}

.project-detail__spotlight.is-open .project-detail__spotlight-chevron {
  transform: rotate(180deg);
}

.project-detail__spotlight-body {
  display: none;
  margin-top: 12px;
}

.project-detail__spotlight.is-open .project-detail__spotlight-body {
  display: block;
}

.project-detail__spotlight-body > * + * {
  margin-top: 12px;
}

.project-detail__spotlight-desc {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 22.75px;
}

.project-detail__spotlight-label {
  margin: 0 0 6px;
  color: #6b7280;
  font-size: 12px;
  line-height: 16px;
}

.project-detail__areas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-detail__area {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.project-detail__area svg {
  width: 12px;
  height: 12px;
  margin-right: 4px;
}

.project-detail__website {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: transparent;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
}

.project-detail__website svg {
  width: 16px;
  height: 16px;
}

.project-detail__website svg:last-child {
  width: 12px;
  height: 12px;
}

.project-detail__spotlight-note {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  font-style: italic;
  line-height: 16px;
  text-align: center;
}

/* --- Full-screen image viewer (mock: image-viewer chunk) --- */
.project-detail-viewer {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
  font-family: Inter, system-ui, sans-serif;
}

.project-detail-viewer[hidden] {
  display: none;
}

.project-detail-viewer__controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.project-detail-viewer__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.project-detail-viewer__btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.project-detail-viewer__btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* AIDEV-NOTE: Mock asks for h-5 w-5 but its Button forces [&_svg]:size-4 — rendered icons are 16px */
.project-detail-viewer__btn svg {
  width: 16px;
  height: 16px;
}

.project-detail-viewer__counter-wrap {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
}

.project-detail-viewer__counter-wrap[hidden] {
  display: none;
}

/* AIDEV-NOTE: Inline span (not a block) — matches the mock's 25px-tall pill */
.project-detail-viewer__counter {
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  line-height: 20px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.project-detail-viewer__hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  z-index: 20;
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  transform: translateX(-50%);
}

.project-detail-viewer__dots {
  position: absolute;
  bottom: 48px;
  left: 50%;
  z-index: 20;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.project-detail-viewer__stage {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.project-detail-viewer__track {
  display: flex;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.project-detail-viewer__slide {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
}

.project-detail-viewer__slide img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.1s ease-out;
}

.project-detail-viewer.is-zoomed .project-detail-viewer__slide img {
  cursor: grab;
}

.project-detail-viewer.is-panning .project-detail-viewer__slide img {
  cursor: grabbing;
  transition: none;
}

html.project-detail-viewer-open,
html.project-detail-viewer-open body {
  overflow: hidden;
}

@media (min-width: 768px) {
  .project-detail__thumbs {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    scroll-padding-left: 0;
  }
}

.project-detail__side {
  margin-top: 16px;
}

.project-detail__title {
  margin: 0;
  color: #111827;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.6px;
}

.project-detail__subtitle {
  margin: 12px 0 0;
  color: #737373;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 25.6px;
}

.project-detail__cta-slot {
  margin-top: 24px;
  padding-top: 8px;
}

.project-detail__cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.project-detail__cta {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 8px 24px;
  border: 0; /* mock's border-2 is overridden by its button variant — computed border is none */
  border-radius: 9999px;
  background: #000;
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  text-decoration: none;
  white-space: nowrap;
}

.project-detail__cta:hover {
  background: #262626;
}

.project-detail__cta:focus-visible {
  outline: 2px solid #eb9610;
  outline-offset: 2px;
}

/* AIDEV-NOTE: Below 1024px the extra bottom space keeps the last row clear of the fixed CTA bar (mock: 149px) */
.project-detail__similar {
  padding-bottom: 149px;
}

.project-detail__similar-title {
  box-sizing: border-box;
  max-width: 1280px;
  margin: 0 auto 16px;
  padding: 0 16px;
  color: #111827;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.45px;
}

/* AIDEV-NOTE: Bleeds off the right edge; ≥1024px the left inset tracks the 1280px content column */
.project-detail__similar-scroll {
  display: flex;
  gap: 16px;
  padding: 0 16px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
  scrollbar-width: none;
}

.project-detail__similar-scroll::-webkit-scrollbar {
  display: none;
}

.project-detail__similar-card {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 180px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #f5f5f5;
  scroll-snap-align: start;
  transform: translateZ(0);
}

.project-detail__similar-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.1);
}

@media (min-width: 640px) {
  .project-detail {
    padding-left: 24px;
    padding-right: 24px;
  }
  .project-detail__similar-title {
    padding: 0 24px;
  }
}

@media (min-width: 768px) {
  .project-detail__pills {
    flex-wrap: wrap;
    margin: 0 0 16px;
    padding: 0;
    overflow: visible;
  }
}

@media (min-width: 1024px) {
  .project-detail {
    padding-left: 32px;
    padding-right: 32px;
  }
  .project-detail__layout {
    flex-direction: row;
    gap: 16px;
  }
  .project-detail__side {
    width: 320px;
    margin-top: 0;
    padding: 40px 0 0 24px;
    box-sizing: border-box;
  }
  .project-detail__cta-bar {
    position: static;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .project-detail__similar {
    padding-top: 32px;
    padding-bottom: 32px;
  }
  .project-detail__similar-title {
    padding: 0 32px;
  }
  .project-detail__similar-scroll {
    padding-left: max(2rem, calc((100vw - 80rem) / 2 + 2rem));
    padding-right: 0;
    scroll-padding-left: max(2rem, calc((100vw - 80rem) / 2 + 2rem));
  }
}
