/* ==========================================================================
   星灵集团生态共享设计系统
   路径：星灵集团/shared/shared.css
   用途：统一四站字体、生态导航条、页脚、主题切换、基础组件
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 品牌色彩变量（按 data-brand 属性切换）
   -------------------------------------------------------------------------- */
:root {
  /* 集团母品牌：深夜蓝 */
  --group-primary: #0B1437;
  --group-secondary: #1E3A8A;
  --group-accent: #3B82F6;
  --group-bg: #F8FAFC;

  /* ONE/星灵中枢：星钴蓝 */
  --opc-primary: #1B4FD8;
  --opc-secondary: #1E40AF;
  --opc-accent: #06B6D4;

  /* 研习社/灵境引擎：玄境紫 */
  --study-primary: #6D28D9;
  --study-secondary: #7C3AED;
  --study-accent: #A78BFA;
  --study-pink: #DB2777;

  /* 工作台/盛世国信：晨曦橙 */
  --work-primary: #EA6A1E;
  --work-secondary: #D97706;
  --work-accent: #FBB130;

  /* 默认使用集团色 */
  --brand-primary: var(--group-accent);
  --brand-secondary: var(--group-secondary);
  --brand-accent: var(--group-accent);
  --topbar-active: #60A5FA;

  /* 共享间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* 共享圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* 字体 - 统一使用 Inter + 思源黑体（Noto Sans SC） */
  --font-display: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Geist Mono', 'SF Mono', 'Consolas', monospace;

  /* 基础颜色 */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --bg-body: #FFFFFF;
  --bg-surface: #F8FAFC;
  --bg-card: #FFFFFF;
  --border-color: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(11, 20, 55, 0.06);
  --shadow-md: 0 4px 12px rgba(11, 20, 55, 0.08);
  --shadow-lg: 0 12px 40px rgba(11, 20, 55, 0.12);
}

/* 品牌主题色切换 */
[data-brand="group"] {
  --brand-primary: var(--group-accent);
  --brand-secondary: var(--group-secondary);
  --brand-accent: var(--group-accent);
  --topbar-active: #60A5FA;
}

[data-brand="opc"] {
  --brand-primary: var(--opc-primary);
  --brand-secondary: var(--opc-secondary);
  --brand-accent: var(--opc-accent);
  --topbar-active: #22D3EE;
}

[data-brand="study"] {
  --brand-primary: var(--study-primary);
  --brand-secondary: var(--study-secondary);
  --brand-accent: var(--study-accent);
  --topbar-active: #C4B5FD;
}

[data-brand="work"] {
  --brand-primary: var(--work-primary);
  --brand-secondary: var(--work-secondary);
  --brand-accent: var(--work-accent);
  --topbar-active: #FCD34D;
}

/* 月光模式 */
[data-theme="dark"],
html.dark {
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --bg-body: #0B1437;
  --bg-surface: #0F2354;
  --bg-card: rgba(15, 35, 84, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   2. 基础重置与字体
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* 统一字号规范（基于品牌文档） */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  color: var(--text-primary);
}

h1 { font-size: clamp(2.25rem, 5.5vw, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.625rem); letter-spacing: -0.02em; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p {
  margin: 0 0 var(--space-4);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   3. 生态导航条（顶部条）
   -------------------------------------------------------------------------- */
.ecosystem-bar {
  background: var(--group-primary);
  color: white;
  font-size: 13px;
  height: 36px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1000;
  overflow: hidden;
  width: 100%;
}

.ecosystem-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .ecosystem-inner {
    padding: 0 var(--space-4);
  }
}

.ecosystem-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ecosystem-links::-webkit-scrollbar {
  display: none;
}

.ecosystem-links a,
.ecosystem-links span {
  white-space: nowrap;
  flex-shrink: 0;
}

.ecosystem-links a {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
  padding-bottom: 2px;
}

.ecosystem-links a:hover {
  color: white;
}

.ecosystem-links a.active {
  color: var(--topbar-active, var(--brand-primary));
  font-weight: 600;
}

.ecosystem-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--topbar-active, var(--brand-primary));
  border-radius: var(--radius-full);
}

.ecosystem-links span {
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

/* 主题切换按钮 */
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(15deg) scale(1.05);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: transform 0.3s, opacity 0.3s;
}

.theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

[data-theme="dark"] .theme-toggle .icon-sun,
html.dark .theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }

[data-theme="dark"] .theme-toggle .icon-moon,
html.dark .theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }

/* --------------------------------------------------------------------------
   4. 统一页脚
   -------------------------------------------------------------------------- */
.main-footer {
  background: var(--group-primary);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .footer-inner {
    padding: 0 var(--space-4);
  }
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

.footer-brand {
  color: white;
}

.footer-brand .brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.footer-brand .brand-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.footer-brand .brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.footer-brand .brand-slogan {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-brand p {
  font-size: 0.875rem;
  line-height: 1.7;
  max-width: 320px;
  margin-bottom: var(--space-4);
  color: rgba(255, 255, 255, 0.7);
}

.footer-eco-strip {
  display: flex;
  gap: 0;
  height: 4px;
  width: 120px;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.footer-eco-strip span {
  flex: 1;
}

.footer-eco-strip span:nth-child(1) { background: var(--group-accent); }
.footer-eco-strip span:nth-child(2) { background: var(--opc-primary); }
.footer-eco-strip span:nth-child(3) { background: var(--study-primary); }
.footer-eco-strip span:nth-child(4) { background: var(--work-primary); }

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col a {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--brand-accent);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-6);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
}

.footer-bottom-left { justify-self: start; }
.footer-bottom-center { justify-self: center; text-align: center; }
.footer-bottom-right { justify-self: end; }

.footer-bottom a {
  transition: color 0.2s ease;
}

.footer-bottom a:hover {
  color: var(--brand-accent);
}

@media (max-width: 768px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-3);
  }
  .footer-bottom-left,
  .footer-bottom-center,
  .footer-bottom-right {
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .footer-top {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   5. 移动端菜单遮罩
   -------------------------------------------------------------------------- */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   6. 通用工具类
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-primary);
  margin-bottom: var(--space-4);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  background: var(--brand-secondary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: transparent;
  color: var(--brand-primary);
  border: 1.5px solid var(--brand-primary);
}

.btn-secondary:hover {
  background: var(--brand-primary);
  color: white;
  transform: translateY(-2px);
}

/* 滚动显示动画 */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 选中文字颜色 */
::selection {
  background: rgba(59, 130, 246, 0.25);
  color: inherit;
}

/* 焦点样式 */
:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}
