/* ========== Left rail ========== */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  background: var(--bg-rail);
  border-right: 1px solid var(--line);
}

.rail__brand {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.35em;
  color: var(--paper);
}

.rail__dots {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  padding: 0.35rem 0;
}

.rail__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--paper-dim);
  background: transparent;
  transition: background 0.25s, transform 0.25s, border-color 0.25s;
}

.rail__dot.is-active,
.rail__dot:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.25);
}

.rail__cta {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rail-cta-fg);
  background: var(--rail-cta-bg);
  padding: 0.85rem 0.35rem;
  border-radius: 999px;
  font-weight: 700;
}

.rail__cta:hover {
  color: var(--rail-cta-fg);
  background: var(--rail-cta-hover);
}

@media (max-width: 900px) {
  .rail {
    display: none;
  }
}

/* ========== Mobile top bar ========== */
.topbar {
  display: none;
  position: fixed;
  inset: 0 0 auto;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  z-index: 120;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: env(safe-area-inset-top, 0px) max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar__brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  min-width: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar__toggle {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.topbar__toggle span {
  display: block;
  width: 1.1rem;
  height: 1.5px;
  background: var(--paper);
  position: relative;
}

.topbar__toggle span::before,
.topbar__toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  background: inherit;
}

.topbar__toggle span::before {
  top: -5px;
}

.topbar__toggle span::after {
  top: 5px;
}

.mobile-nav {
  display: none;
  position: fixed;
  inset: calc(var(--header-h) + env(safe-area-inset-top, 0px)) 0 0;
  z-index: 110;
  background: var(--mobile-nav-bg);
  padding: 1.5rem max(var(--gutter), env(safe-area-inset-right, 0px)) 2rem max(var(--gutter), env(safe-area-inset-left, 0px));
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav.is-open {
  display: flex;
}

.mobile-nav a {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

@media (max-width: 900px) {
  .topbar {
    display: flex;
  }
}

/* ========== Desktop floating nav ========== */
.float-nav {
  position: fixed;
  top: 1.25rem;
  right: var(--gutter);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  background: var(--float-nav-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(14px);
}

.float-nav a {
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}

.float-nav a:hover,
.float-nav a.is-active {
  color: var(--paper);
  background: var(--accent-soft);
}

.float-nav .btn {
  margin-left: 0.25rem;
  min-height: 2.2rem;
  padding: 0.4rem 0.95rem;
  font-size: 0.75rem;
}

.float-nav a.btn--primary,
.float-nav a.btn--primary:hover,
.float-nav a.btn--primary:focus,
.float-nav a.btn--primary.is-active {
  color: var(--btn-primary-fg);
  background: var(--btn-primary-bg);
}

.float-nav a.btn--primary:hover {
  background: var(--btn-primary-hover);
  color: var(--btn-primary-fg);
}

@media (max-width: 1100px) {
  .float-nav .nav-hide {
    display: none;
  }
}

@media (max-width: 900px) {
  .float-nav {
    display: none;
  }
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.9rem;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-weight: 700;
}

.btn--primary:hover {
  background: var(--btn-primary-hover);
  color: var(--btn-primary-fg);
  box-shadow: var(--btn-primary-shadow);
}

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--paper);
}

.btn--ghost:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ========== Theme toggle ========== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 2.5rem;
  height: 2.15rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.theme-toggle:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle__mark {
  font-family: var(--font-display);
}

.float-nav .theme-toggle {
  margin-right: 0.15rem;
}

.topbar .theme-toggle {
  margin: 0;
  min-width: 2.35rem;
  height: 2.35rem;
}

.rail__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.rail__theme {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  letter-spacing: 0.12em;
  font-size: 0.65rem;
  padding: 0.65rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-muted);
  background: transparent;
}

.rail__theme:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

/* ========== Footer colophon ========== */
.colophon {
  border-top: 1px solid var(--line);
  padding: 4rem 0 2.5rem;
  background: var(--bg-rail);
}

.colophon__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

.colophon__brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.colophon h4 {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.colophon a {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.28rem 0;
}

.colophon a:hover {
  color: var(--accent);
}

.colophon__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .colophon__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .colophon__grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Progress ========== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 200;
  background: linear-gradient(90deg, var(--accent), var(--copper));
  pointer-events: none;
}

@media (min-width: 901px) {
  .scroll-progress {
    left: var(--rail);
  }
}

/* ========== Forms / shared content ========== */
.form {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  gap: 0.4rem;
}

.form-row label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--accent-line);
}

.form-row textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.prose {
  font-size: 1.05rem;
  line-height: 1.85;
}

.prose h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  margin: 2.75rem 0 1rem;
  max-width: none;
  letter-spacing: var(--heading-tracking, -0.02em);
}

.prose h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
  max-width: none;
}

.prose p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.85;
  max-width: none;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.prose a:hover {
  color: var(--accent-hover);
}

.prose strong {
  color: var(--paper);
  font-weight: 600;
}

.prose ul,
.prose ol {
  margin: 0 0 1.5rem;
  padding-left: 1.35rem;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  color: var(--text-secondary);
  margin-bottom: 0.55rem;
  line-height: 1.75;
  padding-left: 0.25rem;
}

.prose blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}

.prose blockquote p {
  margin: 0;
  color: var(--paper);
  font-size: 1.05rem;
}

.prose figure {
  margin: 2rem 0;
}

.prose figcaption {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.75rem 0;
}

.prose code {
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* 自定义光标已关闭：不再隐藏系统鼠标 */
