/* =========================
   Projects page
   - Intro chip rail, project modules (3ca, 3cb, 3cc)
   ========================= */

/* The projects page keeps the global header non-sticky. */
.page-projects .header{
  position: static;
}

/* -------------------------
   Intro + project chip rail
   ------------------------- */
.projNavBar{
  margin-top: 28px;
}

.projNavBar__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.projNavBar__label{
  margin: 0;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.62);
}

.projNavBar__controls{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.projNavBar__wrap{
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03)),
    rgba(8,8,10,.6);
  box-shadow: 0 18px 44px rgba(0,0,0,.18);
  backdrop-filter: blur(14px);
}
.projNavBar__wrap::before{
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0));
  opacity: .4;
  pointer-events: none;
}

.projNavBar__rail{
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 10px;
  padding: 2px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 28px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent);
}
.projNavBar__rail::-webkit-scrollbar{ display: none; }

.projNavBar__link{
  flex: 0 0 auto;
  scroll-snap-align: center;
  min-height: 40px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.72);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform .18s ease,
    border-color .2s ease,
    background .2s ease,
    color .2s ease,
    box-shadow .2s ease;
}
.projNavBar__link:hover{
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.12);
  color: #fff;
}
.projNavBar__link.is-active,
.projNavBar__link[aria-current="location"]{
  background: rgba(231,198,255,.18);
  border-color: rgba(231,198,255,.42);
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.05) inset,
    0 12px 24px rgba(0,0,0,.16);
}
.projNavBar__link:focus-visible{
  outline: none;
  border-color: rgba(231,198,255,.72);
  color: #fff;
  box-shadow:
    0 0 0 4px rgba(231,198,255,.18),
    0 12px 24px rgba(0,0,0,.16);
}

.projNavBar .expNavBtn{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, opacity .2s ease;
}
.projNavBar .expNavBtn svg{ width: 18px; height: 18px; }
.projNavBar .expNavBtn:hover:not(:disabled){
  border-color: rgba(231,198,255,.6);
  box-shadow: 0 0 0 4px rgba(231,198,255,.15);
  transform: translateY(-1px);
}
.projNavBar .expNavBtn:disabled{
  opacity: .34;
  cursor: default;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

@media (max-width: 720px){
  .projNavBar{
    margin-top: 24px;
  }
  .projNavBar__wrap{
    padding: 8px;
    border-radius: 22px;
  }
  .projNavBar__rail{
    gap: 8px;
    scroll-padding-inline: 20px;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .projNavBar__link{
    min-height: 38px;
    padding: 10px 14px;
    font-size: 12px;
  }
  .projNavBar .expNavBtn{
    width: 36px;
    height: 36px;
  }
}

@media (min-width: 900px){
  .projNavBar__wrap{ padding: 12px; }
  .projNavBar__link{ font-size: 14px; }
}

/* -------------------------
   Intro
   ------------------------- */
.projIntro{
  position: relative;
  overflow: hidden;
  padding-top: 56px;
  padding-bottom: 44px;
}
.projIntro::before{
  content: "";
  position: absolute;
  inset: -180px;
  background:
    radial-gradient(circle at 15% 18%, rgba(231,198,255,.26), transparent 42%),
    radial-gradient(circle at 82% 34%, rgba(255,255,255,.08), transparent 42%),
    radial-gradient(circle at 48% 90%, rgba(231,198,255,.12), transparent 38%);
  pointer-events: none;
  opacity: .92;
}
.projIntro__inner{
  position: relative;
}
.projIntro .kicker{ color: rgba(255,255,255,.72); }
.projIntro__title{
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.8px;
  margin: 14px 0 0;
}
.projIntro__sub{
  margin: 14px 0 0;
  max-width: 68ch;
  color: rgba(255,255,255,.78);
  font-size: 16px;
  line-height: 1.6;
}

@media (max-width: 720px){
  .projIntro{
    padding-top: 44px;
    padding-bottom: 36px;
  }
  .projIntro__sub{
    font-size: 15px;
  }
}

/* -------------------------
   Project module (3c) – 3ca hero
   ------------------------- */
.projModule{
  scroll-margin-top: clamp(24px, 6vw, 72px);
  content-visibility: auto;
  contain-intrinsic-block-size: 800px;
}

.projModule__hero{
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow: hidden;
  background: #000;
  /* Desktop: wide aspect; mobile: 1:1 */
  aspect-ratio: 21 / 9;
}
@media (max-width: 720px){
  .projModule__hero{ aspect-ratio: 1 / 1; }
}

.projModule__mediaFallback{
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: var(--thumb, none), linear-gradient(180deg, rgba(0,0,0,.3), rgba(0,0,0,.85));
  background-size: cover, cover;
  background-position: center, center;
  filter: contrast(1.05) brightness(.92);
  transition: opacity 420ms ease;
}
.projModule__hero[data-playing="true"] .projModule__mediaFallback{
  opacity: 0;
  pointer-events: none;
}

.projModule__video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 2;
  transition: opacity 420ms ease;
}
.projModule__hero[data-playing="true"] .projModule__video{
  opacity: 1;
}
.projModule__video--crop-center{
  object-position: center center;
}

/* Hero overlay: large title (Apple services style) lower-left */
.projModule__heroOverlay{
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  padding: 24px 20px 28px;
  max-width: 90%;
  pointer-events: none;
}
@media (min-width: 900px){
  .projModule__heroOverlay{ padding: 32px 36px 40px; }
}

.projModule__heroTitle{
  margin: 0;
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,.5);
}
.projModule__heroSub{
  margin: 6px 0 0;
  font-size: clamp(15px, 1.8vw, 18px);
  color: rgba(255,255,255,.85);
  font-weight: 500;
}

/* Hero play/pause (portfolio pCtrl-style) bottom-right */
.projModule__play{
  position: absolute;
  right: 20px;
  bottom: 24px;
  z-index: 4;
  touch-action: manipulation;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow .2s ease, border-color .2s ease, transform .15s ease;
}
.projModule__play:hover{
  border-color: rgba(255,255,255,.3);
  box-shadow: 0 0 0 4px rgba(255,255,255,.08);
  transform: translateY(-1px);
}
.projModule__play:focus-visible{
  outline: 3px solid rgba(231,198,255,.55);
  outline-offset: 3px;
}
.projModule__play .pIcon{
  width: 18px;
  height: 18px;
  fill: #fff;
  opacity: .92;
}
.projModule__hero[data-playing="true"] .projModule__play .pIcon--play{ display: none; }
.projModule__hero[data-playing="false"] .projModule__play .pIcon--pause{ display: none; }

/* -------------------------
   Module content: rail blocks (3cb, 3cc)
   ------------------------- */
.projModule__content{
  padding-top: 48px;
  padding-bottom: 56px;
}

.projRailBlock{
  margin-bottom: 42px;
}
.projRailBlock:last-child{ margin-bottom: 0; }

.projRailHead{
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  margin-bottom: 14px;
}

.projRailTitle{
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  letter-spacing: -0.4px;
  margin: 0;
  font-weight: 700;
}

/* expNav + expNavBtn on projects (dark theme) */
.projRailBlock .expNav{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  margin-left: auto;
}
.projRailBlock .expNavBtn{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.projRailBlock .expNavBtn svg{ width: 18px; height: 18px; }
.projRailBlock .expNavBtn:hover:not(:disabled){
  border-color: rgba(231,198,255,.6);
  box-shadow: 0 0 0 4px rgba(231,198,255,.15);
  transform: translateY(-1px);
}
.projRailBlock .expNavBtn:disabled{
  opacity: .4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 3cb – Asset rail + cards (~2x size). Left edge of first card aligns with headline. */
.projAssetRail{
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 12px 0 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-inline: max(20px, calc((100vw - 1120px) / 2 + 20px));
  scroll-padding-inline: max(20px, calc((100vw - 1120px) / 2 + 20px));
  -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
}
.projResultRail{
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 12px 0 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-inline: max(20px, calc((100vw - 1120px) / 2 + 20px));
  scroll-padding-inline: max(20px, calc((100vw - 1120px) / 2 + 20px));
  -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
}
.projAssetRail.is-dragging,
.projResultRail.is-dragging{
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}
.projAssetRail.is-dragging,
.projAssetRail.is-dragging *,
.projResultRail.is-dragging,
.projResultRail.is-dragging *{
  user-select: none !important;
  -webkit-user-select: none !important;
}
.projAssetRail::-webkit-scrollbar,
.projResultRail::-webkit-scrollbar{ display: none; }

@media (max-width: 720px){
  .projAssetRail,
  .projResultRail{
    -webkit-mask-image: none;
    mask-image: none;
  }
}

@media (max-width: 720px){
  /* Mobile: keep rail controls inline with wrapped titles */
  .projRailBlock .expNav{
    padding: 6px 8px;
    gap: 6px;
  }
  .projRailBlock .expNavBtn{
    width: 36px;
    height: 36px;
  }
}

/* 3cb – projAssetCard: ~2x size */
.projAssetCard{
  flex: 0 0 auto;
  width: clamp(400px, 48vw, 560px);
  scroll-snap-align: center;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  overflow: hidden;
  transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease;
}
.projAssetCard:hover{
  transform: translateY(-2px);
  border-color: rgba(231,198,255,.35);
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}

.projAssetCard__img{
  aspect-ratio: 16 / 12;
  background-size: cover;
  background-position: center;
  background-color: rgba(0,0,0,.3);
}

.projAssetCard__title{
  margin: 0;
  padding: 18px 18px 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: rgba(255,255,255,.95);
}
.projAssetCard__sub{
  margin: 0;
  padding: 0 18px 18px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255,255,255,.72);
}

/* 3cc – projResultCard: 50% taller than original */
.projResultCard{
  flex: 0 0 auto;
  width: clamp(280px, 32vw, 380px);
  min-height: 150px;
  aspect-ratio: 2.4 / 1;
  scroll-snap-align: center;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease;
}
.projResultCard:hover{
  transform: translateY(-2px);
  border-color: rgba(231,198,255,.35);
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}

.projResultCard__icon{
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(231,198,255,.18);
  border: 1px solid rgba(255,255,255,.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.9);
}
.projResultCard__icon svg{ width: 20px; height: 20px; }

.projResultCard__title{
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: rgba(255,255,255,.95);
}
.projResultCard__text{
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255,255,255,.72);
}

/* ===== Project rails: desktop snap controlled by JS (slower, more fluid) ===== */
@media (hover: hover) and (pointer: fine){
  .projAssetRail,
  .projResultRail{
    scroll-snap-type: none;
  }
  .projAssetCard,
  .projResultCard{
    scroll-snap-align: none;
  }
}

@media (prefers-reduced-motion: reduce){
  .projAssetCard,
  .projResultCard,
  .projNavBar__link,
  .projNavBar .expNavBtn,
  .projRailBlock .expNavBtn{
    transition: none;
  }
}
