/**
 * Hero System CSS
 *
 * Styles for hero containers, backgrounds, overlays, and carousels.
 * Used by Default_Header when hero property is present.
 */

/* ==========================================================================
   Bar Height Variables
   ========================================================================== */

:root {
  --bar-height-xs: 40px;
  --bar-height-sm: 60px;
  --bar-height-md: 80px;
  --bar-height-lg: 120px;
  --bar-height-xl: 200px;
}

/* ==========================================================================
   Hero Container
   ========================================================================== */

.hero-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: clip;
}

/* Height variants - vh-based for responsive scaling */
.hero-container--auto {
  height: auto;
}

.hero-container--small {
  min-height: 30vh;
}

.hero-container--medium {
  min-height: 50vh;
}

.hero-container--large {
  min-height: 70vh;
}

.hero-container--xl {
  min-height: 85vh;
}

.hero-container--fullscreen {
  min-height: 100vh;
}

.hero-container--full-minus-nav {
  min-height: calc(100vh - var(--header-height, 80px));
}

/* bg-layers__content within hero needs to fill and be flex container */
.hero-container > .bg-layers__content {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;        /* Grow from flex-basis of 0 */
  min-height: inherit; /* Inherit parent's min-height instead of 100% */
  width: 100%;
}

/* hero-content needs to fill its parent for vertical centering */
.hero-container .hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Bars directly in hero bg-layers__content (full layout) need to fill and center */
.hero-container > .bg-layers__content > .bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ==========================================================================
   Hero Background
   ========================================================================== */

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

.hero-background--fixed {
  background-attachment: fixed;
}

.hero-background--parallax {
  will-change: transform;
}

/* Video backgrounds */
.hero-background--video,
.hero__video-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.hero-video,
.hero__video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
}

.hero-video-player,
.hero__video-background [id^="youtube-player-"],
.hero__video-background [id^="vimeo-player-"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hero-video-player iframe,
.hero__video-background iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw; /* 16:9 aspect ratio */
  min-height: 100vh;
  min-width: 177.77vh; /* 16:9 */
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ==========================================================================
   Hero Overlay
   ========================================================================== */

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Overlay colors */
.hero-overlay--dark {
  background-color: rgba(0, 0, 0, var(--overlay-opacity, 0.6));
}

.hero-overlay--light {
  background-color: rgba(255, 255, 255, var(--overlay-opacity, 0.6));
}

.hero-overlay--brand {
  background-color: oklch(var(--p) / var(--overlay-opacity, 0.6));
}

/* Overlay opacity */
.hero-overlay--opacity-40 {
  --overlay-opacity: 0.4;
}

.hero-overlay--opacity-50 {
  --overlay-opacity: 0.5;
}

.hero-overlay--opacity-60 {
  --overlay-opacity: 0.6;
}

.hero-overlay--opacity-70 {
  --overlay-opacity: 0.7;
}

.hero-overlay--opacity-80 {
  --overlay-opacity: 0.8;
}

/* ==========================================================================
   Hero Content
   ========================================================================== */

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

/* ==========================================================================
   Header Bars in Hero Context
   ========================================================================== */

.header-bars {
  /* position controlled by .sticky class when needed */
  z-index: 3;
  width: 100%;
}

.header-bars--overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

/* ==========================================================================
   Hero Carousel
   ========================================================================== */

.hero-carousel {
  position: relative;
  width: 100%;
  overflow: clip;
}

.hero-carousel__slides {
  position: relative;
  width: 100%;
}

.hero-carousel__slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.hero-carousel__slide--active {
  opacity: 1;
  visibility: visible;
  position: relative;
  z-index: 1;
}

/* Slides use daisyUI base-200 background */
section.hero-carousel__slide {
  background-color: oklch(var(--b2));
}

/* ==========================================================================
   Text Color Inheritance

   When text-white/text-black is set on a container (e.g., carousel slide),
   child elements should inherit that color instead of using their own
   text-base-content. This ensures proper contrast on gradient backgrounds.
   ========================================================================== */

.text-white .text-base-content,
.text-black .text-base-content {
  color: inherit !important;
}

/* Slide heights match carousel container heights */
.hero-carousel.hero-container--small .hero-carousel__slide { min-height: 30vh; }
.hero-carousel.hero-container--medium .hero-carousel__slide { min-height: 50vh; }
.hero-carousel.hero-container--large .hero-carousel__slide { min-height: 70vh; }
.hero-carousel.hero-container--xl .hero-carousel__slide { min-height: 85vh; }
.hero-carousel.hero-container--fullscreen .hero-carousel__slide { min-height: 100vh; }

.hero-carousel__content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

/* Bars in carousel content - fill entire area and center content */
.hero-carousel__content .bar,
.hero-carousel__content .bar[class*="bar--height"] {
  flex: 1;
  width: 100%;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
  display: flex;
  align-items: center;
}

.hero-carousel__content .bar .container,
.hero-carousel__content .bar .container.h-full {
  height: auto !important;
  display: flex;
  align-items: center;
}

.hero-carousel__content .bar .grid,
.hero-carousel__content .bar .grid.h-full {
  height: auto !important;
  width: 100%;
}

/* Center single column in carousel grid */
.hero-carousel__content .bar .grid > [class*="col-span"]:only-child {
  grid-column: 1 / -1;
  margin: 0 auto;
}

/* Carousel Navigation - Universal contrast design */
.hero-carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background-color: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-carousel__arrow:hover {
  background-color: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.1);
}

.hero-carousel__arrow--prev {
  left: 1rem;
}

.hero-carousel__arrow--next {
  right: 1rem;
}

.hero-carousel__arrow-icon {
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Carousel Dots - High contrast pill container */
.hero-carousel__dots {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background-color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero-carousel__dot {
  width: 10px;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.35);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.hero-carousel__dot:hover {
  background-color: rgba(255, 255, 255, 0.7);
}

.hero-carousel__dot--active {
  background-color: #fff;
  transform: scale(1.3);
}

/* ==========================================================================
   Bar Position Classes (Hero Context)
   ========================================================================== */

.bar--position-top {
  align-self: flex-start;
}

.bar--position-center {
  align-self: center;
}

.bar--position-bottom {
  align-self: flex-end;
}

/* ==========================================================================
   Bar Height Classes (Header/Hero Bars)
   ========================================================================== */

/* Bar heights removed - using flex/auto sizing instead */

.bar--height-fill {
  flex: 1;
}

/* ==========================================================================
   Has Hero State
   ========================================================================== */

.has-hero {
  position: relative;
}

.has-hero .hero-container {
  /* Ensure hero takes full header area */
}

/* ==========================================================================
   Sticky Header System
   ========================================================================== */

/* Base sticky state - applied via JavaScript when scrolled past threshold */
.header-bars--sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: transform 0.3s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

/* Scrolled state - when past threshold */
.header-bars--sticky.is-scrolled {
  background-color: oklch(var(--b1));
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Transparent bars get solid background when scrolled */
.header-bars--sticky.header-bars--transparent.is-scrolled {
  background-color: oklch(var(--b1));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Override individual bar transparency when scrolled */
.header-bars--sticky.header-bars--transparent.is-scrolled .bar {
  background-color: oklch(var(--b1));
  border-bottom: 1px solid oklch(var(--b2));
}

/* Hide non-sticky bars when header is scrolled */
.header-bars.is-scrolled .bar[data-sticky="false"] {
  display: none;
}

/* Hidden sticky clone - for split layout (slide down + fade) */
.header-bars .bar.header-bars__sticky-clone {
  height: 0;
  min-height: 0 !important;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.header-bars.is-scrolled .bar.header-bars__sticky-clone {
  height: var(--bar-height-md, 80px);
  opacity: 1;
  pointer-events: auto;
  overflow: visible;
  transition: height 0.6s ease-out, opacity 0.5s ease-out;
}

/* Sticky clone nav - ensure flex display (CSS is ID-scoped, clone may not get it) */
.header-bars__sticky-clone .nav-menu-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 100%;
  width: 100%;
}

.header-bars__sticky-clone .nav-menu-list {
  display: flex;
  flex-direction: row;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
}

.header-bars__sticky-clone .nav-menu-list > li {
  display: inline-flex;
  align-items: center;
}

/* Sticky clone logo - ensure flex display (CSS is ID-scoped, clone may not get it) */
.header-bars__sticky-clone .logo-link {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0.5rem;
  color: oklch(var(--bc));
  text-decoration: none;
}

.header-bars__sticky-clone .logo-link img {
  max-height: 50px;
  width: auto;
}

.header-bars__sticky-clone .logo-link svg {
  max-height: 50px;
  width: auto;
}

.header-bars__sticky-clone .logo-link i {
  font-size: 1.75rem;
  line-height: 1;
  color: oklch(var(--p));
}

.header-bars__sticky-clone .logo-text {
  font-weight: 900;
  font-size: 1.5rem;
  white-space: nowrap;
  color: oklch(var(--bc));
}

/* Auto-hide: hide on scroll down, show on scroll up */
.header-bars--sticky.header-bars--auto-hide.is-scrolling-down {
  transform: translateY(-100%);
}

.header-bars--sticky.header-bars--auto-hide.is-scrolling-up {
  transform: translateY(0);
}

/* Body compensation when header is fixed (no hero case) */
body.has-sticky-header {
  padding-top: var(--sticky-header-height, 80px);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 767px) {
  .hero-container--large {
    min-height: 50vh;
  }

  .hero-container--fullscreen {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
  }

  .hero-carousel__arrow {
    width: 40px;
    height: 40px;
  }

  .hero-carousel__arrow--prev {
    left: 0.5rem;
  }

  .hero-carousel__arrow--next {
    right: 0.5rem;
  }

  .hero-carousel__dots {
    bottom: 1rem;
  }

  .hero-carousel__dot {
    width: 10px;
    height: 10px;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .hero-carousel__slides {
    transition: none;
  }

  .hero-carousel__slide {
    transition: none;
  }

  .hero-background--parallax {
    transform: none !important;
  }

  .hero-carousel__arrow,
  .hero-carousel__dot {
    transition: none;
  }
}
