/* ============================================================================
   Leif — SHARED site chrome for the "Editorial / Navy" theme
   ----------------------------------------------------------------------------
   The header cluster, category sub-nav, and footer are the SAME on every page,
   so their theme rules live here once instead of being copied into each page's
   theme-<page>.css. Load order on a themed page:

       ../styles/theme.css          (tokens · base · product cards · buttons)
       ../styles/theme-chrome.css   (THIS FILE — header · nav · footer)
       ./theme-<page>.css           (only that page's unique surfaces)

   The homepage does NOT load this file — it keeps its self-contained
   homepage/theme-editorial.css (identical rules inline). This file is the
   generic extract of that chrome for every OTHER page.

   All rules scoped under `.ed-theme` (applied to <html> by utils/theme-boot.js),
   so with the flag off they go inert and the page's original chrome shows.
   ============================================================================ */

/* =========================================================
   Header — white surface, bottom border. Logo + nav (left),
   centered search, icon actions + avatar (right). Fixed height
   so a sticky sub-nav can lock right beneath it.
   ========================================================= */
.ed-theme .ed-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  height: 68px;
  padding: 10px 24px;
  background: var(--leif-surface);
  border-bottom: 1px solid var(--leif-border);
  backdrop-filter: none;
  color: var(--leif-text);
  flex-wrap: nowrap;
}

.ed-theme .ed-header-left {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}
.ed-theme .ed-header .brand-logo {
  height: 48px;
  max-width: 164px;
  filter: none;
}

/* Primary nav — inactive secondary, active text with a green underline. */
.ed-theme .ed-nav { display: inline-flex; align-items: center; gap: 20px; }
.ed-theme .ed-nav-link {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  color: var(--leif-text-secondary);
  text-decoration: none;
  padding: 4px 0;
  white-space: nowrap;
}
.ed-theme .ed-nav-link:hover { color: var(--leif-action-clay); }
.ed-theme .ed-nav-link--active { color: var(--leif-text); }
.ed-theme .ed-nav-link--active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--leif-action-clay);
  border-radius: 2px;
}

/* Center search cell. Scope to the compact (non-expanded) state ONLY — the
   expanded search is a fixed popup styled by the page's own CSS. */
.ed-theme .ed-header .header-search:not(.expanded) {
  grid-column: 2;
  margin: 0 auto;
  width: 100%;
  max-width: 440px;
  height: 40px;
  background: var(--leif-canvas);
  border: 1px solid var(--leif-border);
  border-radius: 10px;
}
.ed-theme .ed-header .header-search-icon { color: var(--leif-text-muted); }
.ed-theme .ed-header .header-search-input { color: var(--leif-text); font-weight: 400; }
.ed-theme .ed-header .header-search-input::placeholder { color: var(--leif-text-muted); }
.ed-theme .header-search.expanded { border-color: var(--leif-border); }
.ed-theme .header-search.expanded .header-search-submit { background: var(--leif-action-clay); }
.ed-theme .header-search.expanded .header-search-submit:hover { background: var(--leif-action-clay-dark); }
.ed-theme .header-search.expanded .header-search-cancel { color: var(--leif-action-clay); font-weight: 500; }

/* Right actions cluster */
.ed-theme .ed-actions {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Small icon buttons (feedback / help / cart) */
.ed-theme .ed-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--leif-text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.ed-theme .ed-icon-btn:hover { background: var(--leif-canvas); color: var(--leif-text); }
.ed-theme .ed-icon-btn svg { width: 22px; height: 22px; }
.ed-theme .ed-icon-btn .cart-count {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--leif-badge-red);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}
/* The base .btn label spans inside repurposed icon buttons are hidden in theme. */
.ed-theme .ed-icon-btn .cart-label,
.ed-theme .ed-icon-btn .btn-label-full,
.ed-theme .ed-icon-btn .btn-label-short { display: none; }

/* Avatar + dropdown menu */
.ed-theme .ed-avatar-wrap { position: relative; }
.ed-theme .ed-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--leif-border);
  border-radius: 50%;
  background: var(--leif-canvas);
  color: var(--leif-text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.ed-theme .ed-avatar svg { width: 22px; height: 22px; }
.ed-theme .ed-avatar:hover { border-color: var(--leif-text-muted); color: var(--leif-text); }
/* Baseline hide (unscoped): keeps the dropdown collapsed even when the theme
   flag is OFF, so ?theme=legacy on a restructured page never floats it open.
   The themed .open rule below out-specifies this to reveal it in editorial mode. */
.ed-avatar-menu { display: none; }
.ed-theme .ed-avatar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--leif-surface);
  border: 1px solid var(--leif-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  padding: 6px;
  display: none;
  z-index: 1200;
}
.ed-theme .ed-avatar-menu.open { display: block; }
.ed-theme .ed-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--leif-text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.ed-theme .ed-menu-item:hover { background: var(--leif-canvas); }
.ed-theme .ed-menu-divider { height: 1px; background: var(--leif-border); margin: 6px 4px; }
.ed-theme .ed-menu-score .score-mode__label { font-size: 14px; color: var(--leif-text); }

/* Mobile overflow button (visible <=880px via the page's base CSS) recolored */
.ed-theme .mobile-menu-btn.btn-secondary { color: var(--leif-text-secondary); }
.ed-theme .mobile-menu-btn.btn-secondary:hover { color: var(--leif-text); }

/* =========================================================
   Category sub-nav — locked under the header (sticky at the
   header's fixed height). Icon-over-label tabs where present;
   text-only nav links (e.g. category page) center gracefully.
   ========================================================= */
.ed-theme .category-nav {
  background: var(--leif-surface);
  border-bottom: 1px solid var(--leif-border);
  position: sticky;
  top: 68px;               /* = header height */
  z-index: 999;            /* just under the header */
}
.ed-theme .category-nav-inner { align-items: stretch; gap: 22px; }
.ed-theme .category-nav-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 12px 7px;
  color: var(--leif-text-secondary);
  font-weight: 400;
  border-bottom: 2px solid transparent;
}
.ed-theme .cat-nav-icon { width: 22px; height: 22px; color: var(--leif-text-muted); display: block; flex-shrink: 0; }
.ed-theme .cat-nav-label { font-size: 12px; line-height: 1; white-space: nowrap; }
.ed-theme .category-nav-link:hover { color: var(--leif-text); }
.ed-theme .category-nav-link:hover .cat-nav-icon { color: var(--leif-green-deep); }
.ed-theme .category-nav-link.active {
  color: var(--leif-text);
  font-weight: 500;
  border-bottom-color: var(--leif-green-deep);   /* 2px active underline (navy) */
}
.ed-theme .category-nav-link.active .cat-nav-icon { color: var(--leif-green-deep); }

/* =========================================================
   Footer — navy surface, light text, columns + bottom row.
   Works whether the markup carries the ed-footer-* helper
   classes (restructured pages) or just the base footer classes.
   ========================================================= */
.ed-theme .ed-footer,
.ed-theme .site-footer { background: var(--leif-ink); margin-top: 0; }
.ed-theme .ed-footer-inner,
.ed-theme .site-footer .footer-inner {
  display: flex;
  gap: 60px;
  align-items: flex-start;
  padding: 48px 40px 28px;
}
.ed-theme .site-footer .footer-tagline { color: rgba(255,255,255,0.62); font-weight: 400; }
.ed-theme .ed-footer-columns,
.ed-theme .site-footer .footer-columns { gap: 48px; }
.ed-theme .site-footer .footer-col-title {
  color: #fff;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.4px;
}
.ed-theme .site-footer .footer-links a { color: rgba(255,255,255,0.62); font-weight: 400; }
.ed-theme .site-footer .footer-links a:hover { color: #fff; }

.ed-theme .ed-footer-bottom,
.ed-theme .site-footer .footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding: 18px 40px 26px; text-align: left; }
.ed-theme .site-footer .affiliate-disclosure { color: rgba(255,255,255,0.5); font-weight: 400; }
.ed-theme .site-footer .footer-bottom > p:not(.affiliate-disclosure) { color: rgba(255,255,255,0.55); font-size: 13px; }
.ed-theme .ed-footer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.ed-theme .ed-copyright { color: rgba(255,255,255,0.55); font-size: 13px; margin: 0; }
.ed-theme .ed-copyright a { color: rgba(255,255,255,0.72); text-decoration: none; }
.ed-theme .ed-copyright a:hover { color: #fff; text-decoration: underline; }
.ed-theme .ed-footer-socials { display: inline-flex; gap: 10px; }
.ed-theme .ed-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  transition: background 0.15s ease, color 0.15s ease;
}
.ed-theme .ed-social:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* =========================================================
   Responsive — header folds to one row; footer stacks.
   ========================================================= */
@media (max-width: 880px) {
  .ed-theme .ed-header { grid-template-columns: auto 1fr auto; gap: 10px; padding: 8px 14px; }
  .ed-theme .ed-nav { display: none; }              /* primary nav folds into the mobile menu */
  .ed-theme .ed-header .brand-logo { height: 30px; max-width: 84px; }
  .ed-theme .ed-header-left { gap: 0; }
  .ed-theme .ed-header .header-search:not(.expanded) {
    grid-column: 2; grid-row: 1; margin: 0; max-width: none; height: 38px;
  }
  .ed-theme .ed-actions { grid-column: 3; grid-row: 1; }
  .ed-theme .ed-avatar-wrap,
  .ed-theme .ed-icon-btn { display: none; }         /* fold into mobile menu */
  .ed-theme .ed-footer-inner,
  .ed-theme .site-footer .footer-inner { flex-direction: column; gap: 28px; padding: 32px 20px 24px; }
  .ed-theme .ed-footer-bottom,
  .ed-theme .site-footer .footer-bottom { padding: 18px 20px 24px; }
}
