/* =============================================================
   开元主页 · 共享站点样式  /assets/site.css
   结构：变量 → 重置 → 排版 → 通用组件 → 头部轨道 → 页脚
   ============================================================= */

/* ---------- 1. 设计变量 ---------- */
:root {
  --paper: #F4EFE4;
  --indigo: #17224A;
  --ink: #101423;
  --cinnabar: #D6402F;
  --gold: #D9A441;
  --celadon: #6FAE9B;
  --fog: #DCD4C4;
  --night: #24356B;
  --paper-white: #FFFBF2;
  --ember: #B62A1F;

  --rail-w: 264px;
  --shell-max: 1180px;
  --gutter: clamp(1.15rem, 4vw, 2.75rem);

  --font-display: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --cut-sm: 10px;
  --cut-md: 16px;
  --cut-lg: 22px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 2. 重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

html.nav-open { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }

ul, ol { margin: 0; padding: 0; }

ul[role="list"],
ol[role="list"] { list-style: none; }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; }

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

hr {
  border: 0;
  border-top: 1px solid var(--fog);
  margin: 0;
}

/* ---------- 3. 中文排版与标题 ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .06em;
  color: var(--indigo);
}

h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); letter-spacing: .05em; }

p { font-size: 1rem; line-height: 1.75; }

strong { font-weight: 700; }

.mono,
code,
kbd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.eyebrow,
.label {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--indigo);
}

.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;
}

/* ---------- 4. 焦点态 ---------- */
:focus-visible {
  outline: 3px solid var(--cinnabar);
  outline-offset: 2px;
}

.siderail :focus-visible,
.topbar :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--gold);
}

/* ---------- 5. 布局容器与网格 ---------- */
.container {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: 760px; }

.grid {
  display: grid;
  gap: clamp(1rem, 2.4vw, 1.75rem);
}

/* ---------- 6. 通用按钮族 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.15rem;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.2;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .2s var(--ease);
}

.btn--primary {
  background-color: var(--cinnabar);
  color: var(--paper-white);
  clip-path: polygon(0 0, calc(100% - var(--cut-sm)) 0, 100% var(--cut-sm), 100% 100%, var(--cut-sm) 100%, 0 calc(100% - var(--cut-sm)));
}
.btn--primary:hover { background-color: var(--ember); }

.btn--gold {
  background-color: var(--gold);
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - var(--cut-sm)) 0, 100% var(--cut-sm), 100% 100%, var(--cut-sm) 100%, 0 calc(100% - var(--cut-sm)));
}
.btn--gold:hover { background-color: #E7B659; }

.btn--feedback {
  background-color: var(--celadon);
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - var(--cut-sm)) 0, 100% var(--cut-sm), 100% 100%, var(--cut-sm) 100%, 0 calc(100% - var(--cut-sm)));
}
.btn--feedback:hover { background-color: #8AC3B0; }

.btn--ghost {
  background-color: transparent;
  border-color: currentColor;
  color: var(--indigo);
}
.btn--ghost:hover { background-color: rgba(23, 34, 74, .08); }

.btn--block { width: 100%; }

/* ---------- 7. 面包屑 ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  color: rgba(16, 20, 35, .62);
}
.breadcrumb a {
  color: var(--indigo);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.breadcrumb a:hover { color: var(--cinnabar); }
.breadcrumb__sep { color: rgba(16, 20, 35, .4); }

/* ---------- 8. 可复用图片容器 ---------- */
.media-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--fog);
  background-image:
    repeating-linear-gradient(135deg, rgba(23, 34, 74, .09) 0 1px, transparent 1px 13px),
    linear-gradient(160deg, rgba(36, 53, 107, .14), rgba(217, 164, 65, .1));
  clip-path: polygon(0 0, calc(100% - var(--cut-md)) 0, 100% var(--cut-md), 100% 100%, var(--cut-md) 100%, 0 calc(100% - var(--cut-md)));
}
.media-frame > img,
.media-frame > svg,
.media-frame > picture > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-frame--wide { aspect-ratio: 16 / 9; }
.media-frame--tall { aspect-ratio: 3 / 4; }
.media-frame--square { aspect-ratio: 1 / 1; }

/* ---------- 9. 筛选协议样式 ---------- */
[data-filter-item] { transition: opacity .2s var(--ease); }

[data-filter-item].is-filtered {
  animation: filterIn .28s var(--ease) both;
}

@keyframes filterIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* 可选入场动效：仅在有 JS 时才隐藏 */
html.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
html.js-reveal [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* ---------- 10. 跳过链接 ---------- */
.skip-link {
  position: fixed;
  top: .6rem;
  left: .6rem;
  z-index: 300;
  padding: .6rem 1rem;
  background-color: var(--indigo);
  color: var(--paper-white);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .1em;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transform: translateY(-180%);
  transition: transform .18s var(--ease);
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- 11. 站点头部 ---------- */
.site-header {
  position: relative;
  z-index: 60;
}

/* 11.1 侧边轨道（桌面常驻 / 移动抽屉） */
.siderail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  width: min(86vw, 320px);
  padding: 4.75rem 1.35rem 1.35rem;
  background-color: var(--indigo);
  color: var(--paper);
  border-right: 1px solid rgba(244, 239, 228, .16);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform .3s var(--ease), visibility .3s;
}

.siderail::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(118deg, transparent 0 63%, rgba(217, 164, 65, .16) 63% calc(63% + 1px), transparent calc(63% + 1px)),
    linear-gradient(118deg, transparent 0 74%, rgba(111, 174, 155, .12) 74% calc(74% + 1px), transparent calc(74% + 1px));
}

.site-header[data-open] .siderail {
  transform: translateX(0);
  visibility: visible;
  transition: transform .3s var(--ease), visibility 0s;
}

.siderail__head {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding-bottom: .95rem;
  border-bottom: 1px solid rgba(244, 239, 228, .16);
}

.siderail__brand {
  display: flex;
  align-items: baseline;
  gap: .55rem;
}

.siderail__name {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--paper-white);
}

.siderail__ver {
  padding: .1rem .38rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .12em;
  color: var(--gold);
  border: 1px solid rgba(217, 164, 65, .55);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.siderail__status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .72rem;
  letter-spacing: .16em;
  color: rgba(244, 239, 228, .7);
}

.status-dot {
  display: inline-block;
  width: .5rem;
  height: .5rem;
  flex: none;
  border-radius: 50%;
  background-color: var(--celadon);
  box-shadow: 0 0 0 3px rgba(111, 174, 155, .22);
  animation: dotPulse 2.8s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(111, 174, 155, .22); }
  50%      { box-shadow: 0 0 0 6px rgba(111, 174, 155, .06); }
}

.siderail__nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .18rem;
}

.siderail__legend {
  margin-bottom: .55rem;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .26em;
  color: rgba(244, 239, 228, .42);
}

.siderail__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .7rem .6rem .85rem;
  font-size: .95rem;
  letter-spacing: .1em;
  color: rgba(244, 239, 228, .8);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: background-color .18s var(--ease), color .18s var(--ease), padding-left .18s var(--ease);
}

.siderail__link:hover {
  background-color: rgba(244, 239, 228, .09);
  color: var(--paper-white);
  padding-left: 1rem;
}

.siderail__link[aria-current="page"] {
  background-color: rgba(214, 64, 47, .2);
  color: var(--paper-white);
  font-weight: 700;
}

.siderail__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 1.3rem;
  background-color: var(--cinnabar);
  transform: translateY(-50%);
}

.siderail__idx {
  min-width: 1.5em;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .06em;
  color: rgba(217, 164, 65, .62);
}

.siderail__link[aria-current="page"] .siderail__idx { color: var(--gold); }

.siderail__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(244, 239, 228, .16);
}

.siderail__feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .62rem .8rem;
  font-size: .85rem;
  letter-spacing: .08em;
  color: var(--paper-white);
  background-color: rgba(111, 174, 155, .12);
  border: 1px solid rgba(111, 174, 155, .6);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.siderail__feedback:hover {
  background-color: rgba(111, 174, 155, .26);
  border-color: var(--celadon);
}

.siderail__coord {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  color: rgba(244, 239, 228, .4);
}

/* 11.2 移动端顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1.1rem;
  background-color: var(--indigo);
  color: var(--paper);
  border-bottom: 1px solid rgba(244, 239, 228, .18);
}

.topbar__brand {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--paper-white);
}

.topbar__ver {
  padding: .08rem .3rem;
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--gold);
  border: 1px solid rgba(217, 164, 65, .5);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.topbar__feedback {
  display: none;
  padding: .4rem .6rem;
  font-size: .78rem;
  letter-spacing: .1em;
  color: var(--paper-white);
  border: 1px solid rgba(111, 174, 155, .62);
  transition: background-color .2s var(--ease);
}
.topbar__feedback:hover { background-color: rgba(111, 174, 155, .22); }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .48rem .68rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--paper-white);
  border: 1px solid rgba(244, 239, 228, .42);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: background-color .18s var(--ease);
}
.nav-toggle:hover { background-color: rgba(244, 239, 228, .12); }

.nav-toggle__bars {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 14px;
}
.nav-toggle__bars span {
  display: block;
  height: 2px;
  background-color: currentColor;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.site-header[data-open] .nav-toggle__bars span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.site-header[data-open] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.site-header[data-open] .nav-toggle__bars span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* 11.3 抽屉遮罩 */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  margin: 0;
  padding: 0;
  border: 0;
  background-color: rgba(16, 20, 35, .62);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity .3s var(--ease);
}
.site-header[data-open] .drawer-scrim {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 420px) {
  .topbar__feedback { display: inline-flex; }
}

/* ---------- 12. 桌面端布局 ---------- */
@media (min-width: 1024px) {
  body { padding-left: var(--rail-w); }

  .siderail {
    width: var(--rail-w);
    padding: 1.75rem 1.35rem 1.35rem;
    transform: none;
    visibility: visible;
    transition: none;
    z-index: 1;
  }

  .topbar { display: none; }
  .drawer-scrim { display: none; }
  html.nav-open { overflow: auto; }
}

/* ---------- 13. 站点页脚 ---------- */
.site-footer {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  background-color: var(--indigo);
  color: rgba(244, 239, 228, .86);
  border-top: 3px solid var(--gold);
}

.site-footer__inner {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding: clamp(1.85rem, 4vw, 2.75rem) var(--gutter) clamp(1.5rem, 3vw, 2rem);
}

/* 13.1 通栏反馈区 */
.feedback-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding: clamp(1.15rem, 2.6vw, 1.7rem) clamp(1.15rem, 3vw, 2rem);
  background-color: rgba(111, 174, 155, .1);
  border: 1px solid rgba(111, 174, 155, .5);
  clip-path: polygon(0 0, calc(100% - var(--cut-md)) 0, 100% var(--cut-md), 100% 100%, var(--cut-md) 100%, 0 calc(100% - var(--cut-md)));
}

.feedback-panel__text {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: min(100%, 22rem);
}

.feedback-panel__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--celadon);
}

.feedback-panel__title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.1vw, 1.4rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .05em;
  color: var(--paper-white);
}

.feedback-panel__note {
  font-size: .84rem;
  line-height: 1.6;
  color: rgba(244, 239, 228, .66);
}

/* 13.2 页脚三栏 */
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding-top: clamp(1.75rem, 4vw, 2.6rem);
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--paper-white);
}

.footer-tag {
  font-size: .82rem;
  line-height: 1.65;
  letter-spacing: .04em;
  color: rgba(244, 239, 228, .58);
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--gold);
  line-height: 1.6;
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  list-style: none;
}

.footer-link {
  display: inline-block;
  font-size: .9rem;
  letter-spacing: .06em;
  color: rgba(244, 239, 228, .82);
  border-bottom: 1px solid transparent;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.footer-link:hover {
  color: var(--paper-white);
  border-bottom-color: var(--celadon);
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .04em;
  line-height: 1.7;
  color: rgba(244, 239, 228, .6);
  overflow-wrap: anywhere;
}

/* 13.3 底条 */
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  padding-top: 1.1rem;
  border-top: 1px solid rgba(244, 239, 228, .14);
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  line-height: 1.7;
  color: rgba(244, 239, 228, .52);
}

/* ---------- 14. 响应式补充 ---------- */
@media (min-width: 640px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-col--brand { grid-column: 1 / -1; }
}

@media (min-width: 1024px) {
  .footer-grid { grid-template-columns: 1.35fr .8fr 1.2fr; }
  .footer-col--brand { grid-column: auto; }
}

@media (min-width: 1440px) {
  :root { --shell-max: 1240px; }
}

/* ---------- 15. 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .siderail { transition: none; }
  .siderail__link:hover { padding-left: .85rem; }
  .status-dot { animation: none; }

  html.js-reveal [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  [data-filter-item].is-filtered { animation: none; }
}
