/* 观星指南 · 样式表（纯 CSS，无外部依赖） */

/* ---------- 设计变量 ---------- */
:root {
  --bg: #05080f;
  --bg-soft: #0a1020;
  --card: #0e1628;
  --card-border: rgba(148, 178, 255, 0.12);
  --text: #cdd8ec;
  --heading: #f2f6ff;
  --muted: #93a4c4;
  --accent: #82b4ff;
  --gold: #ffd479;
  --radius: 14px;
  --header-h: 60px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 90% 55% at 70% -10%, rgba(48, 68, 130, 0.35), transparent),
    radial-gradient(ellipse 60% 45% at 15% 35%, rgba(72, 52, 120, 0.22), transparent),
    radial-gradient(ellipse 55% 40% at 85% 75%, rgba(30, 60, 110, 0.18), transparent),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.85;
  overflow-x: hidden;
}

::selection {
  background: rgba(130, 180, 255, 0.3);
}

h1, h2, h3 {
  color: var(--heading);
  line-height: 1.4;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--accent);
}

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- 星点背景（纯 CSS） ---------- */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.starfield::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  background: transparent;
}

.star-a::before {
  width: 2px;
  height: 2px;
  box-shadow:
    8vw 12vh #ffffff, 15vw 68vh #cfe0ff, 22vw 30vh #ffe9c4, 30vw 82vh #ffffff,
    37vw 18vh #dfe8ff, 44vw 55vh #ffffff, 52vw 8vh #cfe0ff, 58vw 74vh #ffffff,
    63vw 40vh #ffe9c4, 70vw 22vh #ffffff, 76vw 60vh #dfe8ff, 84vw 14vh #ffffff,
    90vw 48vh #cfe0ff, 95vw 80vh #ffffff, 5vw 88vh #dfe8ff, 18vw 44vh #ffffff,
    26vw 62vh #cfe0ff, 34vw 6vh #ffffff, 41vw 90vh #ffe9c4, 49vw 32vh #ffffff,
    55vw 86vh #dfe8ff, 66vw 70vh #ffffff, 73vw 88vh #cfe0ff, 80vw 36vh #ffffff,
    87vw 66vh #ffe9c4, 93vw 26vh #ffffff, 12vw 36vh #dfe8ff, 60vw 52vh #ffffff;
  animation: twinkle 6s ease-in-out infinite alternate;
}

.star-b::before {
  width: 1px;
  height: 1px;
  box-shadow:
    4vw 22vh #9fb4dd, 10vw 52vh #b9c8ea, 17vw 82vh #9fb4dd, 24vw 14vh #b9c8ea,
    28vw 46vh #9fb4dd, 33vw 70vh #b9c8ea, 39vw 38vh #9fb4dd, 43vw 8vh #b9c8ea,
    47vw 78vh #9fb4dd, 51vw 26vh #b9c8ea, 57vw 60vh #9fb4dd, 61vw 16vh #b9c8ea,
    65vw 84vh #9fb4dd, 69vw 44vh #b9c8ea, 74vw 6vh #9fb4dd, 78vw 78vh #b9c8ea,
    83vw 30vh #9fb4dd, 88vw 56vh #b9c8ea, 92vw 12vh #9fb4dd, 97vw 64vh #b9c8ea,
    2vw 62vh #9fb4dd, 13vw 26vh #b9c8ea, 20vw 92vh #9fb4dd, 36vw 56vh #b9c8ea,
    54vw 42vh #9fb4dd, 72vw 50vh #b9c8ea, 86vw 86vh #9fb4dd, 99vw 38vh #b9c8ea,
    7vw 40vh #9fb4dd, 31vw 26vh #b9c8ea, 45vw 66vh #9fb4dd, 67vw 28vh #b9c8ea,
    79vw 92vh #9fb4dd, 91vw 72vh #b9c8ea, 16vw 10vh #9fb4dd, 59vw 94vh #b9c8ea;
  animation: twinkle 9s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

/* ---------- 流星（hero 装饰） ---------- */
.meteor {
  position: absolute;
  top: 16%;
  left: 78%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.35);
  opacity: 0;
  animation: meteor-fall 9s linear infinite;
}

.meteor::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 110px;
  height: 1px;
  transform-origin: left center;
  transform: rotate(-45deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), transparent);
}

.meteor-2 {
  top: 30%;
  left: 60%;
  animation-delay: 4.5s;
  animation-duration: 11s;
}

@keyframes meteor-fall {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  3% { opacity: 1; }
  9% { transform: translate3d(-28vw, 22vh, 0); opacity: 0; }
  100% { transform: translate3d(-28vw, 22vh, 0); opacity: 0; }
}

/* ---------- 跳转链接（无障碍） ---------- */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 100;
  background: var(--accent);
  color: #0a1020;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0.8rem;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 50;
  background: rgba(5, 8, 15, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.brand {
  color: var(--heading);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-decoration: none;
}

.brand::before {
  content: "✦ ";
  color: var(--gold);
}

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

.nav-list a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-list a:hover {
  color: var(--heading);
}

.nav-list a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 9px;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- 主体层级 ---------- */
main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  text-align: center;
  padding: calc(var(--header-h) + 3rem) 0 4rem;
  overflow: hidden;
}

.hero .container {
  position: relative;
}

.hero-kicker {
  color: var(--gold);
  letter-spacing: 0.35em;
  font-size: 0.8rem;
  margin: 0 0 0.6rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4rem);
  letter-spacing: 0.08em;
  margin: 0.6rem 0 1rem;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 2;
}

.btn {
  display: inline-block;
  margin-top: 1.4rem;
  padding: 0.75rem 1.9rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--accent);
  color: #0a1020;
}

/* ---------- 章节 ---------- */
.section {
  padding: 3.5rem 0;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.section h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 1.2rem;
}

.sec-num {
  display: block;
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.25em;
  margin-bottom: 0.3rem;
}

.section h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.8rem;
}

.section h3::before {
  content: "✦ ";
  color: var(--accent);
  font-size: 0.85em;
}

.section strong {
  color: var(--heading);
}

/* ---------- 卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: rgba(148, 178, 255, 0.3);
  transform: translateY(-2px);
}

.card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.card h3::before {
  content: none;
}

.card p {
  margin: 0;
  font-size: 0.96rem;
}

.card .stage {
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  margin: 0 0 0.4rem;
}

/* ---------- 步骤列表 ---------- */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 1.5rem 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.9rem 1.1rem 0.9rem 3.4rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(130, 180, 255, 0.15);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- 北极星示意图 ---------- */
.polaris-figure {
  margin: 2rem 0;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.polaris-figure svg {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin: 0 auto;
}

.polaris-figure figcaption {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin-top: 0.9rem;
  line-height: 1.7;
}

/* ---------- 表格（Bortle 分级） ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin: 1.2rem 0;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: var(--card);
}

th,
td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.95rem;
  white-space: nowrap;
}

td:last-child {
  white-space: normal;
}

th {
  color: var(--heading);
  background: rgba(130, 180, 255, 0.06);
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: none;
}

.dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  margin-right: 0.45em;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.dot-1 { background: #050505; }
.dot-2 { background: #6b7280; }
.dot-3 { background: #3b82c4; }
.dot-4 { background: #3f9e5f; }
.dot-5 { background: #c9b458; }
.dot-6 { background: #d08a3e; }
.dot-7 { background: #c0504d; }
.dot-8 { background: #d97b7b; }
.dot-9 { background: #e8e8e8; }

/* ---------- 月相（纯 CSS 绘制） ---------- */
.moon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin: 1.4rem 0 1rem;
}

.moon-item {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.moon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin: 0 auto 0.45rem;
  border: 1px solid var(--card-border);
}

.m-new {
  background: #141c30;
}

.m-first {
  background: linear-gradient(90deg, #141c30 50%, #efe8d5 50%);
}

.m-full {
  background: #efe8d5;
  box-shadow: 0 0 18px rgba(239, 232, 213, 0.25);
}

.m-last {
  background: linear-gradient(90deg, #efe8d5 50%, #141c30 50%);
}

/* ---------- 技巧列表 ---------- */
.tip-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.tip-list li {
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 0.9rem;
}

.tip-list strong {
  display: block;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* ---------- FAQ ---------- */
.faq details {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.faq summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--heading);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--gold);
  font-size: 1.3rem;
  line-height: 1;
  flex: none;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  padding: 0 1.25rem 1.1rem;
  margin: 0;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 2rem 0 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

.footer-note {
  font-size: 0.82rem;
  opacity: 0.75;
}

/* ---------- 返回顶部 ---------- */
.back-to-top {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(14, 22, 40, 0.92);
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-top:hover {
  border-color: var(--accent);
}

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .nav-toggle {
    display: flex;
  }

  .nav-list {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    background: rgba(6, 10, 20, 0.97);
    border-bottom: 1px solid var(--card-border);
  }

  .nav-list.open {
    display: flex;
  }

  .nav-list a {
    display: block;
    padding: 0.7rem 0;
    font-size: 1rem;
    border-bottom: none;
  }
}

@media (max-width: 640px) {
  .section {
    padding: 2.6rem 0;
  }

  .steps li {
    padding-left: 3rem;
  }

  .moon-row {
    gap: 1.1rem;
  }
}

/* ---------- 减弱动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .starfield::before,
  .meteor {
    animation: none;
  }

  .card,
  .btn,
  .back-to-top {
    transition: none;
  }
}
