/* 2026 南庄山水悠遊行 秩序冊 — A4 列印版式
   配色沿用官網（src/components 實際使用值）：
   #0D1F13 深林綠 / #2D6A4F 主綠 / #F4A261 琥珀 / #A8D8B9 淺綠 / #F5F0E8 米白 */

/* Barlow 系列走 Google Fonts：拉丁字集不分片，列印時是正常的 CID TrueType。
   Noto Sans TC 一定要自架 —— Google Fonts 把它拆成上百個 unicode-range 切片，
   Chrome 列印時每片各轉一個 Type 3 字型，印刷廠 preflight 會擋。
   fonts/ 下的檔案由 scripts/build-handbook-fonts.py 產生。 */
@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&family=Barlow:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "Noto Sans TC";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("fonts/NotoSansTC-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans TC";
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url("fonts/NotoSansTC-Medium.woff2") format("woff2");
}

/* 600 沒有獨立字重檔，明確對到 Bold，避免瀏覽器自己合成假粗體 */
@font-face {
  font-family: "Noto Sans TC";
  font-style: normal;
  font-weight: 600 700;
  font-display: block;
  src: url("fonts/NotoSansTC-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans TC";
  font-style: normal;
  font-weight: 900;
  font-display: block;
  src: url("fonts/NotoSansTC-Black.woff2") format("woff2");
}

:root {
  --ink: #0d1f13;
  --green: #2d6a4f;
  --teal: #1a3a30;
  --amber: #f4a261;
  --mint: #a8d8b9;
  --cream: #f5f0e8;
  --paper: #fafaf8;
  --coral: #c9806f;
  --sage: #5a9b8a;
  --line: #d8d3c8;
  --muted: #5f6b62;

  --run: #2d6a4f;
  --kom: #c9806f;

  --pad-x: 14mm;
  --head-h: 13mm;
  /* 四邊出血；裁切線內仍為 A4 210×297mm */
  --bleed: 3mm;
}

@page {
  size: 216mm 303mm;
  margin: 0;
}

* {
  box-sizing: border-box;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #8a8f8b;
  font-family: "Barlow", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  font-size: 11.6pt;
  line-height: 1.65;
}

.page {
  position: relative;
  width: calc(210mm + var(--bleed) * 2);
  height: calc(297mm + var(--bleed) * 2);
  padding: var(--bleed);
  margin: 0 auto 6mm;
  background: var(--paper);
  overflow: hidden;
  page-break-after: always;
  break-after: page;
}

/* :last-of-type 而非 :last-child：瀏覽器擴充會在 body 尾端注入節點，
   那時 .page 不再是 last-child，break-after 沒被取消就會多印一張空白頁 */
.page:last-of-type {
  page-break-after: auto;
  break-after: auto;
}

@media print {
  body {
    background: #fff;
  }
  .page {
    margin: 0;
    box-shadow: none;
  }
}

@media screen {
  .page {
    box-shadow: 0 2mm 8mm rgba(0, 0, 0, 0.28);
  }
}

/* ---------- 廠商廣告頁（螢幕限定） ----------
   廣告在螢幕上是 200dpi 點陣預覽，PDF 則由 scripts/merge-handbook-ads.py 併入
   廠商原始向量檔。列印時整個拿掉，否則 Chrome 印版會多出一套點陣廣告，跟後續
   併進來的向量版重複。 */
.page.ad {
  padding: 0;
  background: #fff;
}

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

@media print {
  .page.ad {
    display: none;
  }
}

/* ---------- PDF 下載鈕（螢幕限定） ---------- */
.pdf-dl {
  position: fixed;
  top: 6mm;
  right: 6mm;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  gap: 2mm;
  padding: 2.6mm 5mm;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-family: "Barlow Condensed", "Noto Sans TC", sans-serif;
  font-size: 12.8pt;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: 0 1mm 4mm rgba(0, 0, 0, 0.3);
}

.pdf-dl:hover {
  background: var(--ink);
}

.pdf-dl svg {
  width: 4mm;
  height: 4mm;
}

@media print {
  .pdf-dl {
    display: none;
  }
}

/* ---------- 頁首 ---------- */
.head {
  /* 往上與左右各延伸一個出血寬度，裁切後仍是 head-h 高、pad-x 邊距 */
  height: calc(var(--head-h) + var(--bleed));
  margin: calc(var(--bleed) * -1) calc(var(--bleed) * -1) 0;
  background: linear-gradient(100deg, var(--teal) 0%, var(--ink) 62%, #050a06 100%);
  display: flex;
  align-items: center;
  gap: 4mm;
  padding: var(--bleed) calc(var(--pad-x) + var(--bleed)) 0;
  color: #fff;
}

.head .brand {
  font-family: "Barlow Condensed", "Noto Sans TC", sans-serif;
  font-weight: 700;
  font-size: 12.8pt;
  letter-spacing: 0.03em;
}

.head .brand em {
  font-style: normal;
  color: var(--amber);
}

.head .bar {
  width: 1.2mm;
  height: 5.5mm;
  background: var(--amber);
  border-radius: 1mm;
}

.head .title {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
  font-size: 12.8pt;
  letter-spacing: 0.08em;
}

.head .en {
  margin-left: auto;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 9.3pt;
  letter-spacing: 0.28em;
  color: var(--mint);
  text-transform: uppercase;
}

/* ---------- 頁尾頁碼（沿用去年斜角造型） ---------- */
.foot {
  /* absolute 的定位基準是 .page 的 padding box，right/bottom 0 即頁面實體邊緣 */
  position: absolute;
  right: 0;
  bottom: 0;
  width: calc(46mm + var(--bleed));
  height: calc(20mm + var(--bleed));
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 calc(var(--pad-x) + var(--bleed)) calc(5mm + var(--bleed)) 0;
}

.foot::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: calc(46mm + var(--bleed));
  height: calc(16mm + var(--bleed));
  background: linear-gradient(255deg, var(--ink) 55%, var(--green) 100%);
  clip-path: polygon(calc(16mm + var(--bleed)) 0, 100% 0, 100% 100%, 0 100%);
}

.foot .num {
  position: relative;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 17pt;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  padding-bottom: 1.6mm;
  border-bottom: 0.7mm solid var(--amber);
  min-width: 11mm;
  text-align: center;
}

/* ---------- 內容容器 ---------- */
.body {
  padding: 7mm var(--pad-x) 0;
  height: calc(297mm - var(--head-h));
}

.body.tight {
  padding-top: 5mm;
}

/* ---------- 賽事色標籤（chevron） ---------- */
.race-tag {
  display: inline-flex;
  align-items: center;
  gap: 2.5mm;
  padding: 1.6mm 9mm 1.6mm 4mm;
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 5mm) 0, 100% 50%, calc(100% - 5mm) 100%, 0 100%);
  margin-bottom: 4mm;
}

.race-tag.run {
  background: var(--run);
}
.race-tag.kom {
  background: var(--kom);
}

.race-tag .date {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 15pt;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.race-tag .dow {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 9.3pt;
  letter-spacing: 0.14em;
  opacity: 0.9;
}

.race-tag .name {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
  font-size: 12.2pt;
  letter-spacing: 0.22em;
}

/* ---------- 通用元件 ---------- */
h2.sec {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 13.9pt;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 3mm;
  padding-left: 3mm;
  border-left: 1.2mm solid var(--amber);
  letter-spacing: 0.05em;
}

h3.sub {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 12.2pt;
  font-weight: 700;
  color: var(--green);
  margin: 4mm 0 2mm;
}

p {
  margin: 0 0 2.4mm;
}

.lead {
  font-size: 11pt;
  color: var(--muted);
  line-height: 1.7;
}

.card {
  background: #fff;
  border: 0.3mm solid var(--line);
  border-radius: 3mm;
  padding: 4mm 5mm;
}

.card.cream {
  background: var(--cream);
  border-color: #e3dccd;
}

/* 步驟框（放在 cream 卡內時仍要看得出邊框） */
.card.step {
  padding: 3mm 3.5mm;
  border-color: var(--green);
  border-width: 0.4mm;
}

.card.dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.grid {
  display: grid;
  gap: 4mm;
}
.g2 {
  grid-template-columns: 1fr 1fr;
}
.g3 {
  grid-template-columns: repeat(3, 1fr);
}
.g4 {
  grid-template-columns: repeat(4, 1fr);
}

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
}

table th {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 2.3mm 2.5mm;
  letter-spacing: 0.04em;
}

table.kom th {
  background: #8f4f3f;
}

table td {
  padding: 2mm 2.5mm;
  border-bottom: 0.2mm solid #e8e4da;
}

table tbody tr:nth-child(even) {
  background: #f4f2ec;
}

table td.num,
table th.num {
  text-align: center;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 10.9pt;
  font-weight: 600;
}

table.mid th,
table.mid td {
  text-align: center;
}

table td.prize {
  color: #b4711f;
  font-weight: 600;
}

.tbl-wrap {
  border: 0.3mm solid var(--line);
  border-radius: 2.5mm;
  overflow: hidden;
}

/* 欄位多、列數多的比較表 */
table.compact {
  font-size: 7pt;
}

table.compact th {
  padding: 1.4mm 2mm;
}

table.compact td {
  padding: 1mm 2mm;
}

/* 列數多但欄位少的名額表：收緊列高，替頁尾備註挪出空間 */
table.slim th {
  padding: 1.7mm 2.5mm;
}

table.slim td {
  padding: 1.3mm 2.5mm;
}

/* 折返點活動流程：時間欄不斷行 */
table.turnaround td.num {
  white-space: nowrap;
  font-size: 10pt;
}

/* 團體帳篷配置表（列數多，壓縮行高） */
table.tent {
  font-size: 10.2pt;
  line-height: 1.35;
}

table.tent th {
  padding: 1.8mm 2mm;
}

table.tent td {
  padding: 1.8mm 2mm;
}

table.tent td.num {
  font-size: 10.8pt;
  white-space: nowrap;
}

/* 贊助商攤位表：單欄、置中，底色字色比照會場配置圖上的攤位標示 */
table.booth th,
table.booth td {
  text-align: center;
}

/* 條列 */
ul.list,
ol.list {
  margin: 0 0 2.5mm;
  padding-left: 5mm;
}

ul.list li,
ol.list li {
  margin-bottom: 1.6mm;
  line-height: 1.75;
}

ul.tick {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.tick li {
  position: relative;
  padding-left: 5mm;
  margin-bottom: 1.8mm;
  line-height: 1.75;
}

ul.tick li::before {
  content: "";
  position: absolute;
  left: 0.6mm;
  top: 1.8mm;
  width: 2mm;
  height: 2mm;
  border-radius: 50%;
  background: var(--amber);
}

/* 規則條文 */
.rule {
  margin-bottom: 3mm;
}

.rule .rt {
  font-weight: 700;
  color: var(--ink);
  font-size: 10.9pt;
  margin-bottom: 0.8mm;
}

.rule .rb {
  font-size: 10pt;
  color: #3f4a42;
  line-height: 1.62;
}

/* 標記 */
.pending {
  display: inline-block;
  background: #fdf0dd;
  color: #a8600d;
  border: 0.3mm dashed #e0a75c;
  border-radius: 1.5mm;
  padding: 0.4mm 2mm;
  font-size: 9.3pt;
  font-weight: 600;
}

.chip {
  display: inline-block;
  border-radius: 99px;
  padding: 0.6mm 3mm;
  font-size: 9.3pt;
  font-weight: 600;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.06em;
}

.chip.run {
  background: #e4efe7;
  color: var(--run);
}
.chip.kom {
  background: #f6e7e2;
  color: #a9584a;
}
.chip.amber {
  background: #fdeed9;
  color: #a8600d;
}

/* 時間軸 */
.tl {
  position: relative;
  padding-left: 0;
}

.tl .row {
  display: grid;
  grid-template-columns: 17mm 1fr;
  gap: 3mm;
  align-items: baseline;
  padding: 1.5mm 0;
  border-bottom: 0.2mm dashed #ddd8cc;
}

.tl .row:last-child {
  border-bottom: 0;
}

.tl .t {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12.8pt;
  font-weight: 700;
  color: var(--amber);
  text-align: right;
}

.tl .e {
  font-size: 10.7pt;
  font-weight: 500;
}

.tl .e small {
  display: block;
  color: var(--muted);
  font-size: 9pt;
}

/* 統計數字 */
.stat {
  text-align: center;
  border-radius: 3mm;
  padding: 3mm 2mm;
  background: #fff;
  border: 0.3mm solid var(--line);
}

.stat .v {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 20pt;
  font-weight: 700;
  line-height: 1;
  color: var(--green);
}

.stat .k {
  font-size: 9.3pt;
  color: var(--muted);
  margin-top: 1mm;
}

/* 圖片 */
figure {
  margin: 0;
}

figure img {
  width: 100%;
  display: block;
  border-radius: 2.5mm;
  border: 0.3mm solid var(--line);
}

figcaption {
  font-size: 8.8pt;
  color: var(--muted);
  margin-top: 1.5mm;
  text-align: center;
}

/* 備註頁：淡格線書寫區。線距用 px —— mm 在 repeating gradient 裡會累積
   舍入誤差，列印出來線寬與間距會忽大忽小 */
.notes-lines {
  height: 248mm;
  border: 0.3mm solid var(--line);
  border-radius: 2.5mm;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 40px,
    #dfe6df 40px 41px
  );
  background-position: 0 6mm;
}

/* QR */
.qr {
  text-align: center;
}

.qr img {
  width: 100%;
  max-width: 26mm;
  display: block;
  margin: 0 auto 1.5mm;
}

.qr .lbl {
  font-size: 9pt;
  color: var(--muted);
  line-height: 1.4;
}

/* 網頁版的 QR 也可以直接點（滑鼠沒辦法掃碼），走與紙本同一組 /q/ 短碼，
   後台就分得出這一次是掃紙本還是點網頁。display:contents 讓 <a> 不產生
   box —— 十個 QR 散在不同版面裡，包一層有 box 的元素會到處差幾毫米。 */
.qrlink {
  display: contents;
}

/* ---------- 封面 ---------- */
.cover {
  background: linear-gradient(170deg, #14301f 0%, #0d1f13 45%, #071008 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
}

.cover .top {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(20mm + var(--bleed)) calc(var(--pad-x) + var(--bleed)) 8mm;
  text-align: center;
  position: relative;
  z-index: 1;
}

.cover .kicker {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11.6pt;
  letter-spacing: 0.5em;
  color: var(--mint);
  text-transform: uppercase;
  margin-bottom: 4mm;
}

.cover h1 {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 30pt;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin: 0 0 2mm;
  line-height: 1.15;
}

.cover h1 .yr {
  font-family: "Barlow Condensed", sans-serif;
  color: var(--amber);
}

.cover .races {
  font-size: 14.5pt;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #e6efe8;
  margin-bottom: 8mm;
}

.cover .bookname {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 26pt;
  font-weight: 700;
  letter-spacing: 0.9em;
  text-indent: 0.9em;
  margin: 0 0 1mm;
}

.cover .bookname-en {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11.6pt;
  letter-spacing: 0.42em;
  color: var(--mint);
  text-transform: uppercase;
}

.cover .word {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 78pt;
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: 0.02em;
  color: rgba(244, 162, 97, 0.9);
  text-align: center;
  margin: 0;
}

.cover .word span {
  display: block;
}

.cover .art {
  position: absolute;
  inset: 0;
  margin: 0;
}

.cover .art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.cover .art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 31, 19, 0.95) 0%,
    rgba(13, 31, 19, 0.9) 42%,
    rgba(13, 31, 19, 0.6) 66%,
    rgba(13, 31, 19, 0.18) 82%,
    rgba(13, 31, 19, 0.1) 100%
  );
}

.cover .datestrip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 7mm 0 0;
}

.cover .datestrip div {
  padding: 2mm 7mm;
  width: 78mm;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12.8pt;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.cover .datestrip .d1 {
  background: var(--run);
}
.cover .datestrip .d2 {
  background: var(--kom);
}

/* 封面下方的 QR 與聯絡資訊（原本在封底，封底改成抽獎導流頁後移到這裡） */
.cover .cover-contact {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 8mm calc(var(--pad-x) + var(--bleed)) 4mm;
  /* 這一段壓在插畫亮處，要由透明漸深接到 .orgs 的底色，文字才讀得到又不出現硬邊 */
  background: linear-gradient(
    180deg,
    rgba(7, 16, 8, 0) 0%,
    rgba(7, 16, 8, 0.55) 38%,
    rgba(7, 16, 8, 0.72) 100%
  );
}

.cover .qrrow {
  display: flex;
  justify-content: space-between;
  margin: 0 6mm 4mm;
}

.cover .qrrow .qr img {
  max-width: 21mm;
  background: #fff;
  padding: 1.2mm;
  border-radius: 1.6mm;
}

.cover .qrrow .qr .lbl {
  font-size: 8.4pt;
  color: #cfe0d4;
}

.cover .contact {
  font-size: 9.3pt;
  line-height: 1.8;
  color: #d7e3d9;
}

.cover .contact b {
  color: var(--amber);
}

/* 封面與封底的單位列：同高、同底色，闔起來攤平時在書底連成一條黑邊 */
.cover .orgs,
.backcover .orgs {
  padding: 5mm calc(var(--pad-x) + var(--bleed)) calc(7mm + var(--bleed));
  text-align: center;
  font-size: 9.3pt;
  color: #d5e0d7;
  line-height: 1.6;
  background: rgba(7, 16, 8, 0.72);
  min-height: 32mm;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  z-index: 1;
}

.cover .orgs {
  position: relative;
  margin-top: auto;
}

.backcover .orgs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  color: #8fa596;
}

/* ---------- 目錄 ---------- */
.toc-col h3 {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 11.6pt;
  margin: 0 0 2.5mm;
}

.toc-item {
  display: flex;
  align-items: baseline;
  gap: 2mm;
  margin-bottom: 2.6mm;
}

.toc-item .nm {
  font-size: 11.1pt;
  font-weight: 600;
  white-space: nowrap;
}

.toc-item .dots {
  flex: 1;
  border-bottom: 0.25mm dotted #b9b3a6;
  transform: translateY(-0.6mm);
}

.toc-item .pg {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12.8pt;
  font-weight: 700;
  color: var(--green);
}

.toc-item .desc {
  font-size: 8.8pt;
  color: var(--muted);
}

.toc-sub {
  font-size: 8.8pt;
  color: var(--muted);
  margin: -1.8mm 0 2.6mm;
  line-height: 1.45;
}

/* ---------- 待填圖框 ---------- */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0.4mm dashed #c3b9a4;
  border-radius: 2mm;
  background: #faf7f1;
  color: #a8600d;
  font-size: 10.4pt;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ---------- 贊助牆 ---------- */
/* 每個 cell 的寬高由 index.html 逐一指定，使各家 logo 的顯示面積相等
   （w = √(A·r)、h = √(A/r)，A = 240mm²），再靠 flex 自動排行 */
.logo-wall {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6mm 7mm;
}

.logo-wall.lead {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3mm 4mm;
}

.logo-wall.lead .cell {
  height: 30mm;
}

.logo-wall .cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-wall .cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- 完賽禮色階 ---------- */
.tiers {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3mm;
}

.tier {
  text-align: center;
}

.tier .dot {
  width: 30mm;
  height: 30mm;
  border-radius: 50%;
  margin: 0 auto 2.5mm;
  box-shadow: 0 1mm 2mm rgba(0, 0, 0, 0.15);
}

.tier .en {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 9.3pt;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.2;
  margin-bottom: 1.5mm;
}

.tier .zh {
  font-size: 10.4pt;
  font-weight: 700;
  margin-bottom: 1.5mm;
}

.tier .tm {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 9.7pt;
  color: #4a554d;
  line-height: 1.5;
}

.tier .tm b {
  color: var(--muted);
}

/* ---------- 特約景點 ---------- */
.spot {
  display: grid;
  grid-template-columns: 42mm 1fr;
  gap: 3.5mm;
  align-items: center;
  border: 0.3mm solid var(--line);
  border-radius: 2.5mm;
  overflow: hidden;
  background: #fff;
}

.spot img {
  width: 42mm;
  height: 42mm;
  object-fit: cover;
  display: block;
}

.spot .nm {
  font-size: 10.4pt;
  font-weight: 700;
  padding-right: 3mm;
}

.spot .ad {
  font-size: 8.4pt;
  color: var(--muted);
  padding-right: 3mm;
}

.spot .ds {
  font-size: 7.8pt;
  color: #46514a;
  line-height: 1.5;
  padding-right: 3mm;
  margin-top: 1mm;
}

/* ---------- 特約景點分布圖 ---------- */
.mlmap {
  width: 92%;
  height: auto;
  display: block;
  margin: 0 auto 1mm;
}

.mlmap .tw {
  fill: #efe9dc;
  stroke: #fff;
  stroke-width: 1.8;
}

.mlmap .tw.hi {
  fill: #d9e9de;
}

.mlmap .tn {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 13px;
  fill: #7d8a80;
  text-anchor: middle;
}

.mlmap .lead {
  stroke: #96a49a;
  stroke-width: 1.4;
}

.mlmap .dot {
  fill: var(--ink);
}

.mlmap .badge {
  fill: var(--coral);
  stroke: #fff;
  stroke-width: 1.8;
}

.mlmap .bn {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 17px;
  fill: #fff;
  text-anchor: middle;
}

.mlmap .phb {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
}

.mlmap .venue .dot {
  fill: var(--green);
}

.mlmap .st {
  fill: var(--green);
  stroke: #fff;
  stroke-width: 1.8;
}

.mlmap .vl {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
  font-size: 15px;
  fill: var(--green);
  text-anchor: middle;
}

.mapnote {
  font-size: 8.4pt;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1.5mm;
}

.mapsrc {
  font-size: 7.8pt;
  color: var(--muted);
  line-height: 1.5;
  margin: 3mm 0 0;
}

.spotlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 6mm;
}

.spotlist li {
  display: flex;
  gap: 2.6mm;
  align-items: flex-start;
  padding: 1.6mm 0;
  border-bottom: 0.25mm solid var(--line);
}

.spotlist li:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.spotlist .n {
  flex: 0 0 4.6mm;
  height: 4.6mm;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 10pt;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlist .lg {
  flex: 0 0 8mm;
  height: 8mm;
  border-radius: 1.2mm;
  background: #fff;
  border: 0.2mm solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlist .lg img {
  max-width: 6.6mm;
  max-height: 6.6mm;
  object-fit: contain;
}

.spotlist .t b {
  display: block;
  font-size: 10pt;
  line-height: 1.3;
}

.spotlist .t em {
  display: block;
  font-style: normal;
  font-size: 8.4pt;
  color: var(--muted);
}

.spotlist .t em + em {
  font-size: 7.6pt;
}

/* ---------- FAQ ---------- */
.faq .q {
  font-size: 10.4pt;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.8mm;
}

.faq .a {
  font-size: 9.5pt;
  color: #46514a;
  line-height: 1.6;
  margin-bottom: 2.8mm;
}

/* ---------- 封底 ---------- */
.backcover {
  background:
    linear-gradient(
      180deg,
      rgba(13, 31, 19, 0.95) 0%,
      rgba(13, 31, 19, 0.92) 48%,
      rgba(13, 31, 19, 0.65) 72%,
      rgba(13, 31, 19, 0.2) 90%,
      rgba(13, 31, 19, 0.12) 100%
    ),
    /* 與封面同一張主視覺的左半，裁切基準要跟 .cover .art img 一致才接得起來 */
    url("assets/cover-back.webp") center center / cover no-repeat,
    #0d1f13;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  /* 下緣 58mm＝封面 QR 列的下緣高度（單位列 32mm ＋ 聯絡區 4mm ＋ 三行聯絡文字
     約 17.7mm ＋ QR 列下留白 4mm），攤平時兩邊 QR 對齊在同一水平 */
  padding: 90mm calc(20mm + var(--bleed)) 58mm;
}

.backcover h2 {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 24pt;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 4mm;
}

.backcover .sub {
  color: #e6efe8;
  font-size: 12pt;
  letter-spacing: 0.05em;
  line-height: 1.9;
  margin-bottom: 9mm;
}

.backcover .qr.survey {
  margin-top: auto;
}

.backcover .qr.survey img {
  max-width: 52mm;
  background: #fff;
  padding: 3mm;
  border-radius: 3mm;
}

.backcover .qr.survey .lbl {
  font-size: 11pt;
  letter-spacing: 0.1em;
  color: #cfe0d4;
  margin-top: 2.5mm;
}

/* ---------- 備註頁：淡色橫線，供現場手寫 ---------- */
/* ---------- 動線節點列 ---------- */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2mm 0;
  margin: 0 0 2.5mm;
}

.flow:last-child {
  margin-bottom: 0;
}

.flow .lbl {
  padding: 0.6mm 2.4mm;
  border: 0.3mm solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 9.2pt;
  white-space: nowrap;
}

/* 終點用強調色，讓動線終點一眼可辨 */
.flow .lbl.end {
  border-color: var(--coral);
  background: var(--coral);
  color: #fff;
  font-weight: 700;
}

.flow .arw {
  margin: 0 1.6mm;
  color: var(--sage);
  font-size: 9.6pt;
}

/* 賽事名稱膠囊：接在起點之後，標示這條動線屬於哪一場 */
.flow .race {
  padding: 0.6mm 2.6mm;
  border-radius: 999px;
  color: #fff;
  font-size: 9.2pt;
  font-weight: 700;
  white-space: nowrap;
}

.flow .race.run {
  background: var(--run);
}

.flow .race.kom {
  background: var(--kom);
}

/* ---------- 跨頁滿版圖（相鄰兩頁各放一半） ----------
   由 scripts/split-spread-image.py 產生的 -l／-r 兩檔。
   四邊各往外推一個 --bleed 才會滿版；中央那側的出血在裁切後被切掉，
   兩頁於書溝接合。`.page` 有 overflow:hidden，超出的部分自動裁掉。 */
/* 要同時escape 掉 .body 的 pad-x／padding-top 與 .page 的 bleed padding，
   只推一個 --bleed 會被 .body 的內距擋住（會內縮 14mm）。
   放在 .body 第一個子元素時 padding-top 用 .body.tight 的 5mm。 */
.spread-img {
  margin: calc((5mm + var(--bleed)) * -1) calc((var(--pad-x) + var(--bleed)) * -1) 3mm;
  line-height: 0;
}

.spread-img img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

/* ---------- 雙頁跨頁閱讀（螢幕限定，由 handbook.js 掛上 body.spread） ----------
   位置與縮放全走 JS 寫的 inline transform，因為要跟著視窗大小算。
   沒有 JS 時 body 不會有 .spread，維持原本的直向捲動，不會壞。 */
@media screen {
  body.spread {
    height: 100vh;
    overflow: hidden;
    background: #6f746f;
    /* 翻頁的 3D 透視。值太大時旋轉看起來像被壓扁而不是翻起來，
       1500px 才有紙張立起來的深度感 */
    perspective: 1500px;
    perspective-origin: 50% 46%;
  }

  body.spread .page {
    display: none;
  }

  /* is-open 的兩頁由 JS 定位；書中縫貼齊，模擬攤開的實體書 */
  body.spread .page.is-open {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    margin: 0;
    transform-origin: 0 0;
    box-shadow: 0 3mm 14mm rgba(0, 0, 0, 0.45);
  }

  /* 封面與封底本身是 flex 直向版面，上面那條 display:block 會把
     .cover .top 的 flex:1、.orgs 的 margin-top:auto 與 .backcover 的置中
     全部吃掉，螢幕上排版就跟 PDF 對不起來。這裡把 flex 補回去。 */
  body.spread .page.cover.is-open,
  body.spread .page.backcover.is-open {
    display: flex;
  }

  /* 瀏覽器放大時（handbook.js 掛上 .zoomed）：版面凍結在放大前的比例，
     容器改成可捲動，才看得到並捲得到視窗外的部分。少了這段，放大等於白放。 */
  body.spread.zoomed {
    height: auto;
    overflow: auto;
  }

  body.spread.zoomed .page.is-open {
    position: absolute;
  }

  /* 翻動中的那一葉：正反兩面疊在同一位置，靠背面隱藏決定誰現身 */
  body.spread .page.leaf {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    box-shadow: 0 5mm 26mm rgba(0, 0, 0, 0.55);
  }

  /* 翻到側面時壓暗，紙張才有轉進光線背面的感覺。
     少了這層，旋轉看起來就只是一張平面卡片在轉。
     時長由 JS 寫入 --flip-ms，與 transform 過場同步。 */
  body.spread .page.leaf::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 80;
    pointer-events: none;
    background: var(--ink);
    opacity: 0;
    animation: leaf-shade var(--flip-ms, 780ms) cubic-bezier(0.37, 0.01, 0.24, 1) both;
  }

  @keyframes leaf-shade {
    0% { opacity: 0; }
    50% { opacity: 0.32; }
    100% { opacity: 0; }
  }

  /* 書溝：左頁右緣、右頁左緣各壓一道內陰影 */
  body.spread .page.is-open[data-side="l"]::after,
  body.spread .page.is-open[data-side="r"]::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14mm;
    pointer-events: none;
    z-index: 50;
  }

  body.spread .page.is-open[data-side="l"]::after {
    right: 0;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.16));
  }

  body.spread .page.is-open[data-side="r"]::after {
    left: 0;
    background: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.16));
  }
}

/* ---------- 翻頁列 ---------- */
.spread-nav {
  position: fixed;
  bottom: 5mm;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  display: none;
  align-items: center;
  gap: 3mm;
  padding: 2mm 3mm;
  border-radius: 999px;
  background: rgba(13, 31, 19, 0.9);
  box-shadow: 0 1mm 4mm rgba(0, 0, 0, 0.35);
}

body.spread .spread-nav {
  display: flex;
}

.spread-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 9mm;
  height: 9mm;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13pt;
  line-height: 1;
  cursor: pointer;
}

.spread-nav button:disabled {
  opacity: 0.3;
  cursor: default;
}

.spread-nav button:not(:disabled):hover {
  background: var(--amber);
  color: var(--ink);
}

.spread-nav .count {
  min-width: 22mm;
  color: var(--mint);
  font-family: "Barlow Condensed", "Noto Sans TC", sans-serif;
  font-size: 11.5pt;
  letter-spacing: 0.04em;
  text-align: center;
  user-select: none;
}

/* 翻頁動畫開關 */
.spread-nav .toggle {
  width: auto;
  height: 7mm;
  padding: 0 3mm;
  margin-left: 1mm;
  border-radius: 999px;
  background: transparent;
  border: 0.3mm solid var(--sage);
  color: var(--mint);
  font-family: "Barlow Condensed", "Noto Sans TC", sans-serif;
  font-size: 10pt;
  letter-spacing: 0.02em;
}

.spread-nav .toggle[aria-pressed="true"] {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--ink);
  font-weight: 700;
}

.spread-nav .toggle:not(:disabled):hover {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

@media print {
  .spread-nav {
    display: none !important;
  }
}
