/* ==========================================================================
   中育启智教育 · 首页自有样式（只写首页业务区）
   —— 依赖公共层：/common/tokens.css + /common/site.css（必须先引用）
   —— 覆盖内容：沉浸式首屏（视频轮播 + 隐形渐变下箭头）、大图背景区块
                （研学介绍/路线/智能体/关于）、导航下拉、滚动淡入
   ========================================================================== */

/* ---------- 锚点定位补偿（导航悬浮高度） ---------- */
.band,
.hero {
  scroll-margin-top: var(--nav-height);
}

/* ==========================================================================
   首页导航：全程透明悬浮（白字），与大图背景区块自然融合
   ========================================================================== */
.site-nav--hero {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom-color: transparent;
}

.site-nav--hero .nav-site {
  color: #fff;
}

.site-nav--hero .nav-menu-btn {
  color: #fff;
}

.site-nav--hero .nav-links a {
  color: rgba(255, 255, 255, 0.85);
}

.site-nav--hero .nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.site-nav--hero .nav-links a.is-active {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- 导航「智能体」下拉 ---------- */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dd-caret {
  transition: transform var(--dur-fast);
}

.nav-dropdown:hover .dd-caret,
.nav-dropdown.is-open .dd-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 6px);
  min-width: 264px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-fast), transform var(--dur-fast),
    visibility var(--dur-fast);
  z-index: 20;
}

/* 桌面端：悬停展开（向上悬停连接区，避免移动鼠标时菜单消失） */
@media (min-width: 861px) {
  .nav-dropdown-menu::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }
}

/* 移动端：点击 .is-open 展开，占满面板宽度 */
.nav-dropdown.is-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.menu-label {
  padding: 8px 12px 4px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: background var(--dur-fast);
}

.menu-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.menu-item.is-coming {
  color: var(--text-muted);
  cursor: default;
}

.menu-item.is-coming:hover {
  background: transparent;
  color: var(--text-muted);
}

/* 下拉面板为白底：已上线项是 <a>，须强制深色，
   否则被 hero 导航白字规则（.site-nav--hero .nav-links a）覆盖成白字而不可见 */
.site-nav--hero .nav-links .menu-item {
  color: var(--text);
}
.site-nav--hero .nav-links .menu-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.mi-name {
  flex: 1;
}

/* ==========================================================================
   首屏：沉浸式视频轮播
   ========================================================================== */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* 视频全部加载失败时的渐变兜底背景 */
  background: linear-gradient(160deg, #16224e 0%, #1e3a8a 55%, #2b5aed 100%);
  color: #fff;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s var(--ease);
}

.hero-video.is-active {
  opacity: 1;
}

/* 渐变压暗层：保证文字可读性 */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(10, 18, 46, 0.55) 0%,
    rgba(10, 18, 46, 0.35) 45%,
    rgba(10, 18, 46, 0.65) 100%
  );
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
  max-width: 900px;
}

/* 入场分层动画 */
.hero-content > * {
  animation: hero-fade-up 0.9s var(--ease) both;
}

.hero-content > *:nth-child(1) { animation-delay: 0.05s; }
.hero-content > *:nth-child(2) { animation-delay: 0.18s; }
.hero-content > *:nth-child(3) { animation-delay: 0.34s; }
.hero-content > *:nth-child(4) { animation-delay: 0.5s; }

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-tag {
  display: inline-block;
  padding: 6px 18px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  font-size: var(--fs-sm);
  letter-spacing: 0.2em;
  margin-bottom: 22px;
}

.hero-company {
  font-size: clamp(34px, 6.5vw, 64px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.hero-slogan {
  margin-top: 18px;
  font-size: clamp(24px, 4.5vw, 44px);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.hero-desc {
  margin: 20px auto 0;
  max-width: 640px;
  font-size: var(--fs-md);
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.78);
}

/* ---------- 向下浏览指示：隐形渐变箭头 ---------- */
.hero-down {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px;
}

.hero-down-chev {
  width: 15px;
  height: 15px;
  border-right: 2px solid rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 2px;
  transform: rotate(45deg);
  opacity: 0;
  /* 交错淡入淡出，整体呈现「隐形渐变」的向下流动感 */
  animation: down-flow 1.8s var(--ease) infinite;
}

.hero-down-chev:nth-child(1) { animation-delay: 0s; }
.hero-down-chev:nth-child(2) { animation-delay: 0.2s; }
.hero-down-chev:nth-child(3) { animation-delay: 0.4s; }

@keyframes down-flow {
  0% {
    opacity: 0;
    transform: rotate(45deg) translate(-8px, -8px);
  }
  40% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: rotate(45deg) translate(8px, 8px);
  }
}

/* ==========================================================================
   大图背景区块（研学介绍 / 路线 / 智能体 / 关于）
   ========================================================================== */
.band {
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #fff;
  padding: 96px 0;
  background: #101a3d; /* 图片未加载时的深色兜底 */
}

.band-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}

/* 桌面端视差滚动，移动端关闭（兼容性问题） */
@media (min-width: 861px) {
  .band-bg {
    background-attachment: fixed;
  }
}

/* 深色压暗层：保证文字与卡片可读性 */
.band-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(8, 14, 38, 0.72) 0%,
    rgba(8, 14, 38, 0.5) 45%,
    rgba(8, 14, 38, 0.78) 100%
  );
  pointer-events: none;
}

.band-content {
  position: relative;
  z-index: 2;
  width: 100%;
}

.band-head {
  text-align: center;
  margin-bottom: 52px;
}

.band-title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
}

/* 标题下方橙色短线装饰 */
.band-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin: 18px auto 0;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.6);
}

.band-sub {
  margin: 20px auto 0;
  max-width: 760px;
  font-size: var(--fs-lg);
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ---------- 玻璃拟态通用 ---------- */
.pillar-card,
.route-card,
.tools-col,
.about-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform var(--dur-base), background var(--dur-base),
    border-color var(--dur-base);
}

.pillar-card:hover,
.route-card:hover,
.about-card:hover {
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}

/* ==========================================================================
   研学介绍：三大支柱
   ========================================================================== */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.pillar-card {
  padding: 32px 26px;
  text-align: center;
}

.pillar-card h3 {
  font-size: var(--fs-lg);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.pillar-card p {
  font-size: var(--fs-sm);
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.82);
}

/* ==========================================================================
   热门研学路线（横向滚动 + scroll-snap，深色玻璃卡）
   ========================================================================== */
.routes-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.routes-track::-webkit-scrollbar {
  height: 8px;
}

.routes-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
}

.routes-track::-webkit-scrollbar-track {
  background: transparent;
}

.route-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  overflow: hidden;
}

.route-cover {
  height: 170px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.route-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow);
}

.route-card:hover .route-cover img {
  transform: scale(1.06);
}

.route-cover--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: linear-gradient(135deg, rgba(43, 90, 237, 0.4), rgba(30, 58, 138, 0.4));
}

.route-body {
  padding: 16px 18px 18px;
}

.route-name {
  font-size: var(--fs-md);
  font-weight: 700;
}

/* ==========================================================================
   智能体：智慧研学支撑平台（玻璃拟态分组展示，无按钮）
   ========================================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

.tools-col {
  padding: 24px 22px;
}

.tools-col-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.tools-col-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--accent);
}

.tool-row {
  padding: 14px 12px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast);
}

.tool-row + .tool-row {
  margin-top: 4px;
}

.tool-row:hover {
  background: rgba(255, 255, 255, 0.1);
}

.tool-info {
  flex: 1;
  min-width: 0;
}

.tool-name {
  font-size: var(--fs-md);
  font-weight: 700;
  margin-bottom: 6px;
}

.tool-desc {
  font-size: var(--fs-xs);
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.75);
}

/* ==========================================================================
   关于我们
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.about-card {
  padding: 30px 26px;
  text-align: center;
}

.about-card h3 {
  font-size: var(--fs-md);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.about-card p {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.9;
}

/* ==========================================================================
   滚动淡入（配合 app.js 的 initReveal）
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 860px) {
  .band {
    padding: 64px 0;
    min-height: auto;
  }

  .band-title {
    font-size: var(--fs-2xl);
  }

  .pillar-grid,
  .tools-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .route-card {
    flex-basis: 260px;
  }

  /* 移动端菜单展开为白底面板：链接强制深色（即使导航仍在首屏透明态） */
  .site-nav--hero .nav-links a {
    color: var(--text-secondary);
  }

  .site-nav--hero .nav-links a:hover,
  .site-nav--hero .nav-links a.is-active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  /* 移动端下拉：静态展开于面板内，浅色卡片风格 */
  .nav-dropdown-menu {
    position: static;
    transform: none;
    min-width: 0;
    margin-top: 6px;
    padding: 4px 8px 8px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: none;
  }

  .nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .menu-item {
    color: var(--text-secondary);
  }

  .menu-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
  }

  .menu-item.is-coming {
    color: var(--text-muted);
  }
}

/* 减弱动效偏好：关闭入场动画与过渡 */
@media (prefers-reduced-motion: reduce) {
  .hero-content > * {
    animation: none;
  }

  .hero-video,
  .reveal,
  .route-card,
  .pillar-card,
  .about-card,
  .nav-dropdown-menu {
    transition: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .hero-down-chev {
    animation: none;
    opacity: 0.7;
  }
}

/* ==========================================================================
   导航登录态：登录按钮 / 用户信息 chip / 退出，智能体权限置灰
   —— 默认白底导航与 hero 透明导航（白字）各适配一套配色
   ========================================================================== */
.nav-auth-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.nav-auth-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.nav-auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-width: 200px;
}

.nav-auth-chip > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* hero 透明导航（白字）适配 */
.site-nav--hero .nav-auth-btn {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

.site-nav--hero .nav-auth-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.site-nav--hero .nav-auth-chip {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---------- 小屏 ---------- */
@media (max-width: 860px) {
  .nav-auth-chip {
    max-width: 130px;
  }

  .nav-auth-btn {
    padding: 6px 12px;
  }
}
