: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-ribbon-height:46px;
  --mbe-guide-nav-height:72px;
  --mbe-accent:var(--mbe-gold);
  --mbe-accent-dark:var(--mbe-gold-dark);
  --mbe-font-display:"Newsreader",Georgia,serif;
  --mbe-font-reading:"IBM Plex Sans",system-ui,sans-serif;
  --mbe-font-ui:"IBM Plex Sans",system-ui,sans-serif;
}

#root{font-family:var(--mbe-font-ui);}
#root h1,
#root h2,
#root h3{font-family:var(--mbe-font-display);letter-spacing:0;}

.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:var(--mbe-ribbon-height);
  background:linear-gradient(180deg,#0e2138,#0b1f3a);
  border-top:1px solid rgba(201,164,76,.18);
  border-bottom:1px solid rgba(201,164,76,.18);
  box-shadow:0 14px 32px -28px rgba(0,0,0,.82);
  color:#b9ad90;
  font-family:var(--mbe-font-ui);
}

.mbe-global-shell + .site-header{
  top:var(--mbe-ribbon-height);
}

/* Hermeneutics renders its native navigation inside the React root, not as
   .site-header. Keep those sticky bars below the shared library ribbon. */
body > #root > div > header.sticky.top-0{
  top:var(--mbe-ribbon-height) !important;
}

#root .top-\[65px\]{
  top:calc(var(--mbe-ribbon-height) + var(--mbe-guide-nav-height) + 4px) !important;
}

#root .top-\[67px\]{
  top:calc(var(--mbe-ribbon-height) + var(--mbe-guide-nav-height) + 6px) !important;
}

#root .top-\[73px\]{
  top:calc(var(--mbe-ribbon-height) + var(--mbe-guide-nav-height) + 12px) !important;
}

#root .top-\[122px\]{
  top:calc(var(--mbe-ribbon-height) + var(--mbe-guide-nav-height) + 61px) !important;
}

.mbe-shell-wrap{
  max-width:none;
  margin:0 auto;
  padding:0 clamp(48px,5vw,92px);
}

.mbe-global-shell .mbe-shell-wrap{
  min-height:var(--mbe-ribbon-height);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:clamp(18px,3vw,42px);
}

.mbe-ribbon-left{
  min-width:0;
  display:flex;
  align-items:center;
  gap:clamp(18px,2vw,30px);
}

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

.mbe-ribbon-logo{
  display:block;
  width:auto;
  height:34px;
  filter:grayscale(1) brightness(0) invert(88%) sepia(18%) saturate(320%) hue-rotate(2deg);
}

.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:#f0d28b;
}

.mbe-ribbon-back{
  color:#b9ad90;
  font-size:.73rem;
  font-weight:800;
  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(201,164,76,.3);
  vertical-align:-3px;
}

.mbe-global-nav{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:clamp(22px,2.6vw,42px);
  color:#b9ad90;
  font-size:.82rem;
  font-weight:800;
  line-height:1;
}

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

/* Animated accent underline on text links (skips the pill button) */
.mbe-ribbon-back,
.mbe-global-nav a:not(.mbe-ribbon-give),
.mbe-library-toggle{
  position:relative;
}

.mbe-ribbon-back::after,
.mbe-global-nav a:not(.mbe-ribbon-give)::after,
.mbe-library-toggle::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-6px;
  height:2px;
  border-radius:2px;
  background:var(--mbe-accent);
  transform:scaleX(0);
  transform-origin:left center;
  transition:transform .22s ease;
}

.mbe-ribbon-back:hover::after,
.mbe-global-nav a:not(.mbe-ribbon-give):hover::after,
.mbe-library-toggle:hover::before,
.mbe-library-menu[open] .mbe-library-toggle::before{
  transform:scaleX(1);
}

/* "Support" promoted to an accent pill button */
.mbe-ribbon-give{
  display:inline-flex;
  align-items:center;
  padding:0;
  border-radius:0;
  background:transparent;
  color:#b9ad90 !important;
  font-weight:800;
  letter-spacing:.01em;
  box-shadow:none;
  transition:transform .16s ease,background .18s ease,box-shadow .18s ease;
}

.mbe-ribbon-give:hover{
  background:transparent;
  color:#f0d28b !important;
  transform:translateY(-1px);
  box-shadow:none;
}

.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% + 24px);
  width:min(920px,calc(100vw - 32px));
  max-height:calc(100vh - 132px);
  overflow:auto;
  overscroll-behavior:contain;
  padding:12px;
  border:1px solid rgba(201,164,76,.25);
  border-radius:8px;
  background:#0f2b47;
  color:#f7f1e5;
  box-shadow:0 24px 50px -34px rgba(0,0,0,.8);
}

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

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

.mbe-library-item{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:11px 12px;
  border-radius:6px;
  color:#f7f1e5;
  text-decoration:none;
}

.mbe-library-item:hover{background:rgba(255,255,255,.08);}
.mbe-library-item[aria-current="page"]{background:rgba(201,164,76,.16);}
.mbe-library-name{font-family:var(--mbe-font-display);font-size:1.02rem;font-weight:600;line-height:1.1;}
.mbe-library-desc{color:#bdb29f;font-size:.78rem;font-weight:500;line-height:1.35;overflow-wrap:anywhere;}

.mbe-global-footer{
  order:999;
  background:linear-gradient(180deg,#0e2138,#0b1f3a);
  color:#b9ad90;
  font-family:var(--mbe-font-ui);
  border-top:1px solid rgba(201,164,76,.18);
  box-shadow:0 -18px 42px -34px rgba(0,0,0,.8);
  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:34px clamp(48px,5vw,92px);
  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:auto;
  height:34px;
  max-width:100%;
  filter:grayscale(1) brightness(0) invert(88%) sepia(18%) saturate(320%) hue-rotate(2deg);
}

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

.mbe-footer-link{
  color:#f0d28b;
  text-decoration:none;
  font-weight:700;
  border-bottom:1px solid rgba(240,210,139,.45);
  padding-bottom:2px;
}

.mbe-footer-link:hover{
  color:#fff6df;
  border-bottom-color:#fff6df;
}

/* Footer "Support" as a matching accent pill */
.mbe-footer-link[href*="donate"]{
  display:inline-flex;
  align-items:center;
  padding:0;
  border-radius:0;
  border-bottom:1px solid rgba(240,210,139,.45);
  background:transparent;
  color:#f0d28b;
  box-shadow:none;
  transition:transform .16s ease,background .18s ease;
}

.mbe-footer-link[href*="donate"]:hover{
  background:transparent;
  color:#fff6df;
  border-bottom-color:#fff6df;
  transform:translateY(-1px);
}

html{
  scroll-padding-top:calc(var(--mbe-ribbon-height) + var(--mbe-guide-nav-height) + 24px);
}

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;
  }
}
