/* ==========================================================================
   Qalculate! 中文站 — 全局样式
   配色取自 logo：白色 / 炭黑 #4C4C4C / 品红 #E934A0
   ========================================================================== */

:root {
  --brand: #e934a0;
  --brand-strong: #c11e82;
  --brand-deep: #8f145f;
  --brand-tint: #fdf0f8;
  --brand-line: #f7d3ea;

  --ink: #202025;
  --ink-2: #4c4c4c;
  --text: #55555e;
  --muted: #86868f;
  --line: #e7e7ee;
  --surface: #ffffff;
  --surface-2: #f7f6fa;

  --dark: #222227;
  --dark-2: #2b2b31;

  --ok: #12805c;

  --shadow-sm: 0 1px 2px rgba(22, 22, 28, 0.05), 0 2px 8px rgba(22, 22, 28, 0.05);
  --shadow-md: 0 6px 24px rgba(22, 22, 28, 0.08);
  --shadow-lg: 0 18px 50px rgba(22, 22, 28, 0.16);

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 9px;

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", "Consolas",
    "Menlo", "Roboto Mono", "Liberation Mono", monospace;

  --maxw: 1140px;
  --gutter: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--brand-strong);
  text-decoration: none;
}

a:hover {
  color: var(--brand-deep);
}

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1em;
}

ul, ol {
  padding-left: 1.35em;
}

/* ---------- 布局工具 ---------- */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.section {
  padding: 84px 0;
}

.section--tint {
  background: var(--surface-2);
}

.section-head {
  max-width: 720px;
  margin: 0 auto 52px;
  text-align: center;
}

.section-head--left {
  margin-left: 0;
  text-align: left;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-strong);
  margin-bottom: 12px;
}

.lead {
  font-size: 1.12rem;
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 12px 24px;
  font-size: 0.98rem;
  font-weight: 700;
  font-family: var(--font-sans);
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(233, 52, 160, 0.28);
}

.btn-primary:hover {
  background: var(--brand-strong);
  color: #fff;
  box-shadow: 0 10px 24px rgba(233, 52, 160, 0.34);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.btn-ghost-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost-dark:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-lg {
  padding: 15px 30px;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9rem;
}

/* ---------- 页头 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand:hover {
  color: var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.96rem;
  padding: 8px 13px;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav a:hover {
  color: var(--brand-strong);
  background: var(--brand-tint);
}

.nav a[aria-current="page"] {
  color: var(--brand-strong);
  background: var(--brand-tint);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
  stroke: var(--ink);
}

/* ---------- 首页 Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 84px;
  background:
    radial-gradient(900px 460px at 82% -10%, rgba(233, 52, 160, 0.1), transparent 60%),
    radial-gradient(700px 420px at 6% 8%, rgba(233, 52, 160, 0.06), transparent 55%),
    linear-gradient(180deg, #fdf8fb 0%, #ffffff 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--brand-line);
  color: var(--brand-strong);
  font-size: 0.86rem;
  font-weight: 700;
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.hero h1 {
  margin-bottom: 18px;
}

.hero h1 .accent {
  color: var(--brand);
}

.hero__sub {
  font-size: 1.16rem;
  color: var(--text);
  max-width: 30em;
  margin-bottom: 30px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 0.92rem;
  color: var(--muted);
}

.hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hero__meta svg {
  width: 16px;
  height: 16px;
  stroke: var(--brand);
}

/* 计算器演示视觉 */

.demo {
  background: var(--dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  color: #fff;
}

.demo__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 18px;
}

.demo__bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4a4a52;
}

.demo__bar .dot--brand {
  background: var(--brand);
}

.demo__bar .name {
  margin-left: 8px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 600;
}

.demo__display {
  background: #16161a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 18px;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.demo__expr {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.8);
  word-break: break-all;
}

.demo__result {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--brand);
  word-break: break-all;
}

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

.demo__chip {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: #dcdce4;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.demo__chip:hover,
.demo__chip.is-active {
  background: rgba(233, 52, 160, 0.18);
  border-color: rgba(233, 52, 160, 0.6);
  color: #fff;
}

/* ---------- 卡片与网格 ---------- */

.grid {
  display: grid;
  gap: 22px;
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-line);
}

.card h3 {
  margin-bottom: 10px;
}

.card p {
  margin-bottom: 0;
  font-size: 0.96rem;
}

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-tint);
  color: var(--brand-strong);
  margin-bottom: 18px;
}

.icon-badge svg {
  width: 24px;
  height: 24px;
}

.icon-badge--dark {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ---------- 表达式示例 ---------- */

.expr-block {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 22px 24px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.94rem;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.75;
}

.expr-block .cm {
  color: #8a8a95;
}

.expr-block .res {
  color: #f98ecb;
}

.expr-list {
  display: grid;
  gap: 14px;
}

.expr-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

.expr-item__in {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink);
  word-break: break-all;
}

.expr-item__out {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand-strong);
  text-align: right;
  word-break: break-all;
}

/* ---------- 数据带 ---------- */

.stats {
  background: var(--dark);
  color: #fff;
  padding: 60px 0;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.stat {
  text-align: center;
}

.stat__num {
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.1;
}

.stat__num em {
  font-style: normal;
  color: var(--brand);
}

.stat__label {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.94rem;
}

/* ---------- CTA ---------- */

.cta {
  background:
    radial-gradient(600px 300px at 80% 0%, rgba(233, 52, 160, 0.22), transparent 60%),
    var(--dark-2);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.cta h2 {
  color: #fff;
}

.cta p {
  color: rgba(255, 255, 255, 0.72);
  max-width: 34em;
  margin-bottom: 20px;
}

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

.site-footer {
  background: var(--dark);
  color: rgba(255, 255, 255, 0.66);
  padding: 68px 0 34px;
  margin-top: 84px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.footer-brand img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.footer-col h4 {
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.footer-col ul {
  list-style: none;
  padding: 0;
}

.footer-col li {
  margin-bottom: 10px;
}

.footer-col a {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.92rem;
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.46);
}

.footer-bottom a {
  color: rgba(255, 255, 255, 0.6);
}

.footer-bottom a:hover {
  color: #fff;
}

/* ---------- 页内 Hero（子页面） ---------- */

.page-hero {
  padding: 60px 0 24px;
  background: linear-gradient(180deg, #fdf8fb 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  margin-bottom: 14px;
}

.page-hero .lead {
  max-width: 46em;
}

.breadcrumb {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--line);
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--brand-strong);
}

/* ---------- 下载页 ---------- */

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.platform-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.platform-card .icon-badge {
  margin-bottom: 16px;
}

.platform-card h3 {
  margin-bottom: 6px;
}

.platform-card .sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.platform-card ul {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.platform-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
}

.platform-card li a {
  font-weight: 600;
}

.platform-card .meta {
  color: var(--muted);
  font-size: 0.82rem;
  flex: none;
}

.platform-card .foot {
  margin-top: auto;
  font-size: 0.86rem;
  color: var(--muted);
}

.dl-note {
  background: var(--brand-tint);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  padding: 18px 22px;
  color: var(--ink-2);
  font-size: 0.94rem;
}

/* ---------- FAQ ---------- */

.faq-list {
  display: grid;
  gap: 12px;
  max-width: 820px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 22px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--brand-strong);
  line-height: 1;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item .faq-body {
  padding: 0 22px 20px;
  font-size: 0.96rem;
  color: var(--text);
}

/* ---------- 关于页 ---------- */

.prose {
  max-width: 780px;
}

.prose h2 {
  margin: 40px 0 16px;
}

.prose p {
  margin-bottom: 16px;
}

.about-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}

.about-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.about-list svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 4px;
  stroke: var(--brand-strong);
}

/* ---------- 模态弹窗 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 20, 25, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.is-open {
  display: flex;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}
button { outline: none } 
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: none;
  background: var(--surface-2);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.modal__close:hover {
  background: var(--line);
}

.modal__close svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
}

.modal__body {
  padding: 34px 34px 30px;
}

.modal__title {
  font-size: 1.5rem;
  margin-bottom: 8px;
  padding-right: 40px;
}

.modal__sub {
  color: var(--muted);
  font-size: 0.94rem;
  margin-bottom: 24px;
}

.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.qr-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.qr-box__img {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  display: inline-block;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.qr-box__img svg,
.qr-box__img img {
  width: 148px;
  height: 148px;
  display: block;
}

.qr-box__label {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.qr-box__hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.modal__direct {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.modal__direct h4 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.modal__direct .row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal__legal {
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .platform-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .section {
    padding: 60px 0;
  }
  .grid--3,
  .grid--2 {
    grid-template-columns: 1fr;
  }
  .stats__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 16px;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 10px 16px 16px;
    display: none;
  }
  .nav.is-open {
    display: flex;
  }
  .nav a {
    padding: 12px 14px;
  }
  .header-actions .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  .qr-grid {
    grid-template-columns: 1fr;
  }
  .modal__body {
    padding: 26px 22px 24px;
  }
  .cta {
    padding: 40px 24px;
  }
  .expr-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .expr-item__out {
    text-align: left;
  }
}

/* ---------- 可访问性 ---------- */

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

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