/* 双穴拯救世界 · 非对称卡片 · 左轨导航 */
:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --mist: #f5f5f5;
  --line: #e3e3e3;
  --mute: #8b8b8b;
  --tick: 36px;
  --rail: 232px;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 20px 44px rgba(0, 0, 0, 0.07);
  --shadow-hi: 0 8px 12px rgba(0, 0, 0, 0.07), 0 28px 60px rgba(0, 0, 0, 0.1);
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding-top: var(--tick);
  background: var(--mist);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.78;
  font-weight: 400;
  letter-spacing: 0.01em;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

p {
  margin: 0 0 1.05em;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

/* 顶部细条 */
.ticker {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--tick);
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  z-index: 60;
}

.ticker-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.42em;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* 左轨导航：移动端为顶部横条 */
.rail {
  position: fixed;
  top: var(--tick);
  left: 0;
  right: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.mark,
.side-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink);
  background: var(--paper);
  overflow: hidden;
  transition: background 0.2s ease, color 0.2s ease;
}

.mark-img,
.side-mark-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mark-txt,
.side-mark-txt {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
}

.mark:hover,
.side-mark:hover {
  background: var(--ink);
  color: var(--paper);
}

.nav {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav-list {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  border-color: var(--ink);
  background: var(--mist);
}

/* 主体 */
main {
  padding-top: 62px;
}

.wrap {
  display: block;
}

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: calc(100svh - var(--tick) - 62px);
  padding: 40px 20px 44px;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  isolation: isolate;
}

.hero-plain {
  background: linear-gradient(160deg, #1f1f1f 0%, #3a3a3a 55%, #1f1f1f 100%);
}

.hero-img {
  position: absolute;
  top: -8%;
  left: 0;
  width: 100%;
  height: 116%;
  object-fit: cover;
  object-position: center;
  z-index: -2;
  will-change: transform;
}

.hero-grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(31, 31, 31, 0.12) 0%,
    rgba(31, 31, 31, 0.52) 52%,
    rgba(31, 31, 31, 0.9) 100%
  );
}

.hero-copy {
  max-width: 62ch;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 8.2vw, 62px);
  line-height: 1.24;
  letter-spacing: 0.02em;
}

.hero-desc {
  margin: 0;
  max-width: 46ch;
  font-size: 16px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.87);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 正文 + 侧栏 */
.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 20px 16px 36px;
}

.prose {
  min-width: 0;
  overflow-wrap: break-word;
}

.prose > section {
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 22px 18px 8px;
  margin: 0 0 16px;
  scroll-margin-top: 130px;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.prose > section:hover {
  box-shadow: var(--shadow-hi);
  transform: translateY(-2px);
}

.prose h2 {
  margin: 0 0 0.12em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 4.4vw, 31px);
  line-height: 1.36;
  letter-spacing: 0.01em;
}

.prose h3 {
  margin: 1.7em 0 0.45em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(18px, 3vw, 21px);
  line-height: 1.5;
}

.prose hr {
  width: 66px;
  height: 2px;
  margin: 14px 0 22px;
  border: 0;
  background: var(--ink);
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.prose a:hover {
  background: var(--mist);
}

.prose ul,
.prose ol {
  margin: 0 0 1.1em;
  padding-left: 1.35em;
}

.prose li {
  margin: 0.35em 0;
}

.prose blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--ink);
  color: #4a4a4a;
}

.prose figure {
  margin: 1.4em 0;
}

.prose figcaption {
  font-size: 14px;
  color: var(--mute);
  margin-top: 8px;
}

.prose img {
  width: 100%;
  box-shadow: var(--shadow);
}

.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 16px;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.prose pre {
  overflow-x: auto;
  padding: 14px;
  background: var(--mist);
  border-left: 2px solid var(--ink);
  font-size: 15px;
}

/* 侧栏 */
.side {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}

.tile {
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}

.tile h2 {
  margin: 0 0 0.1em;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.tile hr {
  width: 34px;
  height: 2px;
  margin: 10px 0 12px;
  border: 0;
  background: var(--ink);
}

.toc {
  counter-reset: toc;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.4;
  border-bottom: 1px solid var(--line);
  transition: color 0.18s ease, padding-left 0.18s ease;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--mute);
}

.toc li:last-child a {
  border-bottom: 0;
}

.toc a:hover {
  padding-left: 4px;
  color: #000;
}

.tile-brand {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.side-brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.08em;
}

/* 页脚 */
.foot {
  background: var(--paper);
  border-top: 1px solid var(--ink);
  padding: 28px 16px 18px;
  display: grid;
  gap: 22px;
}

.foot-brand {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 380px;
}

.sub input {
  flex: 1 1 150px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 16px;
  border-radius: 0;
  color: var(--ink);
}

.sub button {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.sub button:hover {
  background: var(--paper);
  color: var(--ink);
}

.foot-b h2 {
  margin: 0 0 0.1em;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.foot-b hr {
  width: 34px;
  height: 2px;
  margin: 10px 0 12px;
  border: 0;
  background: var(--ink);
}

.foot-list {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 16px;
}

.foot-list a {
  display: block;
  padding: 9px 0;
  min-height: 40px;
  font-size: 15px;
  line-height: 1.4;
}

.foot-list a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.foot-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: #5c5c5c;
}

.copy {
  margin: 0;
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 4px;
  font-size: 14px;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--ink);
}

/* 桌面 */
@media (min-width: 720px) {
  .body {
    padding: 26px 24px 44px;
  }

  .prose > section {
    padding: 30px 28px 10px;
    margin-bottom: 20px;
  }

  .foot {
    grid-template-columns: 1.15fr 1fr;
    padding: 34px 24px 20px;
  }

  .foot-base {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1000px) {
  body {
    padding-left: var(--rail);
  }

  .rail {
    top: var(--tick);
    right: auto;
    bottom: 0;
    width: var(--rail);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 20px 0 18px;
    border-bottom: 0;
    border-right: 1px solid var(--ink);
    overflow-y: auto;
  }

  .mark {
    width: 54px;
    height: 54px;
    margin: 0 20px 22px;
  }

  .nav {
    overflow: visible;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
  }

  .nav-list a {
    padding: 11px 20px;
    min-height: 46px;
    font-size: 16px;
    white-space: normal;
    border: 0;
    border-left: 3px solid transparent;
    transition: border-color 0.2s ease, background 0.2s ease;
  }

  .nav-list a:hover,
  .nav-list a:focus-visible {
    border-left-color: var(--ink);
    background: var(--mist);
  }

  main {
    padding-top: 0;
  }

  .hero {
    min-height: calc(100svh - var(--tick));
    padding: 56px 56px 64px;
  }

  .body {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 26px;
    padding: 32px 56px 56px;
  }

  .prose > section {
    padding: 40px 38px 12px;
    margin-bottom: 24px;
    scroll-margin-top: 60px;
  }

  .side {
    position: sticky;
    top: calc(var(--tick) + 24px);
  }

  .foot {
    padding: 44px 56px 22px;
  }

  .foot-brand {
    font-size: 26px;
  }
}

@media (min-width: 1320px) {
  .body {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .wrap {
    max-width: 1360px;
    margin: 0 auto;
  }
}

/* 动效降级 */
@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;
  }

  .hero-img {
    transform: none !important;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
