/* docs/styles/header-fixed.css - FIXED HEADER WITHOUT SEARCH TRAP
   ===================================================== */

/* =====================================================
   HEADER - Fixed positioning with neumorphic depth
   ===================================================== */

.md-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12000;
  height: 76px;
  background: linear-gradient(135deg, #fdfdf9 0%, #f7f5f0 100%);
  box-shadow:
    0 8px 32px rgba(26, 35, 50, 0.08),
    0 2px 8px rgba(26, 35, 50, 0.04),
    inset 0 -1px 0 rgba(245, 158, 11, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(245, 158, 11, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

[data-md-color-scheme="slate"] .md-header {
  background: linear-gradient(135deg, #1a2332 0%, #263244 100%);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 -1px 0 rgba(251, 191, 36, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(251, 191, 36, 0.1);
}

.md-header__inner {
  height: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

/* Logo */
.md-header__button.md-logo {
  height: 56px;
  padding: 0;
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  order: 0;
}

.md-header__button.md-logo img,
.md-logo img {
  height: 54px !important;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 10px rgba(245, 158, 11, 0.25));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.md-header__button.md-logo:hover img {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 16px rgba(245, 158, 11, 0.3));
}

/* Hide header title to avoid duplicates */
.md-header__title { display: none !important; }

/* Navigation Container */
.md-header-nav {
  display: flex !important;
  align-items: center;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
  margin: 0 0.5rem 0 0.25rem;
  order: 1;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Force nav links visible above mobile breakpoint */
@media screen and (min-width:601px){
  .md-header-nav {display:flex !important; visibility:visible !important; opacity:1 !important;}
  .md-header-nav__link {display:inline-flex !important; visibility:visible !important;}
  .md-tabs {display:flex !important; visibility:visible !important; opacity:1 !important;}
  .md-tabs__list {display:flex !important; visibility:visible !important;}
  .md-tabs__item {display:block !important; visibility:visible !important;}
  .md-tabs__link {display:inline-flex !important; visibility:visible !important; opacity:1 !important;}
}

/* Tabs list and items styling */
.md-tabs__list {
  display:flex !important;
  gap:0.35rem;
  align-items:center;
  margin: 0;
  padding: 0.5rem 1rem;
}

.md-tabs__item {
  margin:0;
  display: inline-block !important;
}

.md-tabs__link {
  position:relative;
  padding:0.32rem 0.65rem !important;
  font-size:0.72rem !important;
  font-weight:600 !important;
  border-radius:18px;
  color:#2a2723 !important;
  text-decoration:none !important;
  transition:all .3s ease;
  display: inline-flex !important;
  align-items: center;
}

.md-tabs__link:hover {
  transform:translateY(-2px);
  color:#f59e0b !important;
}

.md-tabs__link--active {
  color:#1a2332 !important;
}

[data-md-color-scheme="slate"] .md-tabs__link {
  color:#e6dcc6 !important;
}

[data-md-color-scheme="slate"] .md-tabs__link--active {
  color:#fbbf24 !important;
}

/* Ensure tabs area occupies same line and is visible on desktop */
.md-header__inner { gap:0.4rem; }
.md-header__inner .md-tabs,
.md-container > .md-tabs,
.md-tabs { order:1; display:flex !important; flex:1 1 auto; }

/* Desktop: ensure tabs are visible regardless of container */
@media screen and (min-width:1100px){
  .md-tabs,
  .md-header + .md-tabs,
  .md-container > .md-tabs,
  .md-header__inner .md-tabs {
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    position: relative !important;
    z-index: 100;
  }
  .md-tabs__list {
    display:flex !important;
    visibility:visible !important;
    opacity: 1 !important;
  }
  .md-tabs__item {
    display: block !important;
    visibility: visible !important;
  }
  .md-tabs__link {
    display: inline-flex !important;
    visibility:visible !important;
    opacity:1 !important;
  }
}

@media screen and (max-width:600px){
  .md-header__inner > .md-tabs { display:none !important; }
}

/* Navigation tabs positioning */
@media screen and (min-width: 1100px) {
  .md-tabs {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent !important;
  }

  [data-md-color-scheme="slate"] .md-tabs {
    background: transparent !important;
  }
}

/* Hide tabs only on mobile */
@media screen and (max-width: 1099px) {
  .md-tabs {
    display: none !important;
  }
}

/* Navigation Links - Neumorphic Style */
.md-header-nav__link,
.md-tabs__link {
  position: relative;
  padding: 0.28rem 0.5rem !important;
  font-size: 0.72rem !important;
  font-weight: 600;
  color: #2a2723;
  text-decoration: none;
  border-radius: 18px;
  background: #fdfdf9;
  box-shadow:
    2px 2px 6px rgba(26, 35, 50, 0.04),
    -2px -2px 6px rgba(255, 255, 255, 0.7),
    inset 1px 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* Defensive: hide any empty tab links */
.md-tabs__link:empty,
.md-header-nav__link:empty { display: none !important; }

[data-md-color-scheme="slate"] .md-header-nav__link,
[data-md-color-scheme="slate"] .md-tabs__link {
  color: #e6dcc6;
  background: #263244;
  box-shadow:
    2px 2px 6px rgba(0, 0, 0, 0.15),
    -2px -2px 6px rgba(255, 255, 255, 0.02),
    inset 1px 1px 1px rgba(255, 255, 255, 0.03);
}

/* Ornate hover decorations */
.md-header-nav__link::before,
.md-tabs__link::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #f59e0b, #fbbf24, #fcd34d, #fbbf24, #f59e0b);
  background-size: 300% 300%;
  border-radius: 20px;
  opacity: 0;
  z-index: -1;
  transition: all 0.4s ease;
}

.md-header-nav__link:hover::before,
.md-tabs__link:hover::before {
  opacity: 0.3;
  animation: gradientShift 2s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Link Hover */
.md-header-nav__link:hover,
.md-tabs__link:hover {
  transform: translateY(-2px);
  color: #f59e0b;
  box-shadow:
    4px 4px 12px rgba(245, 158, 11, 0.08),
    -4px -4px 12px rgba(255, 255, 255, 0.85),
    inset 2px 2px 3px rgba(245, 158, 11, 0.04);
}

/* Active Link */
.md-header-nav__link--active,
.md-tabs__link--active,
.md-header-nav__link[aria-current],
.md-tabs__link[aria-current] { 
  font-weight:700; 
  position:relative; 
}

.md-header-nav__link--active::after,
.md-tabs__link--active::after,
.md-header-nav__link[aria-current]::after,
.md-tabs__link[aria-current]::after {
  content:''; 
  position:absolute; 
  left:10%; 
  right:10%; 
  bottom:-2px; 
  height:2px;
  background: var(--md-accent-fg-color); 
  border-radius:2px;
  box-shadow: 0 0 10px color-mix(in srgb, var(--md-accent-fg-color) 40%, transparent);
}

/* Light mode: make active link amber */
[data-md-color-scheme="default"] .md-header-nav__link--active,
[data-md-color-scheme="default"] .md-tabs__link--active,
[data-md-color-scheme="default"] .md-header-nav__link[aria-current],
[data-md-color-scheme="default"] .md-tabs__link[aria-current] {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 60%, #f59e0b 100%) !important;
  color: #0b1220 !important;
  border: 1px solid rgba(245, 158, 11, 0.6) !important;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.22),
              inset 0 1px 0 rgba(255, 255, 255, 0.55),
              inset 0 -1px 0 rgba(209, 134, 6, 0.25) !important;
}

/* Blog & Contact - Special CTA Buttons */
.md-header-nav__link[href*="blog"],
.md-header-nav__link[href*="contact"],
.md-tabs__link[href*="blog"],
.md-tabs__link[href*="contact"] {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #1a2332 !important;
  font-weight: 600;
  padding: 0.32rem 0.65rem !important;
  box-shadow:
    0 3px 10px rgba(245, 158, 11, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(209, 134, 6, 0.2);
  position: relative;
}

.md-header-nav__link[href*="blog"]::after,
.md-header-nav__link[href*="contact"]::after,
.md-tabs__link[href*="blog"]::after,
.md-tabs__link[href*="contact"]::after {
  content: '↗';
  margin-left: 0.2rem;
  font-size: 0.7rem;
  opacity: 0.8;
  transition: all 0.3s ease;
}

/* GitHub Button - Neumorphic Card */
.md-source {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.45rem;
  background: linear-gradient(135deg, #fff5e6 0%, #ffedcc 100%);
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow:
    2px 2px 5px rgba(26, 35, 50, 0.04),
    -2px -2px 5px rgba(255, 255, 255, 0.7),
    inset 1px 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  gap: 0.25rem;
  margin-right: 0.25rem;
  position: relative;
  overflow: hidden;
  order: 3;
}

[data-md-color-scheme="slate"] .md-source {
  background: #263244;
  border: 1px solid rgba(251, 191, 36, 0.15);
  box-shadow:
    2px 2px 6px rgba(0, 0, 0, 0.15),
    -2px -2px 6px rgba(255, 255, 255, 0.02),
    inset 1px 1px 1px rgba(255, 255, 255, 0.03);
}

.md-source:hover {
  transform: translateY(-2px);
  box-shadow:
    4px 4px 12px rgba(245, 158, 11, 0.08),
    -4px -4px 12px rgba(255, 255, 255, 0.85);
}

/* Theme GitHub icon to match flame (amber) */
.md-header .md-source__icon svg {
  width: 14px;
  height: 14px;
  fill: #f59e0b !important;
  transition: all 0.3s ease;
}

[data-md-color-scheme="default"] .md-header .md-source__icon svg,
[data-md-color-scheme="default"] .md-source__icon svg {
  fill: #f59e0b !important;
}

[data-md-color-scheme="slate"] .md-header .md-source__icon svg,
[data-md-color-scheme="slate"] .md-source__icon svg {
  fill: #fbbf24 !important;
}

.md-source__repository {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1a2332;
}

[data-md-color-scheme="slate"] .md-source__repository {
  color: #fbbf24;
}

/* Theme Toggle */
label.md-header__button[for^="__palette_"] {
  width: 34px;
  height: 34px;
  padding: 0;
  background: #fdfdf9;
  border-radius: 50%;
  box-shadow:
    2px 2px 5px rgba(26, 35, 50, 0.05),
    -2px -2px 5px rgba(255, 255, 255, 0.7),
    inset 1px 1px 1px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  order: 4;
  margin-right: 0.35rem;
  z-index: 13000;
  pointer-events: auto !important;
}

[data-md-color-scheme="slate"] .md-header__button[for="__palette_1"],
[data-md-color-scheme="slate"] .md-header__button[for="__palette_2"] {
  background: #263244;
  box-shadow:
    2px 2px 6px rgba(0, 0, 0, 0.15),
    -2px -2px 6px rgba(255, 255, 255, 0.02);
}

label.md-header__button[for^="__palette_"] .md-icon,
label.md-header__button[for^="__palette_"] svg {
  width: 17px;
  height: 17px;
  color: #f59e0b;
  fill: #f59e0b;
}

.md-header__button[for="__palette_1"]:hover,
.md-header__button[for="__palette_2"]:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    4px 4px 12px rgba(245, 158, 11, 0.12),
    -4px -4px 12px rgba(255, 255, 255, 0.85);
}

/* Hamburger menu button */
.md-header__button[for="__drawer"] {
  color: #1a2332;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
  cursor: pointer !important;
  pointer-events: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

[data-md-color-scheme="slate"] .md-header__button[for="__drawer"] {
  color: #fbbf24;
}

.md-header__button[for="__drawer"] svg {
  fill: currentColor !important;
  width: 24px;
  height: 24px;
}

/* MOBILE */
@media screen and (max-width: 600px) {
  .md-header {
    height: 64px;
  }

  .md-header__inner {
    padding: 0 0.75rem;
  }

  .md-header__title { display: none !important; }
  
  .md-header__button.md-logo { order: 0; }
  label.md-header__button[for^="__palette_"] { order: 1; margin-left: auto; }
  .md-header__button[for="__drawer"] { order: 2; }

  label.md-header__button[for^="__palette_"] { margin-right: 0.4rem; }

  .md-header__button[for="__drawer"] {
    display: flex !important;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    background: #fdfdf9;
    border-radius: 12px;
    box-shadow:
      3px 3px 8px rgba(26, 35, 50, 0.06),
      -3px -3px 8px rgba(255, 255, 255, 0.8);
    cursor: pointer;
    z-index: 15000;
    margin-left: 0;
    position: fixed;
    top: 8px;
    right: 8px;
    left: auto;
  }

  [data-md-color-scheme="slate"] .md-header__button[for="__drawer"] {
    background: #263244;
    box-shadow:
      3px 3px 8px rgba(0, 0, 0, 0.2),
      -3px -3px 8px rgba(255, 255, 255, 0.02);
  }

  .md-header__button[for="__drawer"] svg { fill: #f59e0b; }

  .md-header-nav {
    display: none !important;
  }

  .md-header__button.md-logo img {
    height: 52px !important;
  }

  .md-source { display: inline-flex !important; order: 3; }

  .md-header__button[for="__palette_1"],
  .md-header__button[for="__palette_2"] {
    width: 36px;
    height: 36px;
  }

  .md-header__button[for="__palette_1"] svg,
  .md-header__button[for="__palette_2"] svg {
    width: 16px;
    height: 16px;
  }
}

/* Content padding */
.md-container {
  padding-top: 76px;
}

@media screen and (min-width: 1100px) {
  .md-container:has(> .md-tabs),
  body:has(> .md-tabs) .md-container {
    padding-top: 124px;
  }
}

@media screen and (max-width: 600px) {
  .md-container {
    padding-top: 64px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .md-source:hover,
  [data-md-color-scheme="slate"] .md-source:hover {
    animation: none !important;
    filter: none !important;
  }
  .md-source::after { transition: none; }
}

/* =====================================================
   FIXES FOR DUPLICATE ELEMENTS & ANIMATIONS
   ===================================================== */

/* Fix duplicate theme toggle - hide all except the correct one */
.md-header__button[for="__palette_0"],
.md-header__button[for="__palette_1"],
.md-header__button[for="__palette_2"] {
  display: none !important;
}

/* Show only the correct toggle for each theme */
[data-md-color-scheme="default"] .md-header__button[for="__palette_1"] {
  display: flex !important;
}

[data-md-color-scheme="slate"] .md-header__button[for="__palette_0"] {
  display: flex !important;
}

/* Fix duplicate search icon - hide the extra search toggle button */
.md-header__button.md-icon[for="__search"]:not(.md-search__icon) {
  display: none !important;
}

/* Hide any orphaned search labels outside the search container */
label[for="__search"]:not(.md-search__icon) {
  display: none !important;
}

/* Ensure only the search icon inside the search form is visible */
.md-search .md-search__icon {
  display: flex !important;
}

/* Fix search modal overlay to prevent click trap */
.md-search__overlay {
  pointer-events: auto !important;
}

/* When search is not active, ensure it doesn't capture clicks */
.md-search:not([data-md-toggle]) .md-search__form {
  pointer-events: auto !important;
}

.md-search:not([data-md-toggle]) .md-search__input {
  pointer-events: auto !important;
}

/* Torch/flame animation for logo */
@keyframes torchFlicker {
  0%, 100% { 
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.8)) 
            drop-shadow(0 0 20px rgba(245, 158, 11, 0.5))
            drop-shadow(0 0 30px rgba(245, 158, 11, 0.3));
    transform: scale(1);
  }
  25% { 
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.9)) 
            drop-shadow(0 0 25px rgba(245, 158, 11, 0.6))
            drop-shadow(0 0 35px rgba(245, 158, 11, 0.4));
    transform: scale(1.02);
  }
  50% { 
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.85)) 
            drop-shadow(0 0 22px rgba(245, 158, 11, 0.55))
            drop-shadow(0 0 32px rgba(245, 158, 11, 0.35));
    transform: scale(1.01);
  }
  75% { 
    filter: drop-shadow(0 0 18px rgba(245, 158, 11, 0.95)) 
            drop-shadow(0 0 28px rgba(245, 158, 11, 0.65))
            drop-shadow(0 0 38px rgba(245, 158, 11, 0.45));
    transform: scale(1.03);
  }
}

/* Apply torch animation to logo on hover */
.md-header__button.md-logo:hover img {
  animation: torchFlicker 1.5s ease-in-out infinite;
}

/* GitHub icon hover with torch effect */
.md-source:hover {
  animation: torchFlicker 2s ease-in-out infinite;
}

/* Fix for navigation links visibility */
.md-tabs__link {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure proper z-index layering */
.md-search {
  z-index: 1000;
}

.md-header {
  z-index: 999;
}

.md-search__overlay {
  z-index: 998;
}

/* Fix image modal z-index */
.modal {
  z-index: 10000 !important;
}

.modal-backdrop {
  z-index: 9999 !important;
}