/* ==========================================================================
   China Expresses — Train detail page components
   --------------------------------------------------------------------------
   统一 12 个列车介绍页（src/trains/*.html）反复出现的碎片化内联样式。
   基准页面：丝路梦享 / 锦绣天府 / 白云号。

   加载顺序：build 时置于 style.20260831.css 之后，同优先级下覆盖全局
   section / h2 的默认值，让列车页拥有一致的视觉骨架。
   必要差异（每列车的独特章节、文案、表格数据、价格）保留在页面内联。
   ========================================================================== */

/* ---- 正文包裹：覆盖全局 section 的大 padding ---- */
.train-section { padding: clamp(48px, 7vw, 88px) 0; }

/* ---- 导语段落 ---- */
.train-lead {
  max-width: 68ch;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 2.5rem;
}
.train-lead--short { margin-bottom: 1.4rem; }

/* ---- 规格卡网格（关键参数 / At a Glance） ---- */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.2rem;
  padding: 2rem;
  background: var(--cream);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  margin-bottom: 3rem;
}
.spec span {
  display: block;
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.spec strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.32rem;
  color: var(--gold-3);
  font-weight: 600;
}

/* ---- 章节标题（h2 + 金色短线） ---- */
.sec-title { margin: 3.5rem 0 1.75rem; }
.sec-title h2 {
  margin: 0 0 .9rem;
  font-family: var(--serif-display);
  font-size: clamp(1.55rem, 2.8vw, 2.05rem);
  color: var(--ink);
  line-height: 1.12;
}
.sec-title::after {
  content: '';
  display: block;
  width: 54px;
  height: 2px;
  background: var(--gold);
}

/* ---- 子标题（表格 / 小节前，h3 层级） ---- */
.sec-sub { margin: 2rem 0 1rem; font-size: 1.15rem; }

/* ---- 卡片网格（骨架统一；列宽是各车必要差异，用修饰类精确覆盖） ---- */
.tgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 3rem; }
.tgrid--240 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tgrid--300 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tgrid--320 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ---- 卡片（仅容器骨架；卡内标题/正文文字排版保留页面内联，作为渐进优化项） ---- */
.tcard {
  background: var(--cream);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
}
.tcard--paper { background: var(--paper-2); border: none; }
.tcard--accent { border-left: 3px solid var(--gold); }

/* ---- 目的地编号卡（容器复用 .tgrid，仅卡样式单列） ---- */
.dest-card {
  background: var(--cream);
  padding: 1.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  position: relative;
}
.dest-num {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  font-family: var(--serif-display);
  font-size: 2.3rem;
  color: var(--gold);
  opacity: .38;
  line-height: 1;
}
.dest-card h3 { font-size: 1.05rem; margin-bottom: .5rem; padding-right: 3rem; }
.dest-card p { font-size: .84rem; color: var(--text-2); line-height: 1.65; }

/* ---- 表格 ---- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  margin-bottom: .7rem;
}
.train-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
  background: var(--paper-2);
  min-width: 640px;
}
.train-table thead tr { background: var(--ink); color: var(--ivory); }
.train-table th { padding: .9rem 1rem; font-weight: 600; }
.train-table tbody tr { border-top: 1px solid var(--line-soft); }
.train-table td { padding: .8rem 1rem; }

/* ---- 图库 ---- */
.gallery-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
.gallery-zoom { display: block; }
.gallery-zoom img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: zoom-in;
}

/* ---- FAQ（列车页 onclick 折叠结构） ---- */
.faq-list { margin-bottom: 3rem; }
.faq-list .faq { border-bottom: 1px solid var(--line-soft); }
.faq-list .faq-q { padding: 1.1rem 0; font-size: 1.05rem; }
.faq-list .faq-q span:last-child { font-size: 1.3rem; }
.faq-list .faq-a { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.faq-list .faq-a-inner { padding: 0 0 1.5rem; color: var(--text-2); line-height: 1.7; font-size: 1rem; }

/* ---- 文末 CTA ---- */
.train-cta { text-align: center; padding: 2rem 0; }
.train-cta p { margin: 0 auto 2rem; max-width: 56ch; }
.train-cta .cta-row { display: inline-flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }

/* ---- 独库提示 ---- */
.duku-note {
  background: #f5faf5;
  padding: 1.2rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid #c8e6c9;
  font-size: .84rem;
  color: #2e7d32;
  line-height: 1.65;
  margin: 0 0 2rem;
  max-width: 70ch;
}
.duku-note a { color: #2e7d32; text-decoration: underline; }

/* ---- 引用块 ---- */
.train-quote {
  border-left: 3px solid var(--gold);
  padding: 1rem 1.4rem;
  margin: 2rem 0 3rem;
  background: var(--cream);
  border-radius: 0 var(--radius) var(--radius) 0;
  max-width: 68ch;
}
.train-quote p { font-family: var(--serif); font-size: 1.18rem; font-style: italic; color: var(--ink); line-height: 1.55; margin: 0; }
.train-quote footer { font-size: .78rem; color: var(--muted); margin-top: .6rem; }

/* ---- 图表 / 数据注脚 ---- */
.train-note { font-size: .78rem; color: var(--muted); }
.source-note{padding:clamp(24px,4vw,48px) 0;background:var(--paper-2);border-top:1px solid var(--line-soft)}
.source-note h2{margin:.35rem 0 .65rem;font-size:clamp(1.35rem,2.4vw,1.8rem)}
.source-note p{max-width:72ch;color:var(--text-2);line-height:1.7}
.source-note ul{margin:.8rem 0 0;padding-left:1.2rem;display:grid;gap:.45rem;max-width:86ch}
.source-note li{color:var(--text-2);line-height:1.55}
.source-note a{color:var(--gold-dark);text-decoration:underline;text-underline-offset:2px}
.source-note span{font-size:.9em;color:var(--muted)}
.entity-record{padding:clamp(28px,4vw,52px) 0;background:var(--cream);border-top:1px solid var(--line-soft)}
.entity-record h2{margin:.35rem 0 1.2rem;font-size:clamp(1.35rem,2.4vw,1.9rem)}
.entity-record h2 small{font-size:.62em;color:var(--muted);font-weight:400}
.entity-record__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:1px;background:var(--line-soft);border:1px solid var(--line-soft);margin:0}
.entity-record__grid div{background:var(--paper);padding:1rem 1.1rem}
.entity-record__grid dt{font-size:.65rem;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-bottom:.3rem}
.entity-record__grid dd{margin:0;color:var(--text);line-height:1.55}

/* ============================================================
   Train page: content column + sticky enquiry rail  (2026-11-08b)
   Single stylesheet for every /trains/ page: index pages, sub-pages and
   attractions. Supersedes train.css and train.20261108.css.
   Adds a persistent enquiry form beside the body copy so a visitor
   can submit at any scroll depth instead of only at the page foot.
   ============================================================ */

/* Shell: sit inside the same 1240px measure as the hero so the
   left edge of the body copy lines up with the banner headline. */
.with-sidebar--train { max-width: var(--maxw); }
.with-sidebar--train > .train-main { flex: 1; min-width: 0; }
.with-sidebar--train .train-rail { width: 300px; }

/* Rail card ------------------------------------------------- */
.train-rail .sidebar__card { padding: 1.35rem 1.3rem; }
.train-rail .sidebar__card h4 { margin-bottom: .5rem; }

.rail-eyebrow {
  display: block; font-size: .58rem; letter-spacing: .19em;
  text-transform: uppercase; color: var(--gold-3); margin-bottom: .45rem;
}
.rail-title {
  font-family: var(--serif-display); font-size: 1.14rem; line-height: 1.25;
  color: var(--ink); margin: 0 0 .5rem; font-weight: 700;
}
.rail-lede { font-size: .78rem; line-height: 1.5; color: var(--text-2); margin: 0 0 1rem; }

.rail-form .field { gap: .25rem; margin-bottom: .6rem; }
.rail-form .field label { font-size: .59rem; letter-spacing: .13em; }
.rail-form .field input,
.rail-form .field select,
.rail-form .field textarea {
  padding: .55rem .65rem; font-size: .84rem; background: #fff; width: 100%;
}
.rail-form .field textarea { min-height: 4.4rem; line-height: 1.5; resize: vertical; }
.rail-form .btn { margin-top: .85rem; padding: .8rem 1rem; font-size: .68rem; }
.rail-form .form-note { font-size: .72rem; line-height: 1.45; margin-top: .6rem; }
.rail-form .form-note:empty { display: none; }
.rail-fineprint {
  font-size: .65rem; line-height: 1.5; color: var(--muted); margin: .7rem 0 0;
}
.rail-honeypot {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

.rail-alt { padding: 1.05rem 1.3rem; }
.rail-alt__t {
  font-size: .58rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .35rem;
}
.rail-alt__m { font-size: .8rem; line-height: 1.5; color: var(--text-2); margin: 0; }
.rail-alt__m a { color: var(--gold-3); text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.rail-alt__m a:hover { border-bottom-color: var(--gold); }

/* Mobile: the rail would land below the copy, which is the problem
   we are solving, so swap it for a fixed quick-enquiry bar. */
.enquiry-bar { display: none; }

@media (max-width: 1080px) {
  .with-sidebar--train { flex-direction: column; gap: 2rem; align-items: stretch; }
  .with-sidebar--train > .train-main,
  .with-sidebar--train > .sidebar-main { width: 100%; flex: none; }
  /* the rail keeps its link and trust cards on a phone, only the form moves
     into the fixed bar, so navigation is not lost */
  .with-sidebar--train .train-rail {
    position: static; top: auto; width: 100%; max-height: none; overflow: visible;
    display: grid; grid-template-columns: 1fr; gap: 1rem;
  }
  .with-sidebar--train .train-rail .sidebar__card { margin-bottom: 0; }
  .with-sidebar--train .rail-form-card { display: none; }
  body:has(.enquiry-bar) { padding-bottom: 76px; }
  /* lift the back-to-top button clear of the bar (it sits at z-index 90) */
  body:has(.enquiry-bar) .back-to-top { bottom: calc(76px + clamp(1rem, 3vw, 2rem)); }
  .enquiry-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    align-items: center; justify-content: space-between; gap: 1rem;
    padding: .6rem .9rem calc(.6rem + env(safe-area-inset-bottom, 0px));
    background: rgba(33,28,20,.96);
    border-top: 1px solid rgba(246,241,231,.14);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .enquiry-bar__t { display: flex; flex-direction: column; line-height: 1.25; }
  .enquiry-bar__t strong {
    font-family: var(--serif-display); font-size: .95rem;
    color: var(--ivory); font-weight: 700;
  }
  .enquiry-bar__t span { font-size: .64rem; color: var(--ivory-dim); }
  .enquiry-bar .btn { flex: none; }
  body:has(.modal.open) .enquiry-bar { display: none; }
}

@media (max-width: 640px) {
  .train-rail .sidebar__card { padding: 1.1rem 1rem; }
  .enquiry-bar__t span { display: none; }
}

/* The shared success panel (built by main.js with inline styles for a full-width
   form) is too heavy inside a 300px rail: condense it to fit the card. */
.train-rail .form-success {
  margin-top: 0 !important;
  padding: 1.1rem .8rem !important;
  background: transparent !important;
  border: none !important;
  border-left: 2px solid var(--gold) !important;
  text-align: left !important;
}
.train-rail .form-success > div:first-child { font-size: 1.3rem !important; }
.train-rail .form-success h3 {
  font-size: 1rem !important; margin: .4rem 0 .35rem !important;
}
.train-rail .form-success p {
  font-size: .78rem !important; line-height: 1.5 !important; margin: 0 0 .9rem !important;
}
.train-rail .form-success .btn {
  padding: .55rem .8rem; font-size: .6rem; letter-spacing: .1em;
}


/* Sub-pages keep their own <div class="wrap"> inside each body section, so the
   measure would otherwise be doubled. Inside the train column they are plain
   blocks; the column itself already carries the gutter. */
.with-sidebar--train .train-main .wrap {
  max-width: none; padding-left: 0; padding-right: 0;
}

/* A rail taller than the viewport would hide its own tail (the trust card and
   the form's submit button), so let it scroll inside itself. */
@media (min-width: 1081px) {
  .train-rail {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .train-rail::-webkit-scrollbar { width: 6px; }
  .train-rail::-webkit-scrollbar-thumb {
    background: var(--line-soft); border-radius: 3px;
  }
}

/* ------------------------------------------------------------------
   Small screens: two-column inline grids that hold a table cannot fit
   390px, and .train-table carries a 640px minimum. Collapse the grid
   and let the table shrink instead of pushing the page sideways.
   ------------------------------------------------------------------ */
@media (max-width: 760px) {
  .with-sidebar--train .train-main [style*="1fr 1fr"]:has(table),
  .with-sidebar--train .train-main [style*="repeat(2"]:has(table) {
    grid-template-columns: 1fr !important;
  }
  .with-sidebar--train .train-main .train-table { min-width: 0; }
  .with-sidebar--train .train-main table { table-layout: fixed; word-break: break-word; }
  .with-sidebar--train .train-main .train-table th,
  .with-sidebar--train .train-main .train-table td { padding: .55rem .5rem; font-size: .8rem; }
}
