:root {
  --bm-shell-bg: #0b0e0d;
  --bm-shell-line: #29312e;
  --bm-shell-text: #f0f3f1;
  --bm-shell-muted: #9ca8a3;
  --bm-shell-accent: #4ed58a;
  --bm-header-height: 65px;
}

.bm-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.bm-site-header {
  box-sizing: border-box;
  position: sticky;
  z-index: 80;
  top: 0;
  width: 100%;
  min-width: 0;
  height: 65px;
  min-height: 65px;
  border-bottom: 1px solid var(--bm-shell-line);
  background: rgba(11, 14, 13, .97);
  backdrop-filter: blur(12px);
  font-family: Pretendard, "Pretendard Variable", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.mode-zone > .bm-site-header {
  grid-area: header;
}

/* Tool workspaces have legacy direct-child header rules. Keep the shared
   shell authoritative without coupling it to each tool stylesheet. */
.app > .bm-site-header {
  min-height: 0;
  display: block;
  padding: 0;
  gap: 0;
}

.app > .bm-site-header .bm-site-header__inner {
  min-height: 64px;
}

.app > .bm-site-header .bm-site-nav {
  width: auto;
  overflow: visible;
  gap: 24px;
  color: var(--bm-shell-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.app > .bm-site-header .bm-site-nav a {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}

.bm-site-header__inner {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 64px;
  min-height: 64px;
  margin: 0;
  padding-inline: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.bm-site-header__identity {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.bm-site-brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bm-shell-text);
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.bm-site-brand:hover,
.bm-site-brand:focus-visible {
  color: var(--bm-shell-text);
  text-decoration: none;
}

.bm-site-brand__mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 2px solid var(--bm-shell-accent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px var(--bm-shell-bg);
  background: var(--bm-shell-accent);
}

.bm-header-divider {
  width: 1px;
  height: 22px;
  flex: 0 0 auto;
  background: var(--bm-shell-line);
}

.bm-header-context {
  overflow: hidden;
  margin: 0;
  color: var(--bm-shell-text);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-site-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--bm-shell-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.bm-site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.bm-site-nav a:hover,
.bm-site-nav a:focus-visible {
  color: var(--bm-shell-text);
  text-decoration: none;
}

.bm-site-nav a[aria-current="page"] {
  border-bottom-color: var(--bm-shell-accent);
  color: var(--bm-shell-text);
}

.bm-site-footer {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  border-top: 1px solid var(--bm-shell-line);
  background: #090c0b;
  color: #a8b2ae;
  font-family: Pretendard, "Pretendard Variable", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

.bm-site-footer__inner {
  box-sizing: border-box;
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 46px;
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(480px, 1.8fr);
  gap: 64px;
}

.bm-site-footer__about p {
  max-width: 560px;
  margin: 10px 0 0;
  color: #a8b2ae;
  font-size: 13px;
  line-height: 1.7;
}

.bm-site-footer__brand {
  color: var(--bm-shell-text);
  font-size: 17px;
  font-weight: 850;
  text-decoration: none;
}

.bm-site-footer__nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
}

.bm-site-footer__group {
  min-width: 0;
}

.bm-site-footer__group h2 {
  margin: 0 0 13px;
  color: var(--bm-shell-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.bm-site-footer__group a {
  min-height: 32px;
  display: flex;
  align-items: center;
  width: fit-content;
  color: #a8b2ae;
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
}

.bm-site-footer__group a:hover,
.bm-site-footer__group a:focus-visible,
.bm-site-footer__brand:hover,
.bm-site-footer__brand:focus-visible {
  color: var(--bm-shell-accent);
  text-decoration: none;
}

@media (max-width: 820px) {
  :root {
    --bm-header-height: 61px;
  }

  .bm-site-header {
    height: 61px;
    min-height: 61px;
  }

  .bm-site-header__inner {
    width: 100%;
    height: 60px;
    min-height: 60px;
    padding: 0 14px;
    gap: 18px;
  }

  .app > .bm-site-header .bm-site-header__inner {
    width: 100%;
    height: 60px;
    min-height: 60px;
    padding: 0 14px;
  }

  .app > .bm-site-header .bm-site-nav {
    overflow-x: auto;
  }

  .bm-header-divider,
  .bm-header-context {
    display: none;
  }

  .bm-site-nav {
    overflow-x: auto;
    justify-content: flex-start;
    gap: 18px;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 14px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: rgba(78, 213, 138, .42) transparent;
  }

  .bm-site-nav::-webkit-scrollbar {
    height: 3px;
  }

  .bm-site-nav::-webkit-scrollbar-track {
    background: transparent;
  }

  .bm-site-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(78, 213, 138, .42);
  }

  .bm-site-nav a {
    scroll-snap-align: start;
  }

  .bm-site-nav::after {
    content: "";
    flex: 0 0 calc(50% - 20px);
  }

  .bm-site-footer__inner {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 520px) {
  :root {
    --bm-header-height: 90px;
  }

  .bm-site-header {
    height: auto;
    min-height: 89px;
  }

  /* Legacy tool styles still target the bare header element on small screens.
     Keep every page on the same shared shell dimensions. */
  body.mode-drop:not(.has-analysis-image) .app > .bm-site-header,
  body.mode-mortar:not(.has-analysis-image) .app > .bm-site-header {
    height: auto !important;
    min-height: 89px !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .bm-site-header__inner {
    height: auto;
    display: block;
    padding: 8px 14px 0;
  }

  .app > .bm-site-header .bm-site-header__inner {
    height: auto;
    display: block;
    padding: 8px 14px 0;
  }

  .app > .bm-site-header .bm-site-nav {
    gap: 18px;
    padding: 0;
  }

  .app > .bm-site-header .bm-site-nav a {
    min-height: 44px;
  }

  .bm-site-brand {
    min-height: 36px;
    font-size: 16px;
  }

  .bm-site-nav {
    margin-top: 1px;
  }

  .bm-site-nav a {
    min-height: 44px;
  }

  .bm-site-footer__inner {
    width: 100%;
    padding: 30px 18px 36px;
  }

  .bm-site-footer__nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 18px;
  }
}
