﻿/* ══════════════════════════════════════════════════
   自学平台 — 跨学科顶部导航栏（共享样式）
   所有页面统一引用此文件，避免样式重复
   ══════════════════════════════════════════════════ */

/* ==================== 跨学科顶部导航 ==================== */
.top-nav {
  background: linear-gradient(180deg, #2b1d15, #3d2a1e);
  border-bottom: 1px solid #5a3e2b;
  position: sticky;
  top: 0;
  z-index: 101;
}

.top-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1.2rem;
}

.top-nav-brand {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #d4a853;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(212, 168, 83, 0.3);
  border-radius: 4px;
  transition: color 180ms ease, border-color 180ms ease;
}

.top-nav-brand:hover {
  color: #e8c97a;
  border-color: rgba(212, 168, 83, 0.6);
}

.top-nav-links {
  display: flex;
  gap: 0;
  align-items: center;
}

.top-nav-links a {
  padding: 0.35rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(250, 243, 226, 0.7);
  text-decoration: none;
  border-radius: 4px;
  transition: all 180ms ease;
}

.top-nav-links a:hover {
  color: #e8c97a;
  background: rgba(255, 255, 255, 0.06);
}

.top-nav-links a.active {
  color: #e8c97a;
  background: rgba(212, 168, 83, 0.12);
}

.top-nav-divider {
  width: 1px;
  height: 1.2rem;
  background: rgba(212, 168, 83, 0.2);
  margin: 0 0.2rem;
}

.top-nav-user {
  font-size: 0.8rem;
  color: rgba(250, 243, 226, 0.5);
  font-family: var(--font-ui);
  padding: 0.35rem 0.5rem;
}

/* 移动端汉堡菜单按钮 */
.top-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2rem;
  height: 2rem;
  background: none;
  border: 1px solid rgba(212, 168, 83, 0.3);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  z-index: 102;
}

.top-nav-toggle span {
  display: block;
  width: 1.2rem;
  height: 2px;
  background: #d4a853;
  border-radius: 1px;
  transition: all 200ms ease;
}

.top-nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.top-nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.top-nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
  .top-nav-toggle {
    display: flex;
  }

  .top-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: linear-gradient(180deg, #3d2a1e, #2b1d15);
    border-bottom: 1px solid #5a3e2b;
    padding: 0.5rem 0;
    z-index: 100;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  }

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

  .top-nav-links a {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 0;
    text-align: center;
    width: 100%;
  }

  .top-nav-divider {
    display: none;
  }

  .top-nav-user {
    display: none;
  }

  .top-nav-inner {
    padding: 0.4rem 0.8rem;
    position: relative;
  }
}

@media (max-width: 768px) and (min-width: 641px) {
  .top-nav-links a {
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
  }
  .top-nav-inner {
    padding: 0.4rem 0.8rem;
  }
}



/* === 瀛︾鍐呬笅鎷夊鑸?(2026-08-08) === */
.sub-nav-dropdown {
  position: relative;
  display: inline-block;
}
.sub-nav-dropdown > a.has-dropdown::after {
  content: ' \25BC';
  font-size: 0.6rem;
  vertical-align: middle;
  opacity: 0.6;
}
.sub-nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.4rem;
  padding: 0.5rem;
  background: var(--card-front-bg, #faf6f0);
  border: 1px solid var(--rule, #d7b98c);
  border-radius: 0.8rem;
  box-shadow: 0 12px 32px var(--shadow, rgba(43,29,21,0.16));
  z-index: 30;
  min-width: 160px;
  white-space: nowrap;
}
.sub-nav-dropdown:hover .sub-nav-dropdown-menu,
.sub-nav-dropdown:focus-within .sub-nav-dropdown-menu {
  display: block;
}
.sub-nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  text-align: center;
  font-family: var(--font-ui, sans-serif);
  color: var(--ink-soft, rgba(43,29,21,0.72));
  transition: all 180ms ease;
}
.sub-nav-dropdown-menu a:hover {
  background: var(--accent-soft, rgba(159,45,32,0.1));
  color: var(--accent, #9f2d20);
}
.sub-nav-dropdown-menu a.active {
  color: var(--accent, #9f2d20);
  background: var(--accent-soft, rgba(159,45,32,0.1));
  font-weight: 700;
}
@media (max-width: 640px) {
  .sub-nav-dropdown {
    display: block;
    width: 100%;
  }
  .sub-nav-dropdown > a {
    text-align: center;
    font-weight: 700;
    color: var(--accent, #9f2d20);
    padding: 0.6rem 0.8rem;
  }
  .sub-nav-dropdown > a.has-dropdown::after {
    display: none;
  }
  .sub-nav-dropdown-menu {
    display: block !important;
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    min-width: auto;
  }
  .sub-nav-dropdown-menu a {
    text-align: center;
    padding: 0.5rem 0.8rem;
  }
}

/* === 个人中心直链 (2026-08-08) === */
.nav-links a.nav-profile-link {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent, #9f2d20);
  border: 1px solid var(--accent, #9f2d20);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 180ms ease;
  margin-left: 0.3rem;
}
.nav-links a.nav-profile-link:hover {
  background: var(--accent, #9f2d20);
  color: var(--card-front-bg, #faf6f0);
}
@media (max-width: 640px) {
  .nav-links a.nav-profile-link {
    display: block;
    width: 100%;
    text-align: center;
    margin: 0.3rem 0;
    padding: 0.6rem 0.8rem;
  }
}