/* MerchantKits site header (all pages) and home-page app groups. The header markup is generated by
   scripts/header.cjs; behaviour in /assets/site.js. Self-contained (no Tailwind), so blog pages can use it too. */

.mk-header {
  --mk-navy: #0f172a;
  --mk-blue: #3b82f6;
  position: sticky; top: 0; z-index: 50;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.mk-header--light { background: rgba(255, 255, 255, 0.95); border-bottom: 1px solid #f1f5f9; --mk-link: #475569; --mk-link-hover: #0f172a; --mk-brand: #0f172a; }
.mk-header--dark { background: rgba(15, 23, 42, 0.95); border-bottom: 1px solid rgba(255, 255, 255, 0.1); --mk-link: #94a3b8; --mk-link-hover: #fff; --mk-brand: #fff; }

.mk-header__inner {
  max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; height: 4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.mk-brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; }
.mk-brand span { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.025em; color: var(--mk-brand); }

.mk-menu__list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2rem; }
.mk-link, .mk-group__toggle {
  font: inherit; font-size: 0.875rem; font-weight: 500; color: var(--mk-link);
  text-decoration: none; background: none; border: 0; padding: 0.5rem 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem; transition: color 0.15s;
}
.mk-link:hover, .mk-group__toggle:hover, .mk-group__toggle[aria-expanded="true"], .mk-link[aria-current="page"] { color: var(--mk-link-hover); }
.mk-link:focus-visible, .mk-group__toggle:focus-visible, .mk-item:focus-visible, .mk-burger:focus-visible, .mk-brand:focus-visible {
  outline: 2px solid var(--mk-blue); outline-offset: 3px; border-radius: 6px;
}
.mk-chevron { width: 0.9rem; height: 0.9rem; transition: transform 0.15s; }
.mk-group__toggle[aria-expanded="true"] .mk-chevron { transform: rotate(180deg); }

/* Dropdown panel: a white card on both header variants. Hidden only once JS runs (no-JS: links stay reachable). */
.mk-group { position: relative; }
.mk-panel {
  position: absolute; top: calc(100% + 0.5rem); left: -1rem; width: 22rem;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14); padding: 0.5rem;
}
.mk-js .mk-panel { display: none; }
.mk-js .mk-group.is-open .mk-panel { display: block; }
/* Hover bridge, so moving the pointer from the toggle into the panel doesn't close it. */
.mk-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -0.75rem; height: 0.75rem; }
.mk-panel ul { list-style: none; margin: 0; padding: 0; }
.mk-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.5rem;
  text-decoration: none; color: #0f172a;
}
.mk-item:hover, .mk-item[aria-current="page"] { background: #f1f5f9; }
.mk-item__icon { flex: none; width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; overflow: hidden; display: grid; place-items: center; background: var(--mk-navy); }
.mk-item__icon svg, .mk-item__icon img { width: 2.25rem; height: 2.25rem; display: block; }
.mk-item__text { display: flex; flex-direction: column; line-height: 1.3; }
.mk-item__name { font-size: 0.875rem; font-weight: 600; }
.mk-item__desc { font-size: 0.8125rem; color: #64748b; }

/* Hamburger (mobile only). */
.mk-burger {
  display: none; width: 2.5rem; height: 2.5rem; border: 0; background: none; cursor: pointer; padding: 0.5rem;
  color: var(--mk-brand); border-radius: 0.5rem;
}
.mk-burger__bars, .mk-burger__bars::before, .mk-burger__bars::after {
  display: block; width: 1.375rem; height: 2px; background: currentColor; border-radius: 1px; position: relative; transition: transform 0.15s, opacity 0.15s;
}
.mk-burger__bars::before, .mk-burger__bars::after { content: ""; position: absolute; left: 0; }
.mk-burger__bars::before { top: -7px; }
.mk-burger__bars::after { top: 7px; }
.mk-burger[aria-expanded="true"] .mk-burger__bars { background: transparent; }
.mk-burger[aria-expanded="true"] .mk-burger__bars::before { transform: translateY(7px) rotate(45deg); }
.mk-burger[aria-expanded="true"] .mk-burger__bars::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 899.98px) {
  .mk-burger { display: inline-block; }
  .mk-menu {
    position: absolute; top: 4rem; left: 0; right: 0; max-height: calc(100vh - 4rem); overflow-y: auto;
    border-bottom: 1px solid #e2e8f0; box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12); background: #fff;
  }
  .mk-header--dark .mk-menu { background: #0f172a; border-bottom-color: rgba(255, 255, 255, 0.1); }
  .mk-js .mk-menu { display: none; }
  .mk-js .mk-header.is-open .mk-menu { display: block; }
  .mk-menu__list { flex-direction: column; align-items: stretch; gap: 0; padding: 0.5rem 1.5rem 1rem; }
  .mk-menu__list > li { border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
  .mk-menu__list > li:last-child { border-bottom: 0; }
  .mk-link, .mk-group__toggle { width: 100%; justify-content: space-between; padding: 0.875rem 0; font-size: 1rem; }
  .mk-panel { position: static; width: auto; border: 0; box-shadow: none; padding: 0 0 0.75rem; background: transparent; }
  .mk-panel::before { display: none; }
  .mk-header--dark .mk-item { color: #fff; }
  .mk-header--dark .mk-item:hover, .mk-header--dark .mk-item[aria-current="page"] { background: rgba(255, 255, 255, 0.06); }
  .mk-header--dark .mk-item__desc { color: #94a3b8; }
  .mk-item { padding: 0.625rem 0.5rem; }
}

/* ---------- Home page: app groups ---------- */
.mk-apps-group { margin-top: 3.5rem; }
.mk-apps-group:first-of-type { margin-top: 0; }
.mk-apps-group__title {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #64748b;
  margin: 0 0 1.25rem; display: flex; align-items: center; gap: 0.75rem;
}
.mk-apps-group__title::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.mk-soon {
  display: inline-block; margin-top: 1rem; padding: 0.35rem 0.75rem; border-radius: 0.5rem;
  font-size: 0.75rem; font-weight: 600; line-height: 1.3;
  color: #fcd34d; background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.35);
}
.mk-card-icon { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; display: block; }

/* ---------- Product pages: second bar (scripts/header.cjs SUBNAVS) ---------- */
.mk-subnav {
  position: sticky; top: 4rem; z-index: 40;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: rgba(30, 41, 59, 0.95); border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.mk-subnav__inner {
  max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; height: 3rem;
  display: flex; align-items: center; gap: 2rem;
}
.mk-subnav__name {
  display: flex; align-items: center; gap: 0.5rem; flex: none;
  color: #fff; font-size: 0.9375rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.mk-subnav__icon { width: 1.5rem; height: 1.5rem; border-radius: 0.375rem; overflow: hidden; display: block; }
.mk-subnav__icon svg, .mk-subnav__icon img { width: 1.5rem; height: 1.5rem; display: block; }
.mk-subnav__links { display: flex; align-items: center; gap: 1.5rem; flex: 1; min-width: 0; }
.mk-subnav__links a { font-size: 0.8125rem; font-weight: 500; color: #94a3b8; text-decoration: none; white-space: nowrap; transition: color 0.15s; }
.mk-subnav__links a:hover { color: #fff; }
.mk-subnav__cta {
  flex: none; margin-left: auto; padding: 0.375rem 0.875rem; border-radius: 0.5rem;
  background: #3b82f6; color: #fff; font-size: 0.8125rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background 0.15s;
}
a.mk-subnav__cta:hover { background: #60a5fa; }
.mk-subnav__cta--soon { background: transparent; color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); cursor: default; }
.mk-subnav a:focus-visible { outline: 2px solid #3b82f6; outline-offset: 3px; border-radius: 6px; }
/* Section jumps land below the two sticky bars. */
:root:has(.mk-subnav) { scroll-padding-top: 7.5rem; }

@media (max-width: 899.98px) {
  /* Phones and tablets: product name and button only; the bar scrolls with the page. */
  .mk-subnav { position: static; }
  .mk-subnav__links { display: none; }
  .mk-subnav__inner { gap: 1rem; }
  :root:has(.mk-subnav) { scroll-padding-top: 4.5rem; }
}
