/* ======================================================================
   Pit o Cuixa — Header Layout
   
   BEM block: .header
   Site header with logo, navigation, mobile menu toggle.
   DS-002: Consistent BEM naming
   ====================================================================== */

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

.header__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.header__logo {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  color: var(--color-on-surface);
  letter-spacing: -0.02em;
}

.header__logo:hover {
  color: var(--color-on-surface);
}

/* ── Menu Toggle (mobile) ────────────────────────────────────── */
.header__menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.header__menu-icon,
.header__menu-icon::before,
.header__menu-icon::after {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-on-surface);
  transition: transform var(--transition-fast);
}

.header__menu-icon {
  position: relative;
}

.header__menu-icon::before,
.header__menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.header__menu-icon::before {
  top: -7px;
}

.header__menu-icon::after {
  top: 7px;
}

/* ── Desktop Menu ────────────────────────────────────────────── */
.header__menu {
  display: none; /* hidden on mobile */
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__menu--open {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  width: 100vw;
  height: calc(100vh - 56px);
  background-color: var(--color-surface, #ffffff);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  padding: 20px 16px;
  gap: 12px;
  z-index: calc(var(--z-header) + 20);
  overflow-y: auto;
}

.header__nav-item {
  list-style: none;
  margin: 0;
}

.header__mobile-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-on-surface, #1e293b);
  background-color: var(--color-surface-container-low, #f8f9fa);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header__mobile-link:hover,
.header__mobile-link--active {
  background-color: var(--color-primary-50, #fffbeb);
  color: var(--color-primary, #d97706);
  border-color: var(--color-primary, #d97706);
}

.header__mobile-lang-wrap {
  list-style: none;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header__mobile-lang-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header__mobile-lang {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header__mobile-lang-link {
  display: block;
  text-align: center;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 10px;
  background-color: var(--color-surface-container-low, #f1f5f9);
  border: 1px solid var(--color-border, #cbd5e1);
  color: var(--color-text, #334155);
  text-decoration: none;
  transition: all 0.2s ease;
}

.header__mobile-lang-link--active {
  background-color: var(--color-primary, #d97706);
  color: #ffffff;
  border-color: var(--color-primary, #d97706);
}

.header__desktop-item {
  display: none;
}

/* ── Custom Language Selector Dropdown with Favicon Flags ──── */
.header__lang-dropdown {
  position: relative;
  display: inline-block;
}

.header__lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--color-surface-container-low, #f8f9fa);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header__lang-toggle:hover,
.header__lang-toggle[aria-expanded="true"] {
  background-color: var(--color-surface-container, #e2e8f0);
  border-color: var(--color-primary, #d97706);
}

.header__lang-flag {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.header__lang-arrow {
  font-size: 0.65rem;
  color: var(--color-text-muted, #64748b);
  transition: transform 0.2s ease;
}

.header__lang-toggle[aria-expanded="true"] .header__lang-arrow {
  transform: rotate(180deg);
}

.header__lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  background-color: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  padding: 6px;
  margin: 0;
  list-style: none;
  z-index: calc(var(--z-header) + 10);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header__lang-menu[hidden] {
  display: none !important;
}

.header__lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-on-surface, #334155);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header__lang-option:hover {
  background-color: var(--color-surface-container-low, #f1f5f9);
  color: var(--color-primary, #d97706);
}

.header__lang-option--active {
  background-color: var(--color-primary-50, #fffbeb);
  color: var(--color-primary, #d97706);
  font-weight: 700;
}

.header__lang-option-flag {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
