/**
 * Webbitech - Projects Page Styles
 * Modern, Creative Studio Aesthetic
 * Warm off-white graph-paper background, tactile studio elements, clean compact project cards
 */

:root {
  --project-ink: #10151d;
  --project-paper: #FAF9F6;
  --project-grid: rgba(94, 133, 243, 0.16);
  --project-muted: #64748b;
  --project-border: #e7e5df;
}

body.projects-page {
  background-color: var(--project-paper);
  background-image:
    linear-gradient(var(--project-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--project-grid) 1px, transparent 1px);
  background-size: 68px 68px;
  background-attachment: scroll;
  color: var(--project-ink);
  margin: 0;
  font-family: "DM Sans", sans-serif;
  overflow-x: hidden;
}

/* ==========================================================================
   TOPBAR & HEADER BRANDING
   ========================================================================== */
.projects-topbar {
  padding: 22px 0 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.projects-topbar small {
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--project-muted);
}

.projects-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.projects-hero-brand {
  text-align: center;
  margin-bottom: 28px;
}

.projects-hero-brand .brand {
  font-size: 28px;
  font-weight: 700;
  text-decoration: none;
  color: var(--project-ink);
  letter-spacing: -0.04em;
  display: inline-block;
  transition: transform 0.2s ease;
}

.projects-hero-brand .brand span {
  color: #0284c7;
}

.projects-hero-brand .brand:hover {
  transform: scale(1.03);
}

/* Studio Accents (Kept Near Edges) */
.project-spark {
  position: absolute;
  font-size: 30px;
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.spark-yellow { color: #facc15; }
.spark-blue { color: #38bdf8; }
.spark-pink { color: #f472b6; }

@keyframes floatAccent {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(6deg); }
}

.animate-float {
  animation: floatAccent 6s ease-in-out infinite;
}

/* ==========================================================================
   PROJECTS SECTION & HEADINGS
   ========================================================================== */
.projects-section {
  padding: 20px 0 120px;
  position: relative;
  overflow: hidden;
}

.projects-head {
  max-width: 840px;
  margin: 0 auto 52px;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* Centered Sticker with Attached SVG Paperclip */
.project-sticker-wrap {
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
}

.project-sticker {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 7px 18px 7px 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(16, 21, 29, 0.05);
  transform: rotate(-1.5deg);
  user-select: none;
}

.project-sticker .clip-pin {
  position: absolute;
  left: 8px;
  top: -12px;
  transform: rotate(-18deg);
  z-index: 2;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12));
}

.projects-heading {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 4.8vw, 3.8rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--project-ink);
  margin: 0 0 16px;
}

.projects-subtext {
  font-size: clamp(16px, 1.25vw, 18.5px);
  line-height: 1.65;
  color: var(--project-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* ==========================================================================
   DYNAMIC CATEGORY FILTER TABS
   ========================================================================== */
.projects-filter-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 42px;
  position: relative;
  z-index: 2;
  padding: 0 10px;
}

.projects-filter-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 8px;
  border-radius: 40px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 6px 20px rgba(16, 21, 29, 0.05);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.projects-filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  background: transparent;
  border: none;
  outline: none;
  padding: 9px 18px;
  border-radius: 30px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.filter-tab .tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #64748b;
  transition: all 0.25s ease;
}

.filter-tab:hover {
  color: var(--project-ink);
  background: rgba(0, 0, 0, 0.04);
}

.filter-tab.active {
  background: var(--project-ink);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 21, 29, 0.16);
}

.filter-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* Dynamic Filter Transition States */
.project-wrap {
  position: relative;
  height: 100%;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.project-wrap.is-filtered-out {
  opacity: 0 !important;
  transform: scale(0.9) translateY(16px) !important;
  pointer-events: none;
}

.project-card {
  background: #ffffff;
  border: 1px solid var(--project-border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(16, 21, 29, 0.04);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  text-decoration: none;
  color: var(--project-ink);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
  z-index: 1;
}

.project-card:hover {
  transform: translateY(-7px) !important;
  box-shadow: 0 20px 42px -8px rgba(16, 21, 29, 0.12);
  border-color: #cbd5e1;
  color: var(--project-ink);
}

/* Small Paperclip on Selected Cards (Attached to top edge without covering image or title) */
.project-card .card-paperclip {
  position: absolute;
  top: -14px;
  left: 28px;
  transform: rotate(12deg);
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.14));
  pointer-events: none;
}

.project-card.clip-right .card-paperclip {
  left: auto;
  right: 28px;
  transform: rotate(-14deg);
}

/* Large Preview Image Container with Consistent Aspect Ratio */
.project-media-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background: #e2e8f0;
}

.project-media-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Floating Category Pill Badge on Image */
.project-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(16, 21, 29, 0.1);
  z-index: 2;
  user-select: none;
}

.project-badge.badge-blue { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.project-badge.badge-green { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.project-badge.badge-pink { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }
.project-badge.badge-yellow { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }

/* Card Body Content */
.project-card-body {
  padding: 20px 8px 6px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-category-sub {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  display: block;
  margin-bottom: 6px;
}

.project-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(21px, 1.8vw, 25px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--project-ink);
  margin: 0 0 10px;
}

.project-summary {
  font-size: 14.5px;
  line-height: 1.6;
  color: #64748b;
  margin: 0 0 18px;
  flex-grow: 1;
}

/* Service Tags */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.p-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3.5px 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.project-card:hover .p-tag {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--project-ink);
}

/* Footer Link Action with Arrow Movement */
.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px dashed #e2e8f0;
  margin-top: auto;
}

.project-view-link {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--project-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.project-view-link i {
  font-size: 14px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .project-view-link {
  color: #0284c7;
}

.project-card:hover .project-view-link i {
  transform: translate(3px, -3px);
}

/* Bottom Explore Portfolio Button */
.project-explore-btn {
  color: var(--project-ink);
  background: transparent;
  border: 1px solid var(--project-ink);
  border-radius: 100px;
  padding: 13px 26px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: all 0.25s ease;
}

.project-explore-btn:hover {
  background: var(--project-ink);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(16, 21, 29, 0.12);
}

/* ==========================================================================
   SCROLL REVEAL STAGGER ANIMATIONS
   ========================================================================== */
.projects-page .reveal {
  opacity: 1; /* Fallback: content is visible by default */
  transform: none;
}

.js-motion .projects-page .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s ease var(--reveal-delay, 0ms),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1) var(--reveal-delay, 0ms);
}

.js-motion .projects-page .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   RESPONSIVE LAYOUTS & ACCESSIBILITY
   ========================================================================== */
@media (max-width: 991px) {
  .projects-section {
    padding: 15px 0 95px;
  }
}

@media (max-width: 767px) {
  .projects-topbar small {
    display: none;
  }

  .projects-section {
    padding: 10px 0 85px;
  }

  .projects-hero-brand {
    text-align: left;
    margin-bottom: 20px;
  }

  .projects-filter-wrap {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .projects-filter-bar {
    border-radius: 20px;
    padding: 5px;
    gap: 4px;
  }

  .filter-tab {
    padding: 7px 13px;
    font-size: 12.5px;
  }

  .project-card {
    padding: 13px;
  }

  .project-card-body {
    padding: 16px 4px 4px;
  }

  .project-media-wrap {
    aspect-ratio: 16 / 10.5;
  }

  .project-name {
    font-size: 20px;
  }

  .project-summary {
    font-size: 13.5px;
    margin-bottom: 14px;
  }

  .project-tags {
    margin-bottom: 16px;
  }
}

/* Project Quick-View Showcase Modal */
.project-modal-img-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--project-border);
  background: #f8fafc;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.project-modal-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.project-modal-title-text {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #64748b;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-media-wrap img,
  .project-view-link i,
  .animate-float,
  .js-motion .projects-page .reveal {
    transition: none !important;
    transform: none !important;
    animation: none !important;
    opacity: 1 !important;
  }
}
