/* ============================================
   Roots Coffee Co. — Custom Styles
   ============================================ */

/* --- Base & Typography --- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

::selection {
  background: #E07A5F;
  color: #fff;
}

/* --- Navigation --- */
.nav-link {
  position: relative;
}

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

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

/* Header scroll state */
header.scrolled {
  background: rgba(253, 246, 240, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(44, 44, 44, 0.08);
}

header.scrolled .nav-link {
  color: #2C2C2C;
}

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

#mobile-menu.open .mobile-nav-link {
  animation: mobileLinkIn 0.3s ease forwards;
  opacity: 1;
}

#mobile-menu.open .mobile-nav-link:nth-child(1) { animation-delay: 0.05s; }
#mobile-menu.open .mobile-nav-link:nth-child(2) { animation-delay: 0.1s; }
#mobile-menu.open .mobile-nav-link:nth-child(3) { animation-delay: 0.15s; }
#mobile-menu.open .mobile-nav-link:nth-child(4) { animation-delay: 0.2s; }

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

/* Hamburger animation */
#menu-toggle.active .menu-line:nth-child(1) {
  transform: rotate(45deg) translate(3px, 3px);
}

#menu-toggle.active .menu-line:nth-child(2) {
  opacity: 0;
}

#menu-toggle.active .menu-line:nth-child(3) {
  width: 1.25rem;
  transform: rotate(-45deg) translate(3px, -3px);
}

/* --- Hero Animations --- */
.hero-eyebrow {
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.hero-word {
  animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-word:nth-child(1) { animation-delay: 0.3s; }
.hero-word:nth-child(2) { animation-delay: 0.4s; }
.hero-word:nth-child(3) { animation-delay: 0.5s; }
.hero-word:nth-child(4) { animation-delay: 0.6s; }
.hero-word:nth-child(5) { animation-delay: 0.7s; }
.hero-word:nth-child(6) { animation-delay: 0.8s; }

.hero-sub {
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.95s forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-image-wrap {
  animation: heroImageIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
  opacity: 0;
  transform: translateY(24px);
}

@keyframes heroImageIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-badge {
  animation: heroBadgeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1.2s forwards;
  opacity: 0;
}

@keyframes heroBadgeIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Float animation for badge */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* --- Marquee --- */
.marquee-track {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-content {
  display: flex;
  animation: marquee 25s linear infinite;
  width: max-content;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- Scroll Reveal (below-the-fold only) --- */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Start hidden only for elements that will be revealed via JS */
.reveal[data-reveal] {
  opacity: 0;
  transform: translateY(32px);
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-eyebrow,
  .hero-word,
  .hero-sub,
  .hero-image-wrap,
  .hero-badge {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .reveal[data-reveal] {
    opacity: 1;
    transform: none;
  }

  .marquee-content {
    animation: none;
  }

  .animate-float {
    animation: none;
  }
}

/* --- Card hover effects --- */
.card-group {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-group:hover {
  transform: translateY(-4px);
}

/* --- Button hover glow --- */
button:hover,
a:hover {
  cursor: pointer;
}

/* --- Form select arrow --- */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

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

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

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

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