/* Shared layout: wrap, topbar, footer-nav, shell helpers */

.wrap {
  width: 100%;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--topbar-h);
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top, 0);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface, var(--text));
  text-decoration: none;
  white-space: nowrap;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-brand span { color: var(--primary); }

.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  min-height: var(--touch-min);
}
.topbar-back:hover { color: var(--primary); }

.footer-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px var(--gutter);
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 36, 0.4);
  z-index: 45;
}
.overlay.is-open { display: block; }

.drawer {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  z-index: 48;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: auto;
}
.drawer.is-open { transform: translateX(0); }

@media (max-width: 479px) {
  .topbar-back-label { display: none; }
}
