/* =========================================================
   半岛体体育 · Site Kit 共享样式 /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, h6,
p, ul, ol, figure, blockquote, dl, dd { margin: 0; }

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

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

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

a { color: inherit; }

:focus-visible {
  outline: 2px solid #21E6C1;
  outline-offset: 3px;
}

/* ---------- 2. 变量 ---------- */
:root {
  --deep: #071B2E;
  --navy: #0E2C47;
  --fence: #16384F;
  --cyan: #21E6C1;
  --orange: #FF6A2B;
  --yellow: #FFD24A;
  --ice: #EAF4F7;
  --mist: #7E97A8;
  --well: #04121F;
  --green: #2FBF71;

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

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 1rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.5625rem;
  --fs-xl: 1.9375rem;
  --fs-2xl: 2.4375rem;
  --fs-3xl: 3.0625rem;
  --fs-4xl: 3.8125rem;

  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 132px;
}

/* ---------- 3. 基础排版 ---------- */
body {
  position: relative;
  min-height: 100vh;
  background: var(--deep);
  color: var(--ice);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 24px 网格底纹 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(234, 244, 247, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(234, 244, 247, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

.site-header,
.site-footer,
#main-content { position: relative; z-index: 1; }

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--ice);
}

h1 { font-size: clamp(2.2rem, 5vw, 4.4rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4375rem); }
h3 { font-size: var(--fs-md); letter-spacing: 0.01em; }

p { max-width: 34em; }

strong { color: var(--cyan); font-weight: 700; }

code, kbd, samp, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

::selection { background: rgba(33, 230, 193, 0.28); color: #ffffff; }

/* ---------- 4. 布局容器 ---------- */
.container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

#main-content {
  display: block;
  scroll-margin-top: 120px;
}

.section {
  position: relative;
  padding-block: clamp(48px, 7vw, 96px);
}

.section--navy { background: var(--navy); border-block: 1px solid var(--fence); }
.section--well { background: var(--well); border-block: 1px solid var(--fence); }

/* ---------- 5. 跳转链接 ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--cyan);
  color: var(--well);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  border: 1px solid var(--cyan);
  transition: top 0.18s ease;
}

.skip-link:focus { top: 12px; }

/* ---------- 6. 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(7, 27, 46, 0.94);
  border-bottom: 1px solid var(--fence);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "left brand right";
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding: 14px var(--gutter) 10px;
  transition: padding 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.masthead__side { display: flex; align-items: center; min-width: 0; }
.masthead__side--left { grid-area: left; justify-self: start; }
.masthead__side--right { grid-area: right; justify-self: end; }
.masthead__brand { grid-area: brand; justify-self: center; min-width: 0; }

/* 品牌 */
.brand {
  display: block;
  text-align: center;
  text-decoration: none;
  min-width: 0;
}

.brand__name {
  position: relative;
  display: block;
  padding-bottom: 7px;
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  line-height: 1.1;
  color: var(--ice);
  white-space: nowrap;
  transition: font-size 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.brand__name::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 190px;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--cyan), var(--orange));
}

.brand__sub {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--mist);
  white-space: nowrap;
}

.brand:hover .brand__name { color: #ffffff; }

/* 版本状态胶囊 */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border: 1px solid rgba(33, 230, 193, 0.35);
  background: rgba(33, 230, 193, 0.07);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--cyan);
  white-space: nowrap;
}

.status-pill__dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(33, 230, 193, 0.18);
  animation: pillPulse 2.6s ease-in-out infinite;
}

@keyframes pillPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* 移动菜单按钮 */
.nav-toggle {
  display: none;
  grid-area: toggle;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--fence);
  border-radius: 0;
  background: rgba(22, 56, 79, 0.55);
  color: var(--ice);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.nav-toggle:hover { border-color: var(--cyan); background: rgba(33, 230, 193, 0.1); }

.nav-toggle__bars {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.nav-toggle__bars span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--cyan);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-toggle__label {
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  color: var(--mist);
}

/* 主栏目 */
.primary-nav {
  border-top: 1px solid var(--fence);
  background: transparent;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: clamp(8px, 2vw, 24px);
}

.nav-list a {
  display: block;
  padding: 11px clamp(10px, 1.6vw, 20px);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--mist);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.nav-list a:hover { color: var(--ice); border-bottom-color: var(--fence); }

.nav-list a[aria-current="page"] {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: linear-gradient(180deg, transparent, rgba(33, 230, 193, 0.1));
}

/* 阅读进度 */
.read-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan) 50%, var(--orange) 100%);
  will-change: transform;
}

/* 滚动收窄 */
.site-header.is-compact .masthead { padding-top: 7px; padding-bottom: 5px; }
.site-header.is-compact .brand__name { font-size: clamp(1.1rem, 1.7vw, 1.45rem); }
.site-header.is-compact .brand__sub { display: none; }
.site-header.is-compact .nav-list a { padding-block: 8px; }

/* ---------- 7. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 0;
  background: none;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn--ghost {
  color: var(--cyan);
  border-color: rgba(33, 230, 193, 0.45);
  background: rgba(33, 230, 193, 0.05);
}

.btn--ghost:hover { border-color: var(--cyan); background: rgba(33, 230, 193, 0.15); color: #ffffff; }

.btn--primary {
  color: var(--well);
  background: var(--cyan);
  border-color: var(--cyan);
}

.btn--primary:hover { background: #57f0d6; border-color: #57f0d6; }

.btn--warn {
  color: #1a0b03;
  background: var(--orange);
  border-color: var(--orange);
}

.btn--warn:hover { background: #ff8151; border-color: #ff8151; }

.btn--quiet {
  color: var(--mist);
  border-color: var(--fence);
}

.btn--quiet:hover { color: var(--ice); border-color: var(--mist); }

.btn--sm { padding: 7px 12px; font-size: var(--fs-xs); letter-spacing: 0.12em; }

/* ---------- 8. 章节编号系统 ---------- */
.chapter {
  position: relative;
  scroll-margin-top: 150px;
}

.chapter__num {
  display: inline-block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--cyan);
}

.chapter__note {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.34em;
  color: var(--mist);
}

/* ---------- 9. 卡片 / 标签 / 数据 ---------- */
.card {
  position: relative;
  background: var(--navy);
  border: 1px solid var(--fence);
  padding: clamp(16px, 2.4vw, 28px);
  transition: border-color 0.2s, background 0.2s;
}

.card::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  width: 3px;
  height: 38px;
  background: var(--cyan);
}

.card:hover { border-color: rgba(33, 230, 193, 0.55); }

.card__title {
  margin-block: 10px 8px;
  font-size: var(--fs-md);
  line-height: 1.35;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  border: 1px solid var(--fence);
  background: rgba(22, 56, 79, 0.55);
  color: var(--mist);
  white-space: nowrap;
}

.tag--live { color: var(--orange); border-color: rgba(255, 106, 43, 0.5); background: rgba(255, 106, 43, 0.1); }
.tag--done { color: var(--green); border-color: rgba(47, 191, 113, 0.45); background: rgba(47, 191, 113, 0.1); }
.tag--accent { color: var(--yellow); border-color: rgba(255, 210, 74, 0.45); background: rgba(255, 210, 74, 0.1); }

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border-left: 2px solid var(--fence);
}

.stat__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ice);
}

.stat__label {
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  color: var(--mist);
}

.stat--accent { border-left-color: var(--cyan); }
.stat--accent .stat__value { color: var(--cyan); }
.stat--warn { border-left-color: var(--orange); }
.stat--warn .stat__value { color: var(--orange); }

.data-grid {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--fence);
  border: 1px solid var(--fence);
}

.data-grid > * { background: var(--deep); padding: 14px 16px; }

/* ---------- 10. 面包屑 ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  color: var(--mist);
}

.breadcrumb a {
  color: var(--mist);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}

.breadcrumb a:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

.breadcrumb li { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb li::after { content: "/"; color: var(--fence); }
.breadcrumb li:last-child::after { content: none; }
.breadcrumb li:last-child { color: var(--ice); }

/* ---------- 11. 图片容器（页面阶段放图用） ---------- */
.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  border: 1px solid var(--fence);
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(116deg, rgba(7, 27, 46, 0) 34%, rgba(33, 230, 193, 0.2) 62%, rgba(7, 27, 46, 0) 88%),
    linear-gradient(180deg, rgba(7, 27, 46, 0.1) 0%, rgba(4, 18, 31, 0.72) 100%);
}

.media-frame img,
.media-frame__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.05) brightness(0.86);
}

.media-frame--wide { aspect-ratio: 16 / 9; }
.media-frame--portrait { aspect-ratio: 3 / 4; }
.media-frame--square { aspect-ratio: 1 / 1; }

.media-frame--cut {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), 0 100%);
}

/* ---------- 12. 章节索引（由 JS 生成） ---------- */
.chapter-index {
  display: none;
  position: fixed;
  right: 18px;
  top: 50%;
  z-index: 50;
  width: 188px;
  transform: translateY(-50%);
  padding: 12px 0;
  background: linear-gradient(90deg, rgba(4, 18, 31, 0), rgba(4, 18, 31, 0.78));
  border-right: 1px solid var(--fence);
}

.chapter-index.is-ready { display: none; }

.chapter-index__title {
  max-width: none;
  padding: 0 12px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--mist);
}

.chapter-index__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-index__link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  font-size: var(--fs-xs);
  color: var(--mist);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.chapter-index__link:hover { color: var(--ice); background: rgba(33, 230, 193, 0.07); }

.chapter-index__link[aria-current="true"] {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(33, 230, 193, 0.1);
}

.chapter-index__num {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.chapter-index__text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (min-width: 1180px) {
  .chapter-index.is-ready { display: block; }
}

/* ---------- 13. 页脚 ---------- */
.site-footer {
  background: var(--well);
  border-top: 1px solid var(--fence);
}

.site-footer::before {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--orange) 52%, var(--yellow) 74%, transparent 100%);
}

.footer__inner { padding-block: clamp(40px, 6vw, 72px) 0; }

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 0.9fr 0.8fr 1.3fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.footer__brand { min-width: 0; }

.brand--footer { display: block; text-align: left; }

.brand--footer .brand__name {
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  letter-spacing: 0.14em;
  text-indent: 0;
}

.brand--footer .brand__name::after {
  left: 0;
  transform: none;
  width: 64px;
  max-width: 64px;
}

.brand--footer .brand__sub { letter-spacing: 0.16em; }

.footer__note {
  margin-top: 18px;
  max-width: 26em;
  font-size: var(--fs-sm);
  line-height: 1.8;
  color: var(--mist);
}

.footer__col { min-width: 0; }

.footer__title {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--cyan);
}

.footer__list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: var(--fs-sm);
}

.footer__list a {
  color: var(--mist);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}

.footer__list a:hover { color: var(--ice); border-bottom-color: var(--cyan); }

.footer__list--plain li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 4px 10px;
  align-items: baseline;
  color: var(--ice);
  line-height: 1.65;
}

.footer__key {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--mist);
}

.footer__val { word-break: break-word; }

.footer__list--plain .copy-btn { grid-column: 2; justify-self: start; }

.copy-btn {
  margin-top: 2px;
  padding: 4px 10px;
  border: 1px solid var(--fence);
  border-radius: 0;
  background: rgba(22, 56, 79, 0.6);
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); background: rgba(33, 230, 193, 0.1); }

.copy-btn.is-copied { color: var(--green); border-color: rgba(47, 191, 113, 0.55); background: rgba(47, 191, 113, 0.12); }

.footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 28px;
  margin-top: clamp(28px, 4vw, 44px);
  padding-block: 18px 26px;
  border-top: 1px solid rgba(22, 56, 79, 0.9);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mist);
}

.footer__base p { max-width: none; }
.footer__legal { color: var(--mist); }
.footer__version { color: rgba(126, 151, 168, 0.85); }
.footer__signoff { color: rgba(234, 244, 247, 0.6); }

/* ---------- 14. 响应式 ---------- */
@media (max-width: 1080px) {
  .footer__grid { grid-template-columns: repeat(3, 1fr); }
  .footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .masthead {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "toggle brand right";
    gap: 10px;
    padding: 10px var(--gutter);
  }

  .nav-toggle { display: inline-flex; }
  .masthead__side--left { display: none; }
  .masthead__side--right { justify-self: end; }

  .brand__name { font-size: clamp(1.15rem, 4.6vw, 1.5rem); letter-spacing: 0.12em; text-indent: 0.12em; }
  .brand__sub { display: none; }

  .primary-nav {
    display: none;
    background: var(--well);
    border-top: 1px solid var(--fence);
  }

  .primary-nav[data-open] { display: block; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    padding: 6px var(--gutter) 14px;
  }

  .nav-list a {
    padding: 13px 4px;
    font-size: var(--fs-base);
    border-bottom: 1px solid rgba(22, 56, 79, 0.85);
    border-left: 2px solid transparent;
  }

  .nav-list a[aria-current="page"] {
    border-bottom-color: rgba(22, 56, 79, 0.85);
    border-left-color: var(--cyan);
    background: rgba(33, 230, 193, 0.09);
  }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .footer__grid { grid-template-columns: repeat(2, 1fr); row-gap: 30px; }
}

@media (max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
  .footer__base { flex-direction: column; align-items: flex-start; }
  .brand__name { font-size: 1.1rem; letter-spacing: 0.08em; text-indent: 0.08em; }
  .nav-toggle__label { display: none; }
}

/* ---------- 15. 减少动效 ---------- */
@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;
  }

  .read-progress { transition: none; }
}
