/* ====================================
   TRELLIS GO - Custom Styles
   Pastoral yet Powerful
   ==================================== */

/* ---------- Base Overrides ---------- */
html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ---------- Navbar Shadow on Scroll ---------- */
#navbar.scrolled {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- Nav Link Underline Hover ---------- */
.nav-link {
  position: relative;
}

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

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

/* ---------- Desktop Dropdown Menus ---------- */
.nav-dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer;
  padding: 0.5rem 0.25rem;
}

.dropdown-toggle .chevron-down {
  transition: transform 0.2s ease;
}

.nav-dropdown:hover .dropdown-menu {
  display: block;
}

.nav-dropdown:hover .dropdown-toggle .chevron-down {
  transform: rotate(180deg);
}

.dropdown-menu {
  z-index: 100;
  min-width: 200px;
}

.dropdown-item {
  display: block;
  font-size: 0.9375rem;
}

.dropdown-item:hover {
  color: #4a7c59;
}

/* ---------- Mobile Dropdown Accordions ---------- */
.mobile-dropdown-toggle {
  cursor: pointer;
  padding-left: 0.5rem;
}

.mobile-dropdown-menu {
  margin-left: 0.5rem;
}

.mobile-dropdown-menu a {
  font-size: 0.9375rem;
}

.mobile-dropdown-toggle .chevron-down {
  transition: transform 0.2s ease;
}

.mobile-dropdown.open .mobile-dropdown-toggle .chevron-down {
  transform: rotate(180deg);
}

/* ---------- Mobile Nav Link ---------- */
.mobile-nav-link {
  position: relative;
  padding-left: 16px;
}

.mobile-nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f5f0e8;
  transition: background 0.3s ease;
}

.mobile-nav-link:hover::before {
  background: #4a7c59;
}

/* ---------- Primary Button ---------- */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

/* ---------- Card Elevated (Subtle lift) ---------- */
.card-elevated {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card-elevated:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(30, 58, 95, 0.08), 0 8px 16px rgba(30, 58, 95, 0.04);
}

/* ---------- Scroll Animation ---------- */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for grid items */
.scroll-animate:nth-child(1) { transition-delay: 0.1s; }
.scroll-animate:nth-child(2) { transition-delay: 0.2s; }
.scroll-animate:nth-child(3) { transition-delay: 0.3s; }

/* ---------- Hero Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in {
  animation: fadeIn 0.8s ease forwards;
}

.animate-slide-up {
  animation: slideUp 0.8s ease forwards;
  animation-delay: 0.2s;
  opacity: 0;
}

.animate-slide-up-delay {
  animation: slideUp 0.8s ease forwards;
  animation-delay: 0.4s;
  opacity: 0;
}

.animate-slide-up-delay-2 {
  animation: slideUp 0.8s ease forwards;
  animation-delay: 0.6s;
  opacity: 0;
}

/* ---------- Comparison Table Row ---------- */
.grid-cols-3 > * {
  padding: 0;
}

/* ---------- Smooth Scroll Offset for Fixed Nav ---------- */
section[id] {
  scroll-margin-top: 80px;
}

@media (max-width: 767px) {
  section[id] {
    scroll-margin-top: 60px;
  }
}

/* ---------- Chart Pulse Animation ---------- */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ---------- Selection Color ---------- */
::selection {
  background: #4a7c59;
  color: #ffffff;
}

/* ---------- Focus Styles ---------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #4a7c59;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Print Styles ---------- */
@media print {
  #navbar,
  .animate-bounce {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}

/* ---------- Decorative Grid Pattern ---------- */
.trellis-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ========================================
   MOBILE RESPONSIVE ENHANCEMENTS
   ======================================== */

/* ---------- Mobile menu button - hidden on desktop, shown on mobile ---------- */
@media (min-width: 768px) {
  #mobile-menu-btn {
    display: none !important;
  }
}

@media (max-width: 767px) {
  #mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }
}

/* ---------- Extra Small (320px - 575px) ---------- */
@media (max-width: 575px) {
  /* Hero section */
  .hero-section {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  /* Reduce blur accent sizes on mobile */
  .absolute.top-20.left-10.w-72,
  .absolute.bottom-20.right-10.w-96 {
    width: 180px !important;
    height: 180px !important;
  }

  .absolute.top-1\/2.left-1\/2.-translate-x-1\/2.-translate-y-1\/2.w-\[600px\] {
    width: 300px !important;
    height: 300px !important;
  }

  /* Pathway section adjustments */
  .pathway-step-card {
    padding: 1rem !important;
  }

  .pathway-step-card .bg-\[0\%_0\%\],
  .pathway-step-card .bg-\[50\%_0\%\],
  .pathway-step-card .bg-\[100\%_0\%\],
  .pathway-step-card .bg-\[0\%_100\%\],
  .pathway-step-card .bg-\[50\%_100\%\],
  .pathway-step-card .bg-\[100\%_100\%\] {
    height: auto !important;
    aspect-ratio: 16 / 9;
  }

  /* Comparison table mobile stacking */
  .comparison-cell {
    padding: 1rem !important;
  }

  /* Chart section compact */
  .chart-compact {
    padding: 1rem !important;
  }

  .chart-compact .space-y-2 > * + * {
    margin-top: 0.5rem !important;
  }

  /* Dismissal stat boxes */
  .stat-box {
    padding: 0.75rem !important;
  }

  .stat-box .font-serif {
    font-size: 1.5rem !important;
  }

  /* Training interface scaling */
  .training-mockup {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Event mockup card */
  .event-mockup {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* ---------- Small (576px - 767px) ---------- */
@media (min-width: 576px) and (max-width: 767px) {
  .absolute.top-20.left-10.w-72 {
    width: 200px !important;
    height: 200px !important;
  }

  .absolute.bottom-20.right-10.w-96 {
    width: 240px !important;
    height: 240px !important;
  }
}

/* ---------- Medium / Tablet (768px - 1023px) ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Pillar cards tighter spacing */
  .pillar-card {
    padding: 1.5rem !important;
  }

  .pillar-card .h-48 {
    height: 10rem !important;
  }

  /* Pathway grid adjustments for tablet */
  .pathway-pair {
    margin-bottom: 1.5rem;
  }

  /* Comparison table padding */
  .comparison-cell {
    padding: 1.25rem !important;
  }
}

/* ---------- Small desktop (1024px+) ---------- */
@media (min-width: 1024px) {
  .pathway-pair-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Mobile-specific utility overrides ---------- */
@media (max-width: 767px) {
  /* Reduce all section padding on mobile */
  .section-mobile-padding {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  /* Compact chart on mobile */
  .chart-compact-mobile {
    padding: 0.75rem !important;
  }

  /* Touch-friendly minimum tap targets */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }

  /* Prevent overflow on small screens */
  .overflow-safe {
    max-width: calc(100vw - 2rem);
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- Large mobile (portrait phones) ---------- */
@media (min-width: 480px) and (max-width: 767px) {
  .mobile-medium-text {
    font-size: 1rem !important;
  }
}
