/* ===== BASE & RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  overflow-x: hidden;
}

::selection {
  background: #C4775B;
  color: white;
}

/* ===== NAV ===== */
#nav {
  background: transparent;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

#nav.scrolled {
  background: rgba(253, 248, 243, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.06);
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: #C4775B;
  transition: width 0.3s ease;
  border-radius: 1px;
}

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

/* ===== HERO ===== */
.hero-bg {
  will-change: transform;
}

.hero-overlay {
  background: linear-gradient(
    160deg,
    rgba(60, 30, 20, 0.72) 0%,
    rgba(80, 45, 30, 0.60) 40%,
    rgba(100, 55, 40, 0.52) 70%,
    rgba(140, 75, 55, 0.45) 100%
  );
}

.hero-title {
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.3);
}

.hero-content {
  padding-top: 80px;
}

.hero-badge {
  animation: fadeInDown 0.8s ease forwards;
}

.hero-title {
  animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-subtitle {
  animation: fadeInUp 0.8s ease 0.4s both;
}

.hero-buttons {
  animation: fadeInUp 0.8s ease 0.6s both;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ===== SERVICE CARDS ===== */
.service-card {
  will-change: transform, box-shadow;
}

/* ===== CTA SECTION ===== */
.cta-bg {
  will-change: transform;
}

.cta-overlay {
  background: linear-gradient(
    135deg,
    rgba(60, 30, 20, 0.78) 0%,
    rgba(90, 47, 36, 0.68) 50%,
    rgba(120, 65, 45, 0.60) 100%
  );
}

/* ===== REVEAL ANIMATIONS ===== */
/* Default: content is visible (progressive enhancement) */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* Only apply hidden state when JS is active and user prefers motion */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(30px);
  }
}

/* Stagger children */
.service-card:nth-child(1) { transition-delay: 0s; }
.service-card:nth-child(2) { transition-delay: 0.08s; }
.service-card:nth-child(3) { transition-delay: 0.16s; }
.service-card:nth-child(4) { transition-delay: 0.24s; }
.service-card:nth-child(5) { transition-delay: 0.32s; }
.service-card:nth-child(6) { transition-delay: 0.40s; }

/* ===== MOBILE MENU ===== */
#mobileMenu {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== BACK TO TOP ===== */
#backToTop {
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

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

#backToTop:not(.visible) {
  opacity: 0;
  transform: translateY(16px);
}

#backToTop:hover {
  background: #A85E44;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .hero-content {
    padding-top: 60px;
  }

  .hero-title {
    font-size: 2.75rem;
  }

  .hero-subtitle {
    font-size: 1.05rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hero-title {
    font-size: 4.5rem;
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 5.5rem;
  }
}

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

  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ===== FOCUS ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #C4775B;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #FDF8F3;
}

::-webkit-scrollbar-thumb {
  background: #D9BE88;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #C4775B;
}
