/* ============================================================
   桥见吉外 · H5 样式
   「桥·会通中外」系列 · 与动画共用视觉体系
   藏青底 #152238 / 鎏金 #C9A227 / 米白 #F2E9D6 / 灰蓝 #8FA0BF
   移动端优先（390 基准，rem 布局）；全部系统字体栈，零外部依赖
   ============================================================ */

:root {
  --navy: #152238;        /* 底色 */
  --navy-deep: #111D31;   /* 第二页满版场 */
  --navy-soft: #1D2E4A;   /* 浮起面板 */
  --navy-lift: #263858;   /* 交互悬停 / 激活面板 */
  --gold: #C9A227;        /* 鎏金点睛 */
  --gold-soft: #E4C867;   /* 小号金色文字用 */
  --cream: #F2E9D6;       /* 正文 */
  --ink-soft: #A9B6CE;    /* 运行正文辅助（蓝灰亮档，对比 ≥7:1） */
  --blue: #8FA0BF;        /* 辅助（次要注意） */
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-snap-type: y mandatory;
  background: var(--navy);
  scrollbar-width: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--cream);
  background: var(--navy);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
  letter-spacing: .01em;
}

h1 { font-size: clamp(3.2rem, 14vw, 8.25rem); }
h2 { font-size: clamp(1.95rem, 6.4vw, 3.2rem); }
h3 { font-size: 1.15rem; }

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }

/* ---------- 焦点与跳转 ---------- */

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

.skip {
  position: fixed;
  top: -56px;
  left: 16px;
  z-index: 80;
  background: var(--gold);
  color: var(--navy);
  padding: 10px 18px;
  font-size: .94rem;
  text-decoration: none;
  transition: top .2s ease-out;
}
.skip:focus { top: 12px; }

/* ---------- 顶部桥进度线 ---------- */

.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 70;
  pointer-events: none;
}
.bar {
  display: block;
  height: 100%;
  width: 25%;
  background: var(--gold);
  position: relative;
  transition: width .8s ease-out;
}
.bar::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  background: var(--gold-soft);
  transform: rotate(45deg);
}

/* ---------- 全屏页 ---------- */

.page {
  min-height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 44px 24px 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
@media (min-width: 920px) {
  .page { padding: 56px 64px 96px; }
}
.page-inner {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
}

.lead {
  margin-top: clamp(14px, 2.4svh, 26px);
  color: var(--ink-soft);
  font-size: 1.15rem;
  max-width: 36em;
  text-wrap: pretty;
}

/* ---------- 滚动触发进场（transform + opacity only） ---------- */

.js .r {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .7s ease-out, transform .7s ease-out;
  transition-delay: var(--d, 0s);
}
.js .on .r { opacity: 1; transform: translateY(0); }

/* ---------- P1 封面 ---------- */

.hero-head { max-width: 1040px; margin-inline: auto; width: 100%; }
.hero h1 { margin-top: 10px; }
.theme {
  margin-top: clamp(14px, 2.4svh, 22px);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: .02em;
  max-width: 30em;
}
.lede {
  margin-top: clamp(10px, 1.8svh, 18px);
  color: var(--ink-soft);
  font-size: 1.15rem;
  max-width: 36em;
  text-wrap: pretty;
}
.note {
  margin-top: clamp(10px, 1.6svh, 16px);
  color: var(--blue);
  font-size: .94rem;
}

.bridge {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin: clamp(12px, 2.2svh, 24px) auto 0;
}
@media (max-width: 640px) {
  .bridge { width: calc(100% + 48px); max-width: none; margin-inline: -24px; }
}
.bridge svg { display: block; width: 100%; height: auto; }

/* 桥形配色 */
.c-ripple { stroke: #223559; stroke-width: 4; stroke-linecap: round; fill: none; }
.ripple2 { stroke-width: 3; }
.c-anchor { fill: var(--navy-soft); }
.c-tower { stroke: var(--blue); stroke-width: 7; stroke-linecap: round; fill: none; }
.c-brace { stroke: var(--blue); stroke-width: 3; stroke-linecap: round; fill: none; opacity: .8; }
.c-hanger { stroke: var(--blue); stroke-width: 1; opacity: .55; fill: none; }
.c-cable { stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.c-deck { stroke: var(--blue); stroke-width: 5; stroke-linecap: round; fill: none; }
.c-rail { stroke: var(--gold); stroke-width: 1; opacity: .85; fill: none; }
.fly { fill: var(--gold-soft); }
.run circle { fill: var(--gold-soft); opacity: .9; }

/* 主缆描线循环 */
#cable { stroke-dasharray: 1000; animation: draw 12s ease-in-out .2s infinite; }
@keyframes draw {
  0%   { stroke-dashoffset: 1000; opacity: 1; }
  42%  { stroke-dashoffset: 0;    opacity: 1; }
  86%  { stroke-dashoffset: 0;    opacity: 1; }
  93%  { stroke-dashoffset: 0;    opacity: 0; }
  94%  { stroke-dashoffset: 1000; opacity: 0; }
  100% { stroke-dashoffset: 1000; opacity: 1; }
}
/* 缆上光点与描线同周期出没 */
.fly { opacity: 0; animation: flyop 12s linear .2s infinite; }
@keyframes flyop {
  0% { opacity: 0; } 5% { opacity: 1; } 88% { opacity: 1; } 96% { opacity: 0; } 100% { opacity: 0; }
}
/* 桥面过桥光点 */
.run { animation: cross 13s linear infinite; }
.run.s2 { animation-delay: -6.5s; }
@keyframes cross {
  from { transform: translateX(-60px); }
  to   { transform: translateX(820px); }
}
/* 水纹呼吸 */
.ripple1 { animation: ripple 5s ease-in-out infinite; }
.ripple2 { animation: ripple 5s ease-in-out 1.4s infinite; }
@keyframes ripple { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }

/* 七语问候带（铺在桥面上） */
.greet { position: absolute; inset: 0; pointer-events: none; }
.greet span {
  position: absolute;
  top: 64%;
  left: var(--x);
  transform: translateY(-130%);
  font-family: var(--serif);
  font-size: clamp(.95rem, 2.9vw, 1.1rem);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .55s ease-out, transform .55s ease-out, color .4s ease-out;
}
.greet span.past { opacity: .5; }
.greet span.hot {
  opacity: 1;
  color: var(--gold-soft);
  transform: translateY(calc(-130% - 10px)) scale(1.14);
}
html:not(.js) .greet span { opacity: .92; }

/* 手机：桥面放不下七个词一行，偶数位升为高排灯串 */
@media (max-width: 640px) {
  .greet span:nth-child(even) { top: 44%; }
}

.hint {
  margin-top: clamp(8px, 1.6svh, 16px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  font-size: .94rem;
}.hint-glyph { color: var(--gold); animation: bob 1.7s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- P2 时间轴（桥墩） ---------- */

.history { background: var(--navy-deep); }

.tl {
  list-style: none;
  margin-top: clamp(20px, 3.6svh, 44px);
  position: relative;
  max-width: 760px;
}
.tl::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--gold);
  opacity: .55;
}
.node { position: relative; padding: 0 0 clamp(24px, 3.3svh, 34px) 36px; }
.node:last-child { padding-bottom: 4px; }
.mark {
  position: absolute;
  left: 0;
  top: 9px;
  width: 13px;
  height: 13px;
  background: var(--gold);
  transform: rotate(45deg);
}
.year {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4.5vw, 2rem);
  line-height: 1.15;
  color: var(--gold-soft);
}
.node h3 { margin-top: 2px; }
.node p {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 1rem;
  max-width: 30em;
  text-wrap: pretty;
}
.node.dest .mark { width: 15px; height: 15px; }
.node.dest .year { color: var(--gold); }
.node.dest p { color: var(--cream); }

@media (min-width: 920px) {
  .tl::before { left: 50%; margin-left: -1px; }
  .node {
    display: grid;
    grid-template-columns: 1fr 56px 1fr;
    padding: 0 0 clamp(40px, 5.2svh, 72px) 0;
  }
  .node:last-child { padding-bottom: 0; }
  .mark { left: calc(50% - 6px); top: 12px; }
  .node.dest .mark { left: calc(50% - 7px); }
  .nbody { grid-column: 1; grid-row: 1; text-align: right; justify-self: end; }
  .node:nth-child(even) .nbody { grid-column: 3; text-align: left; justify-self: start; }
  .node p { margin-left: auto; margin-right: 0; }
  .node:nth-child(even) p { margin-left: 0; }
}

/* ---------- P3 四种精神 ---------- */

.spirits { background: var(--navy); }

.cards {
  list-style: none;
  margin-top: clamp(20px, 3.4svh, 36px);
  display: grid;
  gap: clamp(14px, 2.2svh, 28px);
}
@media (min-width: 900px) {
  .cards { grid-template-columns: 1fr 1fr; gap: clamp(18px, 3svh, 28px); }
}

.card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 16px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--navy-soft);
  border: 0;
  border-radius: 0;
  padding: clamp(18px, 3svh, 32px);
  cursor: pointer;
  transition: transform .35s ease-out, background-color .35s ease-out;
}
.card:hover { transform: translateY(-3px); background: var(--navy-lift); }
.card:active { transform: translateY(-1px) scale(.985); }
.card.active { background: var(--navy-lift); }

.emblem { width: 54px; height: 54px; color: var(--blue); }
.card.active .emblem { color: var(--gold-soft); }
.emblem svg { width: 100%; height: 100%; display: block; }
.emblem path, .emblem circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
}
.card.active .emblem path { animation: redraw .9s ease-out; }
@keyframes redraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

.card-name { display: block; font-family: var(--serif); font-size: 1rem; }
.card-en { display: inline; margin-left: 8px; color: var(--blue); font-size: .94rem; font-family: var(--sans); font-weight: 400; }
.motto {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.3;
  color: var(--cream);
  transition: color .3s ease-out;
}
.card.active .motto, .card:hover .motto { color: var(--gold-soft); }

.fine { margin-top: clamp(18px, 3.4svh, 34px); color: var(--blue); font-size: .94rem; }

/* ---------- P4 结语 ---------- */

.ending { background: var(--navy); }

.creed {
  margin-top: clamp(22px, 4.4svh, 44px);
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 5.4vw, 2.1rem);
  line-height: 1.5;
  text-wrap: balance;
}
.creed-from {
  margin-top: clamp(10px, 1.6svh, 14px);
  text-align: center;
  color: var(--blue);
  font-size: .94rem;
}

.series-panel {
  margin-top: clamp(26px, 5.2svh, 52px);
  background: var(--navy-soft);
  padding: clamp(22px, 3.4svh, 32px) clamp(20px, 2.4vw, 26px);
}
.series-panel h3 { font-size: 1rem; }
.series-panel ul { list-style: none; margin-top: 6px; }
.srow {
  display: grid;
  grid-template-columns: 14px auto;
  column-gap: 12px;
  row-gap: 3px;
  margin-top: clamp(14px, 2.2svh, 22px);
}
.s-mark {
  grid-column: 1;
  grid-row: 1;
  width: 9px;
  height: 9px;
  background: var(--gold);
  transform: rotate(45deg);
  align-self: center;
}
.s-name { grid-column: 2; grid-row: 1; font-size: 1rem; }
.s-note { grid-column: 2; grid-row: 2; color: var(--blue); font-size: .94rem; }
@media (min-width: 560px) {
  .srow { grid-template-columns: 14px auto 1fr; }
  .s-note { grid-column: 3; grid-row: 1; margin-left: 4px; }
}

.ending footer { margin-top: clamp(30px, 6svh, 60px); }
.sign { font-family: var(--serif); font-size: 1rem; }
.credit {
  margin-top: 8px;
  color: var(--blue);
  font-size: .94rem;
  line-height: 1.75;
  max-width: 42em;
}
.sign + .credit { margin-top: 12px; }

/* ---------- 底部页点 ---------- */

.dots {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
  gap: 4px;
  z-index: 70;
}
.dot {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  opacity: .55;
  transition: transform .3s ease-out, opacity .3s ease-out, background-color .3s ease-out;
}
.dot.on::before { background: var(--gold); opacity: 1; transform: scale(1.35); }

/* ---------- BGM 开关（右下角，默认关闭） ---------- */

.bgm {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--navy-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 70;
  transition: background-color .3s ease-out, transform .2s ease-out;
}
.bgm:active { transform: scale(.94); }
.eq { display: flex; align-items: flex-end; gap: 2.5px; height: 18px; }
.eq i {
  width: 3px;
  height: 100%;
  border-radius: 1.5px;
  background: var(--blue);
  transform: scaleY(.35);
  transform-origin: bottom;
  transition: background-color .3s ease-out;
}
.bgm.on { background: var(--gold); }
.bgm.on .eq i { background: var(--navy); animation: eqb 1s ease-in-out infinite; }
.bgm.on .eq i:nth-child(1) { animation-duration: .9s; }
.bgm.on .eq i:nth-child(2) { animation-duration: 1.25s; animation-delay: .1s; }
.bgm.on .eq i:nth-child(3) { animation-duration: 1.05s; animation-delay: .05s; }
@keyframes eqb { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* ---------- 降级：无 JS 与弱动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  .js .r, .js .on .r { opacity: 1; transform: none; transition: none; }
  #cable, .fly, .run, .ripple1, .ripple2, .hint-glyph, .bar, .bgm.on .eq i { animation: none; }
  #cable { stroke-dashoffset: 0; }
  .fly, .run { display: none; }
  .greet span { opacity: .92; transform: translateY(-130%); transition: none; }
  .bgm.on .eq i { transform: scaleY(.8); }
  .card.active .emblem path { animation: none; }
}
