/* ==========================================================================
   nav.css — canonical nav-chrome styles for the <site-nav> component.

   Loaded by pages that do NOT load style.css (the account area loads
   tokens.css + base.css + account.css). Rules are copied verbatim from
   style.css ("Navigation", breadcrumb, and notification-bell sections);
   style.css still carries its own copy for the ~91 public/dashboard pages.
   Follow-up: dedup by having style.css consumers load this file instead.

   Depends only on tokens.css variables, the :root alias block below maps
   style.css's --color-* names onto the tokens.css names so the copied
   rules work unchanged (fallbacks match style.css's dark-theme values).
   ========================================================================== */

:root {
    --color-surface-1: var(--surface-1, #0f1012);
    --color-surface-2: var(--surface-2, #161719);
    --color-border: var(--border, rgba(255, 255, 255, 0.06));
    --color-text: var(--text, #f5f5f5);
    --color-text-secondary: var(--text-secondary, #d4d4d4);
    --color-text-muted: var(--text-muted, #c4c4c4);
    --color-accent-blue: var(--blue, #60a5fa);
    --color-accent-purple: var(--purple, #a78bfa);
}

/* ---------- Pillar accenting (no-op unless [data-pillar] is set) ---------- */
[data-pillar] .nav-logo svg { color: var(--pillar-color); }
[data-pillar] .nav-breadcrumb a { color: var(--pillar-color); }

/* ---------- Navigation ---------- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0.875rem 1.5rem;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
    /* Always-on dark backdrop so nav text is readable even at the top
       of the page over hero gradients. nav-scrolled below intensifies
       it once the user starts scrolling. */
    background: rgba(8, 9, 10, 0.72);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.nav-scrolled {
    background: rgba(8, 9, 10, 0.92);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-bottom-color: var(--color-border);
}

.nav-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 1rem;
}

.nav-logo svg { flex-shrink: 0; }
.nav-logo.home svg circle:last-of-type {
    r: 22;
    opacity: 0.85;
    transition: r 0.3s ease, opacity 0.3s ease;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--color-text); }
.nav-links a.active {
    color: var(--color-text);
    position: relative;
}
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--color-accent-blue), var(--color-accent-purple));
    border-radius: 2px;
}

.nav-sign-in {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-sign-in:hover { color: var(--color-text); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text-secondary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 4-color pillar cycle, offset stops create flowing gradient
   (animates the <site-nav> logo SVG gradient stops) */
@keyframes pillarCycle1 {
    0%, 100% { stop-color: #818cf8; }
    25%      { stop-color: #10b981; }
    50%      { stop-color: #fb7185; }
    75%      { stop-color: #60a5fa; }
}
@keyframes pillarCycle2 {
    0%, 100% { stop-color: #10b981; }
    25%      { stop-color: #fb7185; }
    50%      { stop-color: #60a5fa; }
    75%      { stop-color: #818cf8; }
}

.grad-stop-1 { animation: pillarCycle1 12s ease-in-out infinite; }
.grad-stop-2 { animation: pillarCycle2 12s ease-in-out infinite; }

/* ---------- Notification bell icon (injected into .nav-links by shared.js) ---------- */
.nav-bell {
    position: relative;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.nav-bell:hover { color: var(--color-text); }

.nav-bell-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    font-size: 0.5625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
    padding: 0 4px;
    line-height: 1;
}

.nav-bell-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    padding: 0.75rem;
    display: none;
    z-index: 200;
    max-height: 360px;
    overflow-y: auto;
}

.nav-bell-dropdown.open { display: block; }

.bell-item {
    display: flex;
    gap: 0.625rem;
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.15s;
}

.bell-item:hover { background: var(--color-surface-2); }
.bell-item.unread { color: var(--color-text-secondary); }

.bell-item-title { font-weight: 500; margin-bottom: 2px; }
.bell-item-time { font-size: 0.625rem; color: var(--color-text-muted); }

.bell-empty { text-align: center; padding: 1rem; font-size: 0.75rem; color: var(--color-text-muted); }

/* When nav has the breadcrumb sub-bar, reserve extra top space so content clears the taller fixed bar. */
body.has-nav-breadcrumb { scroll-padding-top: 120px; }
/* Min top-clearance for nav-with-breadcrumb (~120px tall). Pages already
   setting their own `padding-top` ≥8rem (8rem=128px clears the bar) win
   on specificity and keep their layout; this only catches pages without
   a generous top padding. */
body.has-nav-breadcrumb > main:not([class*="page-"]):not([class*="legal-"]) { padding-top: 8rem; }
/* Breadcrumb sub-bar, rendered as second row inside <site-nav> */
.nav-breadcrumb-row { max-width: 1000px; margin: 0 auto; padding-top: 0.5rem; border-top: 1px solid var(--color-border); margin-top: 0.875rem; }
.nav-breadcrumb { font-size: 0.8125rem; color: var(--color-text-muted); display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }
.nav-breadcrumb a { color: var(--color-accent-blue); text-decoration: none; }
.nav-breadcrumb a:hover { color: var(--color-text); }
.nav-breadcrumb .sep { opacity: 0.5; user-select: none; }
.nav-breadcrumb .current { color: var(--color-text); }

/* ---------- Responsive: mobile drawer ---------- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(8, 9, 10, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--color-border);
        padding: 0.75rem 1.5rem;
        gap: 0;
    }

    .nav-links.nav-open { display: flex; }

    .nav-links a {
        padding: 0.875rem 0;
        font-size: 1rem;
        border-bottom: 1px solid var(--color-border);
    }

    .nav-links a:last-child { border-bottom: none; }
    .nav-cta { text-align: center; margin-top: 0.5rem; }
    .nav-sign-in { padding: 0.875rem 0; }
    .nav-toggle { display: flex; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .grad-stop-1, .grad-stop-2 { animation: none !important; }
}

/* ---------- High contrast mode ---------- */
@media (prefers-contrast: more) {
    .nav-links a, .nav-sign-in {
        text-decoration: underline;
        text-underline-offset: 3px;
    }
}

/* ---------- Print ---------- */
@media print {
  .nav { display: none !important; }
}
