/**
 * ScholarTranslate 官网基础样式。
 *
 * 设计 token 来自 `css/theme.css`——它是 `extension/src/ui/theme.css` 的**逐字节副本**
 * （server/test/site.test.ts 有字节一致性锁）：白底 + 极浅紫卡 + 单一中紫点缀，
 * 细边框、近乎无阴影。改色只改扩展源文件，然后重新复制，不要在这里另写一套值。
 *
 * 站点是免构建静态页（与 server/admin 同路线）：不引入框架/打包器/外部字体。
 */

:root {
  /* 站点版式 */
  --site-max: 1120px;
  --site-pad: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--wos-bg);
  color: var(--wos-ink);
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

a {
  color: var(--wos-accent);
  text-decoration: none;
}
a:hover {
  color: var(--wos-accent-strong);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--wos-tint);
  color: var(--wos-accent-ink);
}

:focus-visible {
  outline: none;
  box-shadow: var(--wos-ring);
  border-radius: var(--wos-radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--wos-accent);
  color: #fff;
}
.skip-link:focus {
  left: 16px;
}

/* ---------------- 版式骨架 ---------------- */

.wrap {
  width: 100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 var(--site-pad);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--wos-border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--wos-accent-ink);
}
.brand:hover {
  color: var(--wos-accent-ink);
}
.brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  /* 扩展图标自带淡紫底板与透明圆角；用 drop-shadow 跟随图形轮廓，避免方形阴影 */
  filter: drop-shadow(0 1px 2px rgba(28, 28, 40, 0.12));
}
.brand-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.site-nav a {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--wos-muted);
  font-size: 13.5px;
  transition: background var(--wos-t-fast), color var(--wos-t-fast);
}
.site-nav a:hover {
  background: var(--wos-tint-soft);
  color: var(--wos-accent-ink);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--wos-border);
  background: var(--wos-tint-soft);
  color: var(--wos-accent-ink);
  font-size: 13.5px;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--wos-t-fast), border-color var(--wos-t-fast), color var(--wos-t-fast),
    box-shadow var(--wos-t-fast);
}
.btn:hover:not(:disabled) {
  background: var(--wos-tint);
  border-color: var(--wos-border);
  color: var(--wos-accent-ink);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--wos-accent);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--wos-accent-strong);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--wos-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--wos-tint-soft);
  color: var(--wos-accent-ink);
}
.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 12px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}
.btn-danger {
  border-color: var(--wos-err-border);
  background: var(--wos-err-bg);
  color: var(--wos-err);
}
.btn-block {
  width: 100%;
  margin-top: 14px;
}

/* ---------------- 卡片 / 区块标题 ---------------- */

.card {
  background: var(--wos-card);
  border: 1px solid var(--wos-border);
  border-radius: var(--wos-radius-lg);
  box-shadow: var(--wos-shadow-1);
}

.section {
  padding: 72px 0;
}
.section-tight {
  padding: 44px 0;
}
.section-head {
  max-width: 720px;
  margin: 0 auto 34px;
  text-align: center;
}
.section-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.25;
  color: var(--wos-accent-ink);
  letter-spacing: 0.2px;
}
.section-head h2::before {
  content: '';
  width: 5px;
  height: 0.95em;
  border-radius: 3px;
  background: var(--wos-accent);
}
.section-head p {
  margin-top: 10px;
  color: var(--wos-muted);
  font-size: 14.5px;
}

/* ---------------- 徽标 / 标签 ---------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--wos-tint);
  color: var(--wos-accent-ink);
  white-space: nowrap;
}
.chip-ok {
  background: #f0fdf4;
  color: #15803d;
}
.chip-warn {
  background: var(--wos-warn-bg);
  color: var(--wos-warn);
}
.chip-err {
  background: var(--wos-err-bg);
  color: var(--wos-err);
}
.chip-life {
  background: var(--wos-accent-ink);
  color: #fff;
}
.chip-muted {
  background: var(--wos-surface-tint);
  color: var(--wos-muted);
}

/* ---------------- 表单 ---------------- */

.field {
  display: block;
  margin-bottom: 12px;
}
.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--wos-muted);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--wos-border);
  border-radius: 10px;
  background: #fdfcff;
  color: var(--wos-ink);
  font-size: 14px;
  transition: border-color var(--wos-t-fast), box-shadow var(--wos-t-fast);
}
.input::placeholder {
  color: var(--wos-faint);
}
.input:focus {
  outline: none;
  border-color: var(--wos-accent);
  box-shadow: var(--wos-ring);
}
.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.input-row .field {
  flex: 1;
  min-width: 0;
}
.input-row .btn {
  flex: none;
  margin-bottom: 12px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--wos-ink-soft);
  line-height: 1.6;
  cursor: pointer;
}
.check input {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  flex: none;
  accent-color: var(--wos-accent);
  cursor: pointer;
}
.legal-link {
  color: var(--wos-accent);
}
.legal-link:hover {
  text-decoration: underline;
}

.form-error {
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--wos-err-border);
  border-radius: 10px;
  background: var(--wos-err-bg);
  color: var(--wos-err);
  font-size: 13px;
  line-height: 1.55;
}
.form-ok {
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 13px;
  line-height: 1.55;
}
.form-hint {
  margin: 6px 0 0;
  color: var(--wos-muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------------- 标签页 ---------------- */

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--wos-surface-tint);
  border-radius: 12px;
}
.tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--wos-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--wos-t-fast), color var(--wos-t-fast);
}
.tab:hover:not(:disabled) {
  color: var(--wos-accent-ink);
}
.tab.active {
  background: var(--wos-card);
  color: var(--wos-accent-ink);
  font-weight: 600;
  box-shadow: var(--wos-shadow-1);
}
.tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 注册方式切换（邮箱 / 手机号）；与主 tab 分开，避免 .tabs 选择器歧义 */
.method-switch {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 3px;
  border-radius: 10px;
  background: var(--wos-tint-soft);
}
.method-tab {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--wos-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--wos-t-fast), border-color var(--wos-t-fast), color var(--wos-t-fast);
}
.method-tab:hover:not(:disabled) {
  color: var(--wos-accent-ink);
}
.method-tab.active {
  border-color: var(--wos-border);
  background: var(--wos-card);
  color: var(--wos-accent-ink);
  font-weight: 600;
  box-shadow: var(--wos-shadow-1);
}
.method-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------------- 弹窗 ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 28, 40, 0.38);
  animation: backdrop-in 140ms ease-out;
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: min(86vh, 760px);
  overflow: auto;
  background: var(--wos-card);
  border: 1px solid var(--wos-border);
  border-radius: 16px;
  box-shadow: var(--wos-shadow-2);
  animation: modal-in 160ms ease-out;
}
.modal-wide {
  max-width: 520px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}
.modal-head h2 {
  font-size: 17px;
  color: var(--wos-accent-ink);
  letter-spacing: 0.2px;
}
.modal-head p {
  margin-top: 4px;
  color: var(--wos-muted);
  font-size: 12.5px;
}
.modal-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--wos-faint);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover {
  background: var(--wos-tint-soft);
  color: var(--wos-accent-ink);
}
.modal-body {
  padding: 14px 20px 20px;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

/* ---------------- Toast ---------------- */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
}
.toast {
  padding: 10px 16px;
  border: 1px solid var(--wos-warn-border);
  border-radius: 999px;
  background: var(--wos-warn-bg);
  color: var(--wos-warn);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--wos-shadow-2);
  animation: toast-in 160ms ease-out;
}
.toast.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}
.toast.err {
  border-color: var(--wos-err-border);
  background: var(--wos-err-bg);
  color: var(--wos-err);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------------- 页脚 ---------------- */

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--wos-border);
  background: #fff;
}
.site-footer .wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  padding-top: 40px;
  padding-bottom: 28px;
}
.footer-col h3 {
  font-size: 13px;
  color: var(--wos-accent-ink);
  margin-bottom: 10px;
}
.footer-col a,
.footer-col span {
  display: block;
  margin: 6px 0;
  color: var(--wos-muted);
  font-size: 13px;
}
.footer-col a:hover {
  color: var(--wos-accent);
}
.footer-bottom {
  border-top: 1px solid var(--wos-border-soft);
}
.footer-bottom .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  padding-bottom: 22px;
  color: var(--wos-faint);
  font-size: 12px;
}
.footer-bottom .ai-note {
  color: var(--wos-muted);
}

/* ---------------- 通用 ---------------- */

.muted {
  color: var(--wos-muted);
}
.faint {
  color: var(--wos-faint);
}
.small {
  font-size: 12.5px;
}
.mono {
  font-family: ui-monospace, Consolas, monospace;
}
.center {
  text-align: center;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}

@media (max-width: 900px) {
  .site-nav {
    display: none;
  }
  .site-footer .wrap {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  :root {
    --site-pad: 18px;
  }
  .section {
    padding: 52px 0;
  }
  .site-header .wrap {
    min-height: 58px;
  }
  .brand-name {
    font-size: 14.5px;
  }
  .site-footer .wrap {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
