/* File: css/header.css */

:root {
    --header-height: 64px;
}

/* =============================================================================
   1) BASE HEADER STYLES
   ========================================================================== */
/* Positioning, background blur, and transitions */
header#site-header {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 50;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

/* If the admin bar exists, push the header down */
body.admin-bar header#site-header {
    top: 32px;
}

/* When scrolling down: hide the header */
header#site-header.hidden {
    transform: translateY(-100%);
}

/* When scrolling up: fix the header to top with a darker background */
header#site-header.fixed {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   2) HAMBURGER MENU STYLING
   ========================================================================== */
/* When header is not fixed, hamburger lines are dark gray */
header#site-header:not(.fixed) .hamburger .hamburger-inner,
header#site-header:not(.fixed) .hamburger .hamburger-inner:before,
header#site-header:not(.fixed) .hamburger .hamburger-inner:after {
    background-color: --color-yellow-500;
}

/* When the hamburger is active while header is not fixed, lines turn white */
header#site-header:not(.fixed) .hamburger.is-active .hamburger-inner,
header#site-header:not(.fixed) .hamburger.is-active .hamburger-inner:before,
header#site-header:not(.fixed) .hamburger.is-active .hamburger-inner:after {
    background-color: #fff;
}

/* Basic .hamburger button reset */
.hamburger {
    font: inherit;
    display: inline-block;
    overflow: visible;
    margin: 0;
    padding: 15px;
    cursor: pointer;
    transition-duration: 0.15s;
    transition-timing-function: linear;
    transition-property: opacity, filter;
    text-transform: none;
    color: inherit;
    border: 0;
    background-color: transparent;
}

/* Hover opacity */
.hamburger:hover,
.hamburger.is-active:hover {
    opacity: 0.9;
}

/* Box around the three lines */
.hamburger-box {
    position: relative;
    display: flex;
    width: 40px;
    height: 24px;
    justify-content: center;
    align-items: center;
}

/* The three lines themselves */
.hamburger-inner,
.hamburger-inner:before,
.hamburger-inner:after {
    position: absolute;
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background-color: #fff;
    transition-duration: 0.15s;
    transition-timing-function: ease;
    transition-property: transform;
}

.hamburger-inner:before,
.hamburger-inner:after {
    display: block;
    content: "";
}

.hamburger-inner:before {
    top: -10px;
}

.hamburger-inner:after {
    bottom: -10px;
}

/* “Elastic” variant transforms */
.hamburger--elastic .hamburger-inner {
    top: 2px;
    transition-duration: 0.275s;
    transition-timing-function: cubic-bezier(.68, -0.55, .265, 1.55);
}

.hamburger--elastic .hamburger-inner:before {
    top: 10px;
    transition: opacity 0.125s ease 0.275s;
}

.hamburger--elastic .hamburger-inner:after {
    top: 20px;
    transition: transform 0.275s cubic-bezier(.68, -0.55, .265, 1.55);
}

.hamburger--elastic.is-active .hamburger-inner {
    transition-delay: 75ms;
    transform: translate3d(0, 10px, 0) rotate(135deg);
}

.hamburger--elastic.is-active .hamburger-inner:before {
    transition-delay: 0s;
    opacity: 0;
}

.hamburger--elastic.is-active .hamburger-inner:after {
    transition-delay: 75ms;
    transform: translate3d(0, -20px, 0) rotate(-270deg);
}

/* =============================================================================
   3) CTA (“JOIN”) BUTTON STYLES
   ========================================================================== */
header#site-header .cta {
    font-size: 0.75rem;
    border: 3px solid #383633;
    transition: 0.3s ease-in-out;
}

/* CTA when header is not fixed */
header#site-header:not(.fixed) .cta {
    font-family: 'Poppins', sans-serif;
    background-color: #383633;
    color: #fff;
    text-decoration: none;
}

/* CTA when header is fixed */
header#site-header.fixed .cta {
    background-color: #383633;
    color: #fff;
}

/* CTA hover (text always white) */
header#site-header .cta:hover {
    color: #fff;
}

/* CTA hover, header not fixed: transparent background + gold border */
header#site-header:not(.fixed) .cta:hover {
    background-color: transparent;
    border: 3px solid var(--studio69-gold);
}

/* CTA hover, header fixed: transparent + darker border */
header#site-header.fixed .cta:hover {
    background-color: transparent;
    border-color: #383633;
}

/* =============================================================================
   4) LOGO & SEARCH ICON COLOR
   ========================================================================== */
#logo img.logo,
.lg\:hidden a[aria-label="studio69 Home"] img.logo {
    width: 175px;
    height: auto;
}

/* The search icon (fa‐search) in the header */
a[aria-label="Search"] i.fa {
    color: #fff;
}

/* =============================================================================
   5) OVERLAY MENU (“#primary-menu”) STYLES
   ========================================================================== */
#primary-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--studio69-negative);
    z-index: 1000;
    opacity: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    overflow: hidden;
}

body.admin-bar #primary-menu {
    top: 32px;
    height: calc(100vh - 32px);
}

#primary-menu.open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.primary-menu__container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    padding-top: var(--header-height);
}

/* Panels wrapper */
#primary-menu .menu-panels {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Each .menu-panel covers full area */
#primary-menu .menu-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* The first panel is visible by default */
#primary-menu .panel-1 {
    transform: translateX(0);
    opacity: 1;
}

/* Hidden panels slide off to the right */
#primary-menu .panel-2,
#primary-menu .panel-3 {
    transform: translateX(100%);
    opacity: 0;
}

/* Individual menu items start hidden (to animate in if desired) */
#primary-menu .menu-panel li {
    opacity: 0;
    margin-bottom: 0.5rem;
    max-width: 360px;
    list-style: none;
}

/* Keyframes for animating those menu items in */
@keyframes menuItemEntrance {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* “Back” button in submenu panels */
#primary-menu .back-item {
    position: fixed;
    top: 0;
    left: 0rem;
    width: 2.5rem;
    height: 2.5rem;
    margin: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    border-radius: 9999px;
    transition: background 0.2s ease, opacity 0.3s ease;
    opacity: 0;
}

#primary-menu .back-item.show {
    opacity: 1;
}

#primary-menu .back-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

#primary-menu .back-item i {
    color: #fff;
}

/* Links inside each panel */
#primary-menu .menu-panel a {
    width: 100%;
    text-align: center;
    font-size: 1.25rem;
    color: #fff;
    text-decoration: none;
    position: relative;
    margin-bottom: 0.5rem;
}

/* Underline on hover */
#primary-menu .menu-panel a::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #fff;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease-out;
}

#primary-menu .menu-panel a:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* Arrow icon indicating submenu */
#primary-menu .submenu-toggle {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #fff;
    cursor: pointer;
}

/* Hide nested sub‐menus in panel-1 */
#primary-menu .panel-1 .sub-menu {
    display: none !important;
}

/* =============================================================================
   6) LIVE SEARCH OVERLAY
   ========================================================================== */
/* 6.1) The full‐screen overlay, hidden by default */
#live-search-overlay {
    position: fixed;
    inset: 0; /* shorthand for top:0; right:0; bottom:0; left:0; */
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;            /* hide initially */
    align-items: center;      /* center contents vertically */
    justify-content: center;  /* center contents horizontally */
    z-index: 9999;            /* on top of everything */
    overflow-y: auto;         /* allow scrolling if needed */
    padding: 1rem;
}

/* 6.2) When “.open” is added (via JS), switch to flex */
#live-search-overlay.open {
    display: flex;
}

/* 6.3) Keyframes for animating the modal in/out */
@keyframes searchModalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes searchModalOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* 6.4) The inner “modal” box */
.live-search-inner {
    position: relative;
    max-width: 600px;
    width: 100%;
    background: #111;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transform: scale(0.9);
    animation-fill-mode: forwards;
    animation-duration: 0.25s;
}

/* 6.5) Animate in when overlay is opened */
#live-search-overlay.open .live-search-inner {
    animation-name: searchModalIn;
}

/* If you want to animate out, you can toggle a “.closing” class and use searchModalOut:
   #live-search-overlay.closing .live-search-inner { animation-name: searchModalOut; } */

/* 6.6) The close (“×”) button top‐right */
.live-search-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

/* 6.7) Wrapper around the input so we can position the icon */
.live-search-field-wrapper {
    position: relative;
    margin-top: 1rem;
}

/* 6.8) The text input itself */
.live-search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem; /* reserve space on the right for the icon */
    font-size: 1rem;
    border: 2px solid #facc15;
    border-radius: 4px;
    color: #fff;
    background: #222;
}

/* Placeholder styling */
.live-search-input::placeholder {
    color: #bbb;
}

/* 6.9) Positioning the magnifying‐glass icon inside the input */
.live-search-input-icon {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #facc15;
    pointer-events: none;
}

/* 6.10) The loader (spinner) that shows while Ajax is in progress */
.live-search-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #facc15;
    display: none;
}

/* 6.11) The results list */
.live-search-results {
    list-style: none;
    margin: 1rem 0 0 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.live-search-results li {
    display: flex;
    align-items: center;
    background: #333;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
}

.live-search-result-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 0.75rem;
}

.live-search-result-text {
    display: flex;
    flex-direction: column;
}

.live-search-result-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.live-search-result-meta {
    font-size: 0.875rem;
    opacity: 0.7;
    display: flex;
    gap: 0.5rem;
}

/* Hover-expand underline for primary menu links, expanding from center */
.primary-menu__list li {
  position: relative;
}

.primary-menu__list li a {
  position: relative;
  padding-bottom: 4px; /* space for the underline */
}

.primary-menu__list li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--studio69-gold); /* tailwind yellow-500 */
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease-in-out;
}

.primary-menu__list li a:hover::after,
.primary-menu__list li a:focus::after {
  transform: scaleX(1);
}