/* ==========================================================================
   TibCal.com — Header Styles
   ========================================================================== */

.site-header {
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem; /* 64px */
}

/* Brand Logo */
.site-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-main);
}

.site-brand:hover {
  text-decoration: none;
  color: var(--color-primary);
}

.brand-icon {
  width: 2rem;
  height: 2rem;
  background-color: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
}

/* Desktop Navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}

.nav-link {
  color: var(--color-text-main);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  padding: var(--space-2) 0;
  position: relative;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--color-primary);
}

.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-primary);
}

/* Search Trigger Button in Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-search-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 220px;
  max-width: 100%;
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.header-search-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
}

.header-search-btn:hover {
  border-color: var(--color-primary);
  background-color: #ffffff;
  color: var(--color-text-main);
  box-shadow: var(--shadow-sm);
}

.header-search-btn svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  flex-shrink: 0;
}

.search-kbd {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-family: var(--font-family-mono);
  color: var(--color-text-muted);
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

/* Mobile Nav Toggle Button */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-main);
}

.mobile-menu-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   Desktop Navigation Dropdown
   -------------------------------------------------------------------------- */
.nav-item-has-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.dropdown-arrow {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-item-has-dropdown:hover .dropdown-arrow,
.nav-item-has-dropdown.is-open .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  max-height: 420px;
  overflow-y: auto;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1100;
}

.nav-item-has-dropdown:hover .nav-dropdown-menu,
.nav-item-has-dropdown:focus-within .nav-dropdown-menu,
.nav-item-has-dropdown.is-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu li {
  width: 100%;
}

.nav-dropdown-menu li a {
  display: block;
  padding: 0.5rem 1.25rem;
  color: var(--color-text-main);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-dropdown-menu li a:hover,
.nav-dropdown-menu li a:focus {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

