/* 1. Work Page Header */
.work-header {
  text-align: center;
  padding-top: 180px;
}

.work-header h2 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(40px, 5vw, 62px);
  letter-spacing: -2.5px;
  font-weight: 800;
  margin-bottom: 16px;
}

.work-header h2 em {
  color: var(--blue);
  font-style: normal;
}

.work-header p {
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto;
}

/* 2. Filter Tabs */
.work-filters {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 50px;
}

.filter-btn {
  border-radius: 50px;
  padding: 11px 24px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all .25s ease;
}

.filter-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.filter-btn.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(9, 103, 232, .2);
}

@media (max-width: 760px) {
  .work-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }
  .work-filters::-webkit-scrollbar {
    display: none;
  }
  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* 3. Featured Projects */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 60px;
}

.featured-card {
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
  position: relative;
}

.featured-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 60px rgba(9, 54, 125, .14);
  border-color: #a8c9f7;
}

.featured-img {
  height: 280px;
  overflow: hidden;
  position: relative;
  transition: transform .5s ease;
}

/* Fallback gradients only when no image */
.featured-card:nth-child(1) .featured-img:not(.has-image) { background: linear-gradient(135deg, var(--blue-soft), var(--blue)); }
.featured-card:nth-child(2) .featured-img:not(.has-image) { background: linear-gradient(135deg, var(--ink), var(--blue-dark)); }
.featured-card:nth-child(3) .featured-img:not(.has-image) { background: linear-gradient(135deg, #f5f9ff, var(--muted)); }
.featured-card:nth-child(4) .featured-img:not(.has-image) { background: linear-gradient(135deg, var(--line), var(--blue)); }

.featured-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 16, 32, .4), transparent);
  pointer-events: none;
  z-index: 1;
}

.featured-card:hover .featured-img-inner,
.featured-card:hover .featured-img img {
  transform: scale(1.05);
}

.featured-img-inner {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transition: transform .5s ease;
}

/* Real image inside featured thumb */
.featured-img-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform .5s ease;
}

/* Placeholder icons inside gradient thumbnails */
.placeholder-icon {
  font-size: 52px;
  color: rgba(255, 255, 255, .25);
  user-select: none;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.modal-icon {
  font-size: 72px;
}

.featured-content {
  padding: 28px 30px 32px;
}

.featured-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 6px 14px;
  border-radius: 50px;
  margin-bottom: 14px;
}

.featured-content h3 {
  font-size: 24px;
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.8px;
  margin-bottom: 10px;
  font-weight: 800;
}

.featured-content p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.featured-result {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 18px;
}

.featured-cta {
  font-size: 13px;
  font-weight: 800;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap .2s ease;
  text-decoration: none;
}

.featured-cta:hover {
  gap: 10px;
}

@media (max-width: 760px) {
  .featured-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 470px) {
  .featured-img {
    height: 220px;
  }
}

/* 4. Portfolio Grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 80px;
}

.portfolio-grid .project-card {
  transition: opacity .4s ease, transform .4s ease, box-shadow .35s ease, border-color .35s ease;
}

.project-card.hidden {
  display: none;
}

.project-card.fade-out {
  opacity: 0;
  transform: scale(0.95) translateY(10px);
}

.project-card.fade-in {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@media (max-width: 1050px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 470px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
}

/* 5. Project Cards */
.project-card {
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  position: relative;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: #a8c9f7;
  box-shadow: 0 20px 50px rgba(9, 68, 145, .12);
}

.card-thumb {
  height: 220px;
  overflow: hidden;
  position: relative;
}

.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 16, 32, .3), transparent 60%);
  pointer-events: none;
}

.project-card:hover .card-thumb-inner {
  transform: scale(1.06);
}

.card-thumb-inner {
  width: 100%;
  height: 100%;
  transition: transform .5s ease;
  display: grid;
  place-items: center;
  font-size: 48px;
  color: rgba(255, 255, 255, .3);
}

/* Real image inside card thumb */
.card-thumb-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Fallback gradients only when no image */
.project-card:nth-child(3n+1) .card-thumb:not(.has-image) .card-thumb-inner { background: linear-gradient(135deg, #eaf3ff 0%, #0967e8 100%); }
.project-card:nth-child(3n+2) .card-thumb:not(.has-image) .card-thumb-inner { background: linear-gradient(135deg, #0b1020 0%, #0967e8 100%); }
.project-card:nth-child(3n+3) .card-thumb:not(.has-image) .card-thumb-inner { background: linear-gradient(135deg, #f5f9ff 0%, #647089 100%); }

.card-category {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(9, 103, 232, .85);
  padding: 5px 12px;
  border-radius: 50px;
  backdrop-filter: blur(4px);
}

.card-body {
  padding: 22px 22px 24px;
}

.card-body h3 {
  font-size: 18px;
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  font-weight: 800;
}

.card-body p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-client {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  opacity: .7;
}

.card-cta {
  font-size: 12px;
  font-weight: 800;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: gap .2s ease;
}

.card-cta:hover {
  gap: 9px;
}

/* 6. Project Detail Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(11, 16, 32, .6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  width: min(880px, calc(100% - 40px));
  max-height: calc(100vh - 60px);
  background: #fff;
  border-radius: 24px;
  overflow-y: auto;
  transform: translateY(30px) scale(.97);
  transition: transform .35s ease;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .25);
  position: relative;
}

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

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(6px);
  cursor: pointer;
  font-size: 22px;
  color: var(--ink);
  margin: 16px 16px 0 0;
  display: grid;
  place-items: center;
  transition: background .2s ease, color .2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.modal-close:hover {
  background: var(--blue);
  color: #fff;
}

.modal-hero {
  width: 100%;
  height: 320px;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
}

.modal-hero-inner {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 64px;
  color: rgba(255, 255, 255, .3);
  background: linear-gradient(135deg, #eaf3ff 0%, #0967e8 100%);
}

/* Real image inside modal hero */
.modal-hero-inner.has-image {
  display: block;
}

.modal-hero-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.modal-body {
  padding: 40px 45px 50px;
}

.modal-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 6px 14px;
  border-radius: 50px;
  margin-bottom: 14px;
}

.modal-body h2 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -1.5px;
  margin: 12px 0 8px;
  font-weight: 800;
}

.modal-client {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 28px;
}

.modal-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--blue);
  margin: 30px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-section-title::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--blue);
  border-radius: 50%;
  flex-shrink: 0;
}

.modal-body .modal-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.modal-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 50px;
  background: var(--blue-soft);
  color: var(--blue);
}

.modal-result {
  background: var(--blue-soft);
  border-radius: 16px;
  padding: 22px 26px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-left: 3px solid var(--blue);
}

.tech-tag {
  background: #f5f9ff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.modal-project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  font-size: 13px;
  border-radius: 50px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  margin-top: 24px;
  transition: background .25s ease, transform .25s ease;
}

.modal-project-link:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
}

.modal-gallery-wrap {
  position: relative;
  margin-top: 12px;
}

.modal-gallery {
  display: flex;
  overflow: hidden;
  border-radius: 14px;
  background: var(--blue-soft);
  position: relative;
  min-height: 300px;
}

.modal-gallery-item {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.4s ease;
  padding: 24px;
  box-sizing: border-box;
}

.modal-gallery-item img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  display: block;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 10, 30, 0.65);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.gallery-nav:hover {
  background: rgba(10, 10, 30, 0.85);
  transform: translateY(-50%) scale(1.1);
}

.gallery-nav.prev {
  left: 10px;
}

.gallery-nav.next {
  right: 10px;
}

.gallery-nav:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.gallery-counter {
  text-align: center;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Video player in modal */
.modal-video-wrap {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--ink);
}

.modal-video {
  width: 100%;
  max-height: 420px;
  display: block;
  border-radius: 16px;
}

@media (max-width: 760px) {
  .modal-panel {
    width: calc(100% - 20px);
  }
  .modal-body {
    padding: 28px 22px 35px;
  }
  .modal-hero {
    height: 220px;
  }

  /* Gallery mobile adjustments */
  .modal-gallery {
    min-height: 200px;
    border-radius: 10px;
  }

  .modal-gallery-item {
    padding: 12px;
  }

  .modal-gallery-item img {
    max-width: 100%;
    border-radius: 8px;
  }

  .gallery-nav {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .gallery-nav.prev {
    left: 6px;
  }

  .gallery-nav.next {
    right: 6px;
  }

  .gallery-counter {
    font-size: 0.8rem;
    margin-top: 8px;
  }
}

@media (max-width: 480px) {
  .modal-panel {
    width: 100%;
    border-radius: 16px 16px 0 0;
  }
  .modal-body {
    padding: 20px 16px 30px;
  }
  .modal-hero {
    height: 180px;
  }

  .modal-gallery {
    min-height: 160px;
    border-radius: 8px;
  }

  .modal-gallery-item {
    padding: 8px;
  }

  .modal-gallery-item img {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  }

  .gallery-nav {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .gallery-nav.prev {
    left: 4px;
  }

  .gallery-nav.next {
    right: 4px;
  }

  .gallery-counter {
    font-size: 0.75rem;
    margin-top: 6px;
  }
}

/* 7. Work CTA Section */
/* Assuming .work-cta inherits .cta-section properties, use as hook if needed */
.work-cta {}

/* 8. Empty State */
.portfolio-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 15px;
}

/* 9. Category-specific placeholder gradients for card thumbnails */
.card-thumb[data-category="websites"] .card-thumb-inner,
.featured-img[data-category="websites"],
.modal-hero-inner[data-category="websites"] {
  background: linear-gradient(135deg, #eaf3ff 0%, #0967e8 100%);
}

.card-thumb[data-category="reels"] .card-thumb-inner,
.featured-img[data-category="reels"],
.modal-hero-inner[data-category="reels"] {
  background: linear-gradient(135deg, #0b1020 0%, #1a4fd4 100%);
}

.card-thumb[data-category="social"] .card-thumb-inner,
.featured-img[data-category="social"],
.modal-hero-inner[data-category="social"] {
  background: linear-gradient(135deg, #f0e6ff 0%, #7c3aed 50%, #0967e8 100%);
}

.card-thumb[data-category="branding"] .card-thumb-inner,
.featured-img[data-category="branding"],
.modal-hero-inner[data-category="branding"] {
  background: linear-gradient(135deg, #fef3e2 0%, #f59e0b 50%, #0967e8 100%);
}

.card-thumb[data-category="growth"] .card-thumb-inner,
.featured-img[data-category="growth"],
.modal-hero-inner[data-category="growth"] {
  background: linear-gradient(135deg, #e0fbe4 0%, #22c55e 50%, #0967e8 100%);
}

/* 10. Scroll animations */
.reveal-delay-1 { transition-delay: .1s; }
.reveal-delay-2 { transition-delay: .2s; }
.reveal-delay-3 { transition-delay: .3s; }
.reveal-delay-4 { transition-delay: .4s; }

/* 11. Active nav link */
.nav-links a.active {
  color: var(--blue);
}

/* 12. Smooth scrollbar for modal */
.modal-panel::-webkit-scrollbar {
  width: 6px;
}

.modal-panel::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

/* General rules */
.filter-btn:focus-visible,
.project-card:focus-visible,
.modal-close:focus-visible,
.modal-project-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.body-no-scroll {
  overflow: hidden;
}
