/* ==========================================================================
   BUILTBYJIMI - PROJECTS GALLERY (PROJECTS TAB PAGE)
   Extracted & Styled from Figma Frames:
   - 'projectts tab page' (id: 1:2)
   - 'projects page on scroll' (id: 6:12)
   - 'home page mobile' (id: 7:1290)
   ========================================================================== */

:root {
  --proj-bg: #eaeaea;
  --proj-text: #000000;
  --proj-text-muted: #666666;
  --proj-border: rgba(0, 0, 0, 0.25);
  --proj-border-strong: #000000;
  --proj-lime: #befda7;
  --proj-card-bg: #e2e2e2;
  --proj-pill-bg: #1a1a1a;
  --proj-pill-border: rgba(255, 255, 255, 0.16);

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--proj-bg);
  color: var(--proj-text);
  font-family: var(--font-main);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide native scrollbars for seamless gallery look */
::-webkit-scrollbar {
  display: none !important;
  width: 0px !important;
  height: 0px !important;
}

html {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* App Wrapper */
.projects-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 90px; /* Space for bottom floating nav */
  position: relative;
}

/* Top Navigation / Filter Bar */
.projects-header {
  width: 100%;
  max-width: 1228px;
  margin: 0 auto;
  padding: 36px 40px 18px 40px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 50;
}

.filter-by-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000000;
}

.filter-tabs-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Segmented Connected Filter Buttons (matching Figma & Screenshots) */
.filter-tabs {
  display: inline-flex;
  border: 1px solid #999999;
  background: transparent;
  overflow: hidden;
}

.filter-tab {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #718292;
  background: transparent;
  border: none;
  border-right: 1px solid #999999;
  padding: 7px 16px;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  outline: none;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.filter-tab:last-child {
  border-right: none;
}

/* Green Hover Highlight (from screenshot) */
.filter-tab:hover {
  background-color: #b6fc8e;
  color: #000000;
  box-shadow: inset 0 0 0 1px #000000;
}

/* Green Active/Selected Highlight with crisp border (from screenshot) */
.filter-tab.active {
  background-color: #b6fc8e;
  color: #000000;
  box-shadow: inset 0 0 0 1px #000000;
}

.filter-tab .tab-cross {
  display: none;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  margin-left: 2px;
  transform: translateY(-0.5px);
}

.filter-tab.active .tab-cross {
  display: inline-block;
}

/* ==========================================================================
   CAROUSEL SHOWCASE STAGE
   ========================================================================== */
.showcase-stage {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 10px 0 20px 0;
}

.carousel-viewport {
  width: 100%;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
}

.carousel-viewport.is-dragging {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  align-items: center;
  position: relative;
  width: max-content;
  will-change: transform;
}

/* Individual Project Card - dynamic width strictly determined by card image width */
.project-card {
  flex: 0 0 auto;
  width: min-content;
  max-width: 85vw;
  margin: 0 clamp(16px, 2.2vw, 32px);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.4s ease;
  opacity: 0.55;
  transform: scale(0.92);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.project-card:hover {
  opacity: 0.85;
}

/* Active Project Card (Centered & Expanded) */
.project-card.active {
  width: min-content;
  max-width: 85vw;
  opacity: 1;
  transform: scale(1);
  cursor: pointer;
  z-index: 10;
}

.project-card.active:hover .card-media-box {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.project-card.is-unavailable,
.project-card.is-unavailable.active {
  cursor: default !important;
}

.project-card.is-unavailable:hover .card-media-box {
  transform: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

/* Card Header (Title) */
.card-header-bar {
  display: flex;
  align-items: flex-end;
  margin-bottom: 14px;
  min-height: 42px;
  width: 100%;
  min-width: 100%;
}

.card-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--proj-text);
  margin: 0;
  transition: opacity 0.3s ease;
  white-space: normal;
  word-break: normal;
}

/* Hide title and meta on adjacent side cards without collapsing height */
.project-card:not(.active) .card-header-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Project Card Visual Media Container - hugs the thumbnail width dynamically */
.card-media-box {
  width: fit-content;
  height: auto;
  max-width: 100%;
  background-color: var(--proj-card-bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  transition: box-shadow 0.4s ease, transform 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card.active .card-media-box {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
}

.card-media-img {
  height: clamp(260px, 48vh, 450px);
  width: auto;
  max-width: 80vw;
  object-fit: contain;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.project-card:hover .card-media-img {
  transform: scale(1.02);
}

/* Card Bottom Metadata */
.card-meta-bar {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 48px;
  width: 100%;
  min-width: 100%;
  gap: 12px;
}

.project-card:not(.active) .card-meta-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.card-number-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--proj-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.project-card.active .card-number-tag {
  color: #000000;
  font-weight: 700;
}

.card-dot-active {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #000000;
}

.card-details-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.meta-row {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #222222;
  line-height: 1.35;
  word-break: normal;
}

.meta-label {
  font-weight: 700;
  color: #000000;
  margin-right: 4px;
}

.meta-val {
  font-weight: 400;
  color: #333333;
  white-space: normal;
}

@media (max-width: 768px) {
  .project-card,
  .project-card.active {
    width: min-content;
    max-width: 88vw;
    margin: 0 12px;
  }
  .card-media-img {
    height: clamp(220px, 40vh, 340px);
    max-width: 85vw;
  }
}

/* ==========================================================================
   FLOATING BOTTOM NAVIGATION (Exact Stats from Figma div.nav_container)
   Dimensions: 302.7px x 41.59px, Background: #1A1A1A, Padding: 12px 16px, Bottom: 3rem
   ========================================================================== */
.floating-nav,
.nav_container {
  position: fixed;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: 302.7px;
  height: 41.59px;
  background: #1A1A1A;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--proj-pill-border);
  border-radius: 9999px;
  padding: 12px 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-brand {
  font-size: 13.5px;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-item {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-item:hover {
  color: #ffffff;
}

.nav-item.active {
  color: #ffffff;
  font-weight: 500;
}

.nav-dot-active {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--proj-lime);
  display: inline-block;
  box-shadow: 0 0 8px rgba(190, 253, 167, 0.8);
}

/* ==========================================================================
   QUICK VIEW DETAIL MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  color: #000000;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  border-radius: 6px;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.modal-overlay.open .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: #000000;
  transition: all 0.2s ease;
  z-index: 5;
}

.modal-close-btn:hover {
  background: #000000;
  color: #ffffff;
}

.modal-img-wrap {
  width: 100%;
  height: 380px;
  background: #000000;
  overflow: hidden;
}

.modal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-body {
  padding: 32px 36px;
}

.modal-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #888888;
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px 0;
  margin: 16px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-family: var(--font-mono);
  font-size: 11px;
}

.modal-desc {
  font-size: 15px;
  line-height: 1.6;
  color: #333333;
  margin-bottom: 24px;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #000000;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.modal-btn:hover {
  background: #333333;
  transform: translateY(-2px);
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   Extracted from Figma 'home page mobile' (445px frame specs)
   ========================================================================== */
@media (max-width: 900px) {
  .projects-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 24px 20px 12px 20px;
  }

  .filter-tabs-wrapper {
    position: static;
    transform: none;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .filter-tabs {
    flex-shrink: 0;
  }

  .project-card,
  .project-card.active {
    width: min-content;
    max-width: 85vw;
  }
}

@media (max-width: 600px) {
  .projects-app {
    padding-bottom: 80px;
  }

  .projects-header {
    padding: 20px 16px 8px 16px;
  }

  .filter-by-label {
    font-size: 10px;
  }

  .filter-tab {
    padding: 8px 12px;
    font-size: 10px;
  }

  .showcase-stage {
    padding: 0;
  }

  .carousel-viewport {
    overflow: hidden;
    touch-action: pan-y;
  }

  .project-card {
    width: min-content !important;
    max-width: 86vw !important;
    margin: 0 10px;
    transform: scale(0.92) !important;
    opacity: 0.55 !important;
  }

  .project-card.active {
    width: min-content !important;
    max-width: 88vw !important;
    transform: scale(1) !important;
    opacity: 1 !important;
  }

  .card-header-bar {
    margin-bottom: 10px;
    min-height: auto;
  }

  .card-title {
    font-size: 22px;
  }

  .card-media-box,
  .project-card.active .card-media-box {
    width: fit-content;
    height: auto;
  }

  .card-media-img {
    height: 240px;
    width: auto;
    max-width: 86vw;
  }

  .card-meta-bar {
    margin-top: 10px;
    min-height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .project-card:not(.active) .card-details-box {
    display: flex; /* Show details on mobile */
  }

  .card-details-box {
    align-items: flex-start;
    text-align: left;
  }

  .meta-row {
    font-size: 9.5px;
  }

  .carousel-progress-bar {
    display: none;
  }

  /* Floating pill adapted to mobile */
  .floating-nav,
  .nav_container {
    bottom: 3rem;
    width: min(302.7px, calc(100vw - 32px));
    height: 41.59px;
    padding: 12px 16px;
    gap: 16px;
  }

  .nav-brand {
    font-size: 12px;
  }

  .nav-item {
    font-size: 12px;
  }

  .modal-img-wrap {
    height: 240px;
  }

  .modal-body {
    padding: 20px 18px;
  }

  .modal-title {
    font-size: 24px;
  }
}
