/*
 * Shared site header + mobile menu for standalone static pages (lookbook,
 * wardrobe, …). A copy of the header rules in omni_labs/index.html; markup stays
 * inline in each page, behaviour comes from /assets/chrome/chrome.js. Every token
 * and reset the rules need is scoped to .site-header / .mobile-menu so a page's
 * own :root tokens and element styles can't change the chrome (or vice versa).
 * Edit together with omni_labs/index.html and omnilabs-web/apps/site/app/chrome.css.
 */

.site-header, .mobile-menu {
  --pad: clamp(22px, 5vw, 80px);
  --fg: #0d0d0d; --muted: #767676; --faint: #cccccc; --rule: #e5e5e5; --ink: #050505; --header-bg: #ffffff; --accent: #e63946;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; font-size: 17px; line-height: 1.75; font-weight: 400; color: var(--fg);
  box-sizing: border-box; -webkit-font-smoothing: antialiased;
}
.site-header *, .mobile-menu * { box-sizing: border-box; margin: 0; padding: 0; }
.site-header a, .mobile-menu a { color: inherit; text-decoration: none; }
.site-header button, .mobile-menu button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
.site-header img, .mobile-menu img { max-width: 100%; display: block; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 80; background: var(--header-bg); border-bottom: 1px solid var(--rule); }
.header-top { max-width: 1680px; margin: 0 auto; padding: 26px clamp(20px, 2vw, 32px) 10px; display: flex; align-items: center; justify-content: space-between; gap: clamp(24px, 4vw, 72px); }
.wordmark { display: inline-flex; align-items: center; gap: 14px; }
.wordmark .wm-mark { height: 73px; width: auto; display: block; }
.nav-links { display: flex; gap: clamp(20px, 2.2vw, 40px); align-items: center; flex-wrap: nowrap; }
.header-actions { display: flex; align-items: center; gap: clamp(20px, 2.2vw, 40px); }
.nav-links a { font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.085em; color: var(--muted); position: relative; padding: 4px 0; transition: color 0.3s ease; }
.nav-links a::after { content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: var(--fg); transform: scaleX(0); transform-origin: center; transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--fg); }
/* ---- nav dropdowns (Studio / Lab) ---- */
.nav-group { position: relative; display: flex; align-items: center; }
.nav-group > button { font: inherit; font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.085em; color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; position: relative; transition: color 0.3s ease; }
.nav-group > button::after { content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: var(--fg); transform: scaleX(0); transform-origin: center; transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.nav-group > button:hover { color: var(--fg); }
.nav-group > button:hover::after, .nav-group > button.active::after { transform: scaleX(1); }
.nav-group > button.active { color: var(--fg); }
.nav-group .caret { width: 7px; height: 7px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg) translateY(-1px); transition: transform 0.3s ease; }
.nav-group > button[aria-expanded='true'] .caret { transform: rotate(-135deg) translateY(-2px); }
.nav-panel { position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%) translateY(-6px); min-width: 190px; background: var(--header-bg); border: 1px solid var(--rule); padding: 8px 0; display: flex; flex-direction: column; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0.28s; z-index: 90; }
.nav-group.open .nav-panel { opacity: 1; visibility: visible; pointer-events: all; transform: translateX(-50%) translateY(0); }
.nav-panel a { display: block; padding: 9px 18px; font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.085em; color: var(--muted); transition: color 0.25s ease, background 0.25s ease; }
.nav-panel a::after { display: none; }
.nav-panel a:hover { color: var(--fg); background: rgba(127, 127, 127, 0.08); }
.nav-panel a.active { color: var(--fg); }
@media (prefers-reduced-motion: reduce) { .nav-panel { transition: none; } }
.header-sub { max-width: 1680px; margin: 0 auto; padding: 0 clamp(20px, 2vw, 32px) 16px; font-size: 11px; letter-spacing: 0.17em; color: var(--muted); display: flex; align-items: center; gap: 11px; text-transform: uppercase; text-indent: 8px; }

.hamburger { display: none; width: 26px; height: 14px; position: relative; flex: none; }
.hamburger span { position: absolute; left: 0; height: 2px; background: var(--fg); transition: 0.35s cubic-bezier(0.76, 0, 0.24, 1); }
.hamburger span:nth-child(1) { top: 0; width: 100%; }
.hamburger span:nth-child(2) { top: 12px; width: 55%; }
.hamburger span:nth-child(3) { display: none; }
body.menu-open .hamburger span:nth-child(1) { top: 6px; transform: rotate(45deg); }
body.menu-open .hamburger span:nth-child(2) { top: 6px; width: 100%; transform: rotate(-45deg); }

.mobile-menu { position: fixed; inset: 0; z-index: 90; background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 22px) var(--pad) calc(env(safe-area-inset-bottom) + 26px); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0.45s; }
body.menu-open .mobile-menu { opacity: 1; visibility: visible; transform: none; }

/* top bar — brand + close, mirrors the site header */
.mobile-menu .mm-top { display: flex; align-items: center; justify-content: space-between; flex: none; padding-bottom: clamp(14px, 2.2vh, 22px); border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.mobile-menu .mm-logo { display: inline-flex; align-items: center; }
.mobile-menu .mm-logo img { height: 44px; width: auto; display: block; }
.mm-close { position: relative; width: 30px; height: 30px; flex: none; }
.mm-close span { position: absolute; top: 50%; left: 50%; width: 24px; height: 1.5px; background: #fff; transition: 0.35s cubic-bezier(0.76, 0, 0.24, 1); }
.mm-close span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.mm-close span:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }
.mm-close:hover span { background: var(--accent); }

/* link block */
.mobile-menu .mm-links { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-start; min-height: 0; overflow-y: auto; }
.mobile-menu .mm-links > a { font-size: clamp(1.55rem, 6.4vw, 2.1rem); font-weight: 300; letter-spacing: -0.02em; line-height: 1; color: #fff; display: flex; align-items: baseline; gap: 16px; padding: clamp(3px, 0.85vh, 8px) 0; border-top: 1px solid rgba(255, 255, 255, 0.1); transition: padding-left 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.3s ease; }
.mobile-menu .mm-links > a:hover, .mobile-menu .mm-links > a:active { padding-left: 14px; color: #fff; }
.mobile-menu .mm-links > a .num { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); width: 1.6em; flex: none; transform: translateY(-0.15em); }
.mobile-menu .mm-links > a .lbl { flex: 1; }
.mobile-menu .mm-links > *:first-child { margin-top: clamp(10px, 2.5vh, 26px); border-top: 0; }
.mobile-menu .mm-links > *:last-child { margin-bottom: auto; }
.mobile-menu .mm-links > a:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }

/* group: a muted label, then its routes indented beneath it */
.mobile-menu .mm-group { border-top: 1px solid rgba(255, 255, 255, 0.1); padding: clamp(12px, 2.3vh, 24px) 0 clamp(10px, 1.9vh, 20px); }
.mobile-menu .mm-glabel { display: block; font-family: 'JetBrains Mono', monospace; font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: clamp(6px, 1.2vh, 12px); }
.mobile-menu .mm-group a { display: block; font-size: clamp(1.05rem, 4.1vw, 1.3rem); font-weight: 300; letter-spacing: -0.01em; line-height: 1.02; color: #fff; padding: clamp(5px, 1.1vh, 10px) 0 clamp(5px, 1.1vh, 10px) 14px; transition: padding-left 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.3s ease; }
.mobile-menu .mm-group a:hover, .mobile-menu .mm-group a:active { padding-left: 22px; }

/* staggered reveal — keyed to the direct children, not the link count */
.mobile-menu .mm-links > a, .mobile-menu .mm-group { opacity: 0; transform: translateY(14px); }
body.menu-open .mobile-menu .mm-links > a, body.menu-open .mobile-menu .mm-group { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), padding-left 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.3s ease; }
body.menu-open .mobile-menu .mm-links > a, body.menu-open .mobile-menu .mm-group { transition-delay: calc(0.02s + var(--i, 0) * 0.08s); }
.mobile-menu .mm-links > *:nth-child(1) { --i: 1; }
.mobile-menu .mm-links > *:nth-child(2) { --i: 2; }
.mobile-menu .mm-links > *:nth-child(3) { --i: 3; }
.mobile-menu .mm-links > *:nth-child(4) { --i: 4; }
.mobile-menu .mm-links > *:nth-child(5) { --i: 5; }
.mobile-menu .mm-links > *:nth-child(6) { --i: 6; }
.mobile-menu .mm-links > *:nth-child(7) { --i: 7; }
/* sub-links in two columns: halves the height of Studio + Lab on phones */
.mobile-menu .mm-group { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.mobile-menu .mm-group .mm-glabel { grid-column: 1 / -1; }
@media (max-height: 740px) {
  .mobile-menu { padding-top: calc(env(safe-area-inset-top) + 14px); padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
  .mobile-menu .mm-logo img { height: 36px; }
  .mobile-menu .mm-links > a { font-size: clamp(1.35rem, 5.6vw, 1.8rem); }
  .mobile-menu .mm-group a { font-size: clamp(0.98rem, 3.9vw, 1.15rem); padding-top: 4px; padding-bottom: 4px; }
  .mobile-menu .mm-group { padding: 10px 0 8px; }
}

/* foot — relative + z-index + bg so it paints opaque over scrolled .mm-links */
.mobile-menu .mm-foot { flex: none; position: relative; z-index: 1; background: var(--ink); display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.mobile-menu .mm-foot a { display: inline-block; color: #fff; font-size: clamp(13px, 3.4vw, 15px); letter-spacing: 0.04em; word-break: break-all; }
.mobile-menu .mm-foot .mm-foot-meta { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .nav-links { display: none; }
  .hamburger { display: block; }
}
@media (max-width: 880px) {
  .wordmark .wm-mark { height: 55px; }
  .header-top { padding: 18px var(--pad) 8px; }
  .header-sub { padding: 4px var(--pad) 14px; }
}
@media (max-width: 640px) {
  .header-sub { font-size: 9px; letter-spacing: 0.12em; gap: 8px; padding-bottom: 12px; line-height: 1.25; }
}
@media (max-width: 480px) {
  .wordmark .wm-mark { height: 47px; }
  .header-top { padding: 18px var(--pad) 10px; }
  .header-sub { font-size: 8.5px; letter-spacing: 0.1em; gap: 7px; padding-bottom: 10px; line-height: 1.25; }
}

/* ---------- dark mode (legacy convention: body.dark-mode) ---------- */
body.dark-mode .site-header, body.dark-mode .mobile-menu { --fg: #f0ede6; --muted: #8a857c; --faint: #2a2a2a; --rule: #1c1c1c; --ink: #f0ede6; --header-bg: #0d0d0d; }
body.dark-mode .wordmark .wm-mark { filter: invert(1); }
