/*
Theme Name: CrunchYou
*/

:root {
  /* z-index layers */
  --z-header: 100;
  --z-hero-art: 1;
  --z-hero-content: 2;
}

/* ============================================
   TOUCH DEVICE OPTIMIZATION
   ============================================ */

/* Remove tap highlight while maintaining accessibility */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Ensure focus is visible for keyboard navigation only */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 3px solid rgba(254, 195, 64, 0.9);
  outline-offset: 2px;
  border-radius: 4px;
}

header {
  position: absolute;
  z-index: 100;
  padding: 20px 0 !important;
  width: 100%;
  max-width: 2000px;
}

header > .wp-block-group {
  max-width: 1440px;
  margin: 0 auto;
}

/* Remove the default top gap before the first block */
:where(.wp-site-blocks) > * {
  margin-block-start: 0 !important;
}

/* Transparent, over-hero header */
.cr-header.is-absolute {
  position: absolute;
  inset: 0 0 auto 0; /* top:0; left:0; right:0 */
  background: transparent !important;
  z-index: var(--z-header);
  pointer-events: none; /* lets hero be "on top" visually */
}

.cr-header__inner {
  pointer-events: auto; /* but keep nav clickable */
  padding: 16px clamp(16px, 4vw, 40px);
  position: relative;
}

.cr-header__nav {
  width: 100%;
}

.cr-brand a {
  text-decoration: none;
}

/* Navigation Styling - Based on Figma Design */
.cr-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
}

.cr-header__inner {
  pointer-events: auto;
  padding: 1rem 2rem;
}

.cr-header__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6rem;
}

/* Ensure WordPress navigation block is visible */
.cr-header .wp-block-navigation {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.cr-header .wp-block-navigation__container {
  display: flex !important;
  gap: 0 !important;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cr-header .wp-block-navigation-item {
  display: block !important;
}

/* Target all possible navigation link variations */
.cr-header a,
.cr-header .wp-block-navigation-item a,
.cr-header .wp-block-navigation-link a,
.cr-header .wp-block-navigation-item__content,
.cr-header .wp-block-navigation-link__content,
.cr-header__nav a,
.cr-header__nav .wp-block-navigation-item a,
.cr-header__nav .wp-block-navigation-link a {
  font-family: "Roboto", sans-serif !important;
  color: white !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  font-size: 16px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 0.4rem 1.2rem !important;
  position: relative !important;
  display: inline-block !important;
  border-radius: 12px !important;
  transition: text-decoration 0.2s ease !important;
  /* Improve contrast with subtle text shadow */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Remove focus outline for mouse/touch, keep for keyboard */
.cr-header a:focus:not(:focus-visible),
.cr-header .wp-block-navigation-item a:focus:not(:focus-visible),
.cr-header .wp-block-navigation-link a:focus:not(:focus-visible),
.cr-header .wp-block-navigation-item__content:focus:not(:focus-visible),
.cr-header .wp-block-navigation-link__content:focus:not(:focus-visible),
.cr-header__nav a:focus:not(:focus-visible),
.cr-header__nav .wp-block-navigation-item a:focus:not(:focus-visible),
.cr-header__nav .wp-block-navigation-link a:focus:not(:focus-visible) {
  outline: none !important;
}

/* Hover: Only apply on devices that support hover */
@media (hover: hover) and (pointer: fine) {
  .cr-header a:hover,
  .cr-header .wp-block-navigation-item a:hover,
  .cr-header .wp-block-navigation-link a:hover,
  .cr-header .wp-block-navigation-item__content:hover,
  .cr-header .wp-block-navigation-link__content:hover,
  .cr-header__nav a:hover,
  .cr-header__nav .wp-block-navigation-item a:hover,
  .cr-header__nav .wp-block-navigation-link a:hover {
    background: none !important;
    text-decoration: underline !important;
    text-decoration-color: currentColor !important;
    text-underline-offset: 6px !important;
    text-decoration-thickness: 2px !important;
  }
}

/* Keyboard focus only - high visibility for accessibility */
.cr-header a:focus-visible,
.cr-header .wp-block-navigation-item a:focus-visible,
.cr-header .wp-block-navigation-link a:focus-visible,
.cr-header .wp-block-navigation-item__content:focus-visible,
.cr-header .wp-block-navigation-link__content:focus-visible,
.cr-header__nav a:focus-visible,
.cr-header__nav .wp-block-navigation-item a:focus-visible,
.cr-header__nav .wp-block-navigation-link a:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8) !important;
  outline-offset: 2px !important;
  border-radius: 12px !important;
}

/* Active state */
.cr-header .wp-block-navigation-item.current-menu-item a,
.cr-header .wp-block-navigation-link.current-menu-item a {
  background: none !important;
  font-weight: 600 !important;
  border-color: transparent !important;
  box-shadow: none !important;
  text-decoration: underline !important;
  text-decoration-color: currentColor !important;
  text-underline-offset: 6px !important;
  text-decoration-thickness: 2px !important;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* GSAP ScrollSmoother wrapper styles */
#smooth-wrapper {
  overflow: hidden;
  height: 100vh;
  position: relative;
}

#smooth-content {
  will-change: transform;
}

/* Only apply ScrollSmoother styles on desktop */
@media (max-width: 1024px) {
  #smooth-wrapper {
    height: auto;
    overflow: visible;
  }
}

/* Ensure scrollbar remains visible when Lenis is active */
/* Override Lenis default behavior that might hide scrollbars */
html.lenis,
html.lenis-smooth {
  scrollbar-width: thin !important; /* Firefox - keep scrollbar visible */
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent !important; /* Firefox scrollbar color */
  overflow-y: auto !important; /* Force scrollbar visibility */
}

html.lenis::-webkit-scrollbar,
html.lenis-smooth::-webkit-scrollbar {
  width: 8px !important; /* Keep scrollbar visible on WebKit browsers */
  display: block !important; /* Force display */
}

html.lenis::-webkit-scrollbar-track,
html.lenis-smooth::-webkit-scrollbar-track {
  background: transparent;
}

html.lenis::-webkit-scrollbar-thumb,
html.lenis-smooth::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3) !important;
  border-radius: 4px;
  display: block !important;
}

html.lenis::-webkit-scrollbar-thumb:hover,
html.lenis-smooth::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure body maintains scrollbar - override any Lenis styles */
body {
  overflow-y: auto !important; /* Always show vertical scrollbar */
  overflow-x: hidden !important;
}

/* Force scrollbar visibility during Swiper interactions */
body.swiper-active,
html.swiper-active {
  overflow-y: auto !important;
}

/* Override any Lenis styles that might hide scrollbar */
.lenis.lenis-smooth,
.lenis.lenis-scrolling {
  overflow-y: auto !important;
}

/* Mobile Responsive Styles */
@media (max-width: 780px) {
  .cr-header__inner {
    padding: 0.75rem 1rem;
  }

  .cr-header__nav {
    gap: 1.5rem;
    justify-content: space-around;
    flex-wrap: wrap;
  }

  .cr-header__nav .wp-block-navigation__container {
    gap: 1.5rem !important;
    flex-wrap: wrap;
  }

  .cr-header a,
  .cr-header .wp-block-navigation-item a,
  .cr-header .wp-block-navigation-link a,
  .cr-header .wp-block-navigation-item__content,
  .cr-header .wp-block-navigation-link__content,
  .cr-header__nav a,
  .cr-header__nav .wp-block-navigation-item a,
  .cr-header__nav .wp-block-navigation-link a {
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.08em !important;
    padding: 0.3rem 0.6rem !important;
  }

  /* Ensure proper spacing on mobile */
  .wp-block-group {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }
}

@media (max-width: 480px) {
  /* Adjust group padding for very small screens */
  .wp-block-group {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Hide copyright text */
footer p {
  display: none !important;
}

/* Hide copyright text */
footer p {
  display: none !important;
}

/* ============================================
   PAGE TITLE SPACING FIX
   ============================================ */

/* Add top padding to main content area for pages */
main.wp-block-group {
  padding-top: 6rem; /* Adjust this value as needed */
  padding-left: 2rem;
  padding-right: 2rem;
}

/* Style the post-title block */
.wp-block-post-title {
  margin-top: 2rem !important; /* Additional spacing from header */
  margin-bottom: 2.5rem;
  font-size: 2.5rem;
}

/* Make page title h1 instead of h2 */
.wp-block-post-title h1,
.wp-block-post-title h2 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

/* Mobile responsive spacing */
@media (max-width: 780px) {
  main.wp-block-group {
    padding-top: 4rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .wp-block-post-title h1,
  .wp-block-post-title h2 {
    font-size: 2rem;
  }
}
