/* ═══════════════════════════════════════════════════
   site.css — 全局基础 (与 prototype 对齐)
   ═══════════════════════════════════════════════════ */
:root {
  --ink: #111418;
  --ink-soft: #3a424c;
  --muted: #6a7380;
  --paper: #e9eef2;
  --surface: #f7f9fb;
  --line: #cfd6de;
  --line-soft: #dde3ea;
  --accent: #e84e2f;
  --accent-dark: #c93d22;
  --accent-soft: #ffe8e2;
  --nav-h: 64px;
  --ease: cubic-bezier(.22, .9, .28, 1);
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-ui: "Sora", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* 全局网格纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image:
    linear-gradient(rgba(17, 20, 24, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 20, 24, .04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 20%, #000 30%, transparent 80%);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
}

/* —— 页面容器 —— */
.page {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

/* —— Header / Nav —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px) saturate(1.2);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: block;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.08);
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}
.nav-links {
  display: none; /* 暂时隐藏导航链接，恢复时改回 flex */
  gap: 26px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}
.nav-links a {
  position: relative;
  padding: 6px 0;
  transition: color .2s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
}
.nav-search {
  margin-left: auto;
  position: relative;
  width: 220px;
  z-index: 45;
  transition: width .28s var(--ease);
}
.nav-search.is-expanded { width: 360px; }
.nav-search input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s, border-radius .2s;
}
.nav-search input[type="search"]::-webkit-search-cancel-button,
.nav-search input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.nav-search input::placeholder { color: #9199a4; }
.nav-search input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 20, 24, .08);
}
.nav-search.is-open input {
  border-color: var(--ink);
  border-bottom-color: transparent;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}
.nav-search .icon {
  position: absolute;
  right: 12px;
  top: 19px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-suggest {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  box-shadow: 0 18px 36px rgba(17, 20, 24, .12);
}
.search-suggest[hidden] { display: none; }
.search-suggest-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px 8px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.search-suggest-item:hover,
.search-suggest-item.is-active {
  background: var(--ink);
  color: #fff;
}
.search-suggest-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand, var(--ink));
  color: #fff;
  flex-shrink: 0;
}
.search-suggest-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.search-suggest-icon .icon-fallback {
  display: block;
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}
.search-suggest-copy { min-width: 0; }
.search-suggest-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.3;
}
.search-suggest-copy strong mark {
  color: var(--accent);
  background: transparent;
  font-weight: 700;
}
.search-suggest-item:hover strong mark,
.search-suggest-item.is-active strong mark { color: #ffb4a6; }
.search-suggest-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggest-item:hover span,
.search-suggest-item.is-active span { color: rgba(255,255,255,.58); }
.search-suggest-go {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.search-suggest-item:hover .search-suggest-go,
.search-suggest-item.is-active .search-suggest-go { color: #fff; }
.search-suggest-empty,
.search-suggest-hint {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}
.search-suggest-empty {
  padding: 16px 10px;
  text-align: center;
}
.search-suggest-hint {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
}

/* —— Footer —— */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 56px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.footer-links a:hover { color: var(--ink); }

/* —— 通用按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s, color .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 8px 20px rgba(232, 78, 47, .28);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: rgba(255,255,255,.55);
}

/* —— Animations —— */
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-18px, 14px); }
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes tile-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* —— 响应式：平板 —— */
@media (max-width: 820px) {
  :root { --nav-h: 56px; }
  .page { width: calc(100% - 28px); }
  .nav { gap: 10px; height: var(--nav-h); }
  .brand { gap: 8px; font-size: 15px; flex-shrink: 0; min-width: 0; }
  .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
  .nav-links { display: none; }
  .nav-search,
  .nav-search.is-expanded {
    width: auto; flex: 1; min-width: 0; max-width: 200px;
  }
  .nav-search.is-expanded { max-width: none; }
  .nav-search input {
    height: 34px; padding: 0 34px 0 12px; font-size: 13px; border-radius: 7px;
  }
  .nav-search .icon { right: 10px; top: 17px; width: 14px; height: 14px; }
  .search-suggest-item {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 8px 7px 6px;
  }
  .search-suggest-icon { width: 32px; height: 32px; border-radius: 8px; }
  .search-suggest-hint { display: none; }
  .site-footer {
    flex-direction: column; align-items: flex-start; gap: 12px;
    margin-top: 36px; padding: 22px 0 calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .footer-links { gap: 6px 16px; }
}

@media (max-width: 420px) {
  .page { width: calc(100% - 24px); }
  .brand { font-size: 14px; flex-shrink: 0; }
  .nav-search,
  .nav-search.is-expanded { max-width: none; flex: 1 1 auto; min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
