/* ============================================================================
   Storefront chrome — dedicated consumer header/footer (base_storefront.html).
   Minimal / refined (Linear/Stripe): hairline borders, no card shadows
   (popovers exempt), weight+size hierarchy, tabular counts, 40px hit areas,
   color-only hover. Scoped under .sfx so it never touches the app shell.
   ========================================================================= */

.sfx-body { background: var(--theme-bg); color: var(--theme-text); }
.sfx { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.sfx-header {
  position: sticky; top: 0; z-index: 50;
  /* De-expressed: opaque header, no translucent backdrop-blur (per-scroll repaint). */
  background: var(--theme-card-bg);
  border-bottom: 1px solid var(--border-subtle);
}
.sfx-bar {
  max-width: 1200px; margin: 0 auto; height: 60px;
  padding: 0 var(--space-5);
  display: flex; align-items: center; gap: var(--space-4);
}

.sfx-burger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: -8px;
  border-radius: var(--radius-md); color: var(--theme-text-secondary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sfx-burger:hover { background: var(--theme-bg-secondary, color-mix(in srgb, var(--theme-text) 6%, transparent)); color: var(--theme-text); }

.sfx-logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; flex-shrink: 0; }
.sfx-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-lg);
  background: var(--theme-text); color: var(--theme-card-bg);
}
.sfx-logo-word {
  font-family: var(--font-family-heading); font-weight: 700; font-size: 16px;
  letter-spacing: -0.02em; color: var(--theme-text);
}

.sfx-nav { display: none; align-items: center; gap: 2px; margin-left: var(--space-3); }
.sfx-nav-link {
  padding: 7px 12px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; color: var(--theme-text-secondary); text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sfx-nav-link:hover { color: var(--theme-text); background: color-mix(in srgb, var(--theme-text) 5%, transparent); }
.sfx-nav-link.is-active { color: var(--theme-text); font-weight: 600; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.sfx-search {
  display: none; align-items: center; gap: 8px; flex: 1; max-width: 460px;
  margin: 0 auto; padding: 0 12px; height: 38px;
  background: var(--theme-bg-secondary, color-mix(in srgb, var(--theme-text) 4%, transparent));
  border: 1px solid var(--border-subtle); border-radius: var(--radius-xl);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.sfx-search:focus-within { border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--border-subtle)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 15%, transparent); }
.sfx-search-icon { color: var(--theme-text-tertiary); flex-shrink: 0; }
.sfx-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 14px; color: var(--theme-text);
}
.sfx-search input::placeholder { color: var(--theme-text-tertiary); }

/* ── Right-side actions ─────────────────────────────────────────────────── */
.sfx-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.sfx-icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-md);
  color: var(--theme-text-secondary); text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sfx-icon-btn:hover { background: color-mix(in srgb, var(--theme-text) 6%, transparent); color: var(--theme-text); }
/* WCAG 2.5.5/2.5.8 — 44px tap area on touch. Same rule the app shell already
   applies to .wm-icon-btn (tailwind.css); the storefront chrome was built later
   and never got it, so the header's menu/wishlist/cart buttons sat at 40x40 on
   mobile — measured in a real 390px viewport. Scoped to coarse pointers so
   desktop density is unchanged; only the hit box grows, the glyph stays centred. */
/* One height per row: the burger shares the phone header row with the icon
   buttons, so it takes the same coarse-pointer size (measured 40 vs 44). */
@media (pointer: coarse) {
  .sfx-icon-btn, .sfx-burger {
    min-height: var(--min-touch-target, 44px);
    min-width: var(--min-touch-target, 44px);
  }
}
.sfx-badge {
  position: absolute; top: 3px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); border: 2px solid var(--theme-card-bg);
  background: var(--brand-primary); color: var(--theme-text-inverted);
  font-size: 10px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}

.sfx-nav, .sfx-search, .sfx-menu, .sfx-wish, .sfx-signin, .sfx-cta { /* hidden on mobile, see media query */ }
.sfx-menu, .sfx-wish, .sfx-signin, .sfx-cta { display: none; }

.sfx-avatar {
  /* 40x40 minimum hit area (UI_DESIGN_RULES §12) — this <button> IS the tap
     target (no larger wrapper), and it's the account-menu trigger. */
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--theme-bg-secondary, color-mix(in srgb, var(--theme-text) 8%, transparent));
  border: 1px solid var(--border-subtle); color: var(--theme-text-secondary);
  font-size: 12px; font-weight: 700;
  transition: border-color var(--transition-fast);
}
.sfx-avatar:hover { border-color: color-mix(in srgb, var(--brand-primary) 50%, var(--border-subtle)); }
.sfx-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sfx-signin {
  padding: 8px 12px; font-size: 14px; font-weight: 500;
  color: var(--theme-text-secondary); text-decoration: none; border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}
.sfx-signin:hover { color: var(--theme-text); background: color-mix(in srgb, var(--theme-text) 5%, transparent); }
.sfx-cta {
  margin-left: 6px; padding: 8px 16px; border-radius: var(--radius-xl);
  font-size: 14px; font-weight: 600; text-decoration: none;
  background: var(--theme-text); color: var(--theme-card-bg);
  transition: opacity var(--transition-fast);
}
.sfx-cta:hover { opacity: 0.88; }

/* ── One height per header row ──────────────────────────────────────────
   Nav link, search field, icon buttons, Sign in, Sign up: every control on
   the desktop header line is 40px tall (measured before: 35 / 40 / 40 / 37 /
   37). Horizontal padding stays per family; the vertical size is the row's. */
.sfx-nav-link, .sfx-signin, .sfx-cta, .sfx-search, .sfx-icon-btn {
  box-sizing: border-box; height: 40px; padding-top: 0; padding-bottom: 0; align-items: center;
}
/* No `display` above: signin/cta/search are display:none until 1024px and the
   media rule below turns them to (inline-)flex. The nav link is a plain <a>
   inside the nav's flex row, so it needs a flex box for the height to apply. */
.sfx-nav-link { display: inline-flex; }

/* ── Popovers (language / account) — shadow-exempt per design rules ─────── */
.sfx-menu { position: relative; }
.sfx-pop {
  position: absolute; top: calc(100% + 8px);
  min-width: 184px; padding: 6px;
  background: var(--theme-card-bg); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-popover);
  list-style: none; z-index: 60;
}
.sfx-pop-right { right: 0; }
.sfx-pop-account { min-width: 232px; }
.sfx-pop-head { padding: 6px 10px 8px; }
.sfx-pop-name { font-size: 14px; font-weight: 600; color: var(--theme-text); }
.sfx-pop-sub { font-size: 12px; color: var(--theme-text-tertiary); }
.sfx-pop-sep { height: 1px; background: var(--border-subtle); margin: 5px 0; }
.sfx-pop-form { margin: 0; }
.sfx-pop-item {
  display: flex; align-items: center; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500; color: var(--theme-text-secondary);
  text-decoration: none; text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sfx-pop-item:hover { background: color-mix(in srgb, var(--theme-text) 6%, transparent); color: var(--theme-text); }
.sfx-pop-item.is-active { color: var(--theme-text); font-weight: 600; }
.sfx-pop-item-danger { color: var(--danger-text); }
.sfx-pop-item-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--danger-text); }

/* ── Mobile drawer (reuses profile_sidebar inside) ──────────────────────── */
.sfx-scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 70; }
.sfx-drawer {
  position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px);
  display: flex; flex-direction: column;
  background: var(--theme-card-bg); border-right: 1px solid var(--border-subtle);
  z-index: 80; overflow-y: auto;
}
/* The drawer head is the wordmark; the sidebar's own brand row would stack a
   second one right under it. */
.sfx-drawer .sidebar-brand { display: none; }
.sfx-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--space-4); border-bottom: 1px solid var(--border-subtle);
}

/* ── Content + footer ───────────────────────────────────────────────────── */
.sfx-main { flex: 1 0 auto; min-width: 0; }
.sfx-footer { border-top: 1px solid var(--border-subtle); margin-top: var(--space-12); }
.sfx-foot-inner {
  max-width: 1200px; margin: 0 auto; padding: var(--space-6) var(--space-5);
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
}
.sfx-foot-brand-col { display: flex; flex-direction: column; gap: 2px; }
.sfx-foot-brand { font-family: var(--font-family-heading); font-weight: 700; font-size: 14px; letter-spacing: -0.02em; color: var(--theme-text); }
.sfx-foot-tag { font-size: 11px; color: var(--theme-text-tertiary); }
.sfx-foot-nav { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.sfx-foot-nav a { font-size: 13px; color: var(--theme-text-secondary); text-decoration: none; transition: color var(--transition-fast); }
.sfx-foot-nav a:hover { color: var(--theme-text); }
.sfx-foot-copy { margin-left: auto; font-size: 12px; color: var(--theme-text-tertiary); font-variant-numeric: tabular-nums; }

/* ── Responsive: desktop reveals nav/search/actions; mobile keeps burger+cart ─ */
@media (min-width: 1024px) {
  .sfx-burger { display: none; }
  .sfx-nav { display: flex; }
  .sfx-search { display: flex; }
  .sfx-menu { display: block; }
  .sfx-wish, .sfx-signin, .sfx-cta { display: inline-flex; }
}
@media (max-width: 1023px) {
  .sfx-foot-copy { margin-left: 0; width: 100%; }
}

/* Optional seller-owned footer, using only populated sections. */
.sfx-store-footer { max-width: 1200px; margin-inline: auto; padding: var(--space-7) var(--space-5) var(--space-5); font-size: var(--wm-type-body); color: var(--theme-text-secondary); }
.sfx-store-footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--space-7); align-items: start; }
.sfx-store-footer-grid > * { min-width: 0; }
.sfx-store-footer :is(a, p, h2, h3) { overflow-wrap: anywhere; }
.sfx-store-footer h2, .sfx-store-footer h3 { font-size: var(--wm-type-section); font-weight: var(--wm-weight-strong); line-height: var(--wm-leading-text); color: var(--theme-text); margin: 0 0 var(--space-3); }
.sfx-store-footer h3 { margin-top: var(--space-4); }
.sfx-store-footer p { margin: 0 0 var(--space-3); line-height: 1.6; }
.sfx-store-footer a { color: inherit; text-decoration: none; }
.sfx-store-footer a:hover { color: var(--theme-text); text-decoration: underline; }
.sfx-store-footer a:focus-visible, .sfx-store-footer summary:focus-visible { outline: 2px solid var(--border-accent); outline-offset: 3px; }
.sfx-store-footer-grid > :is(nav, section) > a:not(.sfx-store-footer-brand) { display: block; width: fit-content; margin-bottom: var(--space-3); }
.sfx-store-footer .sfx-store-footer-brand { display: flex; align-items: center; gap: var(--space-3); color: var(--theme-text); font-weight: var(--wm-weight-strong); margin-bottom: var(--space-3); }
.sfx-store-footer-brand img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; border-radius: var(--radius-md); }
.sfx-store-footer-socials { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.sfx-store-footer details { margin-bottom: var(--space-3); }
.sfx-store-footer summary { cursor: pointer; }
.sfx-store-footer details p { margin-top: var(--space-2); white-space: pre-line; }
.sfx-store-footer-hours { white-space: pre-line; }
.sfx-store-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); border-top: 1px solid var(--border-divider); margin-top: var(--space-6); padding-top: var(--space-4); font-size: var(--wm-type-label); }
@media (max-width: 640px) {
  .sfx-store-footer { padding: var(--space-5) var(--space-4); }
  .sfx-store-footer-grid { gap: var(--space-5); }
  .sfx-store-footer a, .sfx-store-footer summary { min-height: 44px; display: inline-flex; align-items: center; }
}
