/* The signed-in shell (#184 184-shell, #155, design C section 2). Only
   index.html loads this. html.app-shell (js/lib/shell_boot.js before first
   paint, then js/app.js) swaps the public #topnav for #appnav:
     >= 700 px  an icon rail on the left: the mark, Plan, Routes, Rides,
                Profile, and Admin + Settings pinned at the foot;
     <  700 px  a top bar: the mark, the four tabs, Admin (admins only) and
                the gear, all 44 px targets down to 320 px with German labels.
   Everything that lays out against the chrome reads --rail-w / --topbar-h,
   so the map views still fill exactly the viewport. */

#appnav { display: none; }
#appnav [hidden] { display: none; }
html.app-shell #topnav { display: none; }
html.app-shell { --rail-w: 88px; --topbar-h: 0px; scroll-padding-top: calc(var(--topbar-h) + 8px); }

html.app-shell #appnav {
  position: fixed; z-index: 50; inset: 0 auto 0 0; width: var(--rail-w);
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 12px 8px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden;
}
html.app-shell body { padding-left: var(--rail-w); }

.shell-brand {
  flex: none; display: grid; place-items: center; min-height: 52px;
  border-radius: var(--r-2); color: var(--text); text-decoration: none;
}
.shell-mark {
  width: 34px; height: 34px; background: var(--accent);
  -webkit-mask: url(/_a/e71be685d7/assets/rider-mark.png) center / contain no-repeat;
  mask: url(/_a/e71be685d7/assets/rider-mark.png) center / contain no-repeat;
}
.shell-tabs { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.shell-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 62px; padding: 6px 2px; border-radius: var(--r-2);
  color: var(--text-2); text-decoration: none; text-align: center; white-space: nowrap;
  font: 650 11.5px/1.1 var(--font-display);
}
.shell-tab .ic { width: 23px; height: 23px; }
.shell-tab:hover { color: var(--text); background: var(--surface-2); }
.shell-tab[aria-current='page'] { color: var(--text); background: var(--accent-soft); }
.shell-tab[aria-current='page'] .ic { color: var(--accent-ink); }
/* The edge bar: flush with the rail's left edge. */
.shell-tab[aria-current='page']::before {
  content: ''; position: absolute; left: -8px; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.shell-admin, .shell-admin[hidden] + .shell-settings { margin-top: auto; }

/* Short windows: the rail scrolls rather than squeezing the targets. */
@media (min-width: 700px) and (max-height: 520px) {
  .shell-tab { min-height: 48px; gap: 2px; }
  .shell-tab .shell-label { font-size: 10.5px; }
}

/* Below the rail: every offset that sat under the old nav sits beside the rail. */
html.app-shell .version-notice { left: var(--rail-w); }

@media (max-width: 699px) {
  html.app-shell { --rail-w: 0px; --topbar-h: 64px; }
  html.app-shell #appnav {
    inset: 0 0 auto 0; width: auto; height: var(--topbar-h);
    flex-direction: row; align-items: center; gap: 2px;
    padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
    overflow: visible;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(12px) saturate(1.3);
    backdrop-filter: blur(12px) saturate(1.3);
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .shell-brand { width: var(--tap); min-height: var(--tap); }
  .shell-mark { width: 30px; height: 30px; }
  .shell-tabs { flex-direction: row; align-self: stretch; gap: 0; min-width: 0; }
  .shell-tab {
    flex: 1 1 0; min-width: 0; min-height: 0; padding: 0 2px; gap: 3px;
    border-radius: 0; font-size: 12px;
  }
  .shell-tab .ic { width: 22px; height: 22px; }
  .shell-tab:hover, .shell-tab[aria-current='page'] { background: none; }
  .shell-tab[aria-current='page']::before { display: none; }
  .shell-tab[aria-current='page']::after {
    content: ''; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 3px;
    border-radius: 3px 3px 0 0; background: var(--accent);
  }
  .shell-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  /* Admin and Settings are icon-only 44 px targets here; their names stay
     for assistive tech. Admin stays reachable for admins (#155). */
  .shell-admin, .shell-settings { flex: 0 0 var(--tap); margin: 0 !important; }
  .shell-admin .shell-label, .shell-settings .shell-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}
@media (max-width: 359px) {
  .shell-tab { font-size: 11px; letter-spacing: -0.005em; }
  /* An admin's bar carries one more target; the mark (a second way to
     Plan) makes room for it so the four labels stay whole. */
  #appnav:has(.shell-admin:not([hidden])) .shell-brand { display: none; }
}
