/* 
 * Journey Office Builders - Design System & Global Styles
 */

:root {
  /* Color Palette - Clean Corporate */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  
  --surface-glass: rgba(255, 255, 255, 0.85);
  --border: rgba(0, 0, 0, 0.08);
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --accent: #910000;
  --accent-hover: #750000;
  
  /* Typography */
  --font-heading: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 5rem;
  
  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.section {
  padding: var(--spacing-3xl) 0;
}

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  font-family: var(--font-heading);
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--text-primary);
  background-color: var(--bg-secondary);
}

/* Glassmorphism */
.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

/* Service Cards (Home Page & Overview) */
.service-card {
  background: #eceef1;
  border: 1px solid #d5d9df;
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.08);
  border-color: #c5cbd3;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  transition: all var(--transition-normal);
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid transparent;
}

.header.scrolled {
  padding: var(--spacing-sm) 0;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
}

.nav-links a {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 1.2rem;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  padding: 12px; /* Increase tap target size */
  margin: -12px; /* Offset padding so visual alignment doesn't break */
  color: var(--text-primary);
  cursor: pointer;
  z-index: 100;
}

.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-overlay .nav-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xl);
}

.mobile-nav-overlay .nav-links a {
  font-size: 1.5rem;
  font-family: var(--font-heading);
}

@media (max-width: 768px) {
  .header-container > .nav-links {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
    order: 3;
  }
  .nav-cta {
    order: 2;
    margin-left: auto;
    margin-right: var(--spacing-sm);
  }
  .nav-cta .btn {
    padding: 8px 24px;
    font-size: 0.9rem;
    white-space: nowrap;
  }
  .header-container > .nav-links.active {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
  }
  
  /* Tap Targets */
  .footer-links a, .nav-links a {
    padding: 12px 0 !important;
    display: inline-block;
  }
  
  a[href^="tel:"], a[href^="mailto:"] {
    padding: 8px 0;
    display: inline-block;
  }
  
  /* Filter buttons tap targets */
  .filter-btn {
    padding: 12px 20px !important;
    margin-bottom: 8px;
  }

  
  /* Typography Scaling */
  h1 { font-size: 2.2rem !important; }
  h2 { font-size: 1.8rem !important; }
  h3 { font-size: 1.3rem !important; }
  
  /* Spacing Adjustments */
  .section { padding: var(--spacing-xl) 0 !important; }
  .footer { padding: var(--spacing-xl) 0 var(--spacing-lg) !important; }
  
  /* Split Slider */
  .split-slider { height: 250px !important; }
  
  /* Project Grid Layout fixes if any */
  .projects-grid, .services-grid {
    gap: var(--spacing-md) !important;
  }
}

/* Scroll Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Interactive Background Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Footer */
.footer {
  background-color: #111111;
  color: #f3f4f6;
  border-top: 1px solid #222222;
  padding: var(--spacing-3xl) 0 var(--spacing-lg);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: var(--spacing-2xl);
  margin-bottom: var(--spacing-2xl);
}

.footer-col h4 {
  margin-bottom: var(--spacing-md);
  font-size: 1.1rem;
  color: #ffffff;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--spacing-sm);
}

.footer-links a {
  color: #9ca3af;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  text-align: center;
  padding-top: var(--spacing-lg);
  border-top: 1px solid #333333;
  color: #9ca3af;
  font-size: 0.9rem;
}

/* Split Slider */
.split-slider {
  position: relative;
  width: 100%;
  height: 350px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.split-slider img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.split-slider-before {
  z-index: 1;
}
.split-slider-after {
  z-index: 2;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}
.split-slider-range {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
}
.split-slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background-color: var(--bg-primary);
  z-index: 3;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.split-slider-handle-btn {
  width: 40px;
  height: 40px;
  background-color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: var(--shadow-md);
}
.split-label {
  position: absolute;
  top: var(--spacing-md);
  padding: 4px 12px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 3;
  pointer-events: none;
}
.split-label-after {
  left: var(--spacing-md);
}
.split-label-before {
  right: var(--spacing-md);
}

/* Hero Carousel Styles */
.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1200ms ease-in-out;
    z-index: 0;
}
.slide.active {
    opacity: 1;
    z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
    .slide {
        transition: none;
    }
}
.slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(1.08) contrast(1.03);
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}
.carousel-btn:hover, .carousel-btn:focus-visible {
    background: rgba(0, 0, 0, 0.7);
}
.carousel-btn.prev {
    left: var(--spacing-xl);
}
.carousel-btn.next {
    right: var(--spacing-xl);
}
@media (max-width: 768px) {
    .carousel-btn {
        display: none;
    }
}
.carousel-dots {
    position: absolute;
    bottom: var(--spacing-xl);
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 12px;
}
.carousel-dot {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.45);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s;
}
.carousel-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}
.carousel-dot.active {
    background-color: #ffffff;
}
.carousel-dot:hover, .carousel-dot:focus-visible {
    background-color: rgba(255, 255, 255, 0.8);
}

/* Nav link base styling for pills */
.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    transition: all 0.2s ease;
}
.nav-links a.active {
    background: rgba(145, 0, 0, 0.08);
}

/* Home Page specific nav styling over dark carousel */
.hero-nav:not(.scrolled) .nav-links a {
    color: #ffffff;
}
.hero-nav:not(.scrolled) .nav-links a.active {
    background: rgba(255, 255, 255, 0.85);
    color: var(--accent);
}
.hero-nav:not(.scrolled) .mobile-menu-btn {
    color: #ffffff;
}

@media (max-width: 768px) {
  .header-container > .nav-links.active {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
  }
  
  /* Tap Targets */
  .footer-links a, .nav-links a {
    padding: 12px 0 !important;
    display: inline-block;
  }
  
  a[href^="tel:"], a[href^="mailto:"] {
    padding: 12px 0 !important;
    display: inline-block;
  }
  
  /* Filter buttons tap targets */
  .filter-btn {
    padding: 12px 20px !important;
    margin-bottom: 8px;
  }
}

/* Contact Page Grid */
.contact-grid { grid-template-columns: 1fr; }
.form-row { grid-template-columns: 1fr; }
@media (min-width: 768px) {
    .contact-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr 1fr; }
}


/* Mobile Base Optimizations */
@media (max-width: 768px) {
  html { font-size: 15px; }
  h1 { font-size: 2.2rem !important; }
  h2 { font-size: 1.8rem !important; }
  
  .section { 
    padding-top: var(--spacing-2xl); 
    padding-bottom: var(--spacing-2xl) !important; 
  }
  
  .hero-content {
    padding-top: 100px !important;
  }
  
  .phase-card, .project-card, .service-card, .glass { 
    padding: var(--spacing-lg) !important; 
  }
  
  .phase-content-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
  }
  
  .about-grid, .contact-grid {
    gap: var(--spacing-xl) !important;
  }
  
  .split-slider {
    height: 250px !important; /* Smaller images on mobile for before/after */
  }
}

@media (max-width: 768px) {
  section[style*="padding-top: 150px"] {
    padding-top: 150px !important;
  }
  .header.scrolled {
    background: rgba(255, 255, 255, 0.98) !important;
  }
}

@media (max-width: 768px) {
  .header-container > .nav-links.active {
    align-items: flex-start !important; /* Prevent the a tags from stretching full width */
    gap: 4px; /* Add slight gap between links */
  }
  .nav-links a {
    padding: 12px 24px !important; /* Restore horizontal padding so the pill wraps the text */
    width: fit-content !important;
  }
}

@media (max-width: 768px) {
  /* Fix white-on-white text in mobile menu on homepage */
  .header-container > .nav-links.active a {
    color: var(--text-primary) !important;
  }
  .header-container > .nav-links.active a.active {
    color: var(--accent) !important;
    background: rgba(145, 0, 0, 0.08) !important;
  }
}

/* Tablet nav: use hamburger menu between 700px and 1024px so the full nav doesn't cram */
@media (min-width: 700px) and (max-width: 1024px) {
  .header-container > .nav-links { display: none; }
  .mobile-menu-btn { display: block; order: 3; }
  .nav-cta { order: 2; margin-left: auto; margin-right: var(--spacing-sm); }
  .nav-cta .btn { white-space: nowrap; }
  .header-container > .nav-links.active {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
  }
  .nav-links a { padding: 12px 24px !important; width: fit-content !important; }
  .header-container > .nav-links.active a { color: var(--text-primary) !important; }
  .header-container > .nav-links.active a.active {
    color: var(--accent) !important;
    background: rgba(145, 0, 0, 0.08) !important;
  }
  .header.scrolled { background: rgba(255, 255, 255, 0.98) !important; }
}
