/* ---- 自托管字体(子集化自 Noto Serif SC / Instrument Serif / JetBrains Mono) ----
   新增页面文字后运行 scripts/subset_fonts.py 重新生成 */
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif SC";
  src: url("../fonts/noto-serif-sc-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif SC";
  src: url("../fonts/noto-serif-sc-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

    :root {
      color-scheme: light;
      --canvas: #f7f6f3;
      --surface: #ffffff;
      --ink: #111111;
      --ink-2: #2f3437;
      --muted: #787774;
      --line: #eaeaea;
      --line-soft: rgba(0, 0, 0, 0.06);
      --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.05);
      --cta-bg: #111111;
      --cta-fg: #ffffff;
      --cta-hover: #333333;
      --glyph-tint: rgba(17, 17, 17, 0.045);
      --wash: rgba(0, 0, 0, 0.035);
      --glass: rgba(255, 255, 255, 0.88);
      --hover-line: rgba(17, 17, 17, 0.22);
      /* spot pastels (semantic accents only) */
      --p-red-bg: #fdebec;   --p-red: #9f2f2d;
      --p-blue-bg: #e1f3fe;  --p-blue: #1f6c9f;
      --p-green-bg: #edf3ec; --p-green: #346538;
      --p-yellow-bg: #fbf3db;--p-yellow: #956400;
      --p-yellow-ink: #6b5610;
      --ease: cubic-bezier(0.16, 1, 0.3, 1);
      --font-serif: "Instrument Serif", "Noto Serif SC", "Songti SC", "STSong", serif;
      --font-sans: -apple-system, "SF Pro Display", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
      --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;
    }

    [data-theme="dark"] {
      color-scheme: dark;
      --canvas: #0e0e0d;
      --surface: #171716;
      --ink: #f2f1ee;
      --ink-2: #d6d5d1;
      --muted: #a09f9a;
      --line: rgba(255, 255, 255, 0.12);
      --line-soft: rgba(255, 255, 255, 0.07);
      --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.45);
      --cta-bg: #f2f1ee;
      --cta-fg: #0e0e0d;
      --cta-hover: #dcdbd7;
      --glyph-tint: rgba(242, 241, 238, 0.06);
      --wash: rgba(255, 255, 255, 0.04);
      --glass: rgba(23, 23, 22, 0.88);
      --hover-line: rgba(255, 255, 255, 0.28);
      --p-red-bg: #2a1415;   --p-red: #f0a7a3;
      --p-blue-bg: #0e1f2b;  --p-blue: #8ec6e8;
      --p-green-bg: #13241a; --p-green: #9ed2a6;
      --p-yellow-bg: #26200e;--p-yellow: #e6c060;
      --p-yellow-ink: #d9bd78;
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    html, body { overflow-x: hidden; }

    body {
      margin: 0;
      min-height: 100dvh;
      font-family: var(--font-sans);
      color: var(--ink);
      -webkit-font-smoothing: antialiased;
      -webkit-tap-highlight-color: transparent;
      background:
        radial-gradient(circle at 50% -10%, var(--wash), transparent 40rem),
        var(--canvas);
    }

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

    /* ---- reading progress (top ink bar) ---- */
    .progress {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 3px;
      background-color: var(--ink);
      transform: scaleX(0);
      transform-origin: 0 50%;
      z-index: 100;
      pointer-events: none;
    }

    .page {
      width: min(1000px, calc(100% - 40px));
      margin: 0 auto;
      padding: 24px 0 clamp(56px, 8vw, 96px);
    }

    /* ============ sticky nav ============ */
    .nav-wrap {
      position: sticky;
      top: 16px;
      z-index: 50;
      display: flex;
      justify-content: center;
      margin-bottom: clamp(56px, 9vw, 104px);
    }
    .nav {
      display: flex;
      gap: 2px;
      max-width: 100%;
      overflow-x: auto;
      padding: 6px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--glass);
      backdrop-filter: blur(12px);
      box-shadow: var(--shadow-soft);
      scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav a {
      flex: 0 0 auto;
      padding: 8px 15px;
      border-radius: 6px;
      font-family: var(--font-sans);
      font-size: 13px;
      font-weight: 500;
      letter-spacing: 0.02em;
      color: var(--ink-2);
      transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
    }
    .nav a:hover { color: var(--ink); background-color: var(--line-soft); }
    .nav a.active { background-color: var(--cta-bg); color: var(--cta-fg); font-weight: 600; }
    .nav a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
    .theme-btn {
      flex: 0 0 auto;
      display: grid;
      place-items: center;
      width: 32px;
      height: 32px;
      margin-left: 4px;
      border: 0;
      border-left: 1px solid var(--line);
      border-radius: 6px;
      background: transparent;
      color: var(--ink-2);
      cursor: pointer;
      transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
    }
    .theme-btn:hover { color: var(--ink); background-color: var(--line-soft); }
    .theme-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
    .theme-btn svg { width: 15px; height: 15px; }
    .icon-sun { display: none; }
    .icon-moon { display: block; }
    [data-theme="dark"] .icon-sun { display: block; }
    [data-theme="dark"] .icon-moon { display: none; }

    /* ============ search + platform chips ============ */
    .search-bar {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 14px;
      padding: 0 2px;
    }
    .search-icon {
      flex: 0 0 auto;
      display: grid;
      place-items: center;
      color: var(--muted);
    }
    .search-input {
      flex: 1;
      min-width: 0;
      border: 0;
      border-bottom: 1px solid var(--line);
      padding: 10px 0;
      background: transparent;
      font-family: var(--font-sans);
      font-size: 15px;
      color: var(--ink);
      outline: none;
      transition: border-color 0.3s var(--ease);
    }
    .search-input::placeholder {
      color: var(--muted);
      font-family: var(--font-mono);
      font-size: 13px;
      letter-spacing: 0.02em;
    }
    .search-input:focus { border-bottom-color: var(--ink); }
    .search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
    .search-count {
      flex: 0 0 auto;
      font-family: var(--font-mono);
      font-size: 11.5px;
      letter-spacing: 0.06em;
      color: var(--muted);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: clamp(40px, 6vw, 64px);
    }
    .chip {
      padding: 5px 12px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: var(--surface);
      color: var(--muted);
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: 0.06em;
      cursor: pointer;
      transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
    }
    .chip:hover { color: var(--ink); border-color: var(--hover-line); }
    .chip.active { background-color: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-fg); }
    .chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
    .no-results {
      display: none;
      margin: 8px 0 clamp(40px, 6vw, 64px);
      text-align: center;
      font-size: 14px;
      color: var(--muted);
    }

    /* ============ hero ============ */
    .hero {
      position: relative;
      padding: 0 0 clamp(48px, 7vw, 80px);
    }

    .hero-glyph {
      position: absolute;
      right: -8px;
      top: -10px;
      font-family: var(--font-serif);
      font-size: clamp(170px, 26vw, 300px);
      line-height: 1;
      color: var(--glyph-tint);
      user-select: none;
      pointer-events: none;
    }

    .hero-content { position: relative; z-index: 1; }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .eyebrow-mark {
      width: 8px;
      height: 8px;
      background-color: var(--ink);
    }

    .hero h1 {
      margin: 22px 0 18px;
      max-width: 780px;
      font-family: var(--font-serif);
      font-weight: 600;
      font-size: clamp(40px, 7.5vw, 66px);
      line-height: 1.18;
      letter-spacing: -0.015em;
      color: var(--ink);
      text-wrap: balance;
    }

    .hero p {
      margin: 0;
      max-width: 560px;
      font-size: clamp(14.5px, 3.4vw, 16px);
      line-height: 1.8;
      color: var(--muted);
      text-wrap: pretty;
    }

    /* ---- hero panels (notice + tips) ---- */
    .hero-panels {
      display: grid;
      grid-template-columns: 1.1fr 1fr;
      gap: 14px;
      margin-top: 40px;
    }

    .panel {
      padding: 24px 26px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background-color: var(--surface);
    }
    .panel strong {
      display: block;
      margin-bottom: 10px;
      font-family: var(--font-mono);
      font-size: 11.5px;
      font-weight: 600;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--ink-2);
    }
    .panel p {
      margin: 0;
      color: var(--muted);
      font-size: 13.5px;
      line-height: 1.75;
      text-wrap: pretty;
    }
    .panel-tips {
      background-color: var(--p-yellow-bg);
      border-color: rgba(149, 100, 0, 0.18);
    }
    .panel-tips strong { color: var(--p-yellow); }
    .panel-tips p { color: var(--p-yellow-ink); }

    /* solid primary CTA — no gradient, no shadow */
    .cta {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      margin-top: 18px;
      padding: 11px 20px;
      border: 1px solid var(--cta-bg);
      border-radius: 6px;
      background-color: var(--cta-bg);
      color: var(--cta-fg);
      font-family: var(--font-sans);
      font-size: 14px;
      font-weight: 600;
      letter-spacing: 0.01em;
      transition: background-color 0.3s var(--ease), transform 0.2s var(--ease);
    }
    .cta:hover { background-color: var(--cta-hover, #333333); }
    .cta:active { transform: scale(0.98); }
    .cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

    /* ---- 盘搜推荐(hero 与搜索栏之间) ---- */
    .panreco {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
      transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
    }
    .panreco:hover {
      transform: translateY(-2px);
      border-color: var(--hover-line);
      box-shadow: var(--shadow-soft);
    }
    .panreco:active { transform: translateY(0) scale(0.99); }
    .panreco:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
    .panreco-text { flex: 1; min-width: 0; }
    .panreco .eyebrow-mark {
      width: 2px;
      height: 12px;
    }
    .panreco-title {
      display: block;
      margin-top: 14px;
      font-family: var(--font-serif);
      font-weight: 600;
      font-size: clamp(24px, 4.5vw, 32px);
      line-height: 1.25;
      letter-spacing: -0.01em;
      color: var(--ink);
    }
    .panreco p {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 13.5px;
      line-height: 1.75;
      text-wrap: pretty;
    }
    .panreco-btn {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 11px 20px;
      border-radius: 6px;
      background-color: var(--ink);
      color: var(--surface);
      font-family: var(--font-sans);
      font-size: 14px;
      font-weight: 600;
      letter-spacing: 0.01em;
      white-space: nowrap;
      transition: opacity 0.3s var(--ease), transform 0.2s var(--ease);
    }
    .panreco:hover .panreco-btn { opacity: 0.88; }
    .panreco-btn svg { flex: 0 0 auto; }
    .panreco + .panreco { margin-top: 14px; }
    @media (max-width: 640px) {
      .panreco {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
      }
      .panreco-btn { align-self: flex-start; }
    }

    /* ============ sections ============ */
    main { display: block; }

    .section {
      scroll-margin-top: 120px;
      margin-top: clamp(56px, 8vw, 88px);
    }
    .section:first-of-type { margin-top: 0; }

    .section-head {
      display: flex;
      align-items: baseline;
      gap: 14px;
      margin-bottom: 18px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--line);
    }
    .section-idx {
      font-family: var(--font-mono);
      font-size: 12px;
      font-weight: 500;
      letter-spacing: 0.08em;
      color: var(--muted);
      font-variant-numeric: tabular-nums;
    }
    .section-head h2 {
      margin: 0;
      font-family: var(--font-serif);
      font-weight: 600;
      font-size: clamp(26px, 5vw, 34px);
      line-height: 1.2;
      letter-spacing: -0.01em;
      color: var(--ink);
      text-wrap: balance;
    }
    .section-count {
      margin-left: auto;
      font-family: var(--font-mono);
      font-size: 11.5px;
      letter-spacing: 0.06em;
      color: var(--muted);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    /* 3-column compact grid */
    .list {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    /* ============ resource cards (compact) ============ */
    .entry {
      position: relative;
      display: flex;
      align-items: center;
      gap: 14px;
      min-height: 74px;
      padding: 14px 16px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background-color: var(--surface);
      transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
    }
    .entry:hover {
      transform: translateY(-2px);
      border-color: var(--hover-line);
      box-shadow: var(--shadow-soft);
    }
    .entry:active {
      transform: translateY(0) scale(0.98);
      transition-duration: 0.1s;
    }
    .entry:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

    .mark {
      flex: 0 0 auto;
      width: 38px;
      height: 38px;
      display: grid;
      place-items: center;
      border-radius: 50%;
      font-family: var(--font-serif);
      font-weight: 600;
      font-size: 15px;
      line-height: 1;
    }
    .m-blue   { background-color: var(--p-blue-bg);   color: var(--p-blue); }
    .m-green  { background-color: var(--p-green-bg);  color: var(--p-green); }
    .m-red    { background-color: var(--p-red-bg);    color: var(--p-red); }
    .m-yellow { background-color: var(--p-yellow-bg); color: var(--p-yellow); }

    .body { flex: 1; min-width: 0; }
    .body strong {
      display: block;
      margin-bottom: 4px;
      font-family: var(--font-sans);
      font-size: 15.5px;
      font-weight: 600;
      letter-spacing: -0.01em;
      line-height: 1.3;
      color: var(--ink);
    }
    .body span {
      display: block;
      font-size: 12.5px;
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* single-entry sections stretch to full row */
    .list-single .entry {
      grid-column: 1 / -1;
      min-height: 84px;
      padding: 18px 22px;
      border-radius: 12px;
    }
    .list-single .entry .mark { width: 46px; height: 46px; font-size: 18px; }
    .list-single .entry .body strong { font-size: 17px; }
    .list-single .entry .body span { font-size: 13px; }

    .arrow {
      flex: 0 0 auto;
      display: grid;
      place-items: center;
      color: var(--muted);
      transition: color 0.3s var(--ease), transform 0.3s var(--ease);
    }
    .entry:hover .arrow { color: var(--ink); transform: translateX(3px); }

    /* ============ footer ============ */
    footer {
      margin-top: clamp(56px, 8vw, 88px);
      padding-top: 28px;
      border-top: 1px solid var(--line);
      text-align: center;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.9;
    }
    footer .sub {
      margin: 6px 0 0;
      font-family: var(--font-mono);
      font-size: 11px;
      letter-spacing: 0.12em;
      opacity: 0.7;
    }

    /* ============ back to top ============ */
    .to-top {
      position: fixed;
      right: 24px;
      bottom: 24px;
      z-index: 90;
      display: grid;
      place-items: center;
      width: 44px;
      height: 44px;
      border: 0;
      border-radius: 50%;
      background-color: var(--cta-bg);
      color: var(--cta-fg);
      cursor: pointer;
      opacity: 0;
      transform: translateY(8px);
      pointer-events: none;
      transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), background-color 0.3s var(--ease);
    }
    .to-top.show { opacity: 1; transform: none; pointer-events: auto; }
    .to-top:hover { background-color: var(--cta-hover); }
    .to-top:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
    .to-top svg { width: 18px; height: 18px; }
    @media (max-width: 640px) {
      .to-top { right: 16px; bottom: 16px; width: 40px; height: 40px; }
    }

    /* ============ scroll reveals ============ */
    .js [data-reveal] { opacity: 0; }
    [data-reveal].in {
      animation: rise 0.6s var(--ease) both;
      animation-delay: var(--d, 0s);
    }
    [data-reveal].done {
      animation: none;
      opacity: 1;
      transform: none;
    }
    @keyframes rise {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: none; }
    }

    /* ============ responsive ============ */
    @media (max-width: 900px) {
      .list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .list-single .entry,
      .list-widefirst .entry:first-child { grid-column: span 2; }
    }
    @media (max-width: 720px) {
      .hero-panels { grid-template-columns: 1fr; }
    }
    @media (max-width: 640px) {
      .page { width: min(1000px, calc(100% - 24px)); }
      .hero-glyph { display: none; }
      .list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
      /* 所有卡片统一每排 3 个（含单入口、首个宽卡） */
      .list .entry,
      .list-single .entry,
      .list-widefirst .entry:first-child {
        grid-column: span 1;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
        min-height: 0;
        padding: 12px 4px;
        border-radius: 10px;
      }
      .list .entry .mark,
      .list-single .entry .mark,
      .list-widefirst .entry:first-child .mark { width: 36px; height: 36px; font-size: 14px; }
      .list .entry .body strong,
      .list-single .entry .body strong,
      .list-widefirst .entry:first-child .body strong { font-size: 12.5px; margin: 0; }
      .list .entry .body span,
      .list-single .entry .body span,
      .list-widefirst .entry:first-child .body span { display: none; }
      .list .entry .arrow,
      .list-single .entry .arrow,
      .list-widefirst .entry:first-child .arrow { display: none; }
      .nav-wrap { top: 10px; }
    }

    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
      }
      [data-reveal], [data-reveal].in, [data-reveal].done {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
      }
    }