:root{
  --mbe-ink:#111827;
  --mbe-bg:#ffffff;
  --mbe-soft:#f6f8f7;
  --mbe-gold:#c9a44c;
  --mbe-gold-dark:#9b7628;
  --mbe-teal:#2f7d7a;
  --mbe-navy:#0b1f3a;
  --mbe-rule:#e5e0d6;
  --mbe-muted:#5f6673;
  --mbe-ivory:#f7f3e8;
  --mbe-max:1080px;
  --mbe-accent:var(--mbe-gold);
  --mbe-accent-dark:var(--mbe-gold-dark);
  --mbe-font-display:"Cinzel",Georgia,serif;
  --mbe-font-reading:"EB Garamond",Georgia,serif;
  --mbe-font-ui:"Jost",system-ui,sans-serif;
}

.mbe-global-shell *,
.mbe-global-footer *{box-sizing:border-box;}

.mbe-global-shell[data-tool="hermeneutics"],
.mbe-global-footer[data-tool="hermeneutics"]{--mbe-accent:#6b54b3;--mbe-accent-dark:#4b3b87;}
.mbe-global-shell[data-tool="psalms"],
.mbe-global-footer[data-tool="psalms"]{--mbe-accent:#c9a44c;--mbe-accent-dark:#2f7d7a;}
.mbe-global-shell[data-tool="daniel"],
.mbe-global-footer[data-tool="daniel"]{--mbe-accent:#c9a44c;--mbe-accent-dark:#5a7049;}
.mbe-global-shell[data-tool="revelation"],
.mbe-global-footer[data-tool="revelation"]{--mbe-accent:#c1564f;--mbe-accent-dark:#8a2f3a;}
.mbe-global-shell[data-tool="sanctuary"],
.mbe-global-footer[data-tool="sanctuary"]{--mbe-accent:#c9a44c;--mbe-accent-dark:#36432f;}
.mbe-global-shell[data-tool="last-day-events"],
.mbe-global-footer[data-tool="last-day-events"]{--mbe-accent:#3f5f86;--mbe-accent-dark:#283a54;}

.mbe-global-shell{
  position:sticky;
  top:0;
  z-index:1200;
  min-height:46px;
  background:linear-gradient(180deg,#fffdf8 0%,var(--mbe-ivory) 100%);
  border-bottom:1px solid var(--mbe-rule);
  box-shadow:0 14px 32px -28px rgba(11,31,58,.38);
  color:var(--mbe-muted);
  font-family:var(--mbe-font-ui);
}

.mbe-global-shell + .site-header{
  top:46px;
}

.mbe-shell-wrap{
  max-width:var(--mbe-max);
  margin:0 auto;
  padding:0 28px;
}

.mbe-global-shell .mbe-shell-wrap{
  min-height:46px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}

.mbe-ribbon-left{
  min-width:0;
  display:flex;
  align-items:center;
  gap:18px;
}

.mbe-ribbon-brand{
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
  color:var(--mbe-navy);
  text-decoration:none;
  white-space:nowrap;
}

.mbe-ribbon-logo{
  display:block;
  width:auto;
  height:34px;
}

.mbe-ribbon-brand:hover,
.mbe-ribbon-back:hover,
.mbe-global-nav a:hover,
.mbe-library-menu[open] .mbe-library-toggle,
.mbe-library-toggle:hover{
  color:var(--mbe-gold-dark);
}

.mbe-ribbon-back{
  color:var(--mbe-muted);
  font-size:.73rem;
  font-weight:600;
  letter-spacing:.14em;
  line-height:1;
  text-decoration:none;
  text-transform:uppercase;
  white-space:nowrap;
}

.mbe-ribbon-back::before{
  content:"";
  display:inline-block;
  width:1px;
  height:16px;
  margin-right:18px;
  background:rgba(155,118,40,.28);
  vertical-align:-3px;
}

.mbe-global-nav{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:18px;
  color:var(--mbe-muted);
  font-size:.82rem;
  font-weight:600;
  line-height:1;
}

.mbe-global-nav a,
.mbe-library-toggle{
  color:inherit;
  text-decoration:none;
  transition:color .18s ease;
  white-space:nowrap;
}

.mbe-library-menu{position:relative;}
.mbe-library-toggle{list-style:none;cursor:pointer;}
.mbe-library-toggle::-webkit-details-marker{display:none;}

.mbe-library-toggle::after{
  content:"";
  display:inline-block;
  width:.38rem;
  height:.38rem;
  margin-left:.42rem;
  border-right:1.5px solid currentColor;
  border-bottom:1.5px solid currentColor;
  transform:rotate(45deg) translateY(-.1rem);
}

.mbe-library-menu[open] .mbe-library-toggle::after{
  transform:rotate(225deg) translateY(-.08rem);
}

.mbe-library-panel{
  position:absolute;
  right:0;
  top:calc(100% + 14px);
  width:min(560px,calc(100vw - 32px));
  padding:12px;
  border:1px solid var(--mbe-rule);
  border-radius:8px;
  background:#fff;
  color:var(--mbe-ink);
  box-shadow:0 24px 50px -34px rgba(11,31,58,.55);
}

.mbe-library-panel::before{
  content:"";
  position:absolute;
  top:-14px;
  right:0;
  left:0;
  height:14px;
}

.mbe-library-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}

.mbe-library-item{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:11px 12px;
  border-radius:6px;
  color:var(--mbe-ink);
  text-decoration:none;
}

.mbe-library-item:hover{background:var(--mbe-soft);}
.mbe-library-item[aria-current="page"]{background:rgba(201,164,76,.13);}
.mbe-library-name{font-family:var(--mbe-font-display);font-size:1.02rem;font-weight:600;line-height:1.1;}
.mbe-library-desc{color:var(--mbe-muted);font-size:.78rem;font-weight:500;line-height:1.35;}

.mbe-global-footer{
  order:999;
  background:linear-gradient(180deg,#fffdf8 0%,var(--mbe-ivory) 100%);
  color:var(--mbe-muted);
  font-family:var(--mbe-font-ui);
  border-top:1px solid var(--mbe-rule);
  box-shadow:0 -14px 32px -30px rgba(11,31,58,.42);
  padding:0;
}

.mbe-global-footer .mbe-shell-wrap{
  max-width:none;
}

.mbe-footer-wrap{
  min-height:auto;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px clamp(18px,3vw,34px);
  padding:24px clamp(20px,3vw,42px);
  font-size:clamp(.86rem,.95vw,.98rem);
  line-height:1.4;
}

.mbe-footer-brand{
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
  color:inherit;
  text-decoration:none;
  border-bottom:0;
}

.mbe-footer-logo{
  display:block;
  width:clamp(168px,16vw,240px);
  max-width:100%;
  height:auto;
}

.mbe-footer-wrap > span:last-child{
  flex-basis:100%;
  color:var(--mbe-muted);
  font-size:clamp(.78rem,.85vw,.9rem);
}

.mbe-footer-link{
  color:var(--mbe-gold-dark);
  text-decoration:none;
  font-weight:600;
  border-bottom:1px solid rgba(155,118,40,.45);
  padding-bottom:2px;
}

.mbe-footer-link:hover{
  color:var(--mbe-navy);
  border-bottom-color:var(--mbe-navy);
}

html{
  scroll-padding-top:64px;
}

body:has(> .mbe-global-footer){
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

body:has(> .mbe-global-footer) > main,
body:has(> .mbe-global-footer) > #root,
body:has(> .mbe-global-footer) > .page,
body:has(> .mbe-global-footer) > .app-shell,
body:has(> .mbe-global-footer) > .atlas-page{
  flex:1 0 auto;
  min-width:0;
}

body:has(> .mbe-global-footer) > .mbe-global-footer{
  margin-top:auto;
  flex:0 0 auto;
}

body > #root:empty{
  min-height:calc(100vh - 260px);
  display:grid;
  place-items:start center;
  padding:clamp(36px,8vh,80px) 24px;
}

body > #root:empty::before{
  content:"";
  display:block;
  width:min(680px,100%);
  height:220px;
  border:1px solid var(--mbe-rule);
  border-radius:10px;
  background:
    linear-gradient(90deg,rgba(255,255,255,.22),rgba(255,255,255,.72),rgba(255,255,255,.22)) 0 0/220% 100%,
    linear-gradient(180deg,#fffdf8 0%,var(--mbe-ivory) 100%);
  box-shadow:0 18px 42px -34px rgba(11,31,58,.42);
  animation:mbe-shell-loading 1.45s ease-in-out infinite;
}

@keyframes mbe-shell-loading{
  0%{background-position:0 0,0 0;}
  100%{background-position:220% 0,0 0;}
}

@media(max-width:720px){
  .mbe-global-shell .mbe-shell-wrap{
    padding:0 18px;
    gap:12px;
  }

  .mbe-ribbon-back{display:none;}

  .mbe-ribbon-logo{
    height:30px;
  }

  .mbe-global-nav{
    gap:14px;
    font-size:.78rem;
  }

  .mbe-library-panel{
    right:-76px;
    width:min(360px,calc(100vw - 24px));
  }

  .mbe-library-grid{grid-template-columns:1fr;}

  .mbe-footer-wrap{
    min-height:auto;
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
    padding:28px 20px;
  }
}
