/* ==========================================================================
   百博赛场 · 共享样式 /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 {
  margin: 0;
}

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

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

a { color: inherit; }

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

table {
  border-collapse: collapse;
  width: 100%;
}

/* ---------- 2. Tokens ---------- */
:root {
  --pitch-900: #08150F;
  --pitch-800: #0F2B22;
  --fence-600: #1C4A38;
  --paper: #F4EFE3;
  --paper-white: #FBFAF6;
  --orange: #FF6A1E;
  --blue: #3C7DFF;
  --yellow: #FFD24A;
  --chalk: #A8B3AC;
  --red: #D9453D;

  --rail-w: 88px;
  --topbar-h: 60px;

  --gap: clamp(16px, 2.4vw, 28px);
  --space-section: clamp(64px, 9vw, 96px);
  --shadow-hard: 8px 8px 0 rgba(8, 21, 15, 0.62);
  --shadow-lift: 14px 14px 0 rgba(8, 21, 15, 0.55);
  --ease-flip: cubic-bezier(.22, .9, .24, 1);

  --font-display: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-body: "Noto Sans SC", "Source Han Sans SC", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ---------- 3. Base ---------- */
body {
  min-height: 100vh;
  padding-left: var(--rail-w);
  padding-top: var(--topbar-h);
  background-color: var(--pitch-900);
  background-image: radial-gradient(circle at 1px 1px, rgba(244, 239, 227, 0.055) 1px, transparent 1.7px);
  background-size: 4px 4px;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#main-content { display: block; }

::selection {
  background: var(--orange);
  color: #0B1A13;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.005em;
  color: var(--paper);
}

h1 { font-size: clamp(28px, 4.4vw, 44px); }
h2 { font-size: clamp(22px, 2.8vw, 32px); }
h3 { font-size: clamp(18px, 2vw, 24px); }
h4 { font-size: 20px; }

p { line-height: 1.75; }

a { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

/* ---------- 4. Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

.editorial {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.lede {
  max-width: 62ch;
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.75;
  color: var(--chalk);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--chalk);
}

.kicker::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  background: var(--orange);
}

.display-title {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--paper);
  transform: skewX(-6deg);
  transform-origin: left bottom;
  text-wrap: balance;
}

/* ---------- 5. Layout ---------- */
.container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 56px);
}

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

.section {
  position: relative;
  padding-block: var(--space-section);
}

.section--tight {
  padding-block: clamp(36px, 5vw, 56px);
}

.section--pitch {
  background: var(--pitch-800);
  border-block: 2px solid var(--fence-600);
}

.section--paper {
  background: var(--paper-white);
  color: var(--pitch-900);
  border-block: 2px solid var(--fence-600);
  background-image: radial-gradient(circle at 1px 1px, rgba(8, 21, 15, 0.08) 1px, transparent 1.7px);
  background-size: 4px 4px;
}

.section--paper h2,
.section--paper h3,
.section--paper h4 {
  color: var(--pitch-900);
}

.section--paper .lede {
  color: #2E4A3E;
}

.section--paper .kicker {
  color: #2E4A3E;
}

.section--paper .chapter__rule {
  background: rgba(8, 21, 15, 0.2);
}

.section--paper .chapter__number {
  color: rgba(8, 21, 15, 0.08);
  -webkit-text-stroke: 1.5px rgba(8, 21, 15, 0.42);
}

.chapter {
  display: flex;
  align-items: flex-end;
  gap: clamp(14px, 2vw, 24px);
  margin-bottom: clamp(28px, 4vw, 48px);
}

.chapter__number {
  flex: none;
  font-family: var(--font-mono);
  font-size: clamp(64px, 10vw, 160px);
  font-weight: 700;
  line-height: 0.76;
  letter-spacing: -0.03em;
  color: rgba(244, 239, 227, 0.09);
  -webkit-text-stroke: 1.5px rgba(244, 239, 227, 0.55);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.chapter__label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
  min-width: 0;
}

.chapter__rule {
  flex: 1 1 auto;
  height: 1px;
  min-width: 32px;
  margin-bottom: 10px;
  background: rgba(244, 239, 227, 0.22);
}

.grid {
  display: grid;
  gap: var(--gap);
}

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

.grid--offset > *:nth-child(even) {
  margin-top: clamp(24px, 4vw, 56px);
}

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 2px solid var(--fence-600);
  background: transparent;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform .18s var(--ease-flip), box-shadow .18s var(--ease-flip),
              background .18s ease, color .18s ease, border-color .18s ease;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 8px 8px 0 rgba(255, 106, 30, 0.32);
}

.btn--primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #0B1A13;
}

.btn--primary:hover {
  box-shadow: 8px 8px 0 rgba(255, 210, 74, 0.4);
}

.btn--ghost {
  background: transparent;
  border-color: rgba(244, 239, 227, 0.5);
  color: var(--paper);
}

.btn--ghost:hover {
  border-color: var(--yellow);
  box-shadow: 8px 8px 0 rgba(60, 125, 255, 0.28);
}

.btn--cut {
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.btn__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  opacity: 0.78;
}

/* ---------- 7. Tags ---------- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 9px;
  border: 1.5px solid var(--fence-600);
  background: transparent;
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.5;
}

.tag--orange { color: var(--orange); border-color: var(--orange); }
.tag--blue   { color: var(--blue);   border-color: var(--blue); }
.tag--yellow { color: var(--yellow); border-color: var(--yellow); }

/* ---------- 8. Cards ---------- */
.card {
  position: relative;
  padding: clamp(18px, 2.4vw, 24px);
  background: var(--pitch-800);
  border: 2px solid var(--fence-600);
  box-shadow: var(--shadow-hard);
  transition: transform .2s var(--ease-flip), box-shadow .2s var(--ease-flip), border-color .2s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lift);
  border-color: rgba(255, 106, 30, 0.65);
}

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

.card__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--paper);
}

.card__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card__body {
  color: var(--chalk);
  font-size: 15px;
}

/* ---------- 9. Media (图片容器基础规则) ---------- */
.media {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--pitch-800);
  border: 2px solid var(--fence-600);
}

.media__img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.04);
}

.media--slant {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 44px), calc(100% - 44px) 100%, 0 100%);
}

.media--tilt {
  transform: rotate(-2.5deg);
  box-shadow: var(--shadow-lift);
}

.media--empty {
  background-image: repeating-linear-gradient(135deg, var(--pitch-800) 0 12px, var(--pitch-900) 12px 24px);
}

.media--empty::after {
  content: "图片位";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--fence-600);
}

.media__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(8, 21, 15, 0.92), rgba(8, 21, 15, 0));
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--yellow);
}

.media__caption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--chalk);
}

/* ---------- 10. Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--chalk);
}

.breadcrumbs__link {
  color: var(--chalk);
  border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}

.breadcrumbs__link:hover {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}

.breadcrumbs__sep {
  color: var(--fence-600);
}

.breadcrumbs__current {
  color: var(--paper);
}

/* ---------- 11. Filter ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-btn {
  padding: 9px 15px;
  border: 1.5px solid var(--fence-600);
  background: transparent;
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.filter-btn:hover {
  color: var(--paper);
  border-color: var(--chalk);
}

.filter-btn[aria-pressed="true"] {
  color: var(--paper);
  border-color: var(--yellow);
  background: rgba(255, 210, 74, 0.1);
  box-shadow: inset 0 -3px 0 var(--yellow);
}

.is-filtered-out {
  display: none !important;
}

/* ---------- 12. Copy button ---------- */
.copy-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  padding: 10px 12px;
  border: 1.5px solid var(--fence-600);
  background: transparent;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}

.copy-btn:hover {
  border-color: var(--yellow);
  background: rgba(255, 210, 74, 0.07);
}

.copy-btn__text {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.copy-btn__hint {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--chalk);
  white-space: nowrap;
}

.copy-btn[data-copied="true"] {
  border-color: var(--yellow);
  background: rgba(255, 210, 74, 0.16);
}

.copy-btn[data-copied="true"] .copy-btn__hint {
  color: var(--yellow);
}

/* ---------- 13. Reading progress ---------- */
.reading-progress {
  position: fixed;
  top: var(--topbar-h);
  left: var(--rail-w);
  right: 0;
  height: 2px;
  z-index: 120;
  pointer-events: none;
  background: rgba(255, 106, 30, 0.12);
}

.reading-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- 14. Header / frame ---------- */
.site-header {
  position: relative;
  z-index: 95;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: calc(var(--rail-w) + 12px);
  z-index: 200;
  padding: 10px 18px;
  background: var(--yellow);
  color: #0B1A13;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  border: 2px solid #0B1A13;
  transform: translateY(-220%);
  transition: transform .2s var(--ease-flip);
}

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

/* 顶部赛场状态条 */
.status-bar {
  position: fixed;
  top: 0;
  left: var(--rail-w);
  right: 0;
  height: var(--topbar-h);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
  padding-inline: clamp(14px, 2.4vw, 26px);
  background: rgba(15, 43, 34, 0.94);
  border-bottom: 2px solid var(--fence-600);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}

.status-bar__chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--paper);
  white-space: nowrap;
}

.status-bar__dot {
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 30, 0.18);
  animation: status-pulse 2.6s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 106, 30, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 106, 30, 0.05); }
}

.status-bar__note {
  position: relative;
  padding-left: clamp(12px, 2vw, 22px);
  color: var(--chalk);
  white-space: nowrap;
}

.status-bar__note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 14px;
  transform: translateY(-50%);
  background: var(--fence-600);
}

.status-bar__spacer {
  flex: 1 1 auto;
}

.status-bar__link {
  color: var(--yellow);
  border-bottom: 1px solid transparent;
  white-space: nowrap;
  transition: border-color .16s ease, color .16s ease;
}

.status-bar__link:hover {
  color: var(--paper);
  border-bottom-color: var(--yellow);
}

/* 左侧装订边 */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 12px;
  background: var(--pitch-800);
  border-right: 2px solid var(--fence-600);
}

.rail__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 6px 14px;
  border-bottom: 2px solid var(--fence-600);
  text-align: center;
}

.rail__brand-cn {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.26em;
  color: var(--paper);
  transition: color .18s ease;
}

.rail__brand:hover .rail__brand-cn {
  color: var(--yellow);
}

.rail__brand-en {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--orange);
}

.rail__list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding: 0 8px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.rail__item {
  display: block;
}

.rail__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 4px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 13.5px;
  letter-spacing: 0.22em;
  color: var(--chalk);
  background: transparent;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: background .2s ease, color .2s ease, clip-path .2s var(--ease-flip);
}

.rail__link:hover,
.rail__link:focus-visible {
  background: var(--fence-600);
  color: var(--paper);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.rail__link[aria-current="page"] {
  background: rgba(255, 106, 30, 0.14);
  color: var(--paper);
  font-weight: 700;
}

.rail__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background: var(--orange);
}

.rail__foot {
  margin: 10px auto 0;
  padding-top: 10px;
  border-top: 1px solid var(--fence-600);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--chalk);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* 移动端抽屉 */
.nav-toggle {
  display: none;
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 96;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--pitch-900);
  border: 2px solid var(--fence-600);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: border-color .18s ease, background .18s ease;
}

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

.nav-toggle__label {
  line-height: 1;
}

.nav-toggle__bar {
  width: 14px;
  height: 2px;
  background: var(--orange);
}

.site-header[data-open="true"] .nav-toggle {
  border-color: var(--orange);
  background: var(--fence-600);
}

.rail__scrim {
  display: none;
}

/* ---------- 15. Footer ---------- */
.site-footer {
  margin-top: clamp(56px, 8vw, 96px);
  background: var(--pitch-800);
  border-top: 2px solid var(--fence-600);
  color: var(--chalk);
}

.footer-inner {
  max-width: 1400px;
  margin-inline: auto;
  padding: clamp(40px, 6vw, 64px) clamp(18px, 4vw, 56px) 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1.5fr;
  gap: clamp(24px, 3vw, 44px);
  align-items: start;
}

.footer-brand__name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(24px, 2.6vw, 30px);
  letter-spacing: 0.1em;
  color: var(--paper);
}

.footer-brand__tag {
  margin-top: 12px;
  max-width: 24ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--chalk);
}

.footer-brand__badge {
  display: inline-block;
  margin-top: 16px;
  padding: 5px 10px;
  border: 1.5px solid var(--fence-600);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--orange);
}

.footer-col__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--fence-600);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
}

.footer-col__title::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--orange);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.footer-item {
  display: block;
  font-size: 14px;
}

.footer-link {
  display: inline-block;
  color: var(--chalk);
  border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}

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

.footer-contact__label {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--fence-600);
}

.footer-contact__label:first-of-type {
  margin-top: 0;
}

.footer-contact__value {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--chalk);
  max-width: 30ch;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: clamp(32px, 4vw, 52px);
  padding-block: 18px 22px;
  border-top: 1px dashed var(--fence-600);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--chalk);
}

.footer-bottom__meta {
  font-variant-numeric: tabular-nums;
}

.footer-note {
  color: var(--fence-600);
}

.footer-season {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-legal {
  display: inline-block;
}

.footer-legal__link {
  color: var(--chalk);
  border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}

.footer-legal__link:hover {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}

/* ---------- 16. Reveal ---------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .32s var(--ease-flip), transform .32s var(--ease-flip);
}

html.js [data-reveal="in"] {
  opacity: 1;
  transform: none;
}

/* ---------- 17. Responsive ---------- */
@media (max-width: 1180px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --rail-w: 0px;
    --topbar-h: 56px;
  }

  body {
    padding-left: 0;
    padding-top: var(--topbar-h);
  }

  .status-bar {
    display: none;
  }

  .skip-link {
    left: 12px;
  }

  .rail {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: var(--topbar-h);
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0 96px 0 14px;
    border-right: 0;
    border-bottom: 2px solid var(--fence-600);
  }

  .rail__brand {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 0;
    border-bottom: 0;
    text-align: left;
  }

  .rail__brand-cn {
    writing-mode: horizontal-tb;
    font-size: 18px;
    letter-spacing: 0.14em;
  }

  .rail__brand-en {
    font-size: 10px;
  }

  .rail__foot {
    display: none;
  }

  .rail__list {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 99;
    flex: none;
    max-height: 78vh;
    margin: 0;
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
    gap: 8px;
    overflow-y: auto;
    background: var(--pitch-800);
    border-top: 2px solid var(--orange);
    box-shadow: 0 -14px 0 rgba(8, 21, 15, 0.4);
    transform: translateY(110%);
    visibility: hidden;
    transition: transform .32s var(--ease-flip), visibility .32s var(--ease-flip);
  }

  .site-header[data-open="true"] .rail__list {
    transform: translateY(0);
    visibility: visible;
  }

  .rail__link {
    writing-mode: horizontal-tb;
    justify-content: space-between;
    padding: 16px 18px;
    font-size: 16px;
    letter-spacing: 0.1em;
    color: var(--paper);
    background: var(--pitch-900);
    border: 1.5px solid var(--fence-600);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  }

  .rail__link:hover,
  .rail__link:focus-visible {
    clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
  }

  .rail__link[aria-current="page"]::after {
    right: auto;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
  }

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

  .rail__scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(8, 21, 15, 0.74);
    opacity: 0;
    pointer-events: none;
    transition: opacity .26s ease;
  }

  .site-header[data-open="true"] .rail__scrim {
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .reading-progress {
    left: 0;
  }

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

  .grid--offset > *:nth-child(even) {
    margin-top: 0;
  }

  .chapter {
    align-items: center;
  }

  .display-title {
    transform: skewX(-4deg);
  }
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .copy-btn {
    max-width: 100%;
  }

  .chapter__number {
    font-size: clamp(56px, 16vw, 92px);
  }
}

/* ---------- 18. 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;
  }

  html.js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .btn:hover,
  .card:hover {
    transform: none;
  }

  .rail__list {
    transition: none;
  }

  .media--tilt {
    transform: none;
  }
}
