/* ════════════════════════════════════════════════════════════
   TEMENOS LIFE · css/nav.css
   Desktop sidebar + mobile tab bar. Sidebar is hidden below
   768 px; tab bar is hidden above. Active state driven by
   router.js toggling .is-active on [data-nav] elements.
   ════════════════════════════════════════════════════════════ */

/* ── Desktop sidebar ──────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: none;          /* hidden on mobile */
  flex-direction: column;
  padding: 1.75rem 0 1.5rem;
  z-index: 100;
}
@media (min-width: 768px) {
  .sidebar { display: flex; }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  width: 100%;
  padding: 0 1.5rem 1.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
  text-align: left;
  transition: color var(--transition), opacity var(--transition);
}

.sidebar-brand:hover {
  opacity: 0.82;
}

.brand-mark-sidebar {
  flex: 0 0 auto;
  width: 2.25rem;
  opacity: 0.9;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 1.65rem;
  line-height: 1;
  color: var(--thread-color);
  letter-spacing: 0.06em;
}

.nav-preferences {
  margin: 0 0.75rem 0.5rem;
  width: calc(100% - 1.5rem);
}

.nav-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}
.nav-mark {
  display: block;
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  background: currentColor;
  opacity: 0.9;
  filter: drop-shadow(0 0 8px color-mix(in srgb, currentColor 12%, transparent));
}
.nav-mark--body {
  aspect-ratio: 259 / 236;
  -webkit-mask: url('../img/body-clean.png') center / contain no-repeat;
  mask: url('../img/body-clean.png') center / contain no-repeat;
}
.nav-mark--mind {
  aspect-ratio: 246 / 253;
  -webkit-mask: url('../img/mind-clean.png') center / contain no-repeat;
  mask: url('../img/mind-clean.png') center / contain no-repeat;
}
.nav-mark--life {
  aspect-ratio: 246 / 253;
  -webkit-mask: url('../img/life-clean.png') center / contain no-repeat;
  mask: url('../img/life-clean.png') center / contain no-repeat;
}
.nav-mark--prefs {
  aspect-ratio: 1;
  -webkit-mask: url('../img/prefs.png') center / contain no-repeat;
  mask: url('../img/prefs.png') center / contain no-repeat;
}
.nav-sub {
  padding-left: 1.75rem;
  font-size: 0.82rem;
}
.sidebar-signout {
  margin: 0 0.75rem 1.25rem;
  padding: 0.5rem 0.85rem;
  width: calc(100% - 1.5rem);
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color var(--transition), border-color var(--transition);
}
.sidebar-signout:hover { color: #e06c75; border-color: #e06c75; }

.prefs-save-status {
  font-size: 0.72rem;
  color: var(--thread-color);
  padding: 0 1.1rem 0.35rem;
  min-height: 1.1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.prefs-save-status.is-visible {
  opacity: 1;
}

.nav-item.is-active {
  background: color-mix(in srgb, var(--thread-color) 15%, transparent);
  color: var(--thread-color);
  font-weight: 500;
}

.sidebar-brand.is-active {
  background: none;
}

/* ── Collapsible nav groups ───────────────────────────────── */
.nav-group { list-style: none; }

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-chevron {
  font-size: 0.85rem;
  opacity: 0.4;
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 260ms ease;
  transform: rotate(0deg);
  line-height: 1;
}

.nav-group.is-open .nav-chevron {
  transform: rotate(90deg);
  opacity: 0.7;
}

.nav-sub-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group.is-open .nav-sub-list {
  max-height: 12rem;
}

/* ── Mobile bottom tab bar ────────────────────────────────── */
.tab-bar {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--tabbar-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}
@media (min-width: 768px) {
  .tab-bar { display: none; }
}

.tab-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: color var(--transition);
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.is-active { color: var(--thread-color); }
.tab-mark {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  background: currentColor;
  opacity: 0.92;
  filter: drop-shadow(0 0 8px color-mix(in srgb, currentColor 10%, transparent));
}
.tab-mark--home {
  aspect-ratio: 1;
  -webkit-mask: url('../img/temenos-master-clean.png') center / contain no-repeat;
  mask: url('../img/temenos-master-clean.png') center / contain no-repeat;
}
.tab-label {
  max-width: 100%;
  overflow: hidden;
  line-height: 1.1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
