/* Kaka SQA — Editorial design system (v2)
   Warm paper · Oxford navy · Terracotta · Fraunces display
   Apple 干净的组件结构保留，视觉气质换成编辑/学院感。
   Class names 向后兼容 — 旧 HTML 直接获益。 */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&display=swap');

:root {
  /* -- Paper & ink -- */
  --bg: #f8f5ef;
  --bg-alt: #f0ebe0;
  --bg-tint: #e8e1d2;
  --surface: #ffffff;
  --surface-hover: #fcfaf5;
  --ink: #16130d;
  --ink-soft: #3a342a;
  --muted: #77706a;
  --line: #d5ccba;
  --line-soft: #eae4d5;

  /* -- Accent: Oxford navy + terracotta -- */
  --accent: #0f3057;
  --accent-hover: #174075;
  --accent-soft: #e5ebf3;
  --accent-2: #b65533;
  --accent-2-hover: #c9633d;
  --accent-2-soft: #f3e5dc;

  /* -- Semantics (slightly earthier) -- */
  --success: #276b3a;
  --success-soft: #d9ead9;
  --warn: #a96316;
  --warn-soft: #f7e5c7;
  --danger: #a7261a;
  --danger-soft: #f3d7d2;

  /* -- Shadows (warmer umbra) -- */
  --shadow-sm: 0 1px 2px rgba(28,20,8,0.05), 0 0 0 1px rgba(28,20,8,0.04);
  --shadow-md: 0 6px 24px rgba(28,20,8,0.07), 0 0 0 1px rgba(28,20,8,0.04);
  --shadow-lg: 0 24px 80px rgba(28,20,8,0.14);
  --shadow-glow: 0 10px 40px rgba(15,48,87,0.22);

  /* -- Radii -- */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 980px;

  /* -- Motion -- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* -- Nav glass -- */
  --nav-bg: rgba(248, 245, 239, 0.78);

  /* -- Typography stacks -- */
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
             "Inter", "Helvetica Neue", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --font-serif: "Fraunces", "PingFang SC", "Noto Sans SC", "Songti SC",
                ui-serif, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* -- Midnight study -- */
    --bg: #12100c;
    --bg-alt: #1b1813;
    --bg-tint: #24201a;
    --surface: #1a1814;
    --surface-hover: #211e19;
    --ink: #f0ead9;
    --ink-soft: #d0c8b5;
    --muted: #8a847a;
    --line: #35312a;
    --line-soft: #24211c;

    --accent: #88b4e2;
    --accent-hover: #a1c6ec;
    --accent-soft: rgba(136, 180, 226, 0.14);
    --accent-2: #e4a27d;
    --accent-2-hover: #ecb18f;
    --accent-2-soft: rgba(228, 162, 125, 0.14);

    --success: #6fc37f;
    --success-soft: rgba(111, 195, 127, 0.14);
    --warn: #e3a55b;
    --warn-soft: rgba(227, 165, 91, 0.14);
    --danger: #e26d61;
    --danger-soft: rgba(226, 109, 97, 0.14);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,240,210,0.04);
    --shadow-md: 0 8px 28px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,240,210,0.05);
    --shadow-lg: 0 24px 80px rgba(0,0,0,0.72);
    --shadow-glow: 0 10px 40px rgba(136,180,226,0.28);

    --nav-bg: rgba(18, 16, 12, 0.78);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "ss01";
}

/* Subtle paper grain — invisible on mobile to save paint */
@media (min-width: 820px) and (prefers-reduced-motion: no-preference) {
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    opacity: 0.035;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  }
  @media (prefers-color-scheme: dark) {
    body::after { opacity: 0.045; mix-blend-mode: screen; }
  }
}

::selection { background: var(--accent-2-soft); color: var(--ink); }

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
}
.serif { font-family: var(--font-serif); }

/* ---------- Global nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line-soft);
  height: 56px;
}
.nav .inner {
  max-width: 1160px;
  margin: 0 auto;
  height: 100%;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.nav .brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.015em;
  flex-shrink: 0;
}
.nav .brand:hover { text-decoration: none; }
.nav .brand .sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-left: 2px;
}
.nav nav {
  display: flex;
  gap: 26px;
  font-size: 13px;
  flex: 1;
  justify-content: center;
}
.nav nav a {
  color: var(--ink);
  opacity: 0.76;
  transition: opacity 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
}
.nav nav a:hover { opacity: 1; text-decoration: none; color: var(--accent); }
.nav .right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.nav .right .who {
  font-size: 12px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .nav { height: 52px; }
  .nav .inner { padding: 0 16px; gap: 12px; }
  .nav .brand { font-size: 18px; }
  .nav nav {
    gap: 16px;
    font-size: 12px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav .right .who { max-width: 90px; }
}
@media (max-width: 520px) {
  .nav .right .who { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; transform: translateY(-1px); border-color: var(--muted); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  color: #fff;
}
.btn.warm {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
}
.btn.warm:hover {
  background: var(--accent-2-hover);
  border-color: var(--accent-2-hover);
  color: #fff;
}
.btn.dark {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.dark:hover { background: #000; color: var(--bg); }
.btn.ghost { border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.link {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  position: relative;
}
.btn.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s var(--ease);
}
.btn.link:hover { background: transparent; text-decoration: none; transform: none; }
.btn.link:hover::after { transform: scaleX(1); }
.btn.sm { height: 32px; font-size: 13px; padding: 0 14px; }
.btn.lg { height: 48px; font-size: 16px; padding: 0 26px; }
.btn.xl { height: 56px; font-size: 17px; padding: 0 34px; font-weight: 500; }
.btn.danger { color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- Form controls ---------- */
.field {
  display: block;
  margin-top: 16px;
}
.field label,
label[for] {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.input,
.textarea,
select.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.input:hover,
.textarea:hover,
select.input:hover {
  border-color: var(--muted);
}
.input:focus,
.textarea:focus,
select.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input::placeholder,
.textarea::placeholder { color: var(--muted); opacity: 0.65; }

/* ---------- Containers / sections ---------- */
.page {
  max-width: 1024px;
  margin: 0 auto;
  padding: 48px 22px 96px;
}
.page.wide { max-width: 1280px; }
.section {
  padding: 96px 22px;
}
.section.tight { padding: 64px 22px; }
.section .inner {
  max-width: 980px;
  margin: 0 auto;
}
.section.hero-section {
  padding: 120px 22px 96px;
  position: relative;
  overflow: hidden;
}
.section.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(15,48,87,0.10), transparent 48%),
    radial-gradient(circle at 84% 38%, rgba(182,85,51,0.09), transparent 52%);
  pointer-events: none;
  z-index: 0;
}
.section.hero-section > .inner { position: relative; z-index: 1; }
@media (prefers-color-scheme: dark) {
  .section.hero-section::before {
    background:
      radial-gradient(circle at 18% 12%, rgba(136,180,226,0.16), transparent 48%),
      radial-gradient(circle at 84% 38%, rgba(228,162,125,0.13), transparent 52%);
  }
}

/* ---------- Cards / surfaces ---------- */
.surface {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
}
.surface.pad { padding: 28px; }
.tile {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.tile.interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.tile.dark { background: var(--ink); color: var(--bg); }
.tile.dark .muted { color: rgba(255,250,235,0.6); }
.tile.alt { background: var(--bg-alt); }
.tile.flat { box-shadow: none; border: 1px solid var(--line-soft); }
.tile.glass {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.32);
}
@media (prefers-color-scheme: dark) {
  .tile.glass {
    background: rgba(30,28,22,0.6);
    border-color: rgba(255,240,210,0.08);
  }
}

/* ---------- Typography ---------- */
/* Editorial eyebrow — uppercase caps with a leading rule */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.eyebrow.plain::before { display: none; }

/* Display — Fraunces for Latin, CJK falls to system sans */
.display {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.022em;
  font-feature-settings: "kern", "liga", "ss01";
}
.display.gradient {
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink) 55%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.display em {
  font-style: italic;
  color: var(--accent-2);
  font-weight: 500;
}

.title-1 {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: clamp(34px, 4.3vw, 54px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.014em;
}
.title-2 {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.01em;
}
.title-3 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.008em;
}
.headline {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.008em;
}
.body-l {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-soft);
  letter-spacing: -0.003em;
}
.body-m {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.body-s {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.caption {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.warm-tint { color: var(--accent-2); }

/* Drop cap — for editorial prose, first letter of a .has-dropcap element */
.has-dropcap > p:first-of-type::first-letter,
.dropcap::first-letter {
  font-family: var(--font-serif);
  float: left;
  font-size: 4.2em;
  line-height: 0.9;
  font-weight: 500;
  padding: 0.08em 0.1em 0 0;
  color: var(--accent-2);
}

/* Pullquote */
.pullquote {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 500;
  font-style: italic;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding: 28px 0 28px 32px;
  border-left: 2px solid var(--accent-2);
  margin: 24px 0;
}
.pullquote cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Section kicker — section-labeling horizontal rule */
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* ---------- Tags / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-alt);
  border: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warm { background: var(--accent-2-soft); color: var(--accent-2); border-color: transparent; }
.chip.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Progress ---------- */
.progress {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-alt);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-pill);
  transition: width 0.6s var(--ease);
}
.progress.dark { background: rgba(255,240,210,0.18); }
.progress.dark > span { background: #fff; }

/* ---------- Grid utilities ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 820px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Notices / alerts ---------- */
.notice {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--ink-soft);
  font-size: 14px;
}
.notice.accent { background: var(--accent-soft); color: var(--accent); }
.notice.warm { background: var(--accent-2-soft); color: var(--accent-2); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Loading ---------- */
.loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.loading::after {
  content: "";
  width: 18px;
  height: 18px;
  margin-left: 12px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Divider ---------- */
.hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 32px 0;
}

/* ---------- Footer ---------- */
.foot {
  background: var(--bg-alt);
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  padding: 32px 22px;
  letter-spacing: 0.01em;
}
.foot .inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
}
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.16s; }
.reveal.delay-3 { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Fade-in on load ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.8s var(--ease) both; }
.fade-up.d-1 { animation-delay: 0.08s; }
.fade-up.d-2 { animation-delay: 0.16s; }
.fade-up.d-3 { animation-delay: 0.24s; }

/* ---------- Small screen tweaks ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .page { padding: 28px 18px 64px; }
  .section { padding: 64px 18px; }
  .section.hero-section { padding: 80px 18px 64px; }
  .tile { padding: 28px; }
  .pullquote { padding-left: 22px; }
}
