/* ==========================================================================
   /assets/site.css — 加拿大指南 · 共享外壳
   夜靛蓝底 / 雪峰白内容 / 铜金刻度 / 暖纸索引
   ========================================================================== */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; }
a { color: inherit; }

/* ---------- 2. Tokens ---------- */
:root {
  --c-indigo: #1B2A4A;
  --c-indigo-deep: #16233E;
  --c-ink: #0F1A2E;
  --c-snow: #F5F7FA;
  --c-paper: #EDE7DA;
  --c-copper: #C8963E;
  --c-copper-lift: #E2B862;
  --c-mist: #8FA3BF;
  --c-teal: #3F6E73;
  --c-rust: #A85C3C;
  --c-pine: #243447;
  --c-text: #1B2A4A;
  --c-text-soft: #5F7191;
  --c-line: rgba(27, 42, 74, 0.14);
  --c-grid: rgba(245, 247, 250, 0.12);

  --font-display: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-body: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --frame-max: 1180px;
  --gutter: clamp(18px, 4vw, 52px);
  --radius: 2px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 3. Base typography ---------- */
html { scroll-padding-top: 122px; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  font-weight: 400;
  color: var(--c-text);
  background-color: var(--c-snow);
  background-image: radial-gradient(rgba(27, 42, 74, 0.05) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--c-indigo);
}

p { line-height: 1.8; }

::selection { background: var(--c-copper); color: #16233E; }

/* ---------- 4. Focus & accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--c-copper);
  outline-offset: 3px;
  border-radius: var(--radius);
}
.site-header :focus-visible,
.site-footer :focus-visible { outline-color: var(--c-copper-lift); }

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 200;
  display: inline-block;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #16233E;
  background: var(--c-copper);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.22s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- 5. Header / masthead ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 70;
  color: var(--c-snow);
  background-color: var(--c-indigo);
  background-image:
    repeating-linear-gradient(90deg, rgba(245, 247, 250, 0.05) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(0deg, rgba(245, 247, 250, 0.035) 0 1px, transparent 1px 38px),
    radial-gradient(120% 170% at 50% -60%, rgba(63, 110, 115, 0.55), transparent 64%),
    linear-gradient(180deg, #1B2A4A 0%, #16233E 100%);
  border-bottom: 1px solid rgba(200, 150, 62, 0.42);
  box-shadow: 0 18px 42px -34px rgba(15, 26, 46, 0.95);
}

.header-inner {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 20px 0 14px;
}

.masthead-index {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mist);
}
.masthead-index strong {
  font-weight: 500;
  color: var(--c-copper);
  letter-spacing: 0.12em;
}
.masthead-tick {
  display: inline-block;
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, var(--c-copper), rgba(200, 150, 62, 0));
}

.brand {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: inherit;
}
.brand-cn {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 2.6vw, 28px);
  letter-spacing: 0.16em;
  line-height: 1.1;
  color: var(--c-snow);
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--c-copper);
}

.masthead-side { justify-self: end; }
.masthead-link {
  display: inline-block;
  padding-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-mist);
  border-bottom: 1px solid rgba(143, 163, 191, 0.42);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.masthead-link:hover { color: var(--c-copper-lift); border-color: var(--c-copper-lift); }

/* mobile nav toggle */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-snow);
  background: rgba(245, 247, 250, 0.05);
  border: 1px solid rgba(200, 150, 62, 0.55);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav-toggle:hover { background: rgba(200, 150, 62, 0.16); border-color: var(--c-copper); }
.nav-toggle-bars {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 10px;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 1.5px;
  background: var(--c-copper);
  transition: transform 0.25s var(--ease), top 0.25s var(--ease);
}
.nav-toggle-bars::before { top: 1px; }
.nav-toggle-bars::after { top: 8px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 4.5px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 4.5px; transform: rotate(-45deg); }
.nav-toggle-text { line-height: 1; }

/* nav */
.site-nav { border-top: 1px solid rgba(245, 247, 250, 0.1); }
.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.nav-list li { position: relative; }
.nav-list a {
  position: relative;
  display: block;
  padding: 14px 18px;
  font-size: 14.5px;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: rgba(245, 247, 250, 0.72);
  transition: color 0.22s var(--ease);
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 0;
  height: 2px;
  background: var(--c-copper);
  transform: translateX(-50%);
  transition: width 0.28s var(--ease);
}
.nav-list a:hover { color: var(--c-snow); }
.nav-list a:hover::after { width: 22px; }
.nav-list a[aria-current="page"] { color: var(--c-snow); }
.nav-list a[aria-current="page"]::after { width: 22px; }

/* scroll progress */
.scroll-progress {
  height: 2px;
  background: rgba(245, 247, 250, 0.1);
}
.scroll-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--c-copper), var(--c-copper-lift));
  box-shadow: 0 0 12px rgba(200, 150, 62, 0.55);
  transition: width 0.1s linear;
}

/* ---------- 6. Footer ---------- */
.site-footer {
  position: relative;
  margin-top: clamp(48px, 8vw, 96px);
  color: rgba(245, 247, 250, 0.78);
  background: var(--c-ink);
  border-top: 1px solid rgba(200, 150, 62, 0.3);
}

.footer-ridge {
  height: 104px;
  border-bottom: 1px solid rgba(245, 247, 250, 0.08);
  background-color: var(--c-ink);
  background-image:
    repeating-linear-gradient(90deg, rgba(245, 247, 250, 0.07) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(0deg, rgba(245, 247, 250, 0.05) 0 1px, transparent 1px 26px),
    radial-gradient(90% 150% at 16% 132%, rgba(63, 110, 115, 0.5), transparent 62%),
    radial-gradient(70% 130% at 88% 142%, rgba(200, 150, 62, 0.22), transparent 60%);
}

.footer-inner {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding: clamp(32px, 5vw, 56px) var(--gutter) 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1.1fr 1fr 0.9fr;
  gap: clamp(24px, 3.4vw, 48px);
  padding-bottom: clamp(28px, 4vw, 44px);
}

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

.footer-heading {
  margin-bottom: 16px;
  padding-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-copper);
  border-bottom: 1px solid rgba(245, 247, 250, 0.12);
}

.footer-brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.16em;
  line-height: 1.2;
  color: var(--c-snow);
}
.footer-tagline {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-mist);
}
.footer-note {
  margin-top: 16px;
  max-width: 32ch;
  font-size: 13.5px;
  line-height: 1.85;
  color: rgba(245, 247, 250, 0.6);
}

.footer-list {
  display: grid;
  gap: 12px;
  font-size: 14px;
  line-height: 1.65;
}
.footer-key {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(143, 163, 191, 0.88);
}
.footer-value {
  display: block;
  margin-top: 2px;
  color: rgba(245, 247, 250, 0.9);
  overflow-wrap: anywhere;
}

.footer-link {
  display: inline-block;
  padding-bottom: 1px;
  text-decoration: none;
  color: rgba(245, 247, 250, 0.86);
  border-bottom: 1px solid rgba(200, 150, 62, 0.35);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.footer-link:hover { color: var(--c-copper-lift); border-color: var(--c-copper-lift); }

.footer-icp {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(143, 163, 191, 0.9);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0 28px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(143, 163, 191, 0.85);
  border-top: 1px solid rgba(245, 247, 250, 0.1);
}
.footer-copy { color: rgba(245, 247, 250, 0.72); }

/* ---------- 7. Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose { max-width: 70ch; }
.prose p + p { margin-top: 1.05em; }

.grid { display: grid; gap: clamp(16px, 2.4vw, 28px); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--aside { grid-template-columns: minmax(180px, 248px) minmax(0, 1fr); align-items: start; }

.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, rgba(27, 42, 74, 0.3), rgba(27, 42, 74, 0));
}

/* ---------- 8. Atoms ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-copper);
}

.section-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--c-indigo);
}

.label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-copper);
}
.label::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
}

.version-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--c-copper);
  background: rgba(200, 150, 62, 0.08);
  border: 1px solid rgba(200, 150, 62, 0.5);
  border-radius: var(--radius);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--c-indigo);
  background: var(--c-snow);
  border: 1px solid rgba(27, 42, 74, 0.18);
  border-radius: var(--radius);
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.tag:hover {
  transform: translateY(-2px);
  border-color: var(--c-copper);
  box-shadow: 0 12px 26px -20px rgba(15, 26, 46, 0.9);
}

.sheet {
  padding: clamp(20px, 3vw, 34px);
  background: var(--c-snow);
  border: 1px solid rgba(27, 42, 74, 0.12);
  border-radius: var(--radius);
}
.sheet--paper {
  background: var(--c-paper);
  border-color: rgba(27, 42, 74, 0.16);
}

/* buttons */
.btn {
  --btn-bg: var(--c-indigo);
  --btn-fg: var(--c-snow);
  --btn-bd: transparent;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
              border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgba(15, 26, 46, 0.9); }
.btn--copper { --btn-bg: var(--c-copper); --btn-fg: #16233E; }
.btn--copper:hover { --btn-bg: var(--c-copper-lift); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--c-snow); --btn-bd: rgba(245, 247, 250, 0.42); }
.btn--ghost:hover { --btn-bd: var(--c-copper); --btn-fg: var(--c-copper-lift); }
.btn--ink { --btn-bg: transparent; --btn-fg: var(--c-indigo); --btn-bd: rgba(27, 42, 74, 0.3); }
.btn--ink:hover { --btn-bd: var(--c-copper); --btn-fg: var(--c-copper); }

/* breadcrumb */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-soft);
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.breadcrumb li { display: flex; align-items: center; gap: 8px; }
.breadcrumb li::after { content: "/"; color: var(--c-mist); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { text-decoration: none; color: inherit; transition: color 0.2s var(--ease); }
.breadcrumb a:hover { color: var(--c-copper); }

/* section index (page stage, paired with data-spy) */
.section-nav {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.section-nav ul { display: grid; gap: 2px; }
.section-nav a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--c-text-soft);
  border-left: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.section-nav a:hover { color: var(--c-indigo); background: rgba(27, 42, 74, 0.04); }
.section-nav a[aria-current="true"] {
  color: var(--c-indigo);
  border-left-color: var(--c-copper);
  background: rgba(200, 150, 62, 0.1);
}

/* media frame — responsive image container for page stage */
.media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(200, 150, 62, 0.35);
  border-radius: var(--radius);
  background-color: var(--c-pine);
  background-image:
    repeating-linear-gradient(115deg, rgba(245, 247, 250, 0.06) 0 1px, transparent 1px 18px),
    linear-gradient(160deg, #243447, #1B2A4A 70%);
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.88) contrast(1.02);
}
.media--wide { aspect-ratio: 21 / 9; }
.media--tall { aspect-ratio: 4 / 5; }
.media-caption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--c-text-soft);
}

/* back to top — injected by JS */
.back-top {
  position: fixed;
  right: clamp(14px, 2.4vw, 28px);
  bottom: clamp(14px, 2.4vw, 28px);
  z-index: 80;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  color: var(--c-indigo);
  background: var(--c-snow);
  border: 1px solid var(--c-copper);
  border-radius: 50%;
  box-shadow: 0 14px 30px -16px rgba(15, 26, 46, 0.85);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease),
              visibility 0.25s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.back-top[data-visible="true"] { opacity: 1; visibility: visible; transform: none; }
.back-top:hover { background: var(--c-copper); color: #16233E; }

/* ---------- 9. Responsive ---------- */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--aside { grid-template-columns: minmax(0, 1fr); }
  .grid--aside .section-nav { order: -1; }
}

@media (max-width: 860px) {
  html { scroll-padding-top: 96px; }

  .masthead {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 14px 0 12px;
  }
  .masthead-index,
  .masthead-side { display: none; }
  .brand { justify-self: start; align-items: flex-start; gap: 4px; }
  .brand-cn { font-size: 20px; letter-spacing: 0.12em; }
  .brand-sub { font-size: 10px; letter-spacing: 0.22em; }

  .nav-toggle { display: inline-flex; justify-self: end; }

  .site-nav {
    max-height: 0;
    overflow: hidden;
    border-top: 1px solid transparent;
    transition: max-height 0.34s var(--ease), border-color 0.34s var(--ease);
  }
  .site-nav[data-open="true"] {
    max-height: 480px;
    border-top-color: rgba(245, 247, 250, 0.14);
  }
  .nav-list { flex-direction: column; align-items: stretch; padding: 6px 0 16px; }
  .nav-list a {
    padding: 14px 2px;
    font-size: 15px;
    border-bottom: 1px solid rgba(245, 247, 250, 0.08);
  }
  .nav-list a::after { left: 2px; bottom: 9px; transform: none; }
  .nav-list a:hover::after,
  .nav-list a[aria-current="page"]::after { width: 16px; }
}

@media (max-width: 720px) {
  .grid--2,
  .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .footer-base { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .footer-ridge { height: 72px; }
  .back-top { width: 44px; height: 44px; }
}

/* ---------- 10. Motion preferences ---------- */
@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;
    scroll-behavior: auto !important;
  }
  .tag:hover,
  .btn:hover,
  .back-top { transform: none !important; }
}
