/* ============================================================
   乐天堂主页 · 共享样式表 /assets/site.css
   夜间航站楼导视系统:深海夜蓝底板 + 暖金橙光源 + 薄荷绿状态
   ============================================================ */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote, dl, dd {
  margin: 0;
}

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

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

button {
  font: inherit;
  color: inherit;
}

/* ---------- 2. 变量 ---------- */
:root {
  --navy: #071A2F;
  --harbor: #0E2C4A;
  --deck: #123A5E;
  --gold: #F5A623;
  --amber: #FFC46B;
  --mint: #4FE0B0;
  --mint-deep: #1E8F73;
  --paper: #F4F0E6;
  --ink: #0B0F14;
  --text: #EAF2F7;
  --muted: #A9BCCB;
  --muted-dim: #6E8798;
  --line: #2A4A66;

  --shell: 1200px;
  --gutter: clamp(20px, 5vw, 48px);

  --font-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Courier New", monospace;

  --fs-display: clamp(2.4rem, 6vw, 4.5rem);
  --fs-title: clamp(1.9rem, 4.2vw, 3rem);
  --fs-section: clamp(1.375rem, 2.5vw, 2rem);
  --fs-card: 1.5rem;
  --fs-body: 1rem;
  --fs-small: 0.875rem;

  --radius: 2px;
  --head-h: 68px;
}

/* ---------- 3. 基础中文排版 ---------- */
body {
  min-height: 100vh;
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.005em;
}

h1 { font-size: var(--fs-title); font-weight: 900; }

a {
  color: var(--amber);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

a:hover { color: var(--gold); }

strong { font-weight: 800; }

::selection {
  background: var(--gold);
  color: var(--ink);
}

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

/* ---------- 4. 跳转链接 ---------- */
.skip-link {
  position: absolute;
  top: -120px;
  left: var(--gutter);
  z-index: 200;
  display: inline-block;
  padding: 10px 18px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-small);
  text-decoration: none;
  border-radius: var(--radius);
  transition: top 0.18s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 10px;
  color: var(--ink);
}

/* ---------- 5. 头部:紧凑命令栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 26, 47, 0.96);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

@supports (backdrop-filter: blur(8px)) {
  .site-header { backdrop-filter: blur(10px); }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 36px);
  width: 100%;
  max-width: var(--shell);
  min-height: var(--head-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 品牌署名 */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--text);
}

.brand:hover { color: var(--text); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--gold);
  background: linear-gradient(155deg, rgba(245, 166, 35, 0.22), rgba(245, 166, 35, 0));
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 1.0625rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.brand-sub {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* 导航 */
.site-nav {
  margin-left: auto;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 24px);
}

.nav-item { display: flex; }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 22px 2px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.24s ease;
}

.nav-link:hover,
.nav-link:focus-visible { color: var(--text); }

.nav-link:hover::after { transform: scaleX(0.55); }

.nav-index {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted-dim);
  transition: color 0.2s ease;
}

.nav-label { display: inline-block; }

.nav-link[aria-current="page"] { color: var(--gold); }

.nav-link[aria-current="page"]::after { transform: scaleX(1); }

.nav-link[aria-current="page"] .nav-index { color: var(--gold); }

/* 右侧入口 */
.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid rgba(245, 166, 35, 0.7);
  background: rgba(245, 166, 35, 0.09);
  color: var(--amber);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.header-cta::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--mint);
}

.header-cta:hover,
.header-cta:focus-visible {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}

/* 移动导航按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  cursor: pointer;
}

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

.nav-toggle-bars {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 16px;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  transition: transform 0.22s ease;
}

.site-header[data-open] .nav-toggle-bar:first-child {
  transform: translateY(3px) rotate(45deg);
}

.site-header[data-open] .nav-toggle-bar:last-child {
  transform: translateY(-3px) rotate(-45deg);
}

.nav-toggle-label { display: inline-block; }

/* 滚动进度 */
.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--amber));
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

/* ---------- 6. 页脚:到达层 ---------- */
.site-footer {
  background: var(--harbor);
  color: var(--text);
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: grid;
  gap: clamp(26px, 4vw, 46px);
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding: clamp(40px, 6vw, 76px) var(--gutter) clamp(22px, 3vw, 32px);
}

.footer-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 32px;
  padding-bottom: clamp(20px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}

.footer-brand {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.footer-tagline {
  max-width: 46ch;
  color: var(--muted);
  font-size: var(--fs-small);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 44px);
}

.footer-col { min-width: 0; }

.footer-col-title {
  margin-bottom: 14px;
  color: var(--mint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.footer-list,
.footer-contact {
  display: grid;
  gap: 11px;
}

.footer-item { min-width: 0; }

.footer-link {
  display: inline-block;
  color: var(--text);
  font-size: 0.9375rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.footer-key {
  display: block;
  margin-bottom: 1px;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
}

.footer-value {
  display: block;
  color: var(--text);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.footer-value--mono {
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 28px;
  padding-top: clamp(18px, 2.6vw, 24px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-legal {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.footer-notes {
  max-width: 54ch;
  color: var(--muted-dim);
  font-size: 0.75rem;
  line-height: 1.7;
}

/* ---------- 7. 容器与分区 ---------- */
.container {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: clamp(48px, 7vw, 96px);
}

.section--tight { padding-block: clamp(28px, 4vw, 52px); }

.section--paper {
  background: var(--paper);
  color: var(--ink);
}

.section--paper a { color: var(--mint-deep); }

.section--deck { background: var(--deck); }

.stack {
  display: grid;
  gap: clamp(16px, 2.4vw, 28px);
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
}

.section--paper .rule { border-top-color: rgba(11, 15, 20, 0.18); }

.prose {
  max-width: 40em;
  line-height: 1.85;
}

.prose > * + * { margin-top: 1.1em; }

/* ---------- 8. 排版组件 ---------- */
.page-title {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.012em;
}

.section-title {
  margin: 0;
  font-size: var(--fs-section);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.section--paper .eyebrow { color: var(--mint-deep); }

.lede {
  max-width: 38em;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.8;
}

.section--paper .lede { color: #3D4A55; }

.section-index {
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
}

.section--paper .section-index { color: #6B7883; }

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

.muted { color: var(--muted); }

/* ---------- 9. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn--primary {
  background: var(--gold);
  color: var(--ink);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--amber);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  border-color: var(--gold);
  color: var(--amber);
}

.section--paper .btn--ghost {
  border-color: rgba(11, 15, 20, 0.28);
  color: var(--ink);
}

.section--paper .btn--ghost:hover,
.section--paper .btn--ghost:focus-visible {
  border-color: var(--mint-deep);
  color: var(--mint-deep);
}

.btn--quiet {
  padding-inline: 0;
  background: none;
  border-color: transparent;
  color: var(--mint);
}

.btn--quiet:hover,
.btn--quiet:focus-visible { color: var(--amber); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- 10. 标签与状态 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.section--paper .tag {
  border-color: rgba(11, 15, 20, 0.2);
  color: #3D4A55;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(79, 224, 176, 0.12);
  color: var(--mint);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.section--paper .pill {
  background: rgba(30, 143, 115, 0.14);
  color: var(--mint-deep);
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.status-dot--mint {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(79, 224, 176, 0.14);
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.section--paper .meta-line { color: #6B7883; }

/* ---------- 11. 面包屑 ---------- */
.breadcrumb {
  padding-block: 18px 0;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: var(--line);
}

.breadcrumb-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-link:hover,
.breadcrumb-link:focus-visible { color: var(--amber); }

.section--paper .breadcrumb-list { color: #6B7883; }

.section--paper .breadcrumb-link { color: #3D4A55; }

/* ---------- 12. 网格 ---------- */
.grid {
  display: grid;
  gap: clamp(16px, 2.6vw, 32px);
}

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

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

.grid--split {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

/* ---------- 13. 图像容器(供页面阶段放置图片) ---------- */
.media-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(118deg, #0A2135 0%, #123A5E 48%, #0A2135 100%);
}

.media-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame--wide { aspect-ratio: 16 / 7; }

.media-frame--banner { aspect-ratio: 21 / 8; }

.media-frame--square { aspect-ratio: 1 / 1; }

.media-trace {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    102deg,
    transparent 22%,
    rgba(245, 166, 35, 0.2) 44%,
    rgba(79, 224, 176, 0.14) 56%,
    transparent 78%
  );
  animation: media-trace-drift 22s linear infinite;
  pointer-events: none;
}

@keyframes media-trace-drift {
  from { transform: translateX(-16%); }
  to { transform: translateX(16%); }
}

.media-caption {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.section--paper .media-caption { color: #6B7883; }

/* ---------- 14. 章节目录链接(配合 data-toc) ---------- */
.toc-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0 8px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover,
.toc-link:focus-visible { color: var(--text); }

.toc-link[aria-current="true"] {
  color: var(--gold);
  border-left-color: var(--gold);
}

.section--paper .toc-link { color: #6B7883; }

.section--paper .toc-link:hover { color: var(--ink); }

.section--paper .toc-link[aria-current="true"] {
  color: var(--mint-deep);
  border-left-color: var(--mint-deep);
}

/* ---------- 15. 返回顶部 ---------- */
.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(14, 44, 74, 0.96);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, background 0.2s ease, color 0.2s ease;
}

.to-top[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover,
.to-top:focus-visible {
  background: var(--gold);
  color: var(--ink);
}

/* ---------- 16. 响应式 ---------- */
@media (max-width: 1080px) {
  .nav-list { gap: 10px; }

  .nav-link { font-size: 0.875rem; padding-block: 20px; }

  .brand-sub { display: none; }
}

@media (max-width: 1023px) {
  :root { --head-h: 62px; }

  .header-inner { position: relative; }

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

  .header-actions { display: none; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    margin-left: 0;
    padding: 8px var(--gutter) 22px;
    background: var(--harbor);
    border-bottom: 1px solid var(--line);
    max-height: calc(100vh - var(--head-h));
    overflow-y: auto;
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.35);
  }

  .site-header[data-open] .site-nav,
  .site-nav[data-open] { display: block; }

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

  .nav-item { display: block; }

  .nav-link {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    padding: 14px 0;
    border-bottom: 1px solid rgba(42, 74, 102, 0.55);
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
  }

  .nav-link::after { display: none; }

  .nav-link[aria-current="page"] { color: var(--gold); }

  .nav-link[aria-current="page"] .nav-index { color: var(--gold); }

  .nav-item:last-child .nav-link { border-bottom: 0; }

  .brand-sub { display: inline; }

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

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

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

@media (max-width: 640px) {
  :root { --gutter: 20px; }

  html { scroll-padding-top: 76px; }

  .brand-mark { width: 32px; height: 32px; }

  .brand-name { font-size: 1rem; }

  .brand-sub { font-size: 0.625rem; letter-spacing: 0.08em; }

  .nav-toggle-label { display: none; }

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

  .footer-lead { align-items: flex-start; }

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

  .btn { width: 100%; justify-content: center; }

  .btn--quiet { width: auto; }

  .to-top { padding: 9px 12px; font-size: 0.75rem; }
}

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

  .media-trace { animation: none; }

  .to-top { transform: none; }
}
