/* ============================================
   SecretChapters – Premium Shared Navigation (v3)
   navigation.css (mahmuda.fun)
   Playful SVG logo · glass premium bar ·
   smooth mobile drawer · scroll shadow
   ============================================ */

/* Solid, not the semi-transparent + backdrop-filter "frosted glass" this
   used to be: on iOS Safari, backdrop-filter on a sticky/fixed header
   that content keeps scrolling past has repeatedly turned out to be the
   root cause of ghosting/smearing bugs elsewhere on this site (the
   story reader, the mobile nav drawer) — removing it here too rather
   than waiting for the same class of bug to get reported here as well. */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-card, #121215);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.navbar.scrolled {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Playful SVG logo ---------- */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.logo-svg {
  height: 34px;
  width: auto;
  display: block;
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.logo:hover .logo-svg { transform: rotate(-4deg) scale(1.05); }
[data-theme="light"] .logo-svg .text-wordmark-light { opacity: 1; }

/* ---------- Premium nav links ---------- */
.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary, #a8a29e);
  transition: all 0.25s ease;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item .nav-icon {
  font-size: 1rem;
  opacity: 0.85;
}
.nav-item:hover {
  color: var(--text-primary, #f2f0eb);
  background: var(--accent-soft, rgba(212, 175, 55, 0.12));
  transform: translateY(-1px);
}
.nav-item.active {
  color: var(--bg-primary, #050505);
  background: linear-gradient(135deg, var(--accent, #d4af37), #e9c55e);
  font-weight: 600;
  box-shadow: 0 4px 16px var(--accent-glow, rgba(212, 175, 55, 0.35));
}

/* ---------- Actions (theme / menu) ---------- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-elevated, #16161c);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  color: var(--text-primary, #f2f0eb);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.theme-toggle:hover {
  border-color: var(--accent, #d4af37);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(212, 175, 55, 0.15));
  transform: rotate(15deg);
}
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary, #f2f0eb);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Mobile drawer ---------- */
@media (max-width: 768px) {
  .nav-container { padding: 0 16px; height: 62px; }

  .nav-links {
    position: fixed;
    top: 62px;
    left: 0;
    right: 0;
    background: var(--bg-card, #121215);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 18px;
    gap: 4px;
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav-item {
    width: 100%;
    text-align: left;
    padding: 13px 16px;
    border-radius: 12px;
  }
  .nav-item.active { border-radius: 12px; }
  .menu-toggle { display: flex; }
}

/* Keep page content clear of the *fixed* .navbar used by every page
   except index.html (which uses .sc-navbar — position:sticky, not
   fixed, so it already reserves its own space in normal document flow
   and needs no compensating padding). This used to apply unscoped to
   every page, adding an unwanted ~62-70px blank gap above index.html's
   own header — the ugly empty strip right at the top of the site. */
body:has(> .navbar) { padding-top: 70px; }
@media (max-width: 768px) { body:has(> .navbar) { padding-top: 62px; } }
