/* ==========================================================================
   layout.css — 布局骨架 & 通用组件
   天天向上 Day Day Up · 官网
   本文件：容器 / 网格 / 按钮 / 导航栏 / 页脚 / 滚动渐显门控
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 容器与栅格
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(64px, 9vw, 108px);
}

/* 居中分隔分组 */
.section--tight {
  padding-block: clamp(48px, 6vw, 76px);
}

/* 通用网格 */
.grid {
  display: grid;
  gap: 26px;
}

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* --------------------------------------------------------------------------
   2. 按钮
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.btn:active { transform: translateY(1px) scale(.99); }

/* 主按钮 · 蓝绿渐变 */
.btn--primary {
  color: var(--on-primary);
  background-image: var(--gradient);
  box-shadow: 0 10px 24px rgba(14, 165, 233, .28);
}
.btn--primary:hover {
  box-shadow: 0 14px 32px rgba(14, 165, 233, .38);
  transform: translateY(-2px);
}

/* 描边次按钮 */
.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover {
  border-color: var(--primary-2);
  color: var(--primary);
  transform: translateY(-2px);
}

/* 玻璃按钮（导航栏内） */
.btn--glass {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
.btn--glass:hover { border-color: var(--primary-2); color: var(--primary); }

.btn--lg { padding: 16px 30px; font-size: 17px; border-radius: var(--radius-md); }
.btn--sm { padding: 10px 16px; font-size: 14px; border-radius: var(--radius-sm); }

.btn .btn__icon { width: 20px; height: 20px; flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   3. 导航栏（顶部固定 · 玻璃拟态）
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
}

.nav--bg {
  background-color: var(--nav-bg);
  border-bottom-color: var(--nav-border);
  box-shadow: 0 6px 24px rgba(15, 23, 42, .06);
}

.nav__inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}

.nav__logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.nav__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.nav__brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--text);
}

.nav__brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  position: relative;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color .2s ease, background-color .2s ease;
}

.nav__link:hover { color: var(--text); background: var(--surface-2); }

/* 折叠菜单（移动端） */
.nav__menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 主题切换按钮 */
.theme-toggle {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  transition: color .25s ease, border-color .25s ease, transform .18s ease;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary-2); }
.theme-toggle svg { width: 20px; height: 20px; }

/* 汉堡按钮（<768px 显示） */
.nav__burger {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
}
.nav__burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}
.nav__burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   4. 滚动渐显（JS 门控：无 JS 时默认可见）
   -------------------------------------------------------------------------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s cubic-bezier(.22, .61, .36, 1), transform .7s cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
html.js .reveal.visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   5. 区块标题
   -------------------------------------------------------------------------- */
.section-header {
  max-width: 720px;
  margin-bottom: clamp(36px, 5vw, 56px);
}

.section-header--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background-image: var(--gradient);
  border-radius: 2px;
}

.section-header--center .eyebrow::before { display: none; }

.section-title {
  margin-top: 14px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
}

.section-lead {
  margin-top: 16px;
  font-size: 18px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. 页脚
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 48px 0 56px;
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer__logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.footer__name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.footer__tagline {
  margin-top: 14px;
  max-width: 420px;
  font-size: 15px;
  color: var(--text-muted);
}

.footer__nav {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.footer__nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .2s ease;
}
.footer__nav a:hover { color: var(--primary); }

.footer__bottom {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-faint);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.footer__bottom a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color .2s ease;
}
.footer__bottom a:hover { color: var(--primary); }

.footer__bottom p {
  margin: 0;
}

.footer__beian {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer__legal {
  display: inline-flex;
  justify-content: center;
  gap: 20px;
}

.footer__legal a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color .2s ease;
}

/* --------------------------------------------------------------------------
   7. 响应式：平板 / 移动
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nav__burger { display: flex; }

  /* 移动端折叠面板：链接纵向堆叠 */
  .nav__menu {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    z-index: 49;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 16px var(--gutter) 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
  }
  .nav__menu.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav__links {
    flex-direction: column;
    width: 100%;
  }
  .nav__link {
    padding: 14px 12px;
    font-size: 17px;
    border-radius: var(--radius-sm);
  }

  .nav__actions { width: 100%; justify-content: space-between; padding-top: 6px; }
  .nav__actions .btn { flex: 1; }
}

@media (max-width: 768px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .section { padding-block: 56px; }
}
