/* Guide page styles
 *
 * 内容轴模型（全站）：
 * - 正文列按 --guide-main-max 水平居中（与无 TOC 页一致）
 * - 左侧 TOC 停在正文左侧空白，不挤占、不带动正文偏轴
 * - 顶栏始终跟全站 --wide，不跟正文列收窄（风格统一）
 */

/* 默认与分档：变量挂在 body，供 main 共用 */
body:has(main.layout--guide-nav) {
  --guide-nav-gap: 1.5rem;
  --guide-main-max: var(--content-guide);
}

body:has(main.layout--guide-nav[data-content-max="standard"]) {
  --guide-main-max: var(--content-standard);
}

body:has(main.layout--guide-nav[data-content-max="table"]) {
  --guide-main-max: var(--content-table);
}

body:has(main.layout--guide-nav[data-content-max="wide"]) {
  --guide-main-max: var(--wide);
}

/* 主栏全宽，真正居中交给中间列 */
.layout--guide-nav {
  max-width: none;
  width: 100%;
  margin-inline: 0;
  padding-top: var(--page-pad-y);
  padding-bottom: var(--page-pad-bottom);
  padding-left: var(--page-pad-x);
  padding-right: var(--page-pad-x-end);
}

.guide-nav-shell,
.quest-chain-shell.has-gutter,
.article-shell.has-gutter {
  position: relative;
  width: 100%;
}

.layout--guide-nav .guide-main,
.quest-chain-shell__main,
.article-shell__main {
  min-width: 0;
  width: 100%;
  max-width: min(100%, var(--guide-main-max));
  margin-inline: auto;
}

/* 宽屏：三列 1fr | 正文 | 1fr，TOC 落在左轨右缘 */
@media (min-width: 901px) {
  .guide-nav-shell:has(> .flow-nav:not([hidden]):not(.is-inline)),
  .quest-chain-shell.has-gutter,
  .article-shell.has-gutter {
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, var(--guide-main-max))
      minmax(0, 1fr);
    align-items: start;
    column-gap: 0;
  }

  .guide-nav-shell:has(> .flow-nav:not([hidden]):not(.is-inline)) > .flow-nav,
  .quest-chain-shell.has-gutter > .flow-nav,
  .article-shell.has-gutter > .flow-nav {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    width: min(100%, var(--content-guide-nav));
    margin-right: var(--guide-nav-gap);
  }

  .guide-nav-shell:has(> .flow-nav:not([hidden]):not(.is-inline)) > .guide-main,
  .quest-chain-shell.has-gutter > .quest-chain-shell__main,
  .article-shell.has-gutter > .article-shell__main {
    grid-column: 2;
    grid-row: 1;
    max-width: none;
    margin-inline: 0;
  }
}

/* 开地图只切分 .quest-detail-shell 内部，不改外层 1fr|正文|1fr 与 TOC */

.flow-nav {
  position: sticky;
  top: var(--gutter-sticky-top, 1rem);
  align-self: start;
  z-index: 30;
  box-sizing: border-box;
  width: 100%;
  max-height: calc(100vh - var(--gutter-sticky-top, 1rem) - 1rem);
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-mid) 100%);
  box-shadow: var(--shadow);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.flow-nav::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.flow-nav.is-inline {
  position: static;
  max-height: 16rem;
  margin: 0 0 1rem;
}


/* 长文/更新共用：来源条 */
.guide-source-bar {
  display: flex;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(51, 255, 167, 0.18);
  border-radius: var(--radius-control);
  background: rgba(51, 255, 167, 0.07);
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-source-bar:hover {
  background: rgba(51, 255, 167, 0.1);
  color: var(--accent-strong);
}

.flow-nav a {
  text-decoration: none;
}

.flow-nav ol {
  display: grid;
  gap: 0.32rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-nav li {
  margin: 0;
}

.flow-nav li a {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-height: 0;
  padding: 0.42rem 0.62rem 0.42rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.flow-nav li a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42rem;
  bottom: 0.42rem;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), rgba(51, 255, 167, 0.18));
  opacity: 0.9;
}

.flow-nav li a:hover,
.flow-nav li a:focus-visible {
  background: rgba(51, 255, 167, 0.08);
  border-color: rgba(51, 255, 167, 0.24);
  color: var(--accent);
}

.flow-nav span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 1.75rem;
  height: 1.45rem;
  margin-top: 0.02rem;
  padding: 0 0.38rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.flow-nav a:hover span,
.flow-nav a:focus-visible span {
  border-color: rgba(51, 255, 167, 0.34);
  background: #1f3d32;
  color: var(--accent);
}

.flow-nav__title {
  margin: 0 0 0.65rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flow-nav a.is-active,
.flow-nav a[aria-current="location"] {
  background: rgba(51, 255, 167, 0.1);
  border-color: rgba(51, 255, 167, 0.28);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.flow-nav a.is-active span,
.flow-nav a[aria-current="location"] span {
  border-color: rgba(51, 255, 167, 0.38);
  background: #1f3d32;
  color: var(--accent);
}

.guide-main {
  min-width: 0;
  width: 100%;
}

.guide-main > .village-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.faq-item__media {
  margin: 0.75rem 0 0;
}

.faq-item__media .lightbox-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.faq-item__media .lightbox-trigger:hover,
.faq-item__media .lightbox-trigger:focus-visible {
  border-color: rgba(51, 255, 167, 0.3);
  box-shadow: 0 0 0 1px rgba(51, 255, 167, 0.14);
}

.faq-item__media img {
  display: block;
  width: 100%;
  height: auto;
}

.process-card {
  margin-bottom: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  box-shadow: none;
  overflow: hidden;
  scroll-margin-top: 1rem;
}

.process-card__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.05rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.process-card__step {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(51, 255, 167, 0.28);
  background: #1f3d32;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.process-card h2 {
  margin: 0;
  font-size: var(--text-h2);
  line-height: 1.35;
}

.process-card .eyebrow {
  margin-bottom: 0.12rem;
}

.process-card__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 1.05rem 1.1rem;
}

/* 手写 guide 页 TOC：无标题时也保持与链页一致的内边距节奏 */
.layout--guide-nav .flow-nav > nav:first-child {
  margin-top: 0.15rem;
}

.copy-block p {
  margin: 0;
}

.copy-block p + p,
.copy-block .account-flow + p {
  margin-top: 0.85rem;
}

.account-flow {
  margin: 0.95rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.8rem;
}

.account-flow li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(13rem, 0.8fr) minmax(18rem, 1.2fr);
  gap: 0.85rem;
  align-items: start;
  min-width: 0;
  padding: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.account-flow li::before {
  content: "";
  position: absolute;
  left: 0.82rem;
  top: 0.82rem;
  bottom: 0.82rem;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), rgba(51, 255, 167, 0.12));
}

.account-flow__copy {
  min-width: 0;
  padding-left: 1.15rem;
}

.account-flow h3 {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin: 0 0 0.28rem;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.35;
}

.account-flow h3::before {
  content: "";
  flex: 0 0 auto;
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(51, 255, 167, 0.08);
}

.account-flow p {
  color: var(--text-muted);
}

.account-flow .account-flow__notice {
  display: block;
  border: 0;
  border-left: 4px solid var(--accent);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-table);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.92rem;
  line-height: 1.6;
}

.account-flow .account-flow__notice::before {
  content: none;
}

.account-flow li.account-flow__notice p,
.account-flow li.account-flow__notice strong {
  margin: 0;
  color: var(--accent-strong);
}

.account-flow .account-flow__notice--warning {
  border-left-color: #ff8a5c;
  background: rgba(255, 138, 92, 0.12);
  color: #ffd9c9;
}

.account-flow li.account-flow__notice--warning p,
.account-flow li.account-flow__notice--warning strong {
  color: #ffe3d6;
}

.account-flow__media {
  min-width: 0;
  margin: 0;
}

.account-flow__media .lightbox-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.account-flow__media .lightbox-trigger:hover {
  border-color: rgba(51, 255, 167, 0.24);
  box-shadow: 0 0 0 1px rgba(51, 255, 167, 0.18), 0 10px 26px rgba(0, 0, 0, 0.22);
}

.account-flow__media img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}

.account-flow__media--pair {
  display: grid;
  gap: 0.55rem;
}

.risk-note--info {
  border-left-color: rgba(51, 255, 167, 0.72);
  background: rgba(51, 255, 167, 0.08);
}

.risk-note {
  padding: 0.65rem 0.75rem;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-table);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.92rem;
  line-height: 1.6;
}

.risk-note--warning {
  border-left-color: #ff8a5c;
  background: rgba(255, 138, 92, 0.12);
  color: #ffd9c9;
}

.risk-note--warning strong {
  color: #ffe3d6;
}

.benefit-sheet {
  margin-top: 0.85rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.benefit-sheet h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.benefit-sheet p {
  color: var(--text-muted);
}

.benefit-sheet ul {
  margin: 0.7rem 0;
  padding-left: 1.1rem;
}

.benefit-sheet li + li {
  margin-top: 0.45rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(8, 8, 8, 0.82);
  cursor: pointer;
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1200px);
  max-height: min(92vh, 900px);
  line-height: 0;
  touch-action: none;
}

.lightbox__img {
  display: block;
  max-width: min(96vw, 1200px);
  max-height: min(88vh, 860px);
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center;
  transition: transform 120ms ease-out;
  border-radius: var(--radius-control);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.lightbox__nav,
.lightbox__close {
  position: absolute;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(33, 33, 33, 0.75);
  color: #f8fafc;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.lightbox__close {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6rem;
}

.lightbox__nav--prev {
  left: 0.35rem;
}

.lightbox__nav--next {
  right: 0.35rem;
}

.lightbox__nav:hover,
.lightbox__close:hover {
  background: rgba(33, 33, 33, 0.92);
}

.lightbox__nav:focus-visible,
.lightbox__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .guide-nav-shell,
  .quest-chain-shell.has-gutter,
  .article-shell.has-gutter {
    display: block;
  }

  .guide-nav-shell > .flow-nav,
  .quest-chain-shell.has-gutter > .flow-nav,
  .article-shell.has-gutter > .flow-nav,
  .flow-nav.is-inline {
    position: static;
    width: auto;
    max-height: 16rem;
    margin: 0 0 1rem;
    justify-self: stretch;
  }

  .layout--guide-nav .guide-main,
  .quest-chain-shell__main,
  .article-shell__main {
    max-width: min(100%, var(--guide-main-max));
    margin-inline: auto;
  }

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

@media (max-width: 620px) {
  .process-card__head,
  .process-card__body {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .account-flow li {
    grid-template-columns: 1fr;
  }

  .lightbox__nav {
    width: 2rem;
    height: 2rem;
  }
}
