/* ============================================================
   layout.css — 页面骨架：头部、Tab、主体、页脚、响应式
   ============================================================ */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- 头部（对齐社保计算工具：左 logo+品牌，中标题居中） ---------- */
.app-header {
  background: linear-gradient(135deg, var(--c-primary) 0%, #2b7de9 100%);
  color: #fff;
  padding: 28px 0 20px;
}

.app-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  position: relative;
}

.app-header__logo-link {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

/* 品牌链接不做下划线（覆盖 base.css 的 a:hover 全局规则；焦点圈保留以满足无障碍） */
.app-header__logo-link:hover {
  text-decoration: none;
  opacity: 0.9;
}

.app-header__logo {
  height: 40px;
  width: auto;
  display: block;
  flex: none;
}

.app-header__brand {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  line-height: 1.2;
  white-space: nowrap;
}

.app-header__titles {
  min-width: 0;
  text-align: center;
}

.app-header h1 {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.app-header__sub {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.app-header__meta {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* ---------- Tab 导航（吸顶） ---------- */
.tab-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
}

.tab-bar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
}

.tab {
  position: relative;
  padding: 14px 18px;
  border: 0;
  background: none;
  color: var(--c-text-2);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.15s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--c-primary);
}

.tab[aria-selected="true"] {
  color: var(--c-primary);
  font-weight: 600;
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  background: var(--c-primary);
  border-radius: 3px 3px 0 0;
}

.tab__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-size: 11px;
  line-height: 17px;
  font-weight: 600;
  vertical-align: 1px;
}

/* ---------- 主体 ---------- */
.app-main {
  padding: 20px 0 40px;
  min-height: 60dvh;
}

.panel[hidden] {
  display: none;
}

/* ---------- 页脚（对齐社保计算工具：三行居中） ---------- */
.app-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-3);
  font-size: 12px;
  padding: 20px 0;
  text-align: center;
}

.app-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.app-footer p {
  margin: 4px 0;
  line-height: 1.6;
}

.app-footer__copy {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--c-text-2);
}

.app-footer__disclaimer {
  color: #0b3d91;
  font-weight: 600;
}

.app-footer__src {
  font-size: 11px;
  opacity: 0.85;
}

/* 数据来源中的书名号标题是可点击的官方原文链接：给轻下划线，避免和纯文本混在一起看不出可点 */
.app-footer__src a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.app-footer a {
  color: inherit;
  text-decoration: none;
}

.app-footer a:hover {
  opacity: 0.8;
}

.app-footer__views {
  white-space: nowrap;
}

.app-footer__views #view-count {
  font-weight: 600;
  color: inherit;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .app-header {
    padding: 18px 0 14px;
  }
  /* 窄屏改为上下堆叠：logo 行 + 标题行，长标题不挤压 */
  .app-header__inner {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .app-header__logo-link {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    gap: 8px;
  }
  .app-header__logo {
    height: 30px;
  }
  .app-header__brand {
    font-size: 17px;
    letter-spacing: 1px;
  }
  .app-header__titles {
    text-align: left;
  }
  .app-header h1 {
    font-size: 18px;
  }
  .app-header__sub {
    font-size: 12px;
  }
  .app-header__meta {
    margin-top: 6px;
    display: none;
  }
  .tab {
    flex: 1;
    padding: 12px 6px;
    font-size: 14px;
  }
  .tab[aria-selected="true"]::after {
    left: 10px;
    right: 10px;
  }
  .tab__badge {
    display: none;
  }
  .app-main {
    padding: 14px 0 32px;
  }
  .app-footer__copy {
    gap: 10px;
    flex-direction: column;
  }
}
