/*
 * Canonical CSS for the LIFE Labs unified top bar.
 *
 * Every sub-tool linked from https://hub.life-labs.dev/ (except life-app)
 * renders the same top bar so the cross-app experience stays consistent.
 *
 * Spec: see shared/README.md.
 *
 * Structure (mirror the markup in top-bar.html exactly):
 *
 *   <nav class="ll-topbar">
 *     <div class="ll-topbar-inner">
 *       <div class="ll-topbar-brand">
 *         <a class="life-labs-hub-link" href="https://hub.life-labs.dev/">← LIFE Labs Hub</a>
 *         <span class="ll-topbar-title">{App Name}</span>
 *         <span class="ll-topbar-accent" aria-hidden="true"></span>
 *       </div>
 *       <div class="ll-topbar-nav"> ... per-app nav links ... </div>
 *       <div class="ll-topbar-actions"> ... tour, identity, sign-out ... </div>
 *     </div>
 *   </nav>
 *
 * The bar is self-themed via fallbacks so it renders correctly even in apps
 * that don't define the LIFE palette CSS custom properties.
 */

.ll-topbar {
  background: var(--color-surface, #F5F0EB);
  border-bottom: 1px solid var(--color-border, #E0DCD5);
  position: sticky;
  top: 0;
  z-index: 100;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", sans-serif;
}

.ll-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 40px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.ll-topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 0 0 auto;
}

/* Force the hub link to stay on one line — never wrap when the bar narrows. */
.life-labs-hub-link {
  white-space: nowrap;
}

.ll-topbar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text, #2D2D2D);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.ll-topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  justify-content: flex-start;
  min-width: 0;
  overflow-x: auto;
}

.ll-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.ll-topbar-link {
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary, #6B6B6B);
  border-radius: 6px;
  transition: color 120ms ease, background-color 120ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.ll-topbar-link:hover,
.ll-topbar-link:focus-visible {
  color: var(--color-text, #2D2D2D);
  background: var(--color-accent-bg, rgba(232, 119, 58, 0.08));
  text-decoration: none;
  outline: none;
}

.ll-topbar-link.is-active,
.ll-topbar-link[aria-current="page"] {
  color: var(--color-accent, #E8773A);
}

.ll-topbar-tour {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: var(--color-accent, #E8773A);
  background: transparent;
  border: 2px solid var(--color-accent, #E8773A);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease;
}

.ll-topbar-tour:hover,
.ll-topbar-tour:focus-visible {
  background: var(--color-accent-bg, rgba(232, 119, 58, 0.08));
  outline: none;
}

.ll-topbar-user {
  font-size: 12px;
  color: var(--color-text-secondary, #6B6B6B);
  padding: 4px 10px;
  background: var(--color-surface-2, #EDE7DF);
  border: 1px solid var(--color-border, #E0DCD5);
  border-radius: 12px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ll-topbar-signout {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary, #6B6B6B);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease;
}

.ll-topbar-signout:hover,
.ll-topbar-signout:focus-visible {
  color: var(--color-text, #2D2D2D);
  background: var(--color-accent-bg, rgba(232, 119, 58, 0.08));
  outline: none;
  text-decoration: none;
}

/* Progressive responsive hiding — most apps have a lot to fit in 40px.
   Order of importance: hub link > nav links > sign out > tour > title > identity. */
@media (max-width: 900px) {
  .ll-topbar-user {
    display: none;
  }
}
@media (max-width: 720px) {
  .ll-topbar-title {
    display: none;
  }
}
@media (max-width: 640px) {
  .ll-topbar-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .ll-topbar-tour {
    display: none;
  }
}
@media (max-width: 480px) {
  .ll-topbar-signout {
    display: none;
  }
}
