/* =========================================================
   北京京驰律师事务所 - 移动端样式
   设计原则：移动优先，宽度基准 375px，最大适配 480px
   ========================================================= */

:root {
  --primary: #8B0000;        /* 深红 - 主色 */
  --primary-bright: #c62828;  /* 亮红 - 强调 */
  --primary-soft: #f5e9e9;    /* 浅红背景 */
  --gold: #b8945f;            /* 金色点缀 */
  --black: #1a1a1a;
  --dark: #2c2c2c;
  --text: #333;
  --text-sub: #666;
  --text-mute: #999;
  --bg: #f7f5f2;              /* 米白背景 */
  --bg-card: #ffffff;
  --border: #ececec;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ========== App 容器 - 移动优先，PC居中 ========== */
.app {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

@media (min-width: 481px) {
  .app {
    box-shadow: 0 0 40px rgba(0,0,0,0.08);
  }
}

/* ========== 顶部导航 ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  min-height: 50px;
}
.brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.brand-logo {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.brand-text { min-width: 0; flex: 1; }
.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 1px;
  margin-top: 1px;
}
.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

/* ========== Hero 首屏 ========== */
.hero {
  position: relative;
  background: linear-gradient(180deg, #3a0a0a 0%, var(--black) 60%);
  color: #fff;
  overflow: hidden;
}
.hero-img {
  width: 100%;
  height: auto;
  display: block;
}
.hero-content {
  padding: 18px 16px 22px;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(26,26,26,0.15) 0%, var(--black) 25%);
}
.hero-tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(184,148,95,0.9);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.hero-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 4px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.hero-desc {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 14px;
}
.hero-cta { display: flex; gap: 10px; }
.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 12px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(139,0,0,0.3);
}
.btn-outline {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(4px);
}

/* ========== 快捷入口 ========== */
.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  margin: 0;
}
.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 4px;
  background: var(--bg-card);
  color: var(--dark);
  text-align: center;
}
.quick-icon {
  font-size: 26px;
  margin-bottom: 6px;
  line-height: 1;
}
.quick-label {
  font-size: 12px;
  color: var(--text-sub);
}

/* ========== 通用 Section ========== */
.section {
  padding: 24px 16px;
  background: var(--bg);
}
.section + .section { padding-top: 4px; }
.section-head {
  text-align: center;
  margin-bottom: 18px;
}
.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--black);
  position: relative;
  display: inline-block;
  padding: 0 24px;
}
.section-title::before,
.section-title::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 18px;
  height: 1px;
  background: var(--gold);
}
.section-title::before { left: 0; }
.section-title::after { right: 0; }
.section-sub {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 2px;
  margin-top: 4px;
}

/* ========== 业务领域 ========== */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.service-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.service-item:active { transform: scale(0.97); }
.service-icon {
  font-size: 32px;
  margin-bottom: 8px;
  line-height: 1;
}
.service-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 4px;
}
.service-desc {
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.4;
}

/* ========== 关于我们 ========== */
.about-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.about-quote {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  font-family: serif;
  letter-spacing: 2px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.about-text {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.8;
  white-space: pre-line;
  text-align: justify;
}
.about-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  font-family: -apple-system, sans-serif;
}
.stat-label {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}

/* ========== 律师团队 ========== */
.team-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.team-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.team-scroll::-webkit-scrollbar { display: none; }
.team-card {
  flex: 0 0 200px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  scroll-snap-align: start;
  cursor: pointer;
}
.team-photo {
  width: 100%;
  height: 240px;
  object-fit: cover;
  object-position: center top;
  background: #ddd;
}
.team-info {
  padding: 12px;
  text-align: center;
}
.team-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 2px;
}
.team-role {
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 4px;
}
.team-edu {
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.team-btn {
  display: inline-block;
  padding: 5px 14px;
  font-size: 11px;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: var(--primary-soft);
}

/* ========== 文章列表 ========== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.article-item {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.article-item:active { transform: scale(0.98); }
.article-cover {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary-soft), #fafafa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
  font-family: serif;
}
.article-body { flex: 1; min-width: 0; }
.article-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.article-summary {
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-mute);
}
.article-tag {
  padding: 1px 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 3px;
  font-size: 10px;
}
.loading, .empty {
  text-align: center;
  padding: 30px 0;
  color: var(--text-mute);
  font-size: 13px;
}

/* ========== 联系我们 ========== */
.contact-section { padding-bottom: 20px; }
.contact-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.contact-item:last-child { border-bottom: none; }
.contact-label {
  font-size: 13px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}
.contact-value {
  font-size: 15px;
  color: var(--primary);
  font-weight: 600;
  font-family: -apple-system, sans-serif;
  cursor: pointer;
}
.contact-qr-btn {
  padding: 4px 10px;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
}

/* ========== 底部 Footer ========== */
.footer {
  background: var(--black);
  color: #aaa;
  padding: 24px 16px 20px;
  text-align: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}
.footer-logo {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.footer-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-align: left;
}
.footer-slogan {
  font-size: 11px;
  color: var(--gold);
  text-align: left;
  margin-top: 2px;
}
.footer-text {
  font-size: 11px;
  color: #777;
  margin-bottom: 4px;
}
.footer-icp {
  font-size: 11px;
  color: #777;
}
.footer-icp a { color: #777; text-decoration: underline; }

/* ========== 底部固定行动栏 ========== */
.bottom-spacer { height: calc(56px + var(--safe-bottom)); }
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  padding-bottom: var(--safe-bottom);
  max-width: 480px;
  margin: 0 auto;
}
.bottom-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  font-size: 11px;
  color: var(--text-sub);
  cursor: pointer;
}
.bottom-btn-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 3px;
}
.bottom-btn-label { font-size: 11px; }
.bottom-btn-phone { color: var(--text); }
.bottom-btn-call { color: var(--primary); }

/* ========== 悬浮客服按钮 ========== */
.fab {
  position: fixed;
  right: max(12px, calc(50vw - 240px + 12px));
  bottom: calc(78px + var(--safe-bottom));
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-bright));
  color: #fff;
  box-shadow: 0 4px 16px rgba(139,0,0,0.4);
  font-size: 12px;
  line-height: 1.1;
  font-weight: 500;
  text-align: center;
  animation: fabPulse 2.4s infinite;
}
.fab-icon { font-size: 18px; margin-bottom: 1px; }
.fab-text { font-size: 10px; }
@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(139,0,0,0.4); }
  50% { box-shadow: 0 4px 22px rgba(139,0,0,0.6), 0 0 0 6px rgba(198,40,40,0.15); }
}

/* ========== 二维码弹窗 ========== */
.qr-modal, .lawyer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.qr-modal.show, .lawyer-modal.show { display: flex; }
.qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}
.qr-panel {
  position: relative;
  width: 80%;
  max-width: 320px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 20px 22px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: panelIn 0.25s ease-out;
}
@keyframes panelIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.qr-close {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 26px;
  color: var(--text-mute);
  line-height: 1;
  padding: 4px 8px;
}
.qr-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 14px;
}
.qr-img-wrap {
  background: #fff;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: 10px;
}
.qr-img-wrap img {
  width: 220px;
  height: auto;
  max-height: 300px;
  display: block;
  object-fit: contain;
}
.qr-tip {
  font-size: 12px;
  color: var(--text-mute);
}

/* ========== 律师详情弹窗 ========== */
.lawyer-panel {
  position: relative;
  width: 88%;
  max-width: 380px;
  max-height: 80vh;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: panelIn 0.25s ease-out;
  overflow-y: auto;
}
.lawyer-detail-photo {
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center top;
  background: #ddd;
}
.lawyer-detail-info {
  padding: 18px 18px 22px;
}
.lawyer-detail-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  text-align: center;
  margin-bottom: 4px;
}
.lawyer-detail-role {
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 4px;
}
.lawyer-detail-edu {
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 16px;
}
.lawyer-detail-field {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 14px;
}
.lawyer-detail-quote {
  font-family: serif;
  text-align: center;
  font-size: 14px;
  color: var(--text-sub);
  font-style: italic;
  padding: 14px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 14px;
}
.lawyer-detail-call {
  display: block;
  text-align: center;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
}

/* ========== 文章详情页 ========== */
.article-page {
  padding: 16px;
  padding-bottom: calc(70px + var(--safe-bottom));
}
.article-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.4;
  margin-bottom: 10px;
}
.article-page-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-mute);
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article-page-content {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
}
.article-page-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--black);
  margin: 20px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
}
.article-page-content p { margin-bottom: 12px; }
.article-page-content ul, .article-page-content ol {
  padding-left: 22px;
  margin-bottom: 12px;
}
.article-page-content li { margin-bottom: 6px; }
.article-back {
  display: inline-block;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 16px;
  margin-bottom: 14px;
}

/* ========== 响应式微调 ========== */
@media (max-width: 359px) {
  .hero-title { font-size: 22px; }
  .hero-cta { flex-direction: column; }
  .quick-label { font-size: 11px; }
  .team-card { flex: 0 0 170px; }
  .team-photo { height: 200px; }
}

@media (min-width: 481px) {
  .bottom-bar, .fab { max-width: 480px; }
  .fab { right: calc(50vw - 240px + 12px); }
}

/* iOS橡皮筋 */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-overflow-scrolling: touch; }
