/* Shared Moji Debate Academy header. Loaded by the page (reserves the sticky bar before JS runs) and again inside the
   header's shadow root by moji-header.js (the rules below), so page CSS cannot restyle the header. Visual copy of app/components/Header.jsx + forHeader/Navbar.jsx
   (the Tournament Tracker header). Every value is literal so no host-page theme or token can change it.
   Mounted by moji-header.js; edit this file and the Academy components together. */
header[data-moji-header], :host { display: block; position: sticky; top: 0; z-index: 50; min-height: 69px; background: #0d1257; }
/* A service product bar (slot="sub") scrolls away with the page; the service pins its own bar if it wants one. */
header[data-moji-header]:has(> [slot="sub"]) { position: relative; }
.moji-header { background: #0d1257; color: #fff;
  font: 400 16px/24px Inter, "Inter Fallback", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.moji-header *, .moji-header *::before, .moji-header *::after { box-sizing: border-box; }
.moji-header :where(a, button) { font: inherit; letter-spacing: normal; text-transform: none; text-decoration: none; cursor: pointer; }
.moji-header ul { list-style: none; margin: 0; padding: 0; }
.moji-header p { margin: 0; }
.moji-header svg { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.moji-header :focus-visible { outline: 2px solid #9ea4ff; outline-offset: 2px; }
.moji-header [hidden] { display: none !important; }
.mh-desktop { border-bottom: 1px solid rgba(255, 255, 255, .1); }
.mh-mobile { display: none; }
.mh-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1280px; margin: 0 auto; padding: 12px 16px; }
.mh-logo { display: flex; align-items: center; flex: none; }
.mh-logo img { display: block; width: auto; height: 44px; }
.mh-nav { flex: none; }
.mh-actions { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 12px; }

/* Top-level items */
.mh-nav > nav > ul { display: flex; align-items: center; gap: 4px; font-size: 15px; }
@media (min-width: 1280px) { .mh-nav > nav > ul { gap: 12px; font-size: 16px; } }
.mh-nav > nav > ul > li { position: relative; }
.mh-top { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 0; border-radius: 8px;
  background: transparent; color: rgba(255, 255, 255, .8); font-weight: 600; text-align: left; white-space: nowrap; transition: background-color .15s, color .15s; }
.mh-top:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.mh-top[aria-expanded="true"], .mh-top[data-active] { background: rgba(255, 255, 255, .15); color: #fff; }
.mh-label-text { position: relative; }
.mh-top[data-current] .mh-label-text::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; border-radius: 9999px; background: #ff6b76; }
.mh-top svg.mh-chev { width: 16px; height: 16px; transition: transform .15s; }
.mh-top[aria-expanded="true"] svg.mh-chev { transform: rotate(180deg); }

/* Dropdown and mega menu */
.mh-menu { position: absolute; left: 0; top: 100%; margin-top: 8px; width: 240px; padding: 8px; border: 1px solid #f3f4f6; border-radius: 12px;
  background: #fff; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1); }
.mh-menu[data-mega] { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; width: 30rem; }
.mh-menu[hidden] { display: none; }
.mh-label { padding: 8px 16px 4px; color: #6b7280; font-size: 12px; font-weight: 600; line-height: 16px; }
.mh-menu li + li, .mh-sublist li + li { margin-top: 4px; }
.mh-item { display: flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 8px; color: #374151; font-size: 14px; font-weight: 500; line-height: 20px; }
.mh-item:hover { background: #f9fafb; color: #0d1257; }
.mh-item[aria-current="page"] { background: #f5f6ff; color: #0d1257; }
.mh-item:focus-visible { outline-color: #0d1257; }

/* Account */
.mh-login { display: inline-flex; align-items: center; padding: 8px 16px; border: 1px solid transparent; border-radius: 12px; background: #fff; color: #0d1257;
  font-size: 14px; font-weight: 500; line-height: 20px; white-space: nowrap; transition: transform .3s, background-color .3s; }
.mh-login:hover { background: #f5f6ff; transform: scale(1.05); }
.mh-cart { position: relative; display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px; border-radius: 9999px; color: #fff; transition: background-color .15s; }
.mh-cart:hover { background: rgba(255, 255, 255, .15); }
.mh-cart svg { width: 24px; height: 24px; }
.mh-cart-count { position: absolute; top: 0; right: 0; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 9999px; background: #ef4444; color: #fff; font-size: 12px; line-height: 16px; }
.mh-account { position: relative; }
.mh-avatar-btn { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid #e5e7eb; border-radius: 9999px; background: #fff; color: #6b7280; transition: background-color .2s, border-color .2s; }
.mh-avatar-btn:hover, .mh-avatar-btn[aria-expanded="true"] { background: #f9fafb; border-color: #d1d5db; }
.mh-avatar { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9999px; background: #ebedff; color: #2d2dbf; font-size: 14px; font-weight: 600; }
.mh-avatar-btn svg { width: 16px; height: 16px; transition: transform .2s; }
.mh-avatar-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.mh-account-menu { position: absolute; right: 0; top: 100%; z-index: 50; width: 192px; margin-top: 12px; overflow: hidden; border: 1px solid #f3f4f6; border-radius: 12px; background: #fff;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1); }
.mh-account-menu a, .mh-account-menu button { display: block; width: 100%; padding: 10px 16px; border: 0; background: transparent; color: #374151; font-size: 14px; line-height: 20px; text-align: left; transition: background-color .15s, color .15s; }
.mh-account-menu > * + * { border-top: 1px solid #f9fafb; }
.mh-account-menu a:hover, .mh-account-menu button:hover { background: #f9fafb; color: #0d1257; }
.mh-account-menu [data-logout]:hover { background: #fef2f2; color: #b91c1c; }

/* Product bar: the service's own slotted content under the shared header (the page styles it) */
.mh-sub { background: #16164f; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.mh-sub-inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* Below lg: bar with burger, centered logo and cart; the menu moves to a drawer */
@media (max-width: 1023px) {
  header[data-moji-header], :host { min-height: 64px; }
  .mh-desktop { display: none; }
  .mh-mobile { display: block; padding: 0 8px; }
  .mh-mobile-bar { position: relative; display: flex; align-items: center; justify-content: space-between; height: 64px; }
  .mh-burger { z-index: 10; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 9999px; background: transparent; color: #fff; }
  .mh-burger:hover { background: rgba(255, 255, 255, .15); }
  .mh-burger svg { width: 28px; height: 28px; }
  .mh-mobile-logo { position: absolute; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; }
  .mh-mobile-logo a { pointer-events: auto; display: flex; }
  .mh-mobile-logo img { display: block; width: auto; height: 32px; }
  .mh-mobile-actions { z-index: 10; display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .mh-sub-inner { padding: 0 8px; }
}

/* Drawer */
.mh-drawer { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #374151;
  font: 400 16px/24px Inter, "Inter Fallback", system-ui, sans-serif; }
.mh-drawer::backdrop { background: rgba(0, 0, 0, .4); }
.mh-drawer *, .mh-drawer *::before, .mh-drawer *::after { box-sizing: border-box; }
.mh-drawer :where(a, button) { font: inherit; text-decoration: none; cursor: pointer; }
.mh-drawer ul { list-style: none; margin: 0; padding: 0; }
.mh-drawer p, .mh-drawer h2 { margin: 0; }
.mh-drawer svg { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mh-drawer :focus-visible { outline: 2px solid #0d1257; outline-offset: 2px; }
.mh-drawer [hidden] { display: none !important; }
.mh-panel { display: flex; flex-direction: column; width: 85%; max-width: 24rem; height: 100%; background: #fff; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1); }
.mh-panel-head { display: flex; flex: none; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #f3f4f6; }
.mh-panel-title { color: #0d1257; font-size: 18px; font-weight: 700; line-height: 28px; }
.mh-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 9999px; background: transparent; color: inherit; }
.mh-close:hover { background: #f3f4f6; }
.mh-close svg { width: 24px; height: 24px; }
.mh-panel-body { flex: 1; min-height: 0; padding: 16px; overflow-y: auto; overscroll-behavior: contain; }
.mh-panel-body > nav > ul { display: flex; flex-direction: column; gap: 4px; }
.mh-panel .mh-top { width: 100%; color: #374151; }
.mh-panel .mh-top:hover { background: #f9fafb; color: #374151; }
.mh-panel .mh-top[aria-expanded="true"], .mh-panel .mh-top[data-active] { background: #f5f6ff; color: #0d1257; }
.mh-panel .mh-top svg.mh-chev { margin-left: 0; }
.mh-sublist { margin-top: 4px; padding-left: 12px; }
.mh-sublist > div + div { margin-top: 8px; }
.mh-panel-user { margin-top: 16px; padding-top: 16px; border-top: 1px solid #f3f4f6; }
.mh-panel-user a { display: flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 8px; color: inherit; }
.mh-panel-user a:hover { background: #f9fafb; }
.mh-panel-foot { flex: none; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid #f3f4f6; }
.mh-panel-foot a, .mh-panel-foot button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; font-weight: 500; }
.mh-panel-foot a { background: #0d1257; color: #fff; }
.mh-panel-foot button { background: #fef2f2; color: #b91c1c; }

@media (prefers-reduced-motion: reduce) {
  .moji-header *, .mh-drawer * { transition: none !important; }
}

/* Static pages size their sticky offsets from --hdr; keep it equal to this header. */
:root { --hdr: 69px !important; }
@media (max-width: 1023px) { :root { --hdr: 64px !important; } }
