/**
 * AIM Global Component Styles
 *
 * Loaded on every front-end page via wp_enqueue_style( 'aim-global-components' ).
 * Contains: Mission Control fixed bar, To-Top button, smooth-scroll.
 *
 * A2 FIX: Shared CSS custom properties consolidated into :root so they cascade
 * correctly and accessibility tools can override them at the document level.
 * Per-component declarations of these same variables removed from all AIM CSS files.
 *
 * DO NOT add page-specific styles here. Use aim-post.css or aim-archive.css.
 *
 * @package    Ahmed Alshamsy
 * @since      2.0.0
 */

/* =============================================================================
   CSS CUSTOM PROPERTIES — :root (A2 FIX)
   Shared variables used across aim-global.css, aim-post.css, aim-archive.css.
   Declaring here at :root allows browser/OS accessibility overrides to cascade.
   Component-specific values (e.g. --text-muted) remain scoped to their component.
   ============================================================================= */

:root {
  --teal-rgb:   23, 100, 90;
  --teal-dark:  #004D40;
  --teal-mid:   #00695C;
  --teal-text:  #1a3a3a; /* Protocol card & component headings — desaturated dark teal */
  --gold:       #C5A059;
  --gold-light: #D4AF37;
  --text:       #0b2f2a;
}

/* =============================================================================
   BODY PADDING — CWV3 FIX (Cumulative Layout Shift)
   The fixed 70px mission control bar covers the bottom of page content on
   single posts. Padding is scoped to .aim-has-mission-bar, which is added via
   PHP body_class filter only on is_single() pages — the only pages where the
   full bar renders. Without this class scope, pages that use .aim-totop-only
   (height: 0) would show blank space under the footer.
   ============================================================================= */

.aim-has-mission-bar {
  padding-bottom: 70px; /* Match .aim-full-bar height */
}

@media (max-width: 600px) {
  .aim-has-mission-bar {
    padding-bottom: 60px; /* Match the 60px bar height at mobile breakpoint */
  }
}

/* =============================================================================
   MISSION CONTROL BAR — Fixed bottom navigation
   ============================================================================= */

#aim-mission-control {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
}

/* Full bar — single post pages */
.aim-full-bar {
  height: 70px;
  background: rgba(0, 26, 18, 0.98);
  border-top: 2px solid var(--gold-light);
  box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(12px); /* A5 FIX: vendor prefix for Android/Firefox */
          backdrop-filter: blur(12px);
}

/* To-Top only — all other pages (bar collapses, only button floats) */
.aim-totop-only {
  height: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
          backdrop-filter: none !important;
  pointer-events: none;
}

/* Control container */
.aim-control-container {
  display: flex;
  width: 100%;
  max-width: 800px;
  justify-content: space-between;
  align-items: center;
  height: 70px;
  padding: 0 15px;
  position: relative;
}

.aim-totop-only .aim-control-container {
  justify-content: flex-end;
  pointer-events: none;
}

/* Individual nav items */
.aim-control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  color: #a8c5c0; /* 4.8:1 contrast ratio against #001A12 — passes WCAG AA */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  height: 100%;
  pointer-events: auto;
}

/* To-Top button specifics */
.aim-totop-only .aim-totop-btn {
  flex: 0 0 50px;
  height: 50px;
  background: rgba(0, 26, 18, 0.9);
  border: 1px solid var(--gold-light);
  border-radius: 4px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  /* UA reset — <button> adds padding, system font, and no cursor by default */
  padding: 0;
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
          appearance: none;
}

/* To-Top button inside the FULL BAR (single post) — compact icon, no circle */
.aim-full-bar .aim-totop-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 6px;
  padding: 0;
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
          appearance: none;
  box-shadow: none;
  /* Do not grow to fill bar height like the nav items */
  align-self: center;
  margin: 0;
}

/* Icons and labels */
.aim-icon svg {
  width: 22px;
  height: 22px;
}

.aim-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Hover states */
.aim-control-item:hover {
  color: var(--gold-light);
  background: linear-gradient(to top, rgba(212, 175, 55, 0.12), transparent);
}

.aim-control-item:hover .aim-icon svg {
  filter: drop-shadow(0 0 8px var(--gold-light));
  transform: translateY(-3px);
}

/* Keyboard focus indicator — WCAG 2.4.7 */
.aim-control-item:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
  border-radius: 4px;
  color: var(--gold-light);
}

/* Highlight item (Download/Assets) */
.highlight-item .aim-icon svg {
  color: #f7e08a;
}

/* =============================================================================
   SMOOTH SCROLL — respects prefers-reduced-motion (WCAG 2.3.3 best practice)
   ============================================================================= */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 600px) {
  .aim-full-bar {
    height: 60px;
  }

  .aim-control-container {
    height: 60px;
  }

  .aim-icon svg {
    width: 18px;
    height: 18px;
  }

  .aim-label {
    font-size: 8px;
  }
}
