/* ============================================
   legal.css — 协议 / 政策 / 商家入驻类长文页面排版
   ============================================ */

/* ============================================
   1. 内容布局 Content Layout
   ============================================ */
.legal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--sp-12);
  padding: var(--sp-12) 0 var(--sp-20);
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
}

/* grid item 默认可被 min-content 撑宽，小屏下会让 1fr 轨道超出容器并被 body 裁切 */
.legal-layout > * {
  min-width: 0;
}

.legal-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--sp-6));
  align-self: start;
  max-height: calc(100vh - var(--nav-height) - var(--sp-12));
  overflow-y: auto;
  padding-right: var(--sp-4);
}

.legal-sidebar::-webkit-scrollbar {
  width: 6px;
}

.legal-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.legal-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 3px;
}

.legal-sidebar-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--color-border);
}

.legal-toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legal-toc-item {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  border-left: 3px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: all var(--t-fast);
  line-height: 1.5;
}

.legal-toc-item:hover {
  background: var(--color-bg-soft);
  color: var(--color-primary);
}

.legal-toc-item.is-active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-weight: var(--fw-semibold);
  border-left-color: var(--color-gold);
}

@media (max-width: 960px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: var(--sp-8);
  }

  .legal-sidebar {
    position: static;
    max-height: none;
    padding: var(--sp-5);
    background: var(--color-bg-soft);
    border-radius: var(--r-lg);
  }

  .legal-sidebar-title {
    margin-bottom: var(--sp-3);
  }

  .legal-toc {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-1);
  }

  .legal-toc-item {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--r-sm);
  }

  .legal-toc-item.is-active {
    border-left: none;
    border-bottom-color: var(--color-gold);
  }
}

/* ============================================
   2. 法律文档正文
   ============================================ */
.legal-content {
  max-width: 760px;
}

.legal-content h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-ink);
  margin: var(--sp-12) 0 var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--color-border);
  scroll-margin-top: calc(var(--nav-height) + var(--sp-4));
}

.legal-content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.legal-content h2 .num {
  display: inline-block;
  margin-right: var(--sp-2);
  color: var(--color-gold-dark);
  font-weight: var(--fw-black);
}

.legal-content h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-ink);
  margin: var(--sp-8) 0 var(--sp-3);
  scroll-margin-top: calc(var(--nav-height) + var(--sp-4));
}

.legal-content p {
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--color-text);
  margin-bottom: var(--sp-4);
}

.legal-content strong {
  font-weight: var(--fw-semibold);
  color: var(--color-ink);
}

.legal-content ol,
.legal-content ul {
  margin: 0 0 var(--sp-5) var(--sp-6);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
}

.legal-content ol {
  list-style: decimal;
}

.legal-content ul {
  list-style: disc;
}

.legal-content li {
  margin-bottom: var(--sp-3);
  padding-left: var(--sp-2);
}

.legal-content li::marker {
  color: var(--color-gold-dark);
  font-weight: var(--fw-semibold);
}

/* 嵌套列表 */
.legal-content li > ul,
.legal-content li > ol {
  margin-top: var(--sp-2);
  margin-left: var(--sp-4);
}

.legal-content li > ul li,
.legal-content li > ol li {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
}

/* ============================================
   3. 风险提示框
   ============================================ */
.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  margin: var(--sp-5) 0;
  border: 1px solid;
  background: var(--color-bg-soft);
}

.callout-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.callout-icon svg {
  width: 16px;
  height: 16px;
}

.callout-body {
  flex: 1;
}

.callout-title {
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-base);
}

.callout-text {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: var(--color-text-secondary);
}

.callout-warning {
  background: #FEF3E2;
  border-color: #F4A261;
}

.callout-warning .callout-icon {
  background: #F4A261;
  color: white;
}

.callout-warning .callout-title {
  color: #C2410C;
}

.callout-danger {
  background: #FEE2E2;
  border-color: #E63946;
}

.callout-danger .callout-icon {
  background: #E63946;
  color: white;
}

.callout-danger .callout-title {
  color: #B82838;
}

.callout-info {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
}

.callout-info .callout-icon {
  background: var(--color-primary);
  color: white;
}

.callout-info .callout-title {
  color: var(--color-primary-dark);
}

.callout-success {
  background: #D1FAE5;
  border-color: var(--color-success);
}

.callout-success .callout-icon {
  background: var(--color-success);
  color: white;
}

.callout-success .callout-title {
  color: #065F46;
}

/* ============================================
   4. 商家入驻页 (merchant.html)
   ============================================ */
.merchant-content {
  max-width: 920px;
}

.merchant-section {
  margin-bottom: var(--sp-12);
}

.merchant-section-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-ink);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  line-height: 1;
}

.legal-content .merchant-section-title .num {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  align-self: center;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  line-height: 1;
}

.merchant-section-desc {
  color: var(--color-text-secondary);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--sp-6);
}

/* 入驻条件卡片 */
.requirement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-6);
}

.requirement-card {
  padding: var(--sp-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  display: flex;
  gap: var(--sp-3);
  transition: all var(--t-base);
}

.requirement-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-md);
}

.requirement-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--color-gold-bg);
  color: var(--color-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.requirement-icon svg {
  width: 18px;
  height: 18px;
}

.requirement-content h4 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-1);
}

.requirement-content p {
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  line-height: var(--lh-relaxed);
}

/* 收益板块 */
.benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}

.benefit-card {
  padding: var(--sp-6);
  background: linear-gradient(135deg, var(--color-bg-soft) 0%, var(--color-bg) 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  position: relative;
  overflow: hidden;
}

.benefit-card::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--color-gold-light) 0%, transparent 70%);
  opacity: 0.4;
}

.benefit-card-num {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--color-gold-dark);
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-3);
}

.benefit-card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
}

.benefit-card-desc {
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  line-height: var(--lh-relaxed);
}

.benefit-card-stat {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--color-border-strong);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.benefit-card-stat strong {
  color: var(--color-primary);
  font-size: var(--fs-base);
}

@media (max-width: 768px) {
  .requirement-grid {
    grid-template-columns: 1fr;
  }
  .benefit-grid {
    grid-template-columns: 1fr;
  }
}

/* 申请入驻三卡：auto-fit 自适应列数（手机 1 列 / 平板 2 列 / 桌面 3 列） */
.apply-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-8);
}

.apply-cta {
  text-align: center;
  margin-top: var(--sp-10);
  padding: var(--sp-8);
  background: linear-gradient(135deg, var(--color-bg-soft) 0%, var(--color-bg) 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--color-border);
}

@media (max-width: 640px) {
  .apply-cta {
    margin-top: var(--sp-8);
    padding: var(--sp-6);
  }
}

/* ============================================
   5. 联系页 (contact.html)
   ============================================ */
.contact-layout {
  padding: var(--sp-12) 0 var(--sp-20);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-6);
  margin-bottom: var(--sp-12);
}

.contact-info-card {
  padding: var(--sp-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  display: flex;
  gap: var(--sp-4);
  transition: all var(--t-base);
}

.contact-info-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-md);
}

.contact-info-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-info-icon svg {
  width: 24px;
  height: 24px;
}

.contact-info-content {
  flex: 1;
}

.contact-info-label {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-1);
}

.contact-info-value {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--color-ink);
  margin-bottom: var(--sp-1);
}

.contact-info-hint {
  font-size: var(--fs-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* 商务合作矩阵 */
.coop-section {
  margin-top: var(--sp-16);
}

.coop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-8);
}

@media (max-width: 640px) {
  .coop-section {
    margin-top: var(--sp-10);
  }
}

/* 留言表单 */
.form-section {
  background: var(--color-bg-soft);
  border-radius: var(--r-2xl);
  padding: var(--sp-12);
  border: 1px solid var(--color-border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-ink);
}

.form-label .required {
  color: var(--color-danger);
}

.form-input,
.form-textarea {
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  transition: border var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: var(--lh-relaxed);
}

.form-help {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  margin-top: var(--sp-2);
}

.form-actions {
  margin-top: var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.form-note {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .form-section {
    padding: var(--sp-6);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* 公司信息块 */
.company-block {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--color-bg);
  border-radius: var(--r-2xl);
  padding: var(--sp-10);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-8);
  margin-bottom: var(--sp-12);
}

.company-block-content h2 {
  color: var(--color-bg);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-3);
}

.company-block-content p {
  color: rgba(255, 255, 255, 0.78);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--sp-4);
}

.company-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.company-meta-item {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.7);
}

.company-meta-item strong {
  display: block;
  color: var(--color-gold);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.company-logo {
  width: 120px;
  height: 120px;
  border-radius: var(--r-2xl);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.company-logo img,
.company-logo svg {
  width: 80%;
  height: 80%;
}

@media (max-width: 768px) {
  .company-block {
    grid-template-columns: 1fr;
    padding: var(--sp-8);
  }

  .company-logo {
    display: none;
  }
}

/* 流程时间线 */
.timeline {
  margin-top: var(--sp-6);
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--sp-4);
  padding-bottom: var(--sp-6);
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 29px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-gold) 0%, var(--color-border) 100%);
}

.timeline-dot {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--color-gold-dark);
  flex-shrink: 0;
  z-index: 1;
}

.timeline-content h4 {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-1);
}

.timeline-content p {
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

/* 通用内联强调 */
.legal-content strong.inline-key {
  background: linear-gradient(180deg, transparent 60%, var(--color-gold-light) 60%);
  padding: 0 4px;
  font-weight: var(--fw-semibold);
}
/* ============================================
   常见问题（FAQ，商家页）
   ============================================ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.faq-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.faq-q {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--color-ink);
  line-height: var(--lh-snug);
  cursor: pointer;
  list-style: none;
  transition: background var(--t-fast);
}

.faq-q::-webkit-details-marker {
  display: none;
}

.faq-q::before {
  content: 'Q';
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--color-gold-bg);
  color: var(--color-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.faq-q::after {
  content: '';
  flex-shrink: 0;
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  transform: rotate(45deg);
  transition: transform var(--t-fast);
}

.faq-q:hover {
  background: var(--color-primary-bg);
}

.faq-item[open] .faq-q::after {
  transform: rotate(225deg);
}

.faq-a {
  position: relative;
  padding: 0 var(--sp-5) var(--sp-5) calc(var(--sp-5) + 38px);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--color-text-secondary);
}

.faq-a::before {
  content: 'A';
  position: absolute;
  left: var(--sp-5);
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--color-primary-bg);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
