/* The registry-driven site menu (services/site_menu.py render_header, assets/site-menu.js).
   Without JavaScript the panels open on :hover and :focus-within; once site-menu.js runs it adds
   .sm-ready and opens them with .is-open instead (hover delays, click, keyboard, touch). */
.sm-header {
  position: sticky; top: 0; z-index: 30; width: 100%; align-self: stretch; box-sizing: border-box; text-align: left;
  font-family: "Manrope", "Segoe UI", sans-serif; line-height: 1.4;
  background: rgba(242, 239, 230, 0.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line, #ddd2bd);
}
/* On a page without a header of its own (the not-found page): at the top, out of the page's flow. */
.sm-header.sm-header-top { position: absolute; top: 0; left: 0; right: 0; }
.sm-header *, .sm-header *::before, .sm-header *::after { box-sizing: border-box; }
:where(.sm-header) :where(ul, p) { margin: 0; padding: 0; }  /* zero specificity: the rules below win */
.sm-bar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px max(24px, calc((100vw - 1440px) / 2)); min-height: 64px;
}
.sm-logo { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; color: var(--text, #111b36); text-decoration: none; white-space: nowrap; }
.sm-nav { display: flex; align-items: center; flex: 1; min-width: 0; gap: 16px; }
.sm-list { list-style: none; margin: 0 auto; padding: 0; display: flex; align-items: center; gap: 6px; }
.sm-item { position: relative; }
.sm-top { display: flex; align-items: center; border-radius: 999px; }
.sm-top-link {
  color: var(--muted, #5c6478); text-decoration: none; font-size: 15px; font-weight: 700;
  padding: 10px 2px 10px 12px; border-radius: 999px; white-space: nowrap;
}
.sm-top-link:hover, .sm-item.is-open .sm-top-link, .sm-top-link[aria-current] { color: var(--text, #111b36); }
.sm-top-link[aria-current="true"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.sm-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 36px;
  border: 0; background: transparent; color: var(--muted, #5c6478); cursor: pointer; border-radius: 999px; padding: 0;
}
.sm-toggle:hover { color: var(--text, #111b36); }
.sm-header a, .sm-header button { -webkit-tap-highlight-color: transparent; }
.sm-chevron { display: block; }
.sm-item.is-open .sm-chevron { transform: rotate(180deg); }
.sm-cta { margin-left: auto; }
.sm-signin {
  display: inline-flex; align-items: center; background: var(--brand, #0f172a); color: #fff; text-decoration: none;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap;
}
.sm-signin:hover { background: #16213f; }
/* The signed-in profile menu that assets/nav-active.js puts in .sm-cta (same as in the old header). */
.sm-cta .btn-apple, .sm-cta .user-pill {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 0; background: var(--brand, #0f172a); color: #fff; font: inherit;
  font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.sm-burger { display: none; }

/* Panels */
.sm-panel {
  display: none; position: absolute; top: 100%; left: 0; z-index: 40; padding-top: 10px;
  max-width: calc(100vw - 32px);
}
.sm-panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; } /* hover bridge */
.sm-panel-inner {
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  padding: 18px; min-width: 320px;
}
.sm-panel-products .sm-panel-inner { width: 560px; }
.sm-panel-grid .sm-panel-inner { width: 620px; }
.sm-panel-cards .sm-panel-inner { width: 520px; }
.sm-panel-groups .sm-panel-inner { width: 600px; }
.sm-panel-inner, .sm-panel-inner * { max-width: 100%; }
.sm-header:not(.sm-ready) .sm-item:hover > .sm-panel,
.sm-header:not(.sm-ready) .sm-item:focus-within > .sm-panel,
.sm-item.is-open > .sm-panel { display: block; }

.sm-desc { display: block; color: var(--muted, #5c6478); font-size: 13px; line-height: 1.45; font-weight: 500; }
.sm-link { color: var(--text, #111b36); text-decoration: none; font-weight: 600; font-size: 14px; }
.sm-link:hover { text-decoration: underline; }
.sm-link-strong { font-weight: 800; font-size: 15px; }
.sm-sublist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.sm-sublist .sm-link { display: block; padding: 6px 0; }
.sm-tag {
  display: inline-block; margin-left: 8px; vertical-align: middle; font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: #d1fae5; color: #065f46;
}
.sm-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sm-product { padding: 12px; border-radius: 14px; background: #faf8f2; }
.sm-product-title { margin: 0 0 4px; }
.sm-product .sm-desc { margin-bottom: 4px; }
.sm-sublist { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
.sm-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sm-tool { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 12px; text-decoration: none; color: inherit; }
.sm-tool:hover { background: #f6f3ea; }
.sm-tile {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; background: var(--sm-tile-bg, #0f172a); color: var(--sm-tile-fg, #fff);
}
.sm-tool-text { min-width: 0; }
.sm-tool-name { display: block; font-weight: 800; font-size: 14px; color: var(--text, #111b36); margin-bottom: 2px; }
.sm-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sm-card { display: block; height: 100%; padding: 14px; border: 1px solid var(--line, #ddd2bd); border-radius: 14px; text-decoration: none; color: inherit; }
.sm-card:hover { border-color: #b9a77c; background: #faf8f2; }
.sm-card-title { display: block; font-weight: 800; font-size: 15px; color: var(--text, #111b36); margin-bottom: 4px; }
.sm-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.sm-group-title { margin: 0; }
.sm-groups .sm-sublist { grid-template-columns: minmax(0, 1fr); }
.sm-see-all {
  display: flex; align-items: center; gap: 6px; margin-top: 14px; padding: 12px 4px 2px; border-top: 1px solid #eee7d8;
  color: var(--text, #111b36); font-weight: 800; font-size: 14px; text-decoration: none;
}
.sm-see-all:hover { text-decoration: underline; }
.sm-panel-inner > .sm-see-all:first-child { margin-top: 0; border-top: 0; padding-top: 2px; }

/* Visible focus */
.sm-header a:focus-visible, .sm-header button:focus-visible { outline: 3px solid #3730a3; outline-offset: 2px; border-radius: 8px; }

@media (prefers-reduced-motion: no-preference) {
  .sm-chevron { transition: transform 0.18s ease; }
  .sm-item.is-open > .sm-panel { animation: sm-in 0.16s ease-out; }
  @keyframes sm-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}

/* Mobile: an accordion (up to 900px) */
@media (max-width: 900px) {
  .sm-bar { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .sm-burger {
    display: inline-flex; align-items: center; gap: 8px; margin-left: auto; min-height: 48px; padding: 0 14px;
    border: 1px solid var(--line, #ddd2bd); border-radius: 999px; background: #fff; color: var(--text, #111b36);
    font: inherit; font-weight: 700; cursor: pointer;
  }
  .sm-burger-lines, .sm-burger-lines::before, .sm-burger-lines::after {
    display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
  }
  .sm-burger-lines::before, .sm-burger-lines::after { content: ""; position: absolute; left: 0; }
  .sm-burger-lines::before { top: -6px; }
  .sm-burger-lines::after { top: 6px; }
  .sm-nav { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 12px; }
  /* Collapsed from the first paint (no layout shift when the script runs). Without JavaScript, focusing
     the Menu button (or anything in the menu) shows it. */
  .sm-header:not(.is-nav-open) .sm-nav { display: none; }
  .sm-header:not(.sm-ready):focus-within .sm-nav { display: flex; }
  .sm-header.is-nav-open .sm-nav { max-height: calc(100vh - 72px); overflow-y: auto; overscroll-behavior: contain; }
  .sm-list { flex-direction: column; align-items: stretch; margin: 0; gap: 0; }
  .sm-item { border-bottom: 1px solid var(--line, #ddd2bd); }
  .sm-top { justify-content: space-between; }
  .sm-top-link { flex: 1; display: flex; align-items: center; min-height: 48px; padding: 0 4px; font-size: 16px; }
  .sm-toggle { width: 48px; height: 48px; }
  .sm-panel { position: static; padding: 0 0 12px; max-width: none; }
  .sm-panel::before { display: none; }
  .sm-panel-inner, .sm-panel-products .sm-panel-inner, .sm-panel-grid .sm-panel-inner,
  .sm-panel-cards .sm-panel-inner, .sm-panel-groups .sm-panel-inner {
    width: auto; min-width: 0; box-shadow: none; border-radius: 14px; padding: 12px;
  }
  .sm-products, .sm-grid, .sm-cards, .sm-groups { grid-template-columns: minmax(0, 1fr); }
  .sm-link, .sm-tool, .sm-card, .sm-see-all { min-height: 48px; }
  .sm-sublist .sm-link { display: flex; align-items: center; padding: 0; }
  .sm-product-title .sm-link, .sm-group-title .sm-link { display: inline-flex; align-items: center; min-height: 48px; }
  .sm-see-all { padding-top: 0; }
  .sm-cta { margin: 16px 0 0; }
  .sm-signin, .sm-cta .btn-apple, .sm-cta .user-pill { display: flex; justify-content: center; min-height: 48px; width: 100%; font-size: 15px; }
  .sm-cta .nav-user-dropdown { display: block; }
  .sm-cta .nav-user-menu { position: static; margin-top: 8px; box-shadow: none; }
}
@media (max-width: 420px) {
  .sm-sublist { grid-template-columns: minmax(0, 1fr); }
}
