/* =========================================================
   FanQieAPI · 用户协议 / 隐私政策
   ========================================================= */

.legal {
  padding: 40px 0 90px;
}

.legal__layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ---------------- 左侧目录 ---------------- */
.legal__side {
  position: sticky;
  top: 92px;
  align-self: start;
}

.legal__side-title {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.legal__toc {
  display: grid;
  gap: 2px;
  padding-left: 11px;
  border-left: 1px solid var(--line-2);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.legal__toc-link {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease;
}

.legal__toc-link:hover {
  color: var(--ink);
  background: rgba(10, 16, 32, 0.035);
}

.legal__toc-link.is-active {
  color: var(--accent);
  background: rgba(29, 91, 255, 0.07);
  font-weight: 600;
}

.legal__toc-link {
  position: relative;
}

.legal__toc-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* ---------------- 正文 ---------------- */
.legal__content {
  min-width: 0;
  max-width: 820px;
}

.legal__head {
  position: relative;
  padding: 34px 34px 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(29, 91, 255, 0.1), transparent 58%),
    radial-gradient(90% 120% at 0% 100%, rgba(79, 139, 255, 0.07), transparent 62%),
    linear-gradient(180deg, #fbfcff, #fff 62%);
  box-shadow: 0 1px 2px rgba(10, 16, 32, 0.04), 0 18px 40px -32px rgba(10, 16, 32, 0.35);
  overflow: hidden;
}

.legal__head::before {
  content: "";
  position: absolute;
  top: -10px;
  right: -10px;
  width: 260px;
  height: 190px;
  pointer-events: none;
  background-image: radial-gradient(rgba(29, 91, 255, 0.22) 1px, transparent 1px);
  background-size: 16px 16px;
  -webkit-mask-image: radial-gradient(120% 100% at 100% 0%, #000, transparent 72%);
  mask-image: radial-gradient(120% 100% at 100% 0%, #000, transparent 72%);
}

.legal__head::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #6f9dff 38%, rgba(29, 91, 255, 0.04));
}

.legal__eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(29, 91, 255, 0.09);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.legal__title {
  margin: 0;
  font-size: 34px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.legal__lead {
  margin: 14px 0 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--muted);
}

.legal__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.legal__meta > span:not(.legal__meta-dot) {
  padding: 5px 11px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.legal__meta-dot {
  display: none;
}

.legal__meta a {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(29, 91, 255, 0.08);
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.legal__meta a:hover {
  background: rgba(29, 91, 255, 0.14);
  text-decoration: underline;
}

.legal__notice {
  position: relative;
  margin: 26px 0 0;
  padding: 16px 20px 16px 50px;
  border: 1px solid rgba(29, 91, 255, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(29, 91, 255, 0.08), transparent 65%),
    rgba(29, 91, 255, 0.035);
}

.legal__notice::before {
  content: "!";
  position: absolute;
  left: 17px;
  top: 17px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a74ff, var(--accent));
  box-shadow: 0 6px 14px -8px rgba(29, 91, 255, 0.9);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
}

.legal__notice strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.legal__notice p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.legal__section {
  margin-top: 16px;
  padding: 26px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 16, 32, 0.04), 0 14px 34px -32px rgba(10, 16, 32, 0.4);
  scroll-margin-top: 96px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.legal__section:first-of-type {
  margin-top: 26px;
}

.legal__section:hover {
  border-color: rgba(29, 91, 255, 0.18);
  box-shadow: 0 1px 2px rgba(10, 16, 32, 0.04), 0 18px 40px -30px rgba(10, 16, 32, 0.42);
}

.legal__section h2 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 16px;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 650;
  color: var(--ink);
}

.legal__section h2 .legal__num {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #3a74ff, var(--accent));
  box-shadow: 0 6px 14px -8px rgba(29, 91, 255, 0.9);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.legal__anchor {
  margin-left: 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted-2);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.legal__section h2:hover .legal__anchor,
.legal__anchor:focus-visible {
  opacity: 1;
}

.legal__anchor:hover {
  color: var(--accent);
}

.legal__section p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted);
}

.legal__section p:last-child {
  margin-bottom: 0;
}

.legal__section ul {
  margin: 4px 0 14px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.legal__section li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--muted);
}

.legal__section li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: rgba(29, 91, 255, 0.4);
  transform: rotate(45deg);
}

.legal__section code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(10, 16, 32, 0.05);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink-2);
}

.legal__section a {
  color: var(--accent);
  text-decoration: none;
}

.legal__section a:hover {
  text-decoration: underline;
}

/* ---------------- 底部 ---------------- */
.legal__foot {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.legal__foot p {
  margin: 0;
  font-size: 13px;
  color: var(--muted-2);
}

.legal__foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legal__foot-links a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.legal__foot-links a:hover {
  border-color: rgba(29, 91, 255, 0.4);
  background: rgba(29, 91, 255, 0.05);
  color: var(--accent);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  .legal__layout {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 36px;
  }

  .legal__title {
    font-size: 30px;
  }
}

@media (max-width: 860px) {
  .legal {
    padding: 26px 0 64px;
  }

  .legal__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .legal__side {
    position: static;
  }

  .legal__side-title {
    margin-bottom: 8px;
  }

  .legal__toc {
    display: flex;
    gap: 6px;
    padding: 0 0 4px;
    border-left: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .legal__toc-link {
    flex: none;
    padding: 6px 12px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: #fff;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .legal__toc-link.is-active {
    border-color: rgba(29, 91, 255, 0.35);
  }

  .legal__toc-link.is-active::before {
    display: none;
  }

  .legal__head {
    padding: 26px 20px 24px;
    border-radius: 18px;
  }

  .legal__title {
    font-size: 26px;
  }

  .legal__lead {
    font-size: 14px;
  }

  .legal__section {
    margin-top: 12px;
    padding: 22px 18px 18px;
    border-radius: 16px;
    scroll-margin-top: 78px;
  }

  .legal__section:first-of-type {
    margin-top: 20px;
  }

  .legal__section h2 {
    font-size: 17px;
    gap: 9px;
    margin-bottom: 12px;
  }

  .legal__section h2 .legal__num {
    width: 27px;
    height: 27px;
    border-radius: 9px;
    font-size: 11.5px;
  }

  .legal__section p,
  .legal__section li {
    font-size: 13.5px;
    line-height: 1.85;
  }

  .legal__foot {
    margin-top: 34px;
  }
}
