/* SOWO Stage13B-R2: structurally isolated desktop navigation and mobile drawer. */

.site-header {
  z-index: 1000;
  padding: 0;
}

.site-header-inner {
  width: min(1320px, calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
}

/* SOWO Stage13B-R4A: continuously widen the Header after the accepted 1440px layout. */
@media (min-width: 1441px) {
  .site-header-inner {
    width: clamp(1320px, calc(80vw + 168px), calc(100% - 32px));
  }
}

.site-header.has-language-menu-open {
  z-index: 1100;
}

.baseline-language-switcher-menu {
  z-index: 1110;
}

.mobile-nav-backdrop,
.mobile-nav-drawer {
  display: none;
}

@media (min-width: 1340px) {
  :root {
    --header-height: 74px;
  }

  .site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(14px, 1.8vw, 28px);
  }

  .site-header .brand {
    flex: 0 0 auto;
  }

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

  .site-header .site-nav {
    position: static !important;
    display: flex !important;
    flex: 0 1 auto;
    grid-template-columns: none !important;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 1.35vw, 20px);
    min-width: 0;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    visibility: visible !important;
  }

  .site-header .site-nav > a,
  .site-header .site-nav > .nav-products > .nav-products-link {
    width: auto;
    height: 42px;
    flex: 0 0 auto;
    padding-inline: clamp(4px, 0.65vw, 10px);
  }

  .site-header .nav-products {
    position: static;
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .site-header .nav-products::before {
    content: none !important;
    display: none !important;
    clip-path: none !important;
    border: 0 !important;
  }

  .site-header .nav-products::after {
    content: "";
    position: fixed;
    z-index: 1009;
    top: calc(var(--header-height) - 22px);
    right: 0;
    left: 0;
    width: auto;
    height: 22px;
    border: 0;
    clip-path: none;
    background: transparent;
    pointer-events: none;
  }

  .site-header .nav-products:hover::after,
  .site-header .nav-products:focus-within::after,
  .site-header .nav-products.is-menu-open::after {
    pointer-events: auto;
  }

  .site-header .nav-products-link {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }

  .site-header .products-menu {
    position: fixed !important;
    z-index: 1010 !important;
    top: var(--header-height) !important;
    right: auto !important;
    left: 50% !important;
    display: block !important;
    width: min(1080px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100svh - var(--header-height) - 16px) !important;
    margin: 0 !important;
    padding: 16px !important;
    border: 1px solid rgba(215, 204, 186, 0.76) !important;
    border-radius: var(--radius) !important;
    background: linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(246, 240, 229, 0.98)) !important;
    box-shadow: 0 22px 52px rgba(37, 35, 31, 0.14) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    clip-path: none !important;
    transform: translate(-50%, 8px) !important;
  }

  .site-header .products-menu::before,
  .site-header .products-menu::after {
    content: none !important;
    display: none !important;
    clip-path: none !important;
    border: 0 !important;
  }

  .site-header .nav-products:hover .products-menu,
  .site-header .nav-products:focus-within .products-menu,
  .site-header .nav-products.is-menu-open .products-menu {
    max-height: calc(100svh - var(--header-height) - 16px) !important;
    margin: 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translate(-50%, 0) !important;
    visibility: visible !important;
  }

  .site-header .products-menu-body {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 235px !important;
  }

  .site-header .products-menu-header {
    padding: 0 2px 13px !important;
    border-bottom: 1px solid rgba(215, 204, 186, 0.68) !important;
    font-size: 0.79rem !important;
  }

  .site-header .products-menu-view-all {
    height: 28px !important;
    padding: 0 10px !important;
    font-size: 0.78rem !important;
  }

  .site-header .products-menu-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .site-header .products-menu-group-toggle {
    position: static !important;
    min-height: 30px !important;
    padding: 0 0 7px !important;
    pointer-events: none !important;
  }

  .site-header .products-menu-group {
    padding: 2px 2px 0 !important;
    border-bottom: 0 !important;
  }

  .site-header .products-menu-group-toggle::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
  }

  .site-header .products-menu-list,
  .site-header .products-menu-group.is-section-open .products-menu-list {
    display: grid !important;
    max-height: none !important;
    padding: 7px 0 0 !important;
    overflow: visible !important;
  }

  .site-header .products-menu-feature {
    display: grid !important;
  }

  .site-header .products-menu-link {
    min-height: 29px !important;
    padding: 5px 8px !important;
    font-size: 0.875rem !important;
  }

  .baseline-language-switcher {
    width: 120px;
    min-width: 120px;
  }

  .baseline-language-switcher-toggle {
    width: 120px;
  }
}

@media (max-width: 1339px) {
  :root {
    --header-height: 66px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  html.nav-open,
  body.nav-open {
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  .site-header {
    height: var(--header-height);
    padding: 0 !important;
  }

  .site-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px 44px;
    grid-template-areas: "brand language toggle";
    align-items: center;
    gap: 10px;
  }

  .site-header .brand {
    grid-area: brand;
    min-width: 0;
    overflow: hidden;
  }

  .site-header .brand small {
    display: none;
  }

  .site-header .brand-logo,
  .site-header .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .site-header .nav-toggle {
    position: static !important;
    grid-area: toggle;
    display: block !important;
    width: 44px;
    height: 44px;
    margin: 0;
  }

  .site-header .site-nav {
    display: none !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    clip-path: none !important;
    transform: none !important;
  }

  .site-header .site-nav .nav-products,
  .site-header .site-nav .products-menu,
  .site-header .site-nav .products-menu-body,
  .site-header .site-nav .products-menu-grid,
  .site-header .site-nav .products-menu-list {
    position: static !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: visible !important;
    clip-path: none !important;
    transform: none !important;
  }

  .site-header .site-nav .nav-products::before,
  .site-header .site-nav .nav-products::after,
  .site-header .site-nav .products-menu::before,
  .site-header .site-nav .products-menu::after,
  .site-header .site-nav .products-menu-group-toggle::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    border: 0 !important;
    clip-path: none !important;
    transform: none !important;
  }

  .baseline-language-switcher {
    grid-area: language;
    width: 64px;
    min-width: 64px;
  }

  .baseline-language-switcher-toggle {
    width: 64px;
    min-width: 64px;
    padding-inline: 7px;
  }

  .baseline-language-switcher-short {
    display: inline;
  }

  .baseline-language-switcher-full {
    display: none;
  }

  .baseline-language-switcher-menu,
  html[lang="ar"][dir="rtl"] .baseline-language-switcher-menu {
    z-index: 1110;
    top: calc(var(--header-height) + 8px);
    right: 12px;
    left: 12px;
  }

  .mobile-nav-backdrop {
    position: fixed;
    z-index: 1990;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(18, 21, 19, 0.48);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  .mobile-nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-nav-drawer {
    position: fixed;
    z-index: 2000;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    display: flex;
    width: min(88vw, 380px);
    max-width: 100%;
    flex-direction: column;
    overflow: hidden;
    border: 0;
    background: var(--surface);
    box-shadow: -22px 0 58px rgba(18, 21, 19, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 200ms ease, opacity 160ms ease, visibility 200ms ease;
  }

  .mobile-nav-drawer.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-nav-drawer-header {
    display: flex;
    min-height: var(--header-height);
    flex: 0 0 var(--header-height);
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 14px 0 16px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-drawer-brand.brand {
    min-width: 0;
    gap: 10px;
  }

  .mobile-drawer-brand.brand small {
    display: block;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-close {
    position: relative;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
  }

  .mobile-nav-close::before,
  .mobile-nav-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    border: 0;
    background: currentColor;
  }

  .mobile-nav-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .mobile-nav-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .mobile-nav-scroll {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 14px 28px;
    scrollbar-gutter: stable;
  }

  .mobile-nav-list {
    display: grid;
    gap: 2px;
  }

  .mobile-nav-link,
  .mobile-products-toggle {
    position: static;
    display: flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    font-size: 0.98rem;
    font-weight: 760;
    line-height: 1.3;
    text-align: start;
    white-space: normal;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link:focus-visible,
  .mobile-nav-link.is-active,
  .mobile-products-toggle:hover,
  .mobile-products-toggle:focus-visible,
  .mobile-products-toggle[aria-expanded="true"] {
    background: #eee5d6;
    color: var(--ink);
  }

  .mobile-products-arrow {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    margin-inline-start: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transform-origin: 50% 50%;
    transition: transform 160ms ease;
  }

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

  .mobile-products-panel {
    position: static;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 4px 0 8px 18px;
    overflow: visible;
  }

  html[dir="rtl"] .mobile-products-panel {
    padding-right: 18px;
    padding-left: 0;
  }

  .mobile-products-panel[hidden] {
    display: none;
  }

  .mobile-products-panel .mobile-nav-link {
    min-height: 46px;
    padding-inline: 14px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 680;
  }

  .mobile-products-view-all {
    color: var(--khaki-dark) !important;
  }
}

@media (max-width: 400px) {
  .site-header-inner {
    width: calc(100% - 20px);
    grid-template-columns: minmax(0, 1fr) 60px 42px;
    gap: 7px;
  }

  .site-header .brand {
    gap: 7px;
  }

  .site-header .brand-logo,
  .site-header .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .baseline-language-switcher,
  .baseline-language-switcher-toggle {
    width: 60px;
    min-width: 60px;
  }

  .site-header .nav-toggle {
    width: 42px;
    height: 42px;
  }

  .mobile-nav-drawer-header {
    padding-inline: 12px;
  }

  .mobile-drawer-brand.brand small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-backdrop,
  .mobile-nav-drawer,
  .mobile-products-arrow {
    transition: none;
  }
}

/* SOWO Stage13B-R4: implemented Header right-side Navigation + Language group. */

/* On mobile, keep the R2 grid contract while retaining the semantic wrapper. */
.header-actions {
  display: contents;
}

@media (min-width: 1340px) {
  .site-header-inner {
    justify-content: flex-start;
    gap: 0;
  }

  .header-actions {
    display: flex;
    flex: 0 0 auto;
    min-width: 0;
    align-items: center;
    gap: 28px;
    margin-inline-start: auto;
  }

  .header-actions > .site-nav {
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .header-actions > .baseline-language-switcher {
    flex: 0 0 120px;
    width: 120px;
    min-width: 120px;
    margin: 0;
  }

  .header-actions > .baseline-language-switcher > .baseline-language-switcher-toggle {
    width: 120px;
    min-width: 120px;
  }

  .site-header .site-nav > a:hover,
  .site-header .site-nav > a:focus-visible,
  .site-header .site-nav > .nav-products > .nav-products-link:hover,
  .site-header .site-nav > .nav-products > .nav-products-link:focus-visible {
    background-color: rgba(238, 229, 214, 0.42);
    color: var(--ink);
  }

  .site-header .site-nav > a.is-active,
  .site-header .site-nav > .nav-products > .nav-products-link.is-active {
    background-color: transparent;
    background-image: linear-gradient(#b79a67, #b79a67);
    background-repeat: no-repeat;
    background-position: center calc(100% - 5px);
    background-size: calc(100% - 20px) 2px;
    color: var(--forest);
  }

  .site-header .site-nav > a.is-active:hover,
  .site-header .site-nav > a.is-active:focus-visible,
  .site-header .site-nav > .nav-products > .nav-products-link.is-active:hover,
  .site-header .site-nav > .nav-products > .nav-products-link.is-active:focus-visible {
    background-color: rgba(238, 229, 214, 0.22);
    color: var(--forest);
  }
}


/* SOWO Stage15R1: Factory Updates nav capacity and compact centered language menu. */
@media (min-width: 1340px) {
  .header-actions {
    gap: 24px;
  }

  .site-header .site-nav {
    gap: 0 !important;
  }

  .site-header .site-nav > a,
  .site-header .site-nav > .nav-products > .nav-products-link {
    padding-inline: 10px !important;
    font-size: 0.875rem !important;
  }
}

.baseline-language-switcher-menu,
html[lang="ar"][dir="rtl"] .baseline-language-switcher-menu {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: auto !important;
  left: auto !important;
  inset-inline-start: auto !important;
  inset-inline-end: 0 !important;
  width: 252px !important;
  inline-size: 252px !important;
  min-width: 0 !important;
  max-width: calc(100vw - 24px) !important;
  max-inline-size: calc(100vw - 24px) !important;
  overflow-x: hidden !important;
}

.baseline-language-switcher-menu .language-option {
  position: relative;
  display: grid !important;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  justify-content: normal !important;
  gap: 0 !important;
  min-height: 42px;
  padding: 8px 12px !important;
  text-align: center;
}

.baseline-language-switcher-menu .language-option__label {
  grid-column: 2;
  display: block;
  width: 100%;
  justify-self: center;
  text-align: center;
  white-space: nowrap;
}

.baseline-language-switcher-menu .language-option__check {
  grid-column: 3;
  display: block;
  min-width: 0;
  justify-self: end;
  color: var(--forest);
  font-weight: 900;
  line-height: 1;
}

.baseline-language-switcher-menu .language-option[aria-current="page"]::after {
  content: none !important;
  display: none !important;
}

@media (max-width: 1339px) {
  .baseline-language-switcher-menu,
  html[lang="ar"][dir="rtl"] .baseline-language-switcher-menu {
    width: min(252px, calc(100vw - 24px)) !important;
    inline-size: min(252px, calc(100vw - 24px)) !important;
  }
}

/* SOWO Stage15R2: desktop navigation rhythm and type scale. */
@media (min-width: 1340px) {
  :root {
    --header-height: 70px;
  }

  .site-header,
  .site-header-inner {
    height: var(--header-height);
    min-height: var(--header-height);
  }

  .site-header-inner,
  .header-actions,
  .site-header .site-nav,
  .site-header .brand,
  .baseline-language-switcher,
  .baseline-language-switcher-toggle {
    align-items: center;
  }

  .header-actions {
    gap: 28px;
  }

  .site-header .site-nav {
    gap: 0 !important;
  }

  .site-header .site-nav > a,
  .site-header .site-nav > .nav-products > .nav-products-link {
    height: 42px;
    padding-inline: 11px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
  }

  html[lang="es"] .site-header .site-nav > a,
  html[lang="es"] .site-header .site-nav > .nav-products > .nav-products-link,
  html[lang="fr"] .site-header .site-nav > a,
  html[lang="fr"] .site-header .site-nav > .nav-products > .nav-products-link,
  html[lang="ar"] .site-header .site-nav > a,
  html[lang="ar"] .site-header .site-nav > .nav-products > .nav-products-link {
    padding-inline: 10.5px !important;
  }

  html[lang="zh-CN"] .site-header .site-nav > a,
  html[lang="zh-CN"] .site-header .site-nav > .nav-products > .nav-products-link,
  html[lang="zh-TW"] .site-header .site-nav > a,
  html[lang="zh-TW"] .site-header .site-nav > .nav-products > .nav-products-link {
    padding-inline: 12px !important;
  }

  .site-header .nav-products-link {
    gap: 5px !important;
  }

  .site-header .nav-products-link::after {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    opacity: 0.65;
  }

  .site-header .site-nav > a.is-active,
  .site-header .site-nav > .nav-products > .nav-products-link.is-active {
    background-color: transparent !important;
    background-position: center calc(100% - 1px);
    background-size: calc(100% - 22px) 2px;
    color: var(--forest);
    font-weight: 600 !important;
  }
}

/* SOWO Stage15R2: approved desktop navigation weight. */
@media (min-width: 1340px) {
  .primary-navigation .nav-link,
  .site-header .site-nav > a,
  .site-header .site-nav > .nav-products > .nav-products-link,
  .site-header .site-nav > a.is-active,
  .site-header .site-nav > .nav-products > .nav-products-link.is-active {
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  .baseline-language-switcher-toggle,
  .baseline-language-switcher-full,
  .baseline-language-switcher-short {
    font-weight: 600 !important;
  }
}

.baseline-language-switcher-toggle,
.baseline-language-switcher-full,
.baseline-language-switcher-short {
  font-weight: 600 !important;
}
