/* ============================================================
   projects.css — Projects Landing Page
   Nexus Living Hub | Session 9
   ============================================================ */


/* ── 01. HERO — 50vh Dark Charcoal
   ============================================================ */
.projects-hero {
  min-height: 50vh;
  background: var(--color-charcoal);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Grain texture overlay */
.projects-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23grain)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Subtle vignette bottom */
.projects-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(to top, rgba(28, 28, 28, 0.4), transparent);
  pointer-events: none;
  z-index: 0;
}

/* Breadcrumb — top-left absolute */
.projects-hero__breadcrumb {
  position: absolute;
  top: 88px;
  left: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-accent);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: var(--tracking-cta);
  text-transform: uppercase;
  color: rgba(201, 169, 110, 0.55);
  z-index: 2;
}

.projects-hero__breadcrumb a {
  color: rgba(201, 169, 110, 0.55);
  text-decoration: none;
  transition: color 0.2s ease;
}

.projects-hero__breadcrumb a:hover {
  color: var(--color-gold);
}

.projects-hero__breadcrumb-sep {
  font-size: 0.5625rem;
  opacity: 0.5;
}

@media (min-width: 768px) {
  .projects-hero__breadcrumb {
    left: var(--space-lg);
  }
}

.projects-hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-3xl) var(--space-sm) var(--space-2xl);
  max-width: 720px;
  width: 100%;
}

/* Animated counter — dominant visual */
.projects-counter {
  font-family: var(--font-hero);
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 800;
  line-height: 1;
  color: var(--color-gold);
  margin-bottom: var(--space-sm);
  display: block;
  letter-spacing: -0.02em;
}

.projects-hero__subtitle {
  font-family: var(--font-heading);
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 500;
  color: var(--color-ivory);
  margin-bottom: var(--space-md);
}

.projects-hero__title {
  font-family: var(--font-hero);
  font-size: var(--size-h1);
  font-weight: 700;
  color: var(--color-ivory);
  line-height: var(--leading-heading);
  margin-bottom: var(--space-sm);
}

.projects-hero__sub {
  font-family: var(--font-body);
  font-size: 1rem;
  color: rgba(245, 240, 232, 0.68);
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto;
}


/* ── 02. FILTER BAR — Sticky pill buttons
   ============================================================ */
.filter-bar-wrap {
  position: sticky;
  top: 72px; /* nav height */
  z-index: var(--z-sticky, 200);
  background: var(--color-cream);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow 0.2s ease;
}

.filter-bar-wrap.is-stuck {
  box-shadow: var(--shadow-nav);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-sm);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: center;
}

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

.filter-btn {
  flex-shrink: 0;
  scroll-snap-align: start;
  font-family: var(--font-accent);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.05em; /* reduced from 0.08em — prevents "B" being clipped to look like "0" */
  text-transform: uppercase;
  padding: 8px 22px 8px 18px; /* extra right-padding compensates for letter-spacing on last char */
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  overflow: visible;
  min-width: max-content; /* ensure full text always fits without clipping */
}

.filter-btn:hover:not(.active) {
  background: var(--color-linen);
  border-color: var(--color-grey);
}

.filter-btn.active {
  background: var(--color-gold);
  color: var(--color-ivory);
  border-color: var(--color-gold);
}

@media (min-width: 768px) {
  .filter-bar {
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-sm);
  }
}


/* ── 03. PROJECT GRID
   ============================================================ */
.projects-section {
  padding: var(--section-pad-mobile);
  background: var(--color-cream);
}

@media (min-width: 768px) {
  .projects-section {
    padding: var(--section-pad-tablet);
  }
}

.projects-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.projects-section__count {
  font-family: var(--font-accent);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-grey);
  letter-spacing: 0.04em;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: stretch; /* equal-height rows */
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: stretch;
  }
}

@media (min-width: 1280px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch;
  }
}

/* ── PROJECT CARD ── */
.project-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.35s ease;
  /* Animation: initially invisible — JS adds .is-visible */
  opacity: 0;
  transform: translateY(20px);
  /* Equal-height layout */
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

/* Image area */
.project-card__image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-linen);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0; /* prevent image from shrinking in flex card */
}

/* Real img inside card */
.project-card__image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-card__image img {
  transform: scale(1.05);
}

/* Subtle hover overlay */
.project-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-charcoal);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover .project-card__image::after {
  opacity: 0.06;
}

/* Placeholder pattern */
.project-card__image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(74, 55, 40, 0.03) 0px,
    rgba(74, 55, 40, 0.03) 1px,
    transparent 1px,
    transparent 28px
  );
}

.project-card__icon {
  font-size: 2rem;
  color: var(--color-border);
  position: relative;
  z-index: 1;
}

/* Card with real photo */
.project-card__image--photo {
  background-size: cover;
  background-position: center;
}
.project-card__image--photo .project-card__icon {
  display: none;
}
.project-card__image--photo::before {
  background: none;
}

/* Badge — absolute top-left */
.project-card__badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 2;
  font-family: var(--font-accent);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: var(--tracking-cta);
  text-transform: uppercase;
  color: var(--color-ivory);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  line-height: 1.4;
}

/* Badge colours per type */
[data-type="2bhk"]      .project-card__badge { background: var(--color-terracotta); }
[data-type="3bhk"]      .project-card__badge { background: var(--color-gold); color: var(--color-charcoal); }
[data-type="4bhk"]      .project-card__badge { background: var(--color-green); }
[data-type="villa"]     .project-card__badge { background: var(--color-espresso); }
[data-type="penthouse"] .project-card__badge { background: var(--color-walnut); }

/* Card content */
.project-card__content {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex: 1; /* fill remaining card height */
}

.project-card__title {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 600;
  color: var(--color-charcoal);
  line-height: 1.3;
  margin-bottom: var(--space-xs);
}

.project-card__location {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--color-grey);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-card__location i {
  color: var(--color-gold);
  font-size: 0.75rem;
}

.project-card__link {
  font-family: var(--font-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold);
  text-decoration: none;
  transition: color 0.2s ease;
  margin-top: auto; /* push link to bottom of content area */
  display: inline-block;
  padding-top: var(--space-xs);
}

.project-card__link:hover {
  color: var(--color-espresso);
}

/* ── Load More Button ── */
.load-more-wrap {
  text-align: center;
  margin-top: var(--space-2xl);
}

.btn-load-more {
  font-family: var(--font-accent);
  font-size: var(--size-cta);
  font-weight: 600;
  letter-spacing: var(--tracking-cta);
  text-transform: uppercase;
  background: transparent;
  color: var(--color-gold);
  border: 2px solid var(--color-gold);
  border-radius: var(--radius-sm);
  padding: 14px 40px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.btn-load-more:hover {
  background: var(--color-gold);
  color: var(--color-ivory);
  transform: scale(1.02);
}

.btn-load-more.is-hidden {
  display: none;
}

/* Result count visible above grid */
.projects-result-msg {
  font-family: var(--font-accent);
  font-size: 0.8125rem;
  color: var(--color-grey);
  text-align: center;
  margin-top: var(--space-md);
  letter-spacing: 0.04em;
}

.projects-result-msg.is-hidden {
  display: none;
}


/* ── 04. CTA SECTION
   ============================================================ */
.projects-cta {
  padding: var(--section-pad-mobile);
  background: var(--color-charcoal);
  text-align: center;
}

@media (min-width: 768px) {
  .projects-cta {
    padding: var(--section-pad-tablet);
  }
}

.projects-cta .container {
  max-width: 600px;
}

.projects-cta__title {
  font-family: var(--font-heading);
  font-size: var(--size-h2);
  font-weight: 700;
  color: var(--color-ivory);
  margin-bottom: var(--space-sm);
}

.projects-cta__sub {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: rgba(245, 240, 232, 0.82);
  margin-bottom: var(--space-xl);
}

/* CTA button override — gold style on dark bg */
.projects-cta .btn-primary {
  background: var(--color-gold);
  color: var(--color-charcoal);
  border: 2px solid var(--color-gold);
  font-family: var(--font-accent);
  font-size: var(--size-cta);
  font-weight: 600;
  letter-spacing: var(--tracking-cta);
  text-transform: uppercase;
  padding: 14px 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.projects-cta .btn-primary:hover {
  background: transparent;
  color: var(--color-gold);
  transform: scale(1.02);
}


/* ── EMPTY STATE (when filter returns 0)
   ============================================================ */
.projects-empty {
  text-align: center;
  padding: var(--space-3xl) var(--space-sm);
  display: none;
}

.projects-empty.is-visible {
  display: block;
}

.projects-empty__icon {
  font-size: 2.5rem;
  color: var(--color-border);
  margin-bottom: var(--space-md);
}

.projects-empty__text {
  font-family: var(--font-heading);
  font-size: var(--size-h3);
  color: var(--color-grey);
}


/* ── REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .project-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .filter-btn,
  .btn-load-more {
    transition: none !important;
  }
}
