/* ============================================
   APEX Motors — Premium Car Brand Website
   Enhanced with custom cursor, background hero,
   and advanced animations
   ============================================ */

/* ---------- CSS RESET ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---------- CUSTOM PROPERTIES ---------- */
:root {
  --color-bg: #f5f4f0;
  --color-bg-alt: #eae8e3;
  --color-white: #ffffff;
  --color-black: #111111;
  --color-dark: #1a1a1a;
  --color-text: #333333;
  --color-text-muted: #777777;
  --color-border: #d8d6d0;
  --color-accent: #111111;

  --font-heading: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;
  --space-3xl: 100px;
  --space-4xl: 140px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast: 0.2s ease;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  /* Hide default cursor globally */
  cursor: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  cursor: none;
}

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

a {
  text-decoration: none;
  color: inherit;
  cursor: none;
}

button {
  cursor: none;
}

ul {
  list-style: none;
}


/* ============================================
   CUSTOM CURSOR
   ============================================ */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--color-black);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, background 0.3s ease, opacity 0.3s ease;
  mix-blend-mode: difference;
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(17, 17, 17, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.35s ease, height 0.35s ease, border-color 0.35s ease, background 0.3s ease, opacity 0.3s ease;
}

/* Cursor grows on hovering interactive elements */
.cursor-dot.hovering {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.9);
  mix-blend-mode: difference;
}

.cursor-ring.hovering {
  width: 60px;
  height: 60px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.05);
}

/* Cursor pressed state */
.cursor-dot.clicking {
  width: 6px;
  height: 6px;
}

.cursor-ring.clicking {
  width: 30px;
  height: 30px;
}

/* Hide custom cursor on mobile */
@media (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
  html, body, a, button { cursor: auto; }
}


/* ============================================
   SCROLL PROGRESS BAR
   ============================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-black);
  z-index: 10001;
  transition: none;
}


/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  cursor: none;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-dark {
  background-color: var(--color-black);
  color: var(--color-white);
}

.btn-dark:hover {
  background-color: #333;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
}

.btn-dark:active {
  transform: translateY(0);
}

/* Button with arrow reveal */
.btn-magnetic {
  gap: 0;
  padding-right: 28px;
}

.btn-arrow {
  display: inline-flex;
  align-items: center;
  width: 0;
  overflow: hidden;
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), margin 0.4s ease;
  margin-left: 0;
}

.btn-magnetic:hover .btn-arrow {
  width: 26px;
  margin-left: 10px;
}

.btn-outline {
  background: transparent;
  color: var(--color-black);
  border: 2px solid var(--color-black);
}

.btn-outline:hover {
  background-color: var(--color-black);
  color: var(--color-white);
  transform: translateY(-1px);
}

.btn-large {
  padding: 18px 40px;
  font-size: 1rem;
}

/* ---------- SECTION HEADINGS ---------- */
.section-heading {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-heading-large {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.15;
  letter-spacing: -0.02em;
}


/* ============================================
   NAVIGATION
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  background: rgba(245, 244, 240, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.navbar.scrolled {
  padding: 14px 48px;
  border-bottom-color: var(--color-border);
  box-shadow: 0 1px 20px rgba(0,0,0,0.05);
}

/* Navbar hides the background when over hero */
.navbar.hero-mode {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nav-brand {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-black);
  transition: color var(--transition-fast);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-black);
  transition: width var(--transition);
}

.nav-link:hover {
  color: var(--color-black);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-phone {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.nav-phone:hover {
  color: var(--color-black);
}

.nav-phone span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mobile Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: none;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-black);
  transition: all var(--transition-fast);
}


/* ============================================
   HERO SECTION — Full Background Image
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Full-screen background image */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%;
  transform: scale(1.05);
  animation: heroZoom 15s ease-in-out infinite alternate;
}

@keyframes heroZoom {
  0% { transform: scale(1.05); }
  100% { transform: scale(1.12); }
}

/* Overlay gradient for text readability */
.hero-bg-overlay {
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(135deg, rgba(245, 244, 240, 0.85) 0%, rgba(245, 244, 240, 0.5) 35%, transparent 60%),
    linear-gradient(to right, rgba(245, 244, 240, 0.7) 0%, transparent 40%),
    linear-gradient(to left, rgba(245, 244, 240, 0.75) 0%, transparent 35%),
    linear-gradient(to top, rgba(245, 244, 240, 0.6) 0%, transparent 30%);
}

/* Particle canvas */
.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Hero content layout */
.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 120px 48px 80px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 60px;
}

/* Eyebrow text */
.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  opacity: 0;
  animation: fadeUp 0.8s 0.2s ease-out forwards;
}

/* Heading with per-word stagger animation */
.hero-heading {
  font-family: var(--font-heading);
  font-size: clamp(3.2rem, 6.5vw, 5.5rem);
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-line {
  display: block;
  overflow: hidden;
  padding-bottom: 4px;
}

.hero-word {
  display: inline-block;
  transform: translateY(110%);
  animation: wordReveal 1s ease-out forwards;
}

.hero-line:nth-child(1) .hero-word { animation-delay: 0.4s; }
.hero-line:nth-child(2) .hero-word { animation-delay: 0.55s; }
.hero-line:nth-child(3) .hero-word { animation-delay: 0.7s; }

@keyframes wordReveal {
  to {
    transform: translateY(0);
  }
}

/* Hero right text */
.hero-text-right {
  max-width: 340px;
  flex-shrink: 0;
  opacity: 0;
  animation: fadeUp 0.8s 0.9s ease-out forwards;
}

.hero-description {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
  }
}


/* Scroll indicator at bottom */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  opacity: 0;
  animation: fadeUp 0.8s 1.4s ease-out forwards;
}

.scroll-indicator span {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
}

.scroll-mouse {
  width: 24px;
  height: 38px;
  border: 2px solid var(--color-text-muted);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.scroll-wheel {
  width: 3px;
  height: 8px;
  background: var(--color-text-muted);
  border-radius: 2px;
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50% { opacity: 0.3; transform: translateY(6px); }
}


/* ============================================
   SERVICES SECTION
   ============================================ */
.services {
  padding: var(--space-4xl) 0;
  background-color: var(--color-white);
}

.services-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.services-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  align-items: center;
  gap: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}

.services-image-block {
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.services-img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.services-image-block:hover .services-img {
  transform: scale(1.05);
}

.services-row-2 {
  grid-template-columns: 0.5fr 0.6fr 1fr;
  align-items: start;
  gap: var(--space-xl);
}

.services-spacer {
  /* Empty spacer for layout alignment */
}

.services-image-small {
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.services-img-small {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.services-image-small:hover .services-img-small {
  transform: scale(1.05);
}

.services-description {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  max-width: 420px;
}


/* ============================================
   FEATURES SECTION
   ============================================ */
.features {
  padding: var(--space-4xl) 0;
  background-color: var(--color-bg);
}

.features-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.features-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.features-subtitle {
  margin-top: var(--space-md);
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.feature-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  padding: var(--space-xl) var(--space-lg);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-black);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
  border-color: transparent;
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--color-border);
  margin-bottom: var(--space-md);
  line-height: 1;
  transition: color var(--transition);
}

.feature-card:hover .feature-number {
  color: var(--color-black);
}

.feature-title {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-black);
  margin-bottom: var(--space-sm);
}

.feature-desc {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--color-text-muted);
}


/* ============================================
   GALLERY SECTION
   ============================================ */
.gallery {
  padding: var(--space-4xl) 0;
  background-color: var(--color-white);
}

.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-2xl);
  gap: var(--space-xl);
}

.gallery-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  max-width: 320px;
  text-align: right;
  line-height: 1.7;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-md);
}

.gallery-item {
  overflow: hidden;
  border-radius: var(--radius-sm);
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover::after {
  opacity: 1;
}

.gallery-item-large {
  grid-row: 1 / 3;
  min-height: 500px;
}

.gallery-item-tall {
  min-height: 240px;
}

.gallery-item-wide {
  min-height: 240px;
}


/* ============================================
   STATS SECTION
   ============================================ */
.stats {
  padding: var(--space-3xl) 0;
  background-color: var(--color-black);
  color: var(--color-white);
}

.stats-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 400;
  display: inline;
  line-height: 1;
}

.stat-suffix {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  display: inline;
}

.stat-label {
  display: block;
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 60px;
  background: rgba(255,255,255,0.15);
}


/* ============================================
   CONTACT SECTION
   ============================================ */
.contact {
  padding: var(--space-4xl) 0;
  background-color: var(--color-bg);
}

.contact-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.contact-content {
  text-align: center;
  max-width: 650px;
  margin: 0 auto;
}

.contact-description {
  margin-top: var(--space-lg);
  font-size: 1.05rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.contact-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}


/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: var(--space-2xl) 0 var(--space-lg);
  background-color: var(--color-black);
  color: rgba(255,255,255,0.5);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.footer-brand {
  margin-bottom: var(--space-xl);
}

.footer-logo {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-white);
}

.footer-tagline {
  margin-top: var(--space-sm);
  font-size: 0.9rem;
  font-family: var(--font-heading);
  font-style: italic;
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-links a {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-white);
}

.footer-bottom p {
  font-size: 0.8rem;
}


/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }


/* ============================================
   RESPONSIVE — TABLET
   ============================================ */
@media (max-width: 1024px) {
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
    padding: 140px 32px 100px;
  }

  .hero-text-right {
    max-width: 500px;
  }

  .hero-heading {
    font-size: clamp(2.8rem, 7vw, 4rem);
  }

  .services-row {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .services-row-2 {
    grid-template-columns: 1fr;
  }

  .services-spacer {
    display: none;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-subtitle {
    text-align: left;
  }

  .stats-container {
    flex-wrap: wrap;
    gap: var(--space-xl);
    justify-content: center;
  }

  .stat-divider {
    display: none;
  }
}


/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    padding: 16px 24px;
  }

  .navbar.scrolled {
    padding: 12px 24px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    border-top: 1px solid var(--color-border);
  }

  .nav-link {
    display: block;
    padding: 16px 24px;
    font-size: 1rem;
  }

  .nav-link::after {
    display: none;
  }

  .nav-phone {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-content,
  .services-container,
  .features-container,
  .gallery-container,
  .stats-container,
  .contact-container,
  .footer-container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .hero {
    min-height: auto;
    padding-top: 0;
    padding-bottom: 0;
  }

  .hero-content {
    padding: 120px 24px 100px;
  }

  .hero-bg-overlay {
    background: 
      linear-gradient(180deg, rgba(245, 244, 240, 0.9) 0%, rgba(245, 244, 240, 0.6) 40%, rgba(245, 244, 240, 0.4) 100%);
  }

  .scroll-indicator {
    display: none;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-item-large {
    grid-row: auto;
    min-height: 300px;
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-md);
  }

  .contact-actions {
    flex-direction: column;
    align-items: center;
  }
}
