/* ============================================================
   财神通棋牌 · 共享样式表 /assets/site.css
   技术蓝图网格 + 档案夹资料卡 + 悬浮胶囊导航
   ============================================================ */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body,
h1, h2, h3, h4, h5,
p, ul, ol, li, figure, blockquote, dl, dd, hr {
  margin: 0;
}

ul, ol { padding: 0; list-style: none; }

img, svg, picture { display: block; max-width: 100%; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

input, select, textarea { font: inherit; }

/* ---------- 2. Tokens ---------- */
:root {
  --gold: #E8B33A;
  --gold-deep: #B9851F;
  --gold-ink: #6B4A08;
  --felt: #1F4D3A;
  --felt-deep: #123328;
  --neon: #2FD4C4;
  --neon-soft: #B9F3ED;
  --neon-ink: #0F5C55;
  --paper: #F6F1E7;
  --warm-gray: #E6DED1;
  --card: #FFFDF8;
  --ink: #15130F;
  --red: #C8402F;
  --red-ink: #8D2A1E;
  --grad-festive: linear-gradient(135deg, #E8B33A, #C8402F);

  --shell: 1240px;
  --gutter: 20px;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --line: rgba(31, 77, 58, 0.16);
  --line-strong: rgba(31, 77, 58, 0.3);
  --line-invert: rgba(246, 241, 231, 0.16);

  --font-head: "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC",
    "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo,
    Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.68, 0.28, 1);
  --shadow-card: 0 18px 44px -34px rgba(18, 51, 40, 0.85);
  --shadow-float: 0 20px 46px -30px rgba(18, 51, 40, 0.7);
}

/* ---------- 3. Base ---------- */
body {
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(31, 77, 58, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 77, 58, 0.055) 1px, transparent 1px);
  background-size: 100% 96px, 96px 100%;
  background-position: 0 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--felt-deep);
  text-wrap: balance;
}

h1 { font-size: clamp(32px, 4.4vw, 52px); }
h2 { font-size: clamp(24px, 3vw, 32px); }
h3 { font-size: clamp(19px, 2vw, 23px); letter-spacing: -0.01em; }

p { max-width: 68ch; }

strong { font-weight: 800; }

::selection {
  background: var(--gold);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ---------- 4. Utilities ---------- */
.container {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: 48px; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--felt);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
}

.section-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--felt-deep);
}

.lede {
  max-width: 62ch;
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.75;
  color: rgba(21, 19, 15, 0.78);
}

.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, var(--line-strong), rgba(31, 77, 58, 0.04));
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 5. Skip link ---------- */
.skip-link {
  position: fixed;
  top: 0;
  left: 16px;
  z-index: 300;
  transform: translateY(-140%);
  padding: 10px 20px 12px;
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: var(--felt-deep);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-float);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 6. Grid ---------- */
.grid {
  display: grid;
  gap: 18px;
}

.grid--12 {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.col--8 { grid-column: span 8; }
.col--7 { grid-column: span 7; }
.col--5 { grid-column: span 5; }
.col--4 { grid-column: span 4; }
.col--3 { grid-column: span 3; }

/* ---------- 7. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background-color 0.18s var(--ease),
    color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.18s var(--ease);
}

.btn--primary {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 12px 26px -18px rgba(185, 133, 31, 0.95);
}

.btn--primary:hover {
  background: var(--gold-deep);
  color: var(--paper);
}

.btn--ghost {
  background: transparent;
  color: var(--felt-deep);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  background: var(--felt);
  border-color: var(--felt);
  color: var(--paper);
}

.btn--sm {
  padding: 9px 16px;
  font-size: 13.5px;
}

.btn:active { transform: translateY(1px); }

/* ---------- 8. Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--warm-gray);
  color: var(--felt-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.tag--gold {
  background: rgba(232, 179, 58, 0.26);
  border-color: rgba(185, 133, 31, 0.48);
  color: var(--gold-ink);
}

.tag--neon {
  background: var(--neon-soft);
  border-color: rgba(47, 212, 196, 0.55);
  color: var(--neon-ink);
}

.tag--red {
  background: rgba(200, 64, 47, 0.14);
  border-color: rgba(200, 64, 47, 0.38);
  color: var(--red-ink);
}

/* ---------- 9. Cards ---------- */
.card {
  position: relative;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    transform 0.18s var(--ease);
}

.card:hover {
  border-color: var(--neon);
  box-shadow: 0 22px 48px -34px rgba(18, 51, 40, 0.9);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--felt-deep);
}

.card-body {
  font-size: 15.5px;
  line-height: 1.72;
  color: rgba(21, 19, 15, 0.76);
}

.card-index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--gold-deep);
}

/* ---------- 10. Media frames ---------- */
.media-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    linear-gradient(135deg, rgba(31, 77, 58, 0.1), rgba(47, 212, 196, 0.14)),
    var(--warm-gray);
}

.media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(31, 77, 58, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 77, 58, 0.1) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.media-frame > img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame--4x3 { aspect-ratio: 4 / 3; }
.media-frame--1x1 { aspect-ratio: 1 / 1; }
.media-frame--wide { aspect-ratio: 21 / 9; }

/* ---------- 11. Breadcrumb ---------- */
.breadcrumb { margin-bottom: 22px; }

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: rgba(21, 19, 15, 0.58);
}

.breadcrumb-list li + li::before {
  content: "/";
  margin-right: 8px;
  color: rgba(31, 77, 58, 0.35);
}

.breadcrumb-link {
  color: var(--felt);
  border-bottom: 1px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.breadcrumb-link:hover {
  color: var(--felt-deep);
  border-bottom-color: var(--gold);
}

/* ---------- 12. TOC ---------- */
.toc {
  position: sticky;
  top: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
}

.toc-title {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--felt);
}

.toc-list {
  display: grid;
  gap: 3px;
}

.toc-link {
  display: block;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(21, 19, 15, 0.72);
  transition: background-color 0.16s var(--ease),
    border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.toc-link:hover {
  background: var(--warm-gray);
  color: var(--felt-deep);
}

.toc-link.is-active {
  border-left-color: var(--gold);
  background: rgba(232, 179, 58, 0.16);
  color: var(--felt-deep);
  font-weight: 700;
}

/* ---------- 13. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  padding-block: 12px;
  background: rgba(246, 241, 231, 0.88);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
}

.header-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 12px 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow-float);
  transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}

.site-header[data-scrolled] .header-shell {
  border-color: rgba(31, 77, 58, 0.26);
  box-shadow: 0 26px 52px -34px rgba(18, 51, 40, 0.9);
}

/* 品牌 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: none;
  min-width: 0;
}

.brand-mark {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--grad-festive);
  box-shadow: inset 0 0 0 1px rgba(21, 19, 15, 0.16);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 4px;
  background: var(--felt-deep);
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon);
  translate: -50% -50%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--felt-deep);
  white-space: nowrap;
}

.brand-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(31, 77, 58, 0.68);
  white-space: nowrap;
}

.brand--invert .brand-name { color: var(--paper); }

.brand--invert .brand-sub { color: rgba(246, 241, 231, 0.66); }

.brand--invert .brand-mark {
  box-shadow: 0 0 0 1px rgba(232, 179, 58, 0.45);
}

/* 导航胶囊 */
.nav-pill {
  margin-inline: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(31, 77, 58, 0.055);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 8px 14px 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--felt-deep);
  transition: background-color 0.18s var(--ease),
    color 0.18s var(--ease), transform 0.18s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 5px;
  left: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.2s var(--ease);
}

.nav-link:hover {
  background: var(--card);
  color: var(--ink);
  transform: translateY(-1px);
}

.nav-link:hover::after { transform: scaleX(1); }

.nav-link[aria-current="page"] {
  background: var(--felt);
  color: var(--paper);
}

.nav-link[aria-current="page"]::after {
  background: var(--gold);
  transform: scaleX(1);
}

.header-cta { flex: none; }

/* 汉堡按钮 */
.nav-toggle {
  display: none;
  flex: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--card);
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.nav-toggle:hover { border-color: var(--neon); }

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--felt-deep);
  transition: transform 0.22s var(--ease), opacity 0.16s var(--ease);
}

.site-header[data-open] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-header[data-open] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.site-header[data-open] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* 底部刻度 / 滚动进度 */
.header-rail {
  position: absolute;
  right: 18px;
  bottom: 3px;
  left: 18px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(31, 77, 58, 0.08);
  pointer-events: none;
}

.rail-progress {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--neon), var(--gold) 62%, var(--red));
}

/* ---------- 14. Footer ---------- */
.site-footer {
  margin-top: 72px;
  border-top: 1px solid rgba(232, 179, 58, 0.42);
  background-color: var(--felt-deep);
  background-image:
    radial-gradient(120% 90% at 10% 0%, rgba(47, 212, 196, 0.16), transparent 58%),
    radial-gradient(90% 80% at 92% 6%, rgba(232, 179, 58, 0.18), transparent 54%),
    linear-gradient(rgba(246, 241, 231, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 241, 231, 0.045) 1px, transparent 1px);
  background-size: auto, auto, 100% 88px, 88px 100%;
  color: var(--paper);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.35fr 0.75fr 1.2fr;
  gap: 36px;
  padding-block: 48px 34px;
}

.footer-brand { min-width: 0; }

.footer-note {
  margin-top: 16px;
  max-width: 34ch;
  font-size: 15px;
  line-height: 1.75;
  color: rgba(246, 241, 231, 0.74);
}

.footer-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 5px 13px;
  border: 1px dashed rgba(232, 179, 58, 0.55);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.footer-title {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.footer-link-list {
  display: grid;
  gap: 9px;
}

.footer-link {
  display: inline-block;
  color: rgba(246, 241, 231, 0.86);
  font-size: 15px;
  border-bottom: 1px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.footer-link:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.contact-list {
  display: grid;
  gap: 11px;
}

.contact-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: start;
}

.contact-key {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.9;
  color: rgba(246, 241, 231, 0.5);
}

.contact-value {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  letter-spacing: 0.01em;
  color: rgba(246, 241, 231, 0.9);
  overflow-wrap: anywhere;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 26px;
  padding-block: 18px 30px;
  border-top: 1px solid var(--line-invert);
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: rgba(246, 241, 231, 0.62);
}

.footer-sep {
  margin-inline: 6px;
  color: rgba(246, 241, 231, 0.32);
}

/* ---------- 15. Responsive ---------- */
@media (max-width: 1080px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
  .footer-contact { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .nav-list { flex-direction: column; align-items: stretch; gap: 4px; }

  .nav-pill {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    z-index: 5;
    max-height: min(72vh, 480px);
    margin: 0;
    padding: 10px;
    overflow-y: auto;
    border-radius: var(--r-lg);
    background: var(--card);
    box-shadow: 0 30px 60px -30px rgba(18, 51, 40, 0.62);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
      visibility 0.2s;
  }

  .nav-link {
    display: block;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 16px;
  }

  .nav-link::after { display: none; }

  .header-cta { margin-left: auto; }

  .nav-toggle { display: inline-flex; }

  .site-header[data-open] .nav-pill {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .site-header[data-open] .header-shell {
    border-color: rgba(47, 212, 196, 0.55);
  }

  .grid--12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .col--8, .col--7, .col--5 { grid-column: span 6; }
  .col--4, .col--3 { grid-column: span 3; }

  .toc { position: static; top: auto; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }

  body { font-size: 16px; }

  .section { padding-block: 34px; }

  .brand-sub { display: none; }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 26px;
    padding-block: 36px 28px;
  }

  .footer-contact { grid-column: auto; }

  .footer-bottom { justify-content: flex-start; }

  .media-frame--wide { aspect-ratio: 16 / 9; }
}

@media (max-width: 620px) {
  .header-cta { display: none; }
  .nav-toggle { margin-left: auto; }

  .grid--12 { grid-template-columns: minmax(0, 1fr); }
  .col--8, .col--7, .col--5, .col--4, .col--3 { grid-column: span 1; }

  .contact-item { grid-template-columns: 1fr; gap: 2px; }
  .contact-key { line-height: 1.6; }
}

/* ---------- 16. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .nav-link:hover,
  .btn:active { transform: none; }
}
