/* ═══════════════════════════════════════════════════════
  SMART GARDENS - Custom Styles
   Beyond Tailwind: masonry, animations, Swiper overrides,
   scrollbar, and WP-portable CSS custom properties.
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties (WP-Portable) ─── */
:root {
  --sg-dark:   #2D3A2E;
  --sg-olive:  #4A5D3A;
  --sg-sage:   #6B7F5E;
  --sg-cream:  #F5F0E8;
  --sg-beige:  #E8E0D4;
  --sg-gold:   #C4A35A;
  --sg-text:   #333333;
  --sg-muted:  #7A7A7A;

  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --max-width:  1440px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}


/* ─── Base / Reset Additions ─── */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* offset for sticky nav */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--sg-cream);
}
::-webkit-scrollbar-thumb {
  background: var(--sg-olive);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--sg-dark);
}


/* ─── Header / Nav ─── */
#site-header {
  backdrop-filter: blur(0px);
  transition: background-color 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

#site-header.scrolled {
  background-color: var(--sg-dark);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
}

#site-header.scrolled .nav-link {
  color: rgba(255, 255, 255, 0.85);
}

/* Hamburger animation */
#menu-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}
#menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
#menu-toggle.active .hamburger-line:nth-child(3) {
  width: 1.5rem;
  transform: translateY(-4px) rotate(-45deg);
}

/* Mobile menu open state */
#mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}


/* ─── Hero ─── */
.hero-bg img {
  will-change: transform;
}

.hero-bg-swiper,
.hero-bg-swiper .swiper-wrapper,
.hero-bg-swiper .swiper-slide {
  height: 100%;
}

/* Line clamp fallback */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ─── Feature Cards ─── */
.feature-card {
  transition: transform 0.3s var(--ease-out-quart);
}
.feature-card:hover {
  transform: translateY(-4px);
}


/* ─── Process Steps ─── */
.process-step {
  transition: transform 0.3s var(--ease-out-quart);
}
.process-step:hover {
  transform: translateY(-2px);
}


/* ─── Portfolio Masonry ─── */
.masonry-grid {
  column-gap: 1.5rem;
}

/* Portfolio reveal - CSS initial state for GSAP .to() pattern */
.portfolio-item {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s var(--ease-out-expo);
}

.portfolio-item.hidden-filter {
  opacity: 0;
  transform: scale(0.8);
  position: absolute;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}


/* ─── Gallery Lightbox ─── */
.sg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(45, 58, 46, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sg-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sg-lightbox__image {
  max-width: min(1100px, 100%);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 0.5rem;
  background: var(--sg-dark);
}

.sg-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9999px;
  color: white;
  font-size: 2rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
}

.sg-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.16);
}


/* ─── Page Prose ─── */
.sg-prose {
  max-width: 46rem;
  font-size: 1.05rem;
  line-height: 1.82;
  color: var(--sg-text);
}

.sg-prose > * + * {
  margin-top: 1.15rem;
}

.sg-prose h2,
.sg-prose h3,
.sg-prose h4 {
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
  color: var(--sg-dark);
  font-family: var(--font-serif);
  line-height: 1.16;
}

.sg-prose h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.sg-prose h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.sg-prose ul,
.sg-prose ol {
  padding-left: 1.35rem;
}

.sg-prose ul {
  list-style: disc;
}

.sg-prose ol {
  list-style: decimal;
}

.sg-prose li + li {
  margin-top: 0.45rem;
}

.sg-prose a {
  color: var(--sg-olive);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.sg-prose strong {
  color: var(--sg-dark);
}


/* ─── Contact Form 7 ─── */
.wpcf7-submit {
  width: 100%;
  padding: 1rem 2.5rem;
  background: var(--sg-dark);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background-color 0.3s ease;
}

.wpcf7-submit:hover {
  background: var(--sg-olive);
}

@media (min-width: 640px) {
  .wpcf7-submit {
    width: auto;
  }
}


/* ─── Swiper Overrides ─── */

/* Hero Swiper */
.hero-swiper .swiper-slide {
  opacity: 0.4;
  transition: opacity 0.3s ease;
}
.hero-swiper .swiper-slide-active {
  opacity: 1;
}

/* Testimonial Swiper */
.testimonial-swiper {
  overflow: hidden;
}
.testimonial-swiper .swiper-slide {
  height: auto;
}

.testimonial-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: var(--sg-olive);
  opacity: 0.3;
  border-radius: 50%;
  transition: all 0.3s ease;
  cursor: pointer;
}
.testimonial-pagination .swiper-pagination-bullet-active {
  opacity: 1;
  width: 24px;
  border-radius: 4px;
}


/* ─── CTA Section ─── */
.cta-card {
  transition: transform 0.3s var(--ease-out-quart), background-color 0.3s ease;
}
.cta-card:hover {
  transform: translateY(-4px);
}


/* ─── GSAP Animation States ─── */
/* Elements start invisible and are revealed by GSAP.
   This prevents FOUC before JS loads. */
.gsap-reveal {
  opacity: 0;
  transform: translateY(30px);
}

.gsap-reveal-left {
  opacity: 0;
  transform: translateX(-40px);
}

.gsap-reveal-right {
  opacity: 0;
  transform: translateX(40px);
}

.gsap-reveal-scale {
  opacity: 0;
  transform: scale(0.9);
}


/* ─── Focus States (Accessibility) ─── */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--sg-olive);
  outline-offset: 2px;
}


/* ─── Responsive Tweaks ─── */
@media (max-width: 768px) {
  .masonry-grid {
    columns: 1 !important;
  }

  .values-item {
    gap: 2rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .masonry-grid {
    columns: 2;
  }
}
