/* ============================================================
   BREAK THE CIRCLE — Layout System
   (Public Nav + App Shell: Sidebar / Bottom Nav)
   ============================================================ */

/* ===== PUBLIC NAVBAR ===== */
.public-nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--sp-6);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-base), box-shadow var(--t-base);
}
.public-nav.scrolled {
  box-shadow: var(--shadow-md);
  background: var(--bg-overlay);
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.nav-logo-text {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  color: var(--text);
  line-height: 1;
}
.nav-logo-text span { color: var(--clr-primary); }

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}
.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-sub);
  transition: color var(--t-fast);
}
.nav-link:hover { color: var(--clr-primary); }

/* Nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--sp-2);
  cursor: pointer;
  color: var(--text-sub);
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: var(--r-full);
  transition: all var(--t-fast);
}

/* Mobile nav drawer */
.nav-drawer {
  display: none;
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: calc(var(--z-sticky) - 1);
  padding: var(--sp-8) var(--sp-6);
  flex-direction: column;
  gap: var(--sp-4);
  border-top: 1px solid var(--border);
  animation: fadeInUp .25s ease both;
}
.nav-drawer.open { display: flex; }
.nav-drawer .nav-link { font-size: var(--text-lg); font-weight: 600; }

@media (max-width: 768px) {
  .nav-links    { display: none; }
  .nav-hamburger { display: flex; }
}

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: transform var(--t-base);
  overflow-y: auto;
  overflow-x: hidden;
}
[data-theme="dark"] .sidebar {
  background: var(--bg-surface);
  box-shadow: 2px 0 30px rgba(0,0,0,.4);
}

/* Sidebar logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-logo-icon { width: 34px; height: 34px; flex-shrink: 0; }
.sidebar-logo-text {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--text);
  line-height: 1.1;
}
.sidebar-logo-text span { color: var(--clr-primary); }

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  color: var(--text-sub);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: all var(--t-fast);
  user-select: none;
}
.sidebar-item:hover {
  background: var(--border);
  color: var(--clr-primary);
}
.sidebar-item.active {
  background: var(--clr-primary-glow);
  color: var(--clr-primary);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--clr-primary);
  border-radius: 0 3px 3px 0;
  box-shadow: var(--glow-xs);
}
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Submit button in sidebar */
.sidebar-item.submit-cta {
  background: var(--clr-primary);
  color: white;
  margin-top: var(--sp-2);
  margin-bottom: var(--sp-2);
  box-shadow: var(--glow-sm);
  font-weight: 700;
}
.sidebar-item.submit-cta:hover {
  background: var(--clr-primary-hover);
  color: white;
  box-shadow: var(--glow-md);
  transform: translateY(-1px);
}
.sidebar-item.submit-cta::before { display: none; }

/* Sidebar footer */
.sidebar-footer {
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App topbar (visible on mobile) */
.app-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

/* Hamburger for mobile sidebar */
.topbar-hamburger {
  padding: var(--sp-2);
  color: var(--text-sub);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.topbar-hamburger:hover { background: var(--border); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: calc(var(--z-sticky) - 1);
  backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }

/* Page body padding */
.page-body {
  padding: var(--sp-8);
  flex: 1;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: var(--z-sticky);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
[data-theme="dark"] .bottom-nav {
  box-shadow: 0 -4px 30px rgba(0,0,0,.4);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  padding: 0 var(--sp-2);
}

.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-lg);
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .02em;
  flex: 1;
  min-width: 0;
  transition: color var(--t-fast);
}
.bn-item svg { width: 20px; height: 20px; }
.bn-item.active { color: var(--clr-primary); }
.bn-item.active svg { filter: drop-shadow(0 0 5px var(--clr-primary)); }

/* Submit button in bottom nav */
.bn-item.bn-submit {
  background: var(--clr-primary);
  color: white;
  border-radius: var(--r-full);
  width: 50px;
  height: 50px;
  padding: 0;
  flex: 0 0 50px;
  margin-top: -14px;
  box-shadow: var(--glow-md);
  font-size: 0;
  transition: all var(--t-fast);
}
.bn-item.bn-submit:hover { background: var(--clr-primary-hover); transform: scale(1.05); }
.bn-item.bn-submit svg { width: 22px; height: 22px; }

/* ===== RESPONSIVE OVERRIDES ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: var(--z-overlay);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
  }

  .app-topbar { display: flex; }
  .bottom-nav { display: block; }

  .page-body {
    padding: var(--sp-5) var(--sp-4);
    padding-bottom: calc(var(--bottom-nav-h) + var(--sp-4));
  }
}

@media (max-width: 480px) {
  .page-body { padding: var(--sp-4) var(--sp-3); padding-bottom: calc(var(--bottom-nav-h) + var(--sp-4)); }
}

/* ===== PAGE TRANSITIONS ===== */
.page-enter { animation: fadeInUp .35s ease both; }

/* ===== SECTION SPACING (landing) ===== */
.section { padding: var(--sp-24) 0; }
.section-sm { padding: var(--sp-16) 0; }
.section-header { margin-bottom: var(--sp-12); }
.section-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  margin-bottom: var(--sp-4);
}
.section-header p {
  font-size: var(--text-lg);
  color: var(--text-sub);
  max-width: 560px;
  margin-inline: auto;
}
