/* =========================================
   1. STRUCTURAL RESET & BASICS
   ========================================= */
.header-nav, .header-menu-nav, .header-burger { display: none !important; }
body.menu-locked { overflow: hidden; }

/* =========================================
   2. FLOATING CONTAINER (Restricted to Site Wrapper)
   ========================================= */
#floating-nav-container {
  position: fixed;
  bottom: 0vw !important;
  left: 2vw;
  right: 2vw;
  width: auto;
  z-index: 99999;
  font-family: var(--body-font-font-family, sans-serif);
  transition: all 0.3s ease; 
}

/* =========================================
   3. THE BOTTOM BAR
   ========================================= */
.fn-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100px; 
  padding: 0px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.5s ease;
  position: relative;
  z-index: 20;
}

.fn-bar.is-visible {
  opacity: 1;
}

/* Triggers */
.fn-trigger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The Icon: 20px Circle */
.half-circle-icon {
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  box-shadow: inset 0 0 0 2px currentColor;
  border-radius: 50%;
  position: relative;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.half-circle-icon::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50%; 
  height: 100%;
  background-color: currentColor;
  border-top-left-radius: 8px; 
  border-bottom-left-radius: 8px;
}

/* =========================================
   4. THE OVERLAY (Full Screen)
   ========================================= */
.fn-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  
  /* --- FIX START: Use Dynamic Viewport Height --- */
  height: 100vh; /* Fallback for older browsers */
  height: 100dvh; /* Adapts to Mobile Browser Bars */
  /* --- FIX END --- */

  z-index: 30; 
  box-sizing: border-box;
  
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.7, 0, 0.2, 1);

  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  
  display: flex;
  flex-direction: column;
  padding: 2vw;
  
  /* Ensure content is scrollable if phone is very small/landscape */
  overflow-y: auto; 
}

/* Open State */
#floating-nav-container.is-open .fn-overlay {
  transform: translateY(0%);
}

.fn-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 40px;
  flex-shrink: 0; /* Prevents header from being squashed */
}

.fn-overlay-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* Ensure some bottom margin so links don't touch footer instantly */
  margin-bottom: 20px; 
}

.fn-overlay-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fn-close-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.fn-lang-switch {
  display: flex;
  gap: 15px;
}

/* =========================================
   5. MOBILE OVERRIDES
   ========================================= */

@media (max-width: 768px) {   
  #floating-nav-container {
    bottom: 0vw;
    left: 6vw;
    right: 6vw;
    width: auto;
  }

  .fn-overlay {
    padding: 6vw;
    
    /* --- FIX START: Add Safe Area Padding for iPhone X+ --- */
    /* This adds extra padding at the bottom so the footer isn't 
       covered by the "Home Swipe" bar */
    padding-bottom: calc(6vw + env(safe-area-inset-bottom));
    /* --- FIX END --- */
  }

  .fn-overlay-content {
    justify-content: center;
  }
}