/**
 * ==========================================================================
 * ACCR Modern Broadsheet Design System - Header & Navigation
 * Spacious Luxury Editorial Masthead + Deep Navy Navigation Bar
 * Inspired by Asharq Al-Awsat (aawsat.com) & International Think Tanks
 * ==========================================================================
 */

.layout_header {
  width: 100%;
  background: #ffffff;
  border-bottom: var(--hairline);
  position: relative;
  z-index: 100;
}

/* ==========================================================================
 * 1. Mobile Top Micro Utility Bar (< 992px)
 * ========================================================================== */
.mobile_top_utility_bar {
  display: none;
  background: var(--bg-surface-subtle);
  border-bottom: var(--hairline);
  padding: 6px 0;
}

.mobile_top_inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile_top_date {
  font-size: 11.5px;
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  font-family: var(--font-ui);
}

.mobile_top_editions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-ui);
}

/* ==========================================================================
 * 2. Main Editorial Masthead (Spacious Breathing Room)
 * ========================================================================== */
.header_masthead {
  width: 100%;
  padding: 24px 0 20px 0;
  background: #ffffff;
  border-bottom: var(--hairline);
}

.header_masthead_grid {
  display: grid;
  grid-template-columns: 1.2fr auto 1.2fr;
  align-items: center;
  gap: var(--space-xl);
}

/* Desktop Only / Mobile Only Utility Classes */
.desktop_only {
  display: flex;
}

.mobile_only_action {
  display: none;
}

/* Right Wing: Editions, Quick Links & Comprehensive Date (Desktop) */
.masthead_wing {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.masthead_wing_right {
  align-items: flex-start;
  text-align: right;
}

.masthead_editions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  font-family: var(--font-ui);
}

.edition_link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.edition_link:hover {
  color: var(--primary);
}

.edition_link.active_edition {
  color: var(--primary);
  font-weight: var(--fw-bold);
}

.edition_divider {
  color: var(--border-strong);
  font-size: 13px;
}

.masthead_date_box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-ui);
}

.date_day {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}

.date_sep {
  color: var(--border-strong);
}

.date_hijri {
  color: var(--text-muted);
}

/* Center Wing: Brand Masthead Centerpiece */
.masthead_center_brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.masthead_brand_anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.masthead_logo_image {
  height: auto;
  max-height: 84px;
  width: auto;
  object-fit: contain;
  background: transparent;
  transition: transform var(--transition-normal);
}

.masthead_brand_anchor:hover .masthead_logo_image {
  transform: scale(1.015);
}

.masthead_brand_tagline {
  margin-top: 6px;
  font-family: var(--font-editorial);
  font-size: 13px;
  font-weight: var(--fw-bold);
  color: var(--primary);
  letter-spacing: 0.03em;
}

/* Left Wing: Social Links & Secondary Tools (Desktop) */
.masthead_wing_left {
  align-items: flex-end;
  text-align: left;
}

.masthead_social_icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-circle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: #ffffff;
  transition: all var(--transition-fast);
}

.social_btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background-color: var(--primary-subtle);
  transform: translateY(-1px);
}

.ico_social {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ==========================================================================
 * 3. Deep Slate / Navy Primary Navigation Bar (The Broadsheet Strip)
 * ========================================================================== */
.header_nav_bar {
  width: 100%;
  background: var(--primary); /* Deep Editorial Navy: #0B2545 */
  color: #ffffff;
  border-bottom: 2px solid var(--primary-dark);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 90;
}

/* Sticky Navigation for Large Screens (>= 992px) - Sticks only nav bar, leaving logo behind */
@media (min-width: 992px) {
  .header_nav_bar.nav_is_sticky {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22) !important;
    transition: box-shadow 0.2s ease;
  }

  .header_nav_placeholder {
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
  }
}

.header_nav_inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.broadsheet_nav_list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  cursor: grab;
}

.broadsheet_nav_list:active {
  cursor: grabbing;
}

.broadsheet_nav_list::-webkit-scrollbar {
  height: 3px;
}

.broadsheet_nav_list::-webkit-scrollbar-track {
  background: transparent;
}

.broadsheet_nav_list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.broadsheet_nav_list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

.each_li {
  position: relative;
  flex-shrink: 0;
}

.each_li > a,
.each_li > button,
.second_one {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-family: var(--font-editorial);
  font-size: 14.5px;
  font-weight: var(--fw-semibold);
  color: #ffffff !important;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.each_li:hover > a,
.each_li:hover > button,
.each_li.menu_open > a,
.each_li.menu_open > button,
.second_one:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
}

.second_one.active_nav {
  background-color: rgba(255, 255, 255, 0.10);
  font-weight: var(--fw-bold);
  position: relative;
}

.second_one.active_nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--accent-gold);
}

/* Dropdown Menus */
.dropdown_menu,
.broadsheet_nav_list li > div {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 230px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  z-index: 100;
  animation: navFadeIn 0.2s ease forwards;
}

.dropdown_menu.is_active,
.broadsheet_nav_list li > div.is_active {
  display: block;
}

@keyframes navFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown_menu a,
.broadsheet_nav_list li > div a {
  display: block;
  padding: 9px 18px;
  font-family: var(--font-editorial);
  font-size: 13.5px;
  font-weight: var(--fw-medium);
  color: var(--text-primary) !important;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.dropdown_menu a:hover,
.broadsheet_nav_list li > div a:hover {
  background-color: var(--primary-subtle);
  color: var(--primary) !important;
  padding-right: 22px;
}

/* Base rule: Mobile Expandable Search is strictly hidden on desktop */
.mobile_search_expandable {
  display: none !important;
}

/* Integrated Desktop Search Input */
.menu_search {
  display: inline-flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  margin-inline-start: var(--space-md);
}

.loginbox_search {
  height: 36px;
  width: 185px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0 16px 0 38px;
  font-family: inherit;
  font-size: 13px;
  color: #ffffff;
  outline: none;
  box-sizing: border-box;
  transition: width 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

html[dir="ltr"] .loginbox_search {
  padding: 0 38px 0 16px;
}

.loginbox_search:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
}

.loginbox_search::placeholder {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  opacity: 1;
}

.loginbox_search:focus {
  width: 235px;
  background: #ffffff;
  color: var(--text-ink, #0b2545);
  border-color: #ffffff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18), 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.loginbox_search:focus::placeholder {
  color: #718096;
}

.btn_search {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat center center;
  background-size: 15px 15px;
  cursor: pointer;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  opacity: 0.85;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  padding: 0;
  margin: 0;
  box-shadow: none;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  user-select: none;
  z-index: 2;
}

html[dir="ltr"] .btn_search {
  left: auto;
  right: 5px;
}

.btn_search:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.2);
}

.btn_search:active {
  transform: translateY(-50%) scale(0.92);
}

.loginbox_search:focus + .btn_search,
.loginbox_search:focus ~ .btn_search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b2545' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  opacity: 0.9;
}

.loginbox_search:focus + .btn_search:hover,
.loginbox_search:focus ~ .btn_search:hover {
  background-color: rgba(11, 37, 69, 0.10);
  opacity: 1;
}

/* ==========================================================================
 * 4. Responsive Mobile Drawer & Hamburger (< 992px)
 * ========================================================================== */
@media (max-width: 991px) {
  .desktop_only {
    display: none !important;
  }

  .mobile_only_action {
    display: flex !important;
  }

  .mobile_top_utility_bar {
    display: block;
  }

  .header_masthead {
    padding: 12px 0;
  }

  .header_masthead_grid {
    grid-template-columns: 44px 1fr 44px;
    gap: var(--space-sm);
  }

  .masthead_logo_image {
    max-height: 52px;
  }

  .masthead_brand_tagline {
    font-size: 11px;
  }

  .btn_mobile_toggle,
  .btn_mobile_search_toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--primary);
    cursor: pointer;
  }

  .hamburger_box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 18px;
  }

  .hamburger_bar {
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    border-radius: 1px;
  }

  .hamburger_text {
    display: none;
  }

  .header_nav_bar {
    display: none; /* Accessible via offcanvas drawer */
  }

  .mobile_search_expandable {
    display: none;
    background: var(--bg-surface-subtle);
    border-bottom: var(--hairline);
    padding: 10px 0;
  }

  .mobile_search_expandable.is_open {
    display: block;
  }

  .mobile_search_expandable_inner {
    display: flex;
    gap: 8px;
  }

  .mobile_search_input {
    flex: 1;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 0 12px;
    font-size: 13px;
    outline: none;
  }

  .btn_mobile_search_submit {
    padding: 0 16px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-xs);
    font-weight: var(--fw-semibold);
    cursor: pointer;
  }
}

/* Offcanvas Drawer */
.mobile_drawer_overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 24, 44, 0.45);
  backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.mobile_drawer_overlay.is_open {
  opacity: 1;
  visibility: visible;
}

.mobile_drawer_panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: #ffffff;
  z-index: 999;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.mobile_drawer_panel.is_open {
  transform: translateX(0);
}

.mobile_drawer_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: var(--hairline);
  background: #ffffff;
}

.drawer_logo_image {
  max-height: 44px;
  width: auto;
}

.btn_drawer_close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn_drawer_close:hover {
  background-color: var(--primary-subtle);
  color: var(--primary);
}

/* 2. Mobile Drawer Integrated Search */
.mobile_drawer_search {
  padding: 12px 18px;
  background: var(--bg-surface-subtle);
  border-bottom: var(--hairline);
  position: relative;
  display: flex;
  align-items: center;
}

.drawer_search_input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 0 12px 0 38px;
  font-family: var(--font-ui);
  font-size: 13px;
  background: #ffffff;
  color: var(--text-ink);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

html[dir="ltr"] .drawer_search_input {
  padding: 0 38px 0 12px;
}

.drawer_search_input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 37, 69, 0.1);
}

.btn_drawer_search_submit {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

html[dir="ltr"] .btn_drawer_search_submit {
  left: auto;
  right: 26px;
}

.btn_drawer_search_submit svg {
  width: 16px;
  height: 16px;
}

/* 3. Mobile Drawer Navigation List & Accordions */
.mobile_drawer_content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.drawer_nav_list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer_nav_item {
  position: relative;
}

.drawer_item_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.drawer_item_row .drawer_link {
  flex: 1;
}

.drawer_accordion_toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.drawer_accordion_toggle:hover {
  background-color: var(--primary-subtle);
  color: var(--primary);
}

.drawer_accordion_toggle svg {
  transition: transform var(--transition-fast);
}

.drawer_accordion_toggle.expanded svg {
  transform: rotate(180deg);
}

.drawer_link {
  display: block;
  padding: 10px 14px;
  font-family: var(--font-editorial);
  font-size: 15px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.drawer_link:hover {
  background-color: var(--primary-subtle);
  color: var(--primary);
}

.drawer_link.active_drawer_link {
  background-color: var(--primary-subtle);
  color: var(--primary);
  font-weight: var(--fw-bold);
  border-inline-start: 3px solid var(--accent-gold);
}

.drawer_submenu {
  padding-inline-start: 16px;
  margin: 4px 0 8px;
  border-inline-start: 2px solid var(--primary-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer_submenu a {
  display: block;
  padding: 7px 12px;
  font-family: var(--font-editorial);
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.drawer_submenu a:hover {
  background-color: var(--primary-subtle);
  color: var(--primary);
}

.drawer_sub_all {
  font-weight: var(--fw-bold);
  color: var(--primary) !important;
}

/* 4. Drawer Footer */
.drawer_footer_section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer_editions_row {
  display: flex;
  gap: 8px;
}

.drawer_edition_btn {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.drawer_edition_btn.active,
.drawer_edition_btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.drawer_quick_links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.drawer_quick_links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.drawer_quick_links a:hover {
  color: var(--primary);
}

.drawer_social_row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer_social_btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-circle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.drawer_social_btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background-color: var(--primary-subtle);
}

.drawer_social_btn .ico_social {
  width: 14px;
  height: 14px;
}
