/* Shared top nav — used by the homepage, About, and every project page.
   Self-contained tokens so it works alongside either home.css or style.css. */

/* Width the nav may span. chat.css shrinks this while the side sheet is open
   so the bar is pushed alongside the page instead of sliding under the sheet. */
:root {
  --nv-avail: 100vw;
  --nv-h: 4.25rem; /* nav height; chat.css matches it so the dividers line up */
}

.nav {
  --nv-bg: #fafcfd;
  --nv-surface: rgba(250, 252, 253, 0.85);
  --nv-fg: #32404f;
  --nv-fg-light: rgba(50, 64, 79, 0.58);
  --nv-border: rgba(50, 64, 79, 0.12);
  --nv-primary: #e65f2e;
  --nv-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --nv-sans: "Geist", ui-sans-serif, system-ui, sans-serif;

  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  /* Project pages set `body { display: flex; padding: 32px }`. width/flex stop
     the header shrinking to fit-content, and the negative inline margins let
     the bar span the viewport while its contents stay centred in 60rem. */
  flex: none;
  align-self: stretch;
  min-height: var(--nv-h);
  margin-inline: calc(50% - var(--nv-avail) / 2);
  padding: 1.1rem max(1.5rem, calc(var(--nv-avail) / 2 - 30rem));
  transition: margin-inline 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              padding 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  background: var(--nv-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--nv-sans);
}

[data-theme="dark"] .nav {
  --nv-bg: #15121a;
  --nv-surface: rgba(21, 18, 26, 0.85);
  --nv-fg: #f2f0f5;
  --nv-fg-light: rgba(242, 240, 245, 0.6);
  --nv-border: rgba(242, 240, 245, 0.14);
}

/* Three-slot layout: name left, links centered, actions right.
   Equal flex on the outer slots is what keeps the links optically centered. */
.nav-name {
  flex: 1 1 0;
  font-family: var(--nv-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--nv-fg);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 0.875rem;
}

.nav-links a {
  color: var(--nv-fg-light);
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav-links a:hover,
.nav-links a.active { color: var(--nv-fg); }

.nav-actions {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

/* Minimal sun/moon theme switcher */
.nav-theme {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--nv-fg-light);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.2s ease;
}
.nav-theme:hover { color: var(--nv-fg); transform: rotate(15deg); }
.nav-theme svg { width: 1rem; height: 1rem; }

.nav-theme .icon-moon { display: none; }
[data-theme="dark"] .nav-theme .icon-sun { display: none; }
[data-theme="dark"] .nav-theme .icon-moon { display: block; }

@media (prefers-reduced-motion: reduce) {
  .nav-theme:hover { transform: none; }
}

.nav-ask {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--nv-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nv-primary);
  background: rgba(230, 95, 46, 0.08);
  border: 1px solid rgba(230, 95, 46, 0.25);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-ask:hover {
  background: rgba(230, 95, 46, 0.14);
  border-color: rgba(230, 95, 46, 0.45);
}
[data-theme="dark"] .nav-ask { background: rgba(230, 95, 46, 0.16); }
[data-theme="dark"] .nav-ask:hover { background: rgba(230, 95, 46, 0.24); }

.nav-ask-star {
  width: 0.8rem;
  height: 0.8rem;
  flex-shrink: 0;
}
.nav-ask:hover .nav-ask-star { animation: nv-twinkle 0.6s ease; }

@keyframes nv-twinkle {
  50% { transform: scale(1.25) rotate(15deg); }
}

/* Orange cursor dot (mouse pointers only — see nav.js) */
.eb-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #e65f2e;
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  will-change: transform;
  transition: opacity 0.25s ease, width 0.18s ease, height 0.18s ease,
    margin 0.18s ease;
}
.eb-cursor.visible { opacity: 0.5; }
.eb-cursor.big {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  opacity: 0.25;
}

/* Hamburger */
.nav-toggle {
  display: none;
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle .bar {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 2px;
  margin-left: -10px;
  border-radius: 1px;
  background: var(--nv-fg);
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}
.nav-toggle .bar1 { top: calc(50% - 7px); }
.nav-toggle .bar2 { top: calc(50% - 1px); }
.nav-toggle .bar3 { top: calc(50% + 5px); }
.nav.open .bar1 { top: calc(50% - 1px); transform: rotate(45deg); }
.nav.open .bar2 { opacity: 0; }
.nav.open .bar3 { top: calc(50% - 1px); transform: rotate(-45deg); }

@media (max-width: 720px) {
  .nav { padding: 0.9rem 1.25rem; gap: 0.8rem; }

  .nav-toggle { display: block; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.3rem 1.25rem 1rem;
    background: var(--nv-bg);
    border-bottom: 1px solid var(--nv-border);
    box-shadow: 0 12px 24px rgba(50, 64, 79, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  }

  .nav.open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links a { display: block; padding: 0.6rem 0; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-ask:hover .nav-ask-star { animation: none; }
}
