/* ========== PAGE TRANSITION (cross-fade) ========== */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  overflow: hidden;
}

.page-transition-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #000;
  opacity: 0;
  will-change: opacity;
}

.page-transition.entering .page-transition-overlay {
  animation: ptFadeIn 0.4s ease-in-out forwards;
}

.page-transition.leaving .page-transition-overlay {
  animation: ptFadeOut 0.4s ease-in-out 0.15s forwards;
}

@keyframes ptFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes ptFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Persistent nav elements above transition */
.logo, .contact-nav-btn {
  z-index: 100000;
}

/* ========== OVERRIDES ========== */
.apps-page-logo {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

.apps-page-nav-btn {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

/* ========== AURORA SHADER BACKGROUND ========== */
.apps-shader-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 50vh;
  z-index: 0;
  opacity: 0;
  animation: shaderFadeIn 1.5s ease 1.5s forwards;
  pointer-events: none;
}

@keyframes shaderFadeIn {
  to { opacity: 0.5; }
}


.apps-shader-bg canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ========== DOTS BACKGROUND ========== */
.apps-dots-bg {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 5000px;
  height: 5000px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  animation: appsFadeIn 1s ease 2s forwards;
}

/* ========== TOP BAR ========== */
.apps-topbar {
  position: fixed;
  top: 90px;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  z-index: 15;
  opacity: 0;
  animation: appsFadeIn 1s ease 2.5s forwards;
}

.apps-breadcrumb {
  display: none;
  font-family: 'PPSemiBold', sans-serif;
  font-size: 16px;
  color: var(--brightgray);
}

.apps-breadcrumb a {
  color: var(--brightgray);
  text-decoration: none;
  transition: opacity 0.15s;
}

.apps-breadcrumb a:hover { opacity: 0.6; }

.apps-breadcrumb-sep {
  margin: 0 10px;
  color: var(--midgray);
}

.apps-breadcrumb-current { color: #fff; }

/* ========== VIEW TOGGLE ICONS (centered) ========== */
.apps-view-toggle {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
}

.apps-view-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apps-view-btn:hover { opacity: 0.3; }
.apps-view-btn.active { opacity: 1; }

.apps-view-icon {
  display: block;
  filter: brightness(200%);
}

/* ========== MAIN ========== */
.apps-main {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: transparent;
}

/* ========== SHOWCASE AREA ========== */
.apps-preview-area {
  position: relative;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.apps-preview-area.visible {
  opacity: 1;
}

.apps-carousel-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  perspective: 1200px;
  transform-style: preserve-3d;
}

/* ========== FLOATING CARDS ========== */
.sc-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 400px;
  height: 400px;
  border-radius: 88px;
  overflow: hidden;
  will-change: transform, opacity;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  pointer-events: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.sc-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.6),
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(117, 223, 233, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sc-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: 44px;
}

.sc-card.censored img {
  filter: blur(12px) brightness(0.55) saturate(0.5);
}

.sc-card.censored {
  pointer-events: none;
}

.sc-shine {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  border-radius: 44px;
  transition: opacity 0.25s;
}

/* ========== GRADIENT OVERLAY ========== */
.apps-gradient-overlay {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  height: 100dvh;
  width: 100vw;
  background: linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.35) 30%, rgba(0,0,0,0.6) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ========== MOBILE APP ICONS (hidden — using showcase instead) ========== */
.apps-mobile-icons {
  display: none !important;
}

.apps-mobile-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.apps-mobile-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.apps-mobile-icon.censored img {
  filter: blur(8px) brightness(0.5) saturate(0.4);
}

/* ========== SCROLL LIST (manually scrollable) ========== */
.apps-list-area {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  height: calc(100dvh - 130px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 2;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.apps-list-area::-webkit-scrollbar {
  display: none;
}

.apps-list-track {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 40vh 0;
}

/* ========== PROJECT ROW — MOBILE (default) ========== */
.apps-row {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
}

.apps-row-wrapper {
  position: relative;
  width: fit-content;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

.apps-row-title {
  font-family: 'PPSemiBold', sans-serif;
  font-size: 20px;
  line-height: 31px;
  color: #f3f3f3;
  white-space: nowrap;
  transition: opacity 0.15s;
  margin-bottom: 5px;
}

.apps-row-tags {
  display: flex;
  gap: 2px;
}

.apps-row-cat {
  border: 1px solid #292929;
  border-radius: 50px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.apps-row-cat-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(2);
  transform: scale(0.8);
}

.apps-row-cat-label {
  font-family: 'PPSemiBold', sans-serif;
  font-size: 14px;
  color: var(--brightgray);
  line-height: 100%;
  white-space: nowrap;
}

.apps-row-year-pill {
  border: 1px solid #292929;
  border-radius: 50px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.apps-row-year-text {
  font-family: 'PPSemiBold', sans-serif;
  font-size: 14px;
  line-height: 14px;
  color: var(--brightgray);
  white-space: nowrap;
}

/* Year (desktop inline, hidden on mobile) */
.apps-row-year-inline {
  display: none;
}

/* Category area (desktop only) */
.apps-row-cat-area {
  display: none;
}

/* ========== COMING SOON BADGE ========== */
.apps-row-coming-soon {
  font-family: 'PPSemiBold', sans-serif;
  font-size: 12px;
  color: #75dfe9;
  border: 1px solid rgba(117, 223, 233, 0.3);
  border-radius: 50px;
  padding: 5px 12px;
  margin-left: 15px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.apps-grid-coming-soon {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: 'PPSemiBold', sans-serif;
  font-size: 11px;
  color: #75dfe9;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(117, 223, 233, 0.3);
  border-radius: 50px;
  padding: 5px 12px;
  letter-spacing: 0.5px;
}

/* ========== STAGGER ANIMATION ========== */
.apps-row { opacity: 0; pointer-events: none; }
.apps-row.visible { opacity: 0.5; pointer-events: all; }
.apps-row.visible:hover { opacity: 1; }
.apps-row.censored.visible { opacity: 0.25; filter: blur(1.5px); pointer-events: none; }

.apps-grid-item.censored .apps-grid-item-bg {
  filter: blur(12px) brightness(0.5) saturate(0.4);
}
.apps-grid-item.censored { pointer-events: none; opacity: 0.4; }

@keyframes appsFadeIn {
  to { opacity: 1; }
}

/* ========== GRID VIEW ========== */
.apps-grid-area {
  display: none;
  position: absolute;
  top: 130px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 2;
  padding: 10px;
}

.apps-grid-area.active {
  display: block;
}

.apps-grid-track {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.apps-grid-item {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.apps-grid-item.visible {
  opacity: 1;
}

.apps-grid-item:hover {
  transform: scale(1.02);
}

.apps-grid-item-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.apps-grid-item-title {
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-family: 'PPSemiBold', sans-serif;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Grid top/bottom fade */
.apps-grid-fade-top,
.apps-grid-fade-bottom {
  position: fixed;
  left: 0;
  width: 100vw;
  height: 25vh;
  pointer-events: none;
  z-index: 3;
}

.apps-grid-fade-top {
  top: 0;
  background: linear-gradient(to bottom, #000, transparent);
}

.apps-grid-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, #000, transparent);
}

/* ========== PROJECT DETAIL PANEL ========== */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: flex-end;
  background: rgba(0,0,0,0);
  transition: background 0.3s ease;
}

.detail-overlay.active {
  display: flex;
  background: rgba(0,0,0,0.5);
}

.detail-panel {
  position: relative;
  width: 0;
  height: 98dvh;
  margin-right: 10px;
  border-radius: 19px;
  overflow: visible;
  background: linear-gradient(to bottom, #292929, #4D4D4D);
  padding: 1px;
  opacity: 0;
  transition: width 0.5s cubic-bezier(0.2, 0.6, 0.015, 1), opacity 0.15s ease;
}

.detail-panel.open {
  width: 75vw;
  opacity: 1;
}

.detail-close {
  position: absolute;
  top: 100px;
  left: -25px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #494949;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.3s;
  opacity: 0;
  animation: detailCloseIn 0.4s ease 0.5s forwards;
}

.detail-close:hover {
  filter: brightness(2);
}

@keyframes detailCloseIn {
  to { opacity: 1; }
}

.detail-scroll {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 19px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.detail-scroll::-webkit-scrollbar {
  display: none;
}

.detail-content-wrapper {
  width: 100%;
  padding-bottom: 150px;
}

/* Banner */
.detail-banner-area {
  position: relative;
  width: 100%;
  height: 500px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.detail-banner-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: linear-gradient(transparent, black 0%, black 45%, transparent 85%);
  mask-image: linear-gradient(transparent, black 0%, black 45%, transparent 85%);
}

.detail-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 60%;
}

/* Title */
.detail-title {
  font-family: 'Intranet', sans-serif;
  font-size: 35px;
  line-height: 130%;
  color: var(--brightgray);
  text-align: center;
  margin: 0 20px 10px;
}

/* Meta (category + year) */
.detail-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.detail-categories {
  display: flex;
  gap: 3px;
}

.detail-cat-pill {
  border: 1px solid #292929;
  border-radius: 50px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.detail-cat-icon {
  width: 16px;
  height: 16px;
  filter: brightness(2);
}

.detail-cat-pill span {
  font-family: 'PPSemiBold', sans-serif;
  font-size: 14px;
  color: var(--brightgray);
  line-height: 100%;
}

.detail-year {
  font-family: 'PPRegular', sans-serif;
  font-size: 18px;
  line-height: 18px;
  color: var(--brightgray);
}

/* Description */
.detail-desc {
  font-family: 'PPRegular', sans-serif;
  font-size: 18px;
  line-height: 27px;
  color: #f3f3f3;
  max-width: 501px;
  margin: 70px auto 0;
  padding: 0 30px;
  text-align: center;
}

/* ========== RESPONSIVE ========== */

/* SM - 640px */
@media (min-width: 640px) {
  .apps-topbar { padding: 0 20px; }
  .apps-list-area { height: 50dvh; }
  .apps-grid-track { grid-template-columns: repeat(2, 1fr); }
}

/* MD - 768px */
@media (min-width: 768px) {
  .apps-topbar { top: 100px; }
  .apps-breadcrumb { display: block; }
  .apps-view-toggle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  .apps-row { min-height: 40px; }
  .apps-row-title { font-size: 24px; }
  .apps-grid-track { grid-template-columns: repeat(2, 1fr); }
}

/* LG - 1024px: Switch to DESKTOP layout */
@media (min-width: 1024px) {
  .apps-topbar { padding: 0 50px; top: 100px; }

  .apps-list-area {
    left: 40px;
    right: auto;
    width: 90vw;
    height: calc(100dvh - 160px);
  }

  .apps-list-track {
    padding: 30vh 0;
  }

  /* Row becomes horizontal */
  .apps-row {
    justify-content: flex-start;
    width: fit-content;
    margin: 0 auto 0 0;
    min-height: 40px;
  }

  .apps-row-wrapper {
    flex-direction: row;
    align-items: center;
    width: 100%;
  }

  /* Category area: fixed 150px width */
  .apps-row-cat-area {
    display: block;
    width: 150px;
    min-width: 150px;
    flex-shrink: 0;
  }

  .apps-row-cat-area .apps-row-cat {
    width: 32px;
    height: 32px;
    padding: 4px;
    border-width: 1.5px;
    border-color: rgba(139, 139, 139, 0.26);
    overflow: hidden;
    transition: width 0.15s, padding 0.15s;
  }

  .apps-row:hover .apps-row-cat-area .apps-row-cat {
    width: auto;
    padding: 4px 6px 4px 4px;
  }

  .apps-row-cat-area .apps-row-cat-label {
    font-family: 'PPRegular', sans-serif;
    font-size: 14px;
    line-height: 100%;
    margin-right: 4px;
    opacity: 0;
    transition: opacity 0.15s;
  }

  .apps-row:hover .apps-row-cat-area .apps-row-cat-label {
    opacity: 1;
  }

  /* Hide mobile tags, show inline year */
  .apps-row-tags { display: none; }
  .apps-row-year-inline {
    display: block;
    font-family: 'PPRegular', sans-serif;
    font-size: 18px;
    color: rgba(242, 242, 242, 0.5);
    white-space: nowrap;
    margin-left: 60px;
    margin-bottom: auto;
  }

  /* Title */
  .apps-row-title {
    font-size: 31px;
    margin-bottom: 0;
  }

  /* Carousel shifts right on desktop */
  .apps-preview-area {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(20%);
  }

  /* Left gradient: from-black/80 via-black/60 to-transparent */
  .apps-gradient-overlay {
    background: linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 30%, transparent 80%);
  }

  .apps-grid-area { padding: 10px 50px; top: 150px; }
  .apps-grid-track { grid-template-columns: repeat(3, 1fr); }
}

/* XL */
@media (min-width: 1280px) {
  .apps-row-title { font-size: 34px; }
}

/* 2XL */
@media (min-width: 1536px) {
  .apps-grid-track { grid-template-columns: repeat(4, 1fr); }
}

/* Detail panel: mobile override */
@media (max-width: 1023px) {
  .apps-preview-area {
    display: block !important;
    position: absolute;
    width: 100%;
    height: 28dvh;
    top: 95px;
    left: 0;
    right: 0;
  }
  .apps-carousel-container {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
  }
  .sc-card {
    width: 120px;
    height: 120px;
    border-radius: 28px;
  }
  .sc-card img { border-radius: 28px; }
  .sc-shine { border-radius: 28px; }
  .apps-list-area { height: calc(72dvh - 95px); top: calc(28dvh + 95px); bottom: auto; }
  .apps-list-track { padding: 20px 0 40px; }

  .detail-panel.open {
    width: 100vw;
  }

  .detail-panel {
    margin-right: 0;
    border-radius: 19px 19px 0 0;
    height: 70dvh;
  }

  .detail-close {
    top: 15px;
    left: auto;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.3);
  }
  .detail-close svg path {
    stroke: #333;
  }

  .detail-banner-area {
    height: 330px;
  }

  .detail-title {
    font-size: 28px;
  }
}
