﻿/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   NAVIGATION â€” fixed bar, compass links, mobile panel,
   Cmd+K search overlay. Phi-harmonic throughout.
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Top bar â€” transparent â†’ solid on scroll â”€â”€ */
.nav-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--phi-space-lg);
  padding: var(--phi-space-md) var(--phi-space-xl);
  background: transparent;
  transition:
    background 0.3s var(--phi-ease),
    border-color 0.3s var(--phi-ease),
    box-shadow 0.3s var(--phi-ease);
  border-bottom: 1px solid transparent;
}
.nav-bar.scrolled {
  background: rgba(6, 6, 15, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--phi-gold-dim);
  box-shadow: 0 1px 26px rgba(212, 168, 67, 0.08);
}

/* â”€â”€ Logo â€” phi glyph + sacred text â”€â”€ */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--phi-space-md);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo .phi-glyph {
  font-family: var(--font-heading);
  font-size: var(--phi-h2);
  line-height: 1;
  color: var(--phi-gold);
  transition: text-shadow var(--phi-duration) var(--phi-ease);
}
.nav-logo:hover .phi-glyph {
  text-shadow: 0 0 12px var(--phi-gold-glow);
}
.nav-logo .logo-text {
  font-family: var(--font-sacred);
  font-size: var(--phi-caption);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--phi-gold);
  white-space: nowrap;
}

/* â”€â”€ Desktop links â€” compass points â”€â”€
   The 12 page links don't always fit horizontally â€” the row scrolls
   sideways (wheel / drag / touch), with gold fade hints at the overflow
   edges so every page stays reachable. */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--phi-space-md);
  list-style: none;
  flex: 1 1 auto;
  min-width: 0;                 /* allow the flex item to shrink */
  justify-content: flex-start;  /* flex-end would push overflow to the LEFT,
                                   where scrolling can never reach it */
  overflow-x: auto;             /* sideways scroll when links overflow */
  overflow-y: hidden;
  flex-wrap: nowrap;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* Firefox â€” hide the scrollbar */
  position: relative;
  padding-bottom: 2px;
}
.nav-links::-webkit-scrollbar {
  display: none;                /* Chrome/Edge â€” hide the scrollbar */
}
/* Gold fade hints â€” visible only on the side that has more links.
   JS toggles .can-scroll-left / .can-scroll-right on .nav-bar. */
.nav-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--phi-ease);
  z-index: 1;
}
.nav-fade.left {
  left: -4px;
  background: linear-gradient(to right, rgba(6, 6, 15, 0.95), rgba(6, 6, 15, 0));
}
.nav-fade.right {
  right: -4px;
  background: linear-gradient(to left, rgba(6, 6, 15, 0.95), rgba(6, 6, 15, 0));
}
.nav-bar.can-scroll-left .nav-fade.left,
.nav-bar.can-scroll-right .nav-fade.right {
  opacity: 1;
}
.nav-links a {
  font-family: var(--font-sacred);
  font-size: var(--phi-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--phi-text-dim);
  padding: var(--phi-space-sm) var(--phi-space-xs);
  position: relative;
  white-space: nowrap;
  transition: color var(--phi-duration) var(--phi-ease);
}
/* Gold underline â€” draws in from center */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; right: 50%;
  height: 1px;
  background: var(--phi-gold);
  box-shadow: 0 0 6px var(--phi-gold-glow);
  transition: left var(--phi-duration) var(--phi-ease),
              right var(--phi-duration) var(--phi-ease);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--phi-gold-bright);
}
.nav-links a:hover::after,
.nav-links a.active::after {
  left: 0; right: 0;
}

/* â”€â”€ Search trigger â€” Cmd+K pill â”€â”€ */
.search-trigger {
  position: relative;
  z-index: 2; /* stays above the nav overflow fades */
  display: flex;
  align-items: center;
  gap: var(--phi-space-sm);
  padding: var(--phi-space-xs) var(--phi-space-md);
  background: var(--phi-bg-card);
  border: 1px solid var(--phi-stroke);
  border-radius: 8px;
  color: var(--phi-text-dim);
  font-family: var(--font-body);
  font-size: var(--phi-caption);
  letter-spacing: 0.08em;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--phi-duration) var(--phi-ease),
              color var(--phi-duration) var(--phi-ease);
}
.search-trigger:hover {
  border-color: var(--phi-gold-dim);
  color: var(--phi-gold);
}
.search-trigger kbd {
  font-family: var(--font-mono);
  font-size: 0.7em;
  padding: 1px 4px;
  background: var(--phi-bg-elevated);
  border-radius: 3px;
  border: 1px solid var(--phi-stroke);
}

/* â”€â”€ Mobile hamburger â€” 3 lines morph to X â”€â”€ */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1001;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 1px;
  background: var(--phi-gold);
  position: absolute;
  left: 10px;
  transition: all 0.4s var(--phi-ease);
}
.hamburger span:nth-child(1) { top: 14px; }
.hamburger span:nth-child(2) { top: 21px; }
.hamburger span:nth-child(3) { top: 28px; }
.hamburger.active span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* â”€â”€ Mobile full-screen panel â”€â”€ */
/* Mobile panel — dropdown below nav-bar */
.mobile-panel {
  position: fixed;
  top: 60px;
  left: 0; right: 0;
  z-index: 9999;
  background: rgba(6, 6, 15, 0.97);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--phi-ease);
  border-bottom: 1px solid rgba(212,168,67,0.15);
}
.mobile-panel.open {
  max-height: 80vh;
  overflow-y: auto;
}
.mobile-panel.open {
  max-height: 80vh;
  overflow-y: auto;
}
.mobile-panel a {
  font-family: var(--font-sacred);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--phi-text);
  text-decoration: none;
  padding: var(--phi-space-sm) var(--phi-space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: color 0.2s, background 0.2s;
}
.mobile-panel a:last-child { border-bottom: none; }
.mobile-panel a:hover,
.mobile-panel a.active {
  color: var(--phi-gold-bright);
  background: rgba(212,168,67,0.06);
}
.mobile-panel a:hover,
.mobile-panel a.active {
  color: var(--phi-gold-bright);
}
/* Staggered link entrance â€” Ï†-spaced delays (0.05 Ã— Ï†â¿â»Â¹) */
.mobile-panel a:nth-child(1)  { transition-delay: 0.05s; }
.mobile-panel a:nth-child(2)  { transition-delay: 0.081s; }
.mobile-panel a:nth-child(3)  { transition-delay: 0.131s; }
.mobile-panel a:nth-child(4)  { transition-delay: 0.212s; }
.mobile-panel a:nth-child(5)  { transition-delay: 0.343s; }
.mobile-panel a:nth-child(6)  { transition-delay: 0.554s; }
.mobile-panel a:nth-child(7)  { transition-delay: 0.897s; }
.mobile-panel a:nth-child(8)  { transition-delay: 1s; }
.mobile-panel a:nth-child(9)  { transition-delay: 1s; }
.mobile-panel a:nth-child(10) { transition-delay: 1s; }
.mobile-panel a:nth-child(11) { transition-delay: 1s; }
.mobile-panel a:nth-child(12) { transition-delay: 1s; }
/* On close, links reset without stagger so the panel hides cleanly */
.mobile-panel:not(.open) a {
  transition-delay: 0s;
}

/* Body lock while the panel is open */
body.nav-open {
  overflow: hidden;
}

/* â”€â”€ Search overlay â€” full-screen dark, big input, gold hover â”€â”€ */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 6, 15, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s var(--phi-ease), visibility 0.3s;
}
.search-overlay.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}
.search-overlay .search-prompt {
  font-family: var(--font-sacred);
  font-size: var(--phi-caption);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--phi-gold-dim);
  margin-bottom: var(--phi-space-lg);
}
.search-overlay input {
  width: min(600px, 90vw);
  padding: var(--phi-space-lg) var(--phi-space-xl);
  background: var(--phi-bg-card);
  border: 1px solid var(--phi-gold-dim);
  border-radius: 12px;
  color: var(--phi-text-bright);
  font-size: var(--phi-h2);
  font-family: var(--font-body);
  outline: none;
  transition: box-shadow var(--phi-duration) var(--phi-ease),
              border-color var(--phi-duration) var(--phi-ease);
}
.search-overlay input::placeholder { color: var(--phi-text-dim); }
.search-overlay input:focus {
  border-color: var(--phi-gold);
  box-shadow: 0 0 26px var(--phi-gold-glow);
}
.search-results {
  width: min(600px, 90vw);
  max-height: 50vh;
  overflow-y: auto;
  margin-top: var(--phi-space-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--phi-gold-dim) transparent;
}
.search-results:empty { display: none; }
.search-result-item {
  display: block;
  padding: var(--phi-space-md) var(--phi-space-lg);
  border-bottom: 1px solid var(--phi-stroke);
  text-decoration: none;
  color: var(--phi-text);
  transition: background 0.2s var(--phi-ease), color 0.2s var(--phi-ease);
}
.search-result-item .result-title {
  color: var(--phi-text-bright);
  font-size: var(--phi-body);
}
.search-result-item .result-meta {
  color: var(--phi-text-dim);
  font-size: var(--phi-caption);
  margin-top: 2px;
}
.search-result-item:hover,
.search-result-item:focus {
  background: var(--phi-bg-card);
}
.search-result-item:hover .result-title,
.search-result-item:focus .result-title {
  color: var(--phi-gold);
}
.search-no-results {
  color: var(--phi-text-dim);
  padding: var(--phi-space-lg);
  font-size: var(--phi-body);
}

/* â”€â”€ Responsive â€” hide links, show hamburger â”€â”€ */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .search-trigger { display: none; }
  .hamburger { display: block; }
  .nav-logo .logo-text { font-size: 0.5rem; letter-spacing: 0.12em; }
}
@media (min-width: 769px) {
  /* Keep the bar readable on medium screens with 12 links */
  @media (max-width: 1024px) {
    .nav-links { gap: var(--phi-space-xs); }
    .nav-logo .logo-text { font-size: 0.5rem; }
  }
}

/* â”€â”€ Reduced motion â”€â”€ */
@media (prefers-reduced-motion: reduce) {
  .nav-bar, .nav-links a, .nav-links a::after,
  .hamburger span, .mobile-panel, .mobile-panel a,
  .search-overlay, .search-result-item {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .mobile-panel a { opacity: 1; transform: none; }
}

/* Sound toggle (Task 24) */
.sound-toggle {
  background: none; border: 1px solid var(--phi-stroke);
  color: var(--phi-text-dim); width: 32px; height: 32px;
  border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; margin-left: var(--phi-space-md);
  transition: color .3s var(--phi-ease), border-color .3s var(--phi-ease);
}
.sound-toggle:hover { color: var(--phi-gold); border-color: var(--phi-gold-dim); }
.sound-toggle.sound-off { opacity: .4; }
/* Tribute toggle (Task 26 — the Ghost track): gold-accented sibling */
.sound-toggle.sound-tribute { margin-left: var(--phi-space-sm); }
.sound-toggle.sound-tribute:not(.sound-off) {
  color: var(--phi-gold); border-color: var(--phi-gold-dim);
}
@media (max-width: 768px) { .sound-toggle { display: none; } }
