/* =========================================================
   site.css — 老版新葡萄8883特色 共享外壳
   顺序：reset → tokens → base → layout → header → footer → components → responsive
   ========================================================= */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body, h1, h2, h3, h4, h5, p, ul, ol, li, figure, blockquote, address, dl, dd { 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; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ---------- tokens ---------- */
:root {
  --ink: #1B1428;
  --paper: #F8F2E7;
  --paper-2: #EDE3D2;
  --grape: #6B2E8F;
  --grape-deep: #3D1257;
  --grape-soft: #A87CC6;
  --lime: #B5E32A;
  --gold: #E3A03C;
  --blue-line: #C7B8D6;
  --moss: #2F4A3C;

  --shell: 1240px;
  --edge: clamp(16px, 4vw, 44px);
  --gap: clamp(16px, 2vw, 28px);
  --block: clamp(28px, 4vw, 56px);

  --r-sm: 6px;
  --r-md: 14px;
  --r-lg: 28px;

  --ff-geo: "Helvetica Neue", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ff-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --sh-card: 0 1px 0 rgba(27, 20, 40, .05), 0 18px 34px -24px rgba(61, 18, 87, .45);
}

/* ---------- base ---------- */
html[data-view="screen"] { --shell: 1460px; }

body {
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: clamp(16px, 1.05vw + 12px, 18px);
  line-height: 1.75;
  letter-spacing: .02em;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html[data-view="screen"] body {
  font-size: clamp(17px, 1.05vw + 13px, 19.6px);
}

/* 蓝图网格底：8px 细线 + 64px 刻度 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(107, 46, 143, .055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(107, 46, 143, .055) 1px, transparent 1px),
    linear-gradient(to right, rgba(107, 46, 143, .11) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(107, 46, 143, .11) 1px, transparent 1px);
  background-size: 8px 8px, 8px 8px, 64px 64px, 64px 64px;
}

h1, h2, h3, h4 {
  font-family: var(--ff-geo);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.01em;
}

:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
  border-radius: 4px;
}

#main-content { display: block; outline: none; }

/* ---------- layout ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--edge);
}
.stack > * + * { margin-top: var(--block); }
.stack--tight > * + * { margin-top: clamp(16px, 2vw, 28px); }

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

.mono {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .08em;
}

/* ---------- header ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -120px;
  z-index: 90;
  padding: 10px 18px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  border-radius: 0 0 10px 10px;
  transition: top .18s ease-out;
}
.skip-link:focus { top: 0; }

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--grape);
}

/* 版本状态条 */
.ver-bar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px var(--edge);
  background: var(--grape-deep);
  color: var(--paper);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .08em;
}
.ver-bar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.ver-bar__brand {
  font-family: var(--ff-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ver-bar__sep {
  width: 1px;
  height: 16px;
  background: rgba(248, 242, 231, .35);
  flex: none;
}
.ver-bar__ver { color: rgba(248, 242, 231, .72); white-space: nowrap; }
.ver-bar__ver b { color: var(--lime); font-size: 14px; font-weight: 700; }
.ver-bar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.ver-bar__hint { color: rgba(248, 242, 231, .55); }

.viewswitch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(248, 242, 231, .32);
  border-radius: 999px;
  background: rgba(248, 242, 231, .07);
}
.viewswitch__btn {
  appearance: none;
  cursor: pointer;
  padding: 5px 13px;
  border-radius: 999px;
  background: transparent;
  color: rgba(248, 242, 231, .74);
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: .08em;
  white-space: nowrap;
  transition: background .2s ease-out, color .2s ease-out;
}
.viewswitch__btn:hover { color: var(--paper); }
.viewswitch__btn[aria-pressed="true"] { background: var(--lime); color: var(--ink); font-weight: 700; }

/* 框架式导航 */
.nav-frame {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 var(--edge);
}

.site-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}
.site-nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-nav__list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  transition: background .2s ease-out, color .2s ease-out;
}
.site-nav__idx {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--grape-soft);
  transition: color .2s ease-out;
}
.site-nav__list a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 4px;
  border-radius: 2px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .22s ease-out;
}
.site-nav__list a:hover { background: rgba(107, 46, 143, .08); }
.site-nav__list a:hover::after { transform: scaleX(1); }
.site-nav__list a:hover .site-nav__idx { color: var(--grape); }
.site-nav__list a[aria-current="page"] {
  background: var(--grape);
  color: var(--paper);
}
.site-nav__list a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav__list a[aria-current="page"] .site-nav__idx { color: var(--lime); }

.tick-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.tick-cta::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grape);
  flex: none;
}
.tick-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -14px rgba(61, 18, 87, .85); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--grape);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.nav-toggle__bars {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 16px;
}
.nav-toggle__bars i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--grape);
  transition: transform .24s ease-out, opacity .24s ease-out;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.scroll-scan {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
  background: transparent;
}
.scroll-scan__fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--grape), var(--lime) 70%, var(--gold));
}

/* 移动端抽屉遮罩 */
body[data-nav-open] { overflow: hidden; }
body[data-nav-open]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(27, 20, 40, .55);
}

/* ---------- footer ---------- */
.site-foot {
  position: relative;
  margin-top: clamp(64px, 10vw, 120px);
  background: var(--ink);
  color: var(--paper);
  border-top: 4px solid var(--grape);
}
.foot-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 48px var(--edge) 28px;
}
.foot-brand {
  font-family: var(--ff-geo);
  font-weight: 800;
  font-size: clamp(24px, 3.4vw, 40px);
  line-height: 1.05;
  letter-spacing: -.01em;
}
.foot-mark {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--lime);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr 1.05fr;
  gap: 36px 32px;
  padding: 34px var(--edge) 42px;
  border-top: 1px solid rgba(248, 242, 231, .16);
}
.foot-col__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--grape-soft);
}
.foot-col__title::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--lime);
  flex: none;
}
.foot-list li { padding: 4px 0; font-size: 14px; color: rgba(248, 242, 231, .82); }
.foot-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: rgba(248, 242, 231, .86);
  transition: color .18s ease-out, transform .18s ease-out;
}
.foot-list a:hover { color: var(--lime); transform: translateX(3px); }
.foot-list--plain li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  line-height: 1.7;
}
.foot-list__idx {
  flex: none;
  min-width: 3.6em;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--grape-soft);
}
.foot-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 28px;
  padding: 18px var(--edge) 34px;
  border-top: 1px solid rgba(248, 242, 231, .16);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: rgba(248, 242, 231, .62);
}

/* ---------- components ---------- */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-block: 18px;
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--moss);
}
.crumb a { color: var(--grape); }
.crumb a:hover { text-decoration: underline; }
.crumb__sep { color: var(--blue-line); }
.crumb [aria-current="page"] { color: var(--ink); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--moss);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--lime);
  flex: none;
}

.lede {
  font-size: clamp(18px, 1.6vw, 20px);
  line-height: 1.7;
  color: var(--ink);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--blue-line);
}
.section-head__title {
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 800;
  line-height: 1.05;
}
.section-head__meta {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--grape);
}

.prose {
  max-width: 38em;
  line-height: 1.75;
}
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 1.9em; font-size: clamp(22px, 2.4vw, 32px); }
.prose h3 { margin-top: 1.6em; font-size: 20px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose ul li { list-style: none; position: relative; }
.prose ul li::before {
  content: "";
  position: absolute;
  left: -1.1em;
  top: .78em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.prose ol { list-style: decimal; }
.prose ol li { padding-left: .2em; }
.prose a { color: var(--grape); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote {
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--lime);
  color: var(--moss);
}

.card {
  position: relative;
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--blue-line);
  border-radius: var(--r-md);
  background: rgba(255, 253, 248, .72);
  transition: border-color .24s ease-out, transform .24s ease-out, box-shadow .24s ease-out;
}
.card:hover {
  border-color: var(--grape);
  transform: translateY(-3px);
  box-shadow: var(--sh-card);
}
.card__title { font-size: clamp(20px, 2.2vw, 28px); margin-bottom: 8px; }
.card__meta {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--moss);
}

.panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 48px);
  border-radius: var(--r-lg);
  background: var(--grape-deep);
  color: var(--paper);
}
.panel__title { font-size: clamp(24px, 3vw, 40px); color: var(--paper); }
.panel a { color: var(--lime); }

.rail { font-size: 14px; color: var(--moss); }
.rail__label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--grape);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: 1px solid var(--grape);
  border-radius: 999px;
  background: var(--grape);
  color: var(--paper);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease-out, color .2s ease-out, transform .2s ease-out, border-color .2s ease-out;
}
.btn:hover { background: var(--grape-deep); transform: translateY(-2px); }
.btn--lime { background: var(--lime); border-color: var(--ink); color: var(--ink); }
.btn--lime:hover { background: #C9F24A; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--grape); color: var(--paper); }
.btn--sm { padding: 9px 16px; font-size: 13px; }

/* 图片容器（页面阶段把 img 放入 .frame） */
.frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--blue-line);
  border-radius: var(--r-md);
  background:
    radial-gradient(120px 120px at 78% 22%, rgba(227, 160, 60, .32), transparent 70%),
    radial-gradient(160px 160px at 22% 78%, rgba(107, 46, 143, .24), transparent 70%),
    linear-gradient(to right, rgba(107, 46, 143, .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(107, 46, 143, .08) 1px, transparent 1px),
    var(--paper-2);
  background-size: auto, auto, 24px 24px, 24px 24px, auto;
}
.frame > img { width: 100%; height: 100%; object-fit: cover; }
.frame--wide { aspect-ratio: 21 / 9; }
.frame--tall { aspect-ratio: 3 / 4; }
.frame--square { aspect-ratio: 1 / 1; }
.frame__tag {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(27, 20, 40, .84);
  color: var(--paper);
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: .08em;
}

/* 可访问标签页 */
.tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--blue-line);
}
.tabs__btn {
  appearance: none;
  cursor: pointer;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--moss);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: .08em;
  transition: background .2s ease-out, color .2s ease-out, border-color .2s ease-out;
}
.tabs__btn:hover { border-color: var(--blue-line); }
.tabs__btn[aria-selected="true"] {
  background: var(--grape);
  border-color: var(--grape);
  color: var(--paper);
}
.tabs__panel { padding-top: 24px; }
.tabs__panel[hidden] { display: none; }

/* 滚动显现（仅在 html[data-motion="on"] 时启用） */
html[data-motion="on"] .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .5s ease-out, transform .5s ease-out;
}
html[data-motion="on"] .reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .site-nav__list a { padding: 12px 10px; font-size: 14px; }
  .site-nav__idx { display: none; }
}

@media (max-width: 900px) {
  .ver-bar { padding-block: 8px; }
  .nav-frame { justify-content: space-between; }
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: block;
    width: min(86vw, 344px);
    padding: 92px 22px 40px;
    background: var(--grape-deep);
    color: var(--paper);
    border-right: 1px solid var(--grape);
    overflow-y: auto;
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform .34s ease-out, visibility .34s ease-out;
  }
  .site-nav::before {
    content: "栏目索引";
    position: absolute;
    top: 34px;
    left: 22px;
    right: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(248, 242, 231, .22);
    font-family: var(--ff-mono);
    font-size: 11px;
    letter-spacing: .18em;
    color: var(--lime);
  }
  .site-nav[data-open] {
    transform: translateX(0);
    visibility: visible;
  }
  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .site-nav__list a {
    width: 100%;
    justify-content: flex-start;
    padding: 14px 12px;
    border-radius: 10px;
    border-bottom: 1px solid rgba(248, 242, 231, .12);
    color: var(--paper);
    font-size: 16px;
  }
  .site-nav__list a::after { display: none; }
  .site-nav__list a:hover { background: rgba(248, 242, 231, .1); }
  .site-nav__idx { display: inline; color: var(--grape-soft); }
  .site-nav__list a[aria-current="page"] { background: var(--lime); color: var(--ink); }
  .site-nav__list a[aria-current="page"] .site-nav__idx { color: var(--grape-deep); }
  .site-nav__list a[aria-current="page"]:hover { background: var(--lime); }

  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .ver-bar__brand { font-size: 12px; letter-spacing: .06em; }
  .viewswitch__btn { padding: 5px 10px; font-size: 10px; }
  .foot-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .foot-grid { grid-template-columns: 1fr; gap: 28px; }
  .foot-base { flex-direction: column; }
}

@media (max-width: 420px) {
  .ver-bar__hint { display: none; }
  .foot-list--plain li { flex-direction: column; gap: 2px; }
  .foot-list--plain .foot-list__idx { min-width: 0; }
}

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