/* —— 自托管 Inter（T5，红线：禁第三方字体外链，文件见 src/assets/fonts/）—— */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-800-normal.woff2") format("woff2");
}

/* kcalcraft 视觉系统 v1 — 现代风自研（Stitch 地理围栏不可达，用户 2026-10-25 拍板自研）
   方向：premium health-tech dashboard meets editorial science journal
   三层色彩：纸白底 / 石灰卡面 / 深绿强调 + 琥珀 caution；超大展示数字（tnum） */

:root {
  /* 色板 */
  --paper: #faf9f6;          /* 暖纸白底 */
  --card: #ffffff;           /* 卡面 */
  --stone: #f2f0eb;          /* 卡面次级 */
  --ink: #1c1917;
  --ink-soft: #57534e;
  --ink-faint: #8a857e;
  --accent: #166534;         /* 深绿 */
  --accent-ink: #14532d;     /* 深绿 hover/小字 */
  --accent-soft: #e8f3ec;    /* 绿 tint */
  --amber: #b45309;
  --amber-soft: #fef6e7;
  --line: #e4e1da;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 72rem;
  --shadow: 0 1px 2px rgba(28, 25, 23, .05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-feature-settings: "cv05" 1, "ss01" 1;
  text-rendering: optimizeLegibility;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
h1, h2, h3, h4 { letter-spacing: -.02em; line-height: 1.25; }

/* 数字语音：等宽数字tabular */
.num, .result .big strong, dd, td, th { font-feature-settings: "tnum" 1, "cv05" 1; }

/* header / nav */
.site-header { border-bottom: 1px solid var(--line); background: rgba(250, 249, 246, .92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; flex-wrap: wrap; gap: .75rem; align-items: baseline; padding-top: .8rem; padding-bottom: .8rem; }
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: baseline; gap: .5rem; }
.brand-name { font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; }
.brand-tag { display: none; font-size: .8rem; color: var(--ink-soft); }
@media (min-width: 40rem) { .brand-tag { display: block; } }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-left: auto; font-size: .95rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; padding: .35rem .1rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent-ink); }

/* hero */
.hero { padding: 3rem 0 1.5rem; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 .5rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .25rem 0 1rem; max-width: 22ch; }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 46rem; margin: 0 0 1.5rem; }
.trust-strip { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; color: var(--ink-soft); font-size: .92rem; margin: 0 0 1rem; }
.trust-strip li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

/* 卡片矩阵 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; padding: .5rem 0 1.5rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: var(--card); box-shadow: var(--shadow); transition: border-color .15s ease, transform .15s ease; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent-ink); }
.card p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* 工具页 layout */
.tool-layout { display: grid; grid-template-columns: minmax(18rem, 26rem) 1fr; gap: 2rem; align-items: start; margin-top: 1.25rem; }
@media (max-width: 60rem) { .tool-layout { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; background: var(--card); box-shadow: var(--shadow); position: sticky; top: 5.5rem; }
.panel h2 { margin-top: 0; font-size: 1.1rem; }

/* 表单 */
.field { margin: 0 0 1rem; }
.field > label, .field > legend { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .35rem; color: var(--ink); }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%; min-height: 44px; padding: .55rem .75rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem;
}
.field input:hover, .field select:hover { border-color: var(--ink-faint); }
.field input:focus, .field select:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset.field { border: 0; padding: 0; }
.seg { display: flex; gap: .5rem; flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: .92rem; font-weight: 500; cursor: pointer; }
.seg input { accent-color: var(--accent); }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.hint { font-size: .85rem; color: var(--ink-faint); margin: .3rem 0 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 48px; padding: .7rem 1.4rem; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: #fff; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--accent-ink); }
.btn:active { transform: translateY(1px); }

/* 结果区：lab readout */
.result { margin-top: 1rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--card); padding: 1.2rem 1.4rem; }
.result .big { font-size: 1rem; margin: 0 0 .25rem; }
.result .big strong { display: block; font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; color: var(--accent-ink); margin: .15rem 0 .6rem; }
dl { display: grid; grid-template-columns: minmax(10rem, auto) 1fr; gap: .35rem 1.25rem; margin: .9rem 0 0; padding-top: .9rem; border-top: 1px dashed var(--line); font-size: .95rem; }
dt { color: var(--ink-soft); }
dd { margin: 0; font-weight: 600; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: .95rem 1.2rem; margin: 1rem 0; border-left: 4px solid var(--accent); }
.sanity { border: 1px solid #f3e3c3; border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: var(--radius); padding: .8rem 1.1rem; margin: 1rem 0; font-size: .92rem; }
.sanity strong:first-child { color: var(--amber); }
.sanity ul { margin: .4rem 0 0; padding-left: 1.2rem; }

/* 表格（journal 风） */
.cmp-figure { margin: 1.5rem 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
table.cmp { border-collapse: collapse; width: 100%; min-width: 44rem; font-size: .92rem; }
.cmp caption { caption-side: top; text-align: left; padding: .9rem 1.2rem .6rem; font-size: .85rem; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.cmp th { text-align: left; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); background: var(--stone); padding: .65rem 1.2rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cmp tbody th { text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--ink); background: transparent; white-space: normal; min-width: 10rem; }
.cmp td { padding: .75rem 1.2rem; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-soft); }
.cmp tbody tr:last-child td, .cmp tbody tr:last-child th { border-bottom: 0; }
.cmp tbody tr:hover td, .cmp tbody tr:hover th { background: var(--paper); }

/* byline / breadcrumb / faq / references */
.byline { display: flex; gap: .6rem; align-items: center; color: var(--ink-soft); font-size: .9rem; margin: .9rem 0 1.2rem; }
.avatar { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 1.2rem 0 0; font-size: .85rem; color: var(--ink-faint); }
.breadcrumb li + li::before { content: "› "; color: var(--line); }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1.1rem; margin: .5rem 0; background: var(--card); }
.faq details[open] { border-color: var(--ink-faint); }
.faq summary { font-weight: 600; cursor: pointer; }
.faq .a { margin-top: .6rem; color: var(--ink-soft); }
main h2 { font-size: 1.35rem; margin: 2.2rem 0 .8rem; }
main h3 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
main ul:not(.trust-strip) { padding-left: 1.3rem; }
main li { margin: .3rem 0; }
main section > ul li { color: var(--ink-soft); font-size: .95rem; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--stone); margin-top: 3.5rem; padding: 2.5rem 0 2rem; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 60rem) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer h2 { font-size: 1rem; margin-top: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: .3rem 0; font-size: .92rem; }
.site-footer p { font-size: .92rem; color: var(--ink-soft); }
.disclaimer { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; font-size: .85rem; color: var(--ink-faint); }

.backtop { position: fixed; right: 1rem; bottom: 1rem; background: var(--ink); color: #fff; text-decoration: none; border-radius: 999px; padding: .45rem 1rem; font-size: .85rem; box-shadow: var(--shadow); }
.backtop:hover { background: var(--accent-ink); }

@media print {
  .site-header, .site-footer, .backtop, .panel form, .btn { display: none; }
  .tool-layout { grid-template-columns: 1fr; }
  .panel { position: static; border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; }
  .cmp-figure { overflow-x: visible; }
  a { color: var(--ink); text-decoration: none; }
  main a[href^="/"]::after { content: " (kcalcraft.com" attr(href) ")"; font-size: .8em; color: var(--ink-faint); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover { transform: none; }
}
