/* TrulyUseful shared chrome — sidebar navigation.
 *
 * Single source of truth for the sidebar that appears on every page
 * under trulyuseful.com.au. Served from /_shared/chrome.css so each
 * app's landing page can `<link rel="stylesheet" href="/_shared/chrome.css">`
 * without bundling its own copy.
 *
 * Design tokens intentionally duplicate the app-side tokens where they
 * need to match (accent colour, surface alphas), but otherwise the
 * sidebar is self-contained so apps can't accidentally bleed styles
 * into it or vice versa. Everything is scoped under `.tu-*`.
 */

:root {
    /* Width of the desktop sidebar. Consumed by app-side layouts via
     * `calc(var(--tu-sidebar-width) + 32px)` so the main content
     * reserves the right margin. */
    --tu-sidebar-width: 240px;

    --tu-bg-top:      #0a0a0c;
    --tu-bg-bottom:   #07070a;
    --tu-text:        #f5f5f7;
    --tu-text-dim:    #a1a1aa;
    --tu-text-dimmer: #6b6b74;
    --tu-accent:      #3d8bfd;
    --tu-border:      rgba(255, 255, 255, 0.08);
    --tu-surface:     rgba(255, 255, 255, 0.04);
    --tu-surface-hi:  rgba(255, 255, 255, 0.08);
}

/* ------------------------------------------------------------ Sidebar */

.tu-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--tu-sidebar-width);
    padding: 24px 20px 20px;
    background: linear-gradient(180deg, var(--tu-bg-top) 0%, var(--tu-bg-bottom) 100%);
    border-right: 1px solid var(--tu-border);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    color: var(--tu-text);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 28px;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
}

/* Brand mark */
.tu-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-decoration: none;
    color: var(--tu-text);
    padding: 4px 4px 0;
}
.tu-brand-wordmark {
    width: min(152px, 100%);
    height: auto;
    display: block;
}
.tu-brand-sub {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--tu-text-dimmer);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-left: 2px;
}

/* Nav section */
.tu-nav-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.tu-nav-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tu-text-dimmer);
    padding: 0 8px 6px;
    align-self: stretch;
}

.tu-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--tu-text-dim);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: background 0.12s ease, color 0.12s ease;
    width: fit-content;
    max-width: 100%;
}
.tu-nav-item:hover {
    background: var(--tu-surface);
    color: var(--tu-text);
}
.tu-nav-item.is-active {
    background: rgba(61, 139, 253, 0.15);
    color: var(--tu-text);
}
.tu-nav-item.is-active .tu-nav-glyph {
    opacity: 1;
    color: var(--tu-accent);
}
.tu-nav-glyph {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    font-size: 12px;
    opacity: 0.7;
}
.tu-nav-glyph img {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    object-fit: cover;
    display: block;
}
.tu-nav-status {
    margin-left: auto;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--tu-surface);
    color: var(--tu-text-dimmer);
}

/* Bottom filler + footer */
.tu-nav-spacer { flex: 1 1 auto; }
.tu-sidebar-footer {
    padding: 8px;
    font-size: 11px;
    color: var(--tu-text-dimmer);
    line-height: 1.5;
}
.tu-sidebar-footer a {
    color: var(--tu-text-dim);
    text-decoration: none;
}
.tu-sidebar-footer a:hover { color: var(--tu-text); }

/* ------------------------------------------------------------ Mobile */

/* Hamburger button — only rendered on narrow viewports. Positioned
 * fixed top-left so it's reachable from anywhere on the page. */
.tu-menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 110;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--tu-border);
    background: rgba(10, 10, 12, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--tu-text);
    cursor: pointer;
    padding: 0;
}
.tu-menu-toggle svg { width: 18px; height: 18px; display: block; margin: 0 auto; }

/* Backdrop that dims the page behind the sidebar when open on mobile. */
.tu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 99;
}
body.tu-menu-open .tu-backdrop {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 820px) {
    .tu-menu-toggle { display: block; }
    .tu-nav-section { align-items: stretch; }
    .tu-nav-item {
        display: flex;
        width: auto;
    }
    .tu-sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }
    body.tu-menu-open .tu-sidebar {
        transform: translateX(0);
    }
}
