/* ==========================================================================
   MappedBible — unified navigation system
   Built 2026-07-28. One stylesheet, three presentations:
     1a  grouped masthead + mega-menus   (all pages, desktop)
     1b  persistent study sidebar        (study surfaces only)
     1c  intent doors + bottom bar       (homepage hero / all pages, mobile)

   WHY THIS FILE EXISTS: the site is 14 hand-maintained static HTML files
   with no build step. Nav was duplicated in every one, and WEB_BUILD_LOG
   records repeated drift ("nav blocks must be kept identical manually").
   Nav markup now lives in nav.js and styling lives here — change once.
   ========================================================================== */

:root {
  --parchment:    #EDE7DA;
  --card:         #F5F1E9;
  --card-lift:    #FCFAF4;
  --strip:        #EFE9DC;
  --ink:          #211E18;
  --ink-soft:     #4A4438;
  --muted:        #6E6555;
  --muted-light:  #8A8172;
  --navy:         #283655;
  --navy-deep:    #1a2540;
  --gold:         #9C7B3F;
  --gold-light:   #C4A05A;
  --border:       #E4DCCC;
  --border-warm:  #D8CFBD;
  --hover-warm:   #EAE0CD;

  --serif: 'EB Garamond', Georgia, serif;
  --sans:  'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --nav-h:     64px;
  --strip-h:   30px;
  --sidebar-w: 232px;
  --bottom-h:  58px;
}

/* --- utility strip -------------------------------------------------- */
.mb-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 26px; background: var(--strip);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold);
}
.mb-strip .mb-strip-links { display: flex; gap: 20px; }
.mb-strip a { color: var(--muted-light); text-decoration: none; }
.mb-strip a:hover { color: var(--ink); }

/* --- masthead ------------------------------------------------------- */
.mb-mast {
  position: relative;
  background: rgba(245,241,233,.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}
.mb-mast-inner {
  display: flex; align-items: center; gap: 28px;
  padding: 12px 26px;
}
.mb-brand {
  display: flex; align-items: center; gap: 12px;
  flex: 0 0 auto; text-decoration: none;
}
.mb-brand img { width: 40px; height: 40px; display: block; }
.mb-brand .wordmark {
  font-family: var(--serif); font-weight: 600; font-size: 27px;
  line-height: 1; color: var(--navy); letter-spacing: .02em;
}

/* --- four doors ----------------------------------------------------- */
.mb-doors { display: flex; align-items: stretch; gap: 4px; flex: 1; }
.mb-door {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 8px;
  font-size: 14.5px; color: var(--muted);
  cursor: pointer; user-select: none;
  border: none; background: none; font-family: var(--sans);
  transition: background .13s ease, color .13s ease;
}
.mb-door:hover, .mb-door.open { background: var(--hover-warm); color: var(--ink); }
.mb-door[aria-current="page"] { background: var(--hover-warm); color: var(--ink); }
.mb-door .caret { font-size: 9px; color: var(--gold); }

/* --- search pill ---------------------------------------------------- */
.mb-search {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border-warm);
  border-radius: 100px; padding: 7px 8px 7px 16px;
  width: 290px; flex: 0 0 auto; cursor: text;
}
.mb-search input {
  flex: 1; border: none; outline: none; background: none;
  font-family: var(--sans); font-size: 13.5px; color: var(--ink);
  min-width: 0;
}
.mb-search input::placeholder { color: #A59B86; }
.mb-search .kbd {
  font-family: var(--mono); font-size: 10px; color: var(--gold);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px;
}

/* --- mega menu ------------------------------------------------------ */
.mb-mega {
  position: absolute; left: 200px; right: 26px; top: 100%; z-index: 60;
  background: var(--card-lift);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 26px 54px -28px rgba(33,30,24,.45);
  padding: 24px 28px 26px;
  display: none; grid-template-columns: 1.1fr 1fr 1fr; gap: 30px;
}
.mb-mega.open { display: grid; }
.mb-mega .col { display: flex; flex-direction: column; gap: 14px; }
.mb-mega .col + .col {
  border-left: 1px solid #EFE7D6; padding-left: 26px;
}
.mb-mega .eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
}
.mb-mega a.item { display: block; text-decoration: none; }
.mb-mega a.item .t {
  font-family: var(--serif); font-size: 20px; color: var(--navy);
}
.mb-mega a.item .d {
  font-size: 12.5px; line-height: 1.55; color: var(--muted); margin-top: 3px;
}
.mb-mega a.item:hover .t { color: var(--gold); }
.mb-mega .chip {
  font-size: 12.5px; padding: 5px 11px; background: #fff;
  border: 1px solid var(--border); border-radius: 100px;
  color: var(--ink-soft); text-decoration: none; display: inline-block;
}
.mb-mega .chip:hover { border-color: var(--gold); }
.mb-mega .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mb-mega .quick {
  display: block; padding: 8px 14px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; color: var(--ink); text-decoration: none;
}
.mb-mega .quick:hover { border-color: var(--gold); }
.mb-mega .stat-line {
  font-family: var(--mono); font-size: 11px; color: var(--muted-light);
  letter-spacing: .06em;
}

/* ==========================================================================
   1b — persistent study sidebar
   Applied to study surfaces: read, mapped, extra, school, study,
   concordance, node, berean, archive. Body gets .mb-has-sidebar.
   ========================================================================== */
.mb-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--card); border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 40;
  padding: 18px 0 24px;
  display: flex; flex-direction: column; gap: 4px;
}
.mb-sidebar .sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 16px; text-decoration: none;
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.mb-sidebar .sb-brand img { width: 30px; height: 30px; }
.mb-sidebar .sb-brand .wm {
  font-family: var(--serif); font-weight: 600; font-size: 19px;
  color: var(--navy); line-height: 1;
}
.mb-sidebar .sb-group {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
  padding: 14px 18px 6px;
}
.mb-sidebar a.sb-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; font-size: 13.5px; color: var(--ink-soft);
  text-decoration: none; border-left: 2px solid transparent;
}
.mb-sidebar a.sb-link:hover { background: var(--strip); color: var(--ink); }
.mb-sidebar a.sb-link[aria-current="page"] {
  background: var(--hover-warm); color: var(--ink);
  border-left-color: var(--gold); font-weight: 500;
}
.mb-sidebar .sb-stat {
  margin: 16px 18px 0; padding: 12px 14px;
  background: var(--navy); border-radius: 10px;
}
.mb-sidebar .sb-stat .sb-stat-t {
  font-family: var(--mono); font-size: 9px; letter-spacing: .18em;
  text-transform: uppercase; color: #8FA3C8; margin-bottom: 6px;
}
.mb-sidebar .sb-stat .sb-stat-v {
  font-family: var(--mono); font-size: 11.5px; color: #E8E0CC; line-height: 1.7;
}
.mb-sidebar .sb-foot {
  margin-top: auto; padding: 16px 18px 0;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 7px;
}
.mb-sidebar .sb-foot a {
  font-size: 12.5px; color: var(--muted-light); text-decoration: none;
}
.mb-sidebar .sb-foot a:hover { color: var(--gold); }

body.mb-has-sidebar { padding-left: var(--sidebar-w); }
body.mb-has-sidebar .mb-strip,
body.mb-has-sidebar .mb-mast { display: none; }

/* ==========================================================================
   1c — intent doors (homepage hero) + mobile bottom bar
   ========================================================================== */
.mb-intents {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin: 26px 0 0;
}
.mb-intent {
  border: 1px solid var(--border); border-radius: 14px;
  background: #FBF8F1; padding: 18px 20px;
  text-decoration: none; display: block;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.mb-intent:hover {
  border-color: var(--gold); transform: translateY(-2px);
  box-shadow: 0 18px 40px -26px rgba(40,54,85,.5);
}
.mb-intent.primary {
  border-color: var(--navy); background: var(--card-lift);
  box-shadow: 0 18px 40px -26px rgba(40,54,85,.6);
}
.mb-intent .eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold);
}
.mb-intent .verb {
  font-family: var(--serif); font-size: 26px; color: var(--navy);
  margin: 4px 0;
}
.mb-intent .d { font-size: 12.5px; line-height: 1.55; color: var(--muted); }

/* --- mobile bottom bar ---------------------------------------------- */
.mb-bottom {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  height: var(--bottom-h);
  background: rgba(245,241,233,.97);
  border-top: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(10px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mb-bottom .bb-inner {
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: var(--bottom-h);
}
.mb-bottom a {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted-light);
  font-size: 10.5px; letter-spacing: .04em;
}
.mb-bottom a .ico { font-size: 17px; line-height: 1; }
.mb-bottom a[aria-current="page"] { color: var(--navy); }
.mb-bottom a[aria-current="page"] .ico { color: var(--gold); }

/* --- mobile drawer -------------------------------------------------- */
.mb-burger {
  display: none; border: none; background: none; cursor: pointer;
  font-size: 22px; color: var(--ink); padding: 4px 8px; line-height: 1;
}
.mb-drawer {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(26,24,20,.55);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.mb-drawer.open { opacity: 1; pointer-events: auto; }
.mb-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(86vw, 340px);
  background: var(--card); overflow-y: auto; padding: 20px 22px 40px;
  transform: translateX(100%); transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; gap: 2px;
}
.mb-drawer.open .mb-drawer-panel { transform: translateX(0); }
.mb-drawer .dr-close {
  align-self: flex-end; border: none; background: none; cursor: pointer;
  font-size: 24px; color: var(--muted); line-height: 1; padding: 0 0 10px;
}
.mb-drawer .dr-group {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
  padding: 16px 0 6px;
}
.mb-drawer a.dr-link {
  display: block; padding: 11px 0; font-size: 16px;
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.mb-drawer a.dr-link:hover { color: var(--gold); }

/* ==========================================================================
   RESPONSIVE — this is where the three presentations swap
   ========================================================================== */

/* Tablet: sidebar collapses, doors stay */
@media (max-width: 1100px) {
  .mb-sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .mb-sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.3); }
  body.mb-has-sidebar { padding-left: 0; }
  body.mb-has-sidebar .mb-strip,
  body.mb-has-sidebar .mb-mast { display: block; }
  body.mb-has-sidebar .mb-mast-inner { display: flex; }
  .mb-search { width: 200px; }
  .mb-mega { left: 26px; }
}

/* Mobile: doors → burger + bottom bar; intents stack */
@media (max-width: 820px) {
  .mb-strip { display: none; }
  .mb-doors { display: none; }
  .mb-search { display: none; }
  .mb-burger { display: block; margin-left: auto; }
  .mb-mega { display: none !important; }
  .mb-bottom { display: block; }

  .mb-mast-inner { padding: 10px 16px; gap: 12px; }
  .mb-brand .wordmark { font-size: 23px; }
  .mb-brand img { width: 34px; height: 34px; }

  .mb-intents { grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
  .mb-intent { padding: 15px 17px; }
  .mb-intent .verb { font-size: 23px; }

  /* clear the fixed bottom bar */
  body { padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
  .mb-brand .wordmark { font-size: 20px; }
  .mb-intent .verb { font-size: 21px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .mb-intent, .mb-sidebar, .mb-drawer, .mb-drawer-panel, .mb-door {
    transition: none !important;
  }
  .mb-intent:hover { transform: none; }
}

/* Print: nav is chrome, not content */
@media print {
  .mb-strip, .mb-mast, .mb-sidebar, .mb-bottom, .mb-drawer { display: none !important; }
  body.mb-has-sidebar { padding-left: 0; }
}

/* ==========================================================================
   DEFENSIVE RESETS — added 2026-07-28 after conflict audit.

   The 14 hand-maintained pages still carry their original inline <style>
   blocks, including bare element rules like:
       nav { display:flex; justify-content:center; gap:22px; margin-top:10px; }
       nav a { color:#6E6555; }
   Those were written for the old nav and are now orphaned, but they still
   match — .mb-bottom IS a <nav>, and .mb-drawer contains <a> elements.

   Class selectors beat bare element selectors on specificity, so anything
   this file declares explicitly already wins. The danger is properties this
   file does NOT declare (gap, margin, justify-content) silently inheriting
   from the legacy rule. These resets close that gap.

   The orphaned inline CSS should be stripped in a follow-up pass — it is
   dead weight and a trap for the next session. Doing it here, unverified,
   right before a deploy, is how a site breaks at 8pm.
   ========================================================================== */
.mb-bottom,
.mb-drawer,
.mb-sidebar {
  margin: 0 !important;
  gap: 0;
  justify-content: initial;
  text-align: left;
  letter-spacing: normal;
}
.mb-bottom .bb-inner { gap: 0; }
.mb-bottom a,
.mb-bottom a:visited { margin: 0; text-decoration: none; }
.mb-drawer a,
.mb-drawer a:visited,
.mb-sidebar a,
.mb-sidebar a:visited { margin: 0; text-decoration: none; }

/* Legacy pages set `nav a { color: … }`; restore ours explicitly. */
.mb-bottom a            { color: var(--muted-light); }
.mb-bottom a[aria-current="page"] { color: var(--navy); }
.mb-drawer a.dr-link    { color: var(--ink); }
.mb-sidebar a.sb-link   { color: var(--ink-soft); }
.mb-sidebar .sb-foot a  { color: var(--muted-light); }
.mb-sidebar a.sb-link[aria-current="page"] { color: var(--ink); }

/* Some pages set `body { padding-top }` or sticky offsets for the old
   header. The masthead is no longer sticky, so neutralise stale offsets
   only where they would collide with our fixed chrome. */
[data-mb-nav] { margin: 0; padding: 0; }
