/* ============================================================
   AI-math · Calculator system stylesheet
   Shared by the Calculator Hub and every calculator detail page.
   Brand tokens lifted from the AI-math landing page.
   ============================================================ */

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

:root {
  --sky: #e8f4fd;
  --sky-mid: #c5dff5;
  --blue: #3b82c4;
  --blue-deep: #1a5fa8;
  --blue-light: #6fa8d8;
  --ink: #0f2340;
  --ink-soft: #3a556b;
  --ink-faint: #6f86a0;
  --white: #ffffff;
  --surface: #f4f9fe;
  --surface-2: #eef6fd;
  --border: #cce0f0;
  --border-soft: #e1eefa;
  --accent: #ff7c5c;
  --accent-deep: #e85f3c;
  --good: #2a9d6f;

  --shadow-sm: 0 2px 10px rgba(26,95,168,0.07);
  --shadow-md: 0 12px 32px rgba(26,95,168,0.10);
  --shadow-lg: 0 24px 60px rgba(15,35,64,0.14);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 100px;

  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--white);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── NAV ─────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 48px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
.nav .logo {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--blue-deep);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.nav .logo .dash { color: var(--accent); }
.nav-links { list-style: none; display: flex; gap: 30px; align-items: center; }
.nav-links a {
  color: var(--ink-soft); font-size: 0.92rem; font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--blue-deep); }
.nav-cta {
  background: var(--blue-deep); color: #fff !important;
  padding: 10px 20px; border-radius: var(--r-pill);
  font-size: 0.86rem; font-weight: 600;
  box-shadow: 0 2px 12px rgba(26,95,168,0.25);
  transition: background 0.2s, transform 0.15s;
}
.nav-cta:hover { background: var(--blue); transform: translateY(-1px); }

/* ── LANGUAGE SWITCHER ───────────────────────────── */
/* 由 i18n.js 在导航栏运行时注入；分段式 EN / 中文 / RU 切换 */
.lang-switch {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-pill); padding: 3px; margin-left: 4px;
}
.lang-btn {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  color: var(--ink-faint); background: none; border: none; cursor: pointer;
  padding: 5px 11px; border-radius: var(--r-pill); line-height: 1;
  transition: color 0.18s, background 0.18s;
}
.lang-btn:hover { color: var(--blue-deep); }
.lang-btn.active { color: #fff; background: var(--blue-deep); }
@media (max-width: 880px) {
  /* 移动端导航隐藏了链接，但语言切换仍需可见 */
  .lang-switch { margin-left: 0; }
}

/* ── BUTTONS ─────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--blue-deep); color: #fff;
  padding: 14px 28px; border-radius: var(--r-pill);
  font-size: 0.95rem; font-weight: 600; font-family: var(--sans);
  border: none; cursor: pointer;
  box-shadow: 0 4px 18px rgba(26,95,168,0.28);
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--blue); transform: translateY(-2px); box-shadow: 0 8px 26px rgba(26,95,168,0.34); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 9px;
  background: #fff; color: var(--blue-deep);
  padding: 13px 26px; border-radius: var(--r-pill);
  border: 1.5px solid var(--border);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--sky); border-color: var(--blue-light); }

/* ── LAYOUT ──────────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 48px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--blue);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ── FOOTER ──────────────────────────────────────── */
.footer {
  background: var(--ink); color: rgba(255,255,255,0.55);
  padding: 56px 0 40px;
  margin-top: 80px;
}
.footer .footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 48px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 40px;
}
.footer .logo { font-family: var(--serif); color: #fff; font-size: 1.3rem; }
.footer .logo .dash { color: var(--accent); }
.footer-brand p { font-size: 0.85rem; margin-top: 10px; max-width: 250px; line-height: 1.6; }
.footer-col h4 {
  font-family: var(--mono);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(255,255,255,0.4); margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-col a { font-size: 0.88rem; color: rgba(255,255,255,0.6); transition: color 0.2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  max-width: 1180px; margin: 36px auto 0; padding: 22px 48px 0;
  border-top: 1px solid rgba(255,255,255,0.09);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: 0.8rem; color: rgba(255,255,255,0.32);
}

/* ============================================================
   GENERATED DETAIL PAGES — shared layout
   被 build/generate.mjs 产出的每个计算器详情页复用，避免逐页内联样式。
   ============================================================ */

/* breadcrumb */
.crumb { padding: 22px 0 0; }
.crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.84rem; color: var(--ink-faint); }
.crumb a { color: var(--ink-soft); }
.crumb a:hover { color: var(--blue-deep); }
.crumb .sep { color: var(--border); }
.crumb li[aria-current] { color: var(--blue-deep); font-weight: 500; }

/* page head */
.calc-head { padding: 22px 0 30px; }
.calc-head .eyebrow { margin-bottom: 14px; }
.calc-head h1 { font-family: var(--serif); font-size: clamp(2.2rem, 4.2vw, 3.2rem); letter-spacing: -0.03em; line-height: 1.08; color: var(--ink); margin-bottom: 14px; max-width: 20ch; }
.calc-head p { font-size: 1.05rem; color: var(--ink-soft); font-weight: 300; line-height: 1.6; max-width: 620px; }
.head-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hb { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 500; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--border-soft); padding: 7px 14px; border-radius: var(--r-pill); }
.hb svg { width: 15px; height: 15px; color: var(--good); }

/* main grid */
.calc-main { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }

/* AI solver card (detail pages funnel into our own ask UI) */
.ai-solver { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.ai-solver .solver-top { background: linear-gradient(135deg, #103a68, #1a5fa8); padding: 22px 26px; display: flex; align-items: center; justify-content: space-between; }
.ai-solver .solver-top h2 { font-family: var(--serif); color: #fff; font-size: 1.4rem; letter-spacing: 0.01em; font-weight: 400; }
.ai-solver .solver-top .pill { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: #fff; background: rgba(255,255,255,0.16); padding: 5px 11px; border-radius: var(--r-pill); white-space: nowrap; }
.ai-solver .solver-body { padding: 26px; }
.ai-solver .solver-body > .sub { font-size: 0.95rem; color: var(--ink-soft); font-weight: 300; line-height: 1.6; margin-bottom: 20px; }

/* shared ask box (our own UI) — used by hero band + solver card */
.ask-box { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-pill); padding: 7px 7px 7px 20px; box-shadow: var(--shadow-sm); }
.ask-box .ai-spark { width: 22px; height: 22px; flex-shrink: 0; color: var(--blue); }
.ask-box input { flex: 1; border: none; outline: none; background: none; font-family: var(--sans); font-size: 1rem; color: var(--ink); padding: 13px 4px; min-width: 0; }
.ask-box input::placeholder { color: var(--ink-faint); }
.ask-box .send { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; background: var(--blue-deep); color: #fff; border: none; cursor: pointer; font-family: var(--sans); font-size: 0.92rem; font-weight: 600; white-space: nowrap; padding: 13px 24px; border-radius: var(--r-pill); transition: background 0.2s, transform 0.15s; }
.ask-box .send:hover { background: var(--blue); transform: translateY(-1px); }
.ask-box .send svg { width: 16px; height: 16px; }
.ask-launch { display: none; align-items: center; gap: 13px; color: var(--ink-soft); padding: 16px 2px 4px; }
.ask-launch.show { display: flex; }
.ask-launch .spin { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--blue-deep); border-radius: 50%; animation: askspin 0.7s linear infinite; }
@keyframes askspin { to { transform: rotate(360deg); } }

/* sidebar */
.side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }
.side-card { background: #fff; border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 20px; }
.side-card h3 { font-size: 0.78rem; font-family: var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 14px; }
.side-links { display: flex; flex-direction: column; gap: 2px; }
.side-links a { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-soft); padding: 9px 0; border-bottom: 1px solid var(--border-soft); transition: color 0.16s; }
.side-links a:last-child { border-bottom: none; }
.side-links a:hover { color: var(--blue-deep); }
.side-links a .ar { margin-left: auto; color: var(--border); }
.side-links a:hover .ar { color: var(--accent); }
.tutor-card { background: linear-gradient(150deg, #103a68, #1d5e93); color: #fff; border: none; }
.tutor-card h3 { color: var(--sky-mid); }
.tutor-card p { font-size: 0.9rem; color: rgba(255,255,255,0.78); line-height: 1.55; font-weight: 300; margin-bottom: 16px; }
.tutor-card .btn-primary { background: #fff; color: var(--blue-deep); width: 100%; justify-content: center; padding: 12px; font-size: 0.9rem; }
.tutor-card .btn-primary:hover { background: var(--sky); }

/* SEO content */
.content { padding: 56px 0 0; }
.content .col { max-width: 760px; }
.content h2 { font-family: var(--serif); font-size: 1.8rem; letter-spacing: -0.02em; color: var(--ink); margin: 40px 0 16px; }
.content h2:first-child { margin-top: 0; }
.content p { font-size: 1rem; color: var(--ink-soft); line-height: 1.75; font-weight: 300; margin-bottom: 14px; }
.content p b, .content li b { color: var(--ink); font-weight: 600; }
.content ul, .content ol { margin: 0 0 16px 22px; }
.content li { font-size: 1rem; color: var(--ink-soft); line-height: 1.7; font-weight: 300; margin-bottom: 8px; }

/* related grid */
.rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
.rel-card { display: block; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 18px; transition: all 0.2s; }
.rel-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--border); }
.rel-card .ric { width: 36px; height: 36px; border-radius: 9px; background: var(--sky); display: flex; align-items: center; justify-content: center; font-family: var(--serif); color: var(--blue-deep); font-size: 1rem; margin-bottom: 10px; }
.rel-card h4 { font-size: 0.94rem; font-weight: 600; color: var(--ink); }
.rel-card p { font-size: 0.82rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.45; font-weight: 300; }

/* faq */
.faq-block { padding: 56px 0 0; max-width: 820px; }
.faq-item { border-bottom: 1px solid var(--border-soft); }
.faq-q { width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-family: var(--sans); font-size: 1.02rem; font-weight: 600; color: var(--ink); padding: 20px 40px 20px 0; position: relative; }
.faq-q::after { content: '+'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--blue); font-weight: 300; }
.faq-item.open .faq-q::after { content: '−'; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.faq-a p { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.7; font-weight: 300; padding-bottom: 20px; margin: 0; }

@media (max-width: 940px) {
  .calc-main { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; }
  .side-card { flex: 1; min-width: 240px; }
  .rel-grid { grid-template-columns: 1fr; }
}

/* ── FLOATING MATH SYMBOLS (hero motif) ──────────── */
.floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.floats span {
  position: absolute; bottom: -40px;
  font-family: var(--serif); color: rgba(59,130,196,0.16);
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  12% { opacity: 1; }
  88% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-115vh) rotate(28deg); }
}

/* ── SCROLL REVEAL ───────────────────────────────── */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 880px) {
  .nav { padding: 14px 22px; }
  .nav-links { display: none; }
  .wrap { padding: 0 22px; }
  .footer .footer-inner, .footer-bottom { padding-left: 22px; padding-right: 22px; }
}
