/* Transport fonts (Road Sign Factory) */
@font-face {
  font-family: "TransportMedium";
  src: url("fonts/TransportMedium.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "TransportHeavy";
  src: url("fonts/TransportHeavy.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* RSF Chinese Medium (500) — local, for Flag overlay */
@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans HK";
  src: url("fonts/NotoSansHK-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* MTR PIDS navy chrome */
  --mtr-navy: #002B54;
  /* v0.8 light station-board tokens */
  --ground: #ffffff;
  --ground-2: #e8e9eb;
  /* soft L→R wash — shared by header + page so no below-header seam */
  --split-left: var(--ground-2);
  --split-right: #c5d2e0; /* deeper cool wash (v0.25) */
  --split-grad: linear-gradient(
    90deg,
    var(--split-left) 0%,
    var(--split-left) 38%,
    color-mix(in srgb, var(--split-left) 55%, var(--split-right)) 58%,
    color-mix(in srgb, var(--split-left) 18%, var(--split-right)) 82%,
    var(--split-right) 100%
  );
  --ink: #121212;
  --mute: #5c5c5c;
  --rule: #121212;
  --ink-white: #ffffff;
  --ink-black: #000000;
  --neon-amber: #ffb020; /* kept for Flag :focus-visible */
  /* Non-flag UI 中文黑體；站名牌另用宋體；路牌 Flag 仍本地 Noto Sans TC Medium 500 */
  --zh: "Noto Sans TC", "Noto Sans HK", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --zh-station: "Noto Serif TC", "Source Han Serif TC", "Songti TC", serif;
  --en: "Source Sans 3", "Myriad Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* TPDM Flag gold v7 metrics at 461×138 plate */
  --flag-w: 461px;
  --xh: 21px;
  --en-fs: calc(1.88 * var(--xh));
  --zh-fs: calc(2.25 * var(--xh));
  --gap: 14px;
  --shield: 63px;
  --inset-l: 21.6%;
  --inset-r: 7.5%;
  --inset-t: 9%;
  --inset-b: 12%;
  --digit-nudge-y: 0;
  --route-yellow: #E9B500;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--zh), var(--en);
  background: var(--split-grad);
  color: var(--ink);
}

.page {
  min-height: calc(100vh - 72px);
  /* no top pad — sticky header sits flush under top-nav */
  padding: 0 clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem);
  background: var(--split-grad);
  overflow-x: clip;
}

/* —— v0.13 top nav: full-height hover, lang toggle, right hamburger —— */
.top-nav {
  position: relative;
  z-index: 40;
  width: 100%;
  height: 72px;
  background: var(--mtr-navy);
  color: #fff;
  display: flex;
  align-items: stretch;
  will-change: opacity;
}

.top-nav__inner {
  width: 100%;
  max-width: calc(60rem + 2 * clamp(1.5rem, 4vw, 3rem));
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.top-nav__mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  align-self: stretch;
  height: 100%;
  font-family: var(--zh), var(--en);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  padding: 0 1.15rem;
  border-radius: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.top-nav__mark:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-decoration: none;
}

.top-nav__mark:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  outline: 2px solid #fff;
  outline-offset: -2px;
  text-decoration: none;
}

.top-nav__spacer {
  display: none;
  flex: 1;
  min-width: 0;
}

.top-nav__lang {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0.2rem;
  margin-left: 0.35rem;
  padding: 0.2rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.top-nav__lang-btn {
  font-family: var(--zh), var(--en);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.top-nav__lang-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.top-nav__lang-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.top-nav__lang-btn.is-active {
  color: var(--mtr-navy);
  background: #fff;
}

.top-nav__menu-btn {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  color: #fff;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.top-nav__menu-btn:hover,
.top-nav__menu-btn:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.top-nav__menu-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.top-nav__burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 22px;
  height: 16px;
}

.top-nav__burger span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: #fff;
}

.top-nav__backdrop {
  display: none;
}

.top-nav__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.top-nav__links::-webkit-scrollbar {
  display: none;
}

.top-nav__links > li {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.top-nav__links a {
  display: flex;
  align-items: center;
  height: 100%;
  font-family: var(--zh), var(--en);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  padding: 0 1.15rem;
  border-radius: 0;
  border-bottom: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.top-nav__links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border-bottom-color: transparent;
}

.top-nav__links a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.28);
  outline: 2px solid #fff;
  outline-offset: -2px;
  border-radius: 0;
  border-bottom-color: transparent;
}

@media (max-width: 720px) {
  .top-nav {
    height: 64px;
  }

  .top-nav__mark {
    display: none;
  }

  .top-nav__spacer {
    display: block;
  }

  .top-nav__menu-btn {
    display: inline-flex;
    order: -1;
    margin-right: 0.25rem;
  }

  .top-nav__lang {
    margin-left: 0;
    margin-right: 0;
  }

  .top-nav__links {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: 64px;
    z-index: 45;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    height: auto;
    margin: 0;
    padding: 1rem clamp(1.25rem, 4vw, 2rem) 1.25rem;
    background: rgba(0, 43, 84, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    overflow: visible;
  }

  .top-nav__links.is-open {
    display: flex;
  }

  .top-nav__links > li {
    height: auto;
  }

  .top-nav__links a {
    display: flex;
    width: 100%;
    height: auto;
    font-size: 1.2rem;
    padding: 0.95rem 1.1rem;
    border-radius: 8px;
  }

  .top-nav__backdrop {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    z-index: 44;
    background: rgba(0, 20, 40, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  .top-nav__backdrop[hidden] {
    display: none;
  }

  body.nav-menu-open {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-nav__mark,
  .top-nav__menu-btn,
  .top-nav__lang-btn,
  .top-nav__links a {
    transition: none;
  }
}

/* —— v0.11 West Kowloon–style station name (centred, no frame) —— */
.station-board {
  max-width: 60rem;
  margin: 0 auto 2.75rem;
  padding: clamp(2.75rem, 8vw, 4.5rem) 1.25rem clamp(2.25rem, 6vw, 3.5rem);
  background: transparent;
  border: none;
  border-radius: 0;
  text-align: center;
  color: #0a1a3a;
}

.station-board__zh {
  margin: 0;
  font-family: var(--zh-station);
  font-weight: 700;
  font-size: clamp(3.2rem, 10vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: 0.12em;
  color: #0a1a3a;
}

.station-board__en {
  margin: 0.55rem 0 0;
  font-family: var(--en);
  font-weight: 600;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: #0a1a3a;
}

.page > main {
  padding-top: 0.25rem;
}

.junction {
  max-width: 60rem;
  margin: 0.5rem auto 0;
}

/* —— v0.7 Flag Left CSS overlay（TPDM 金樣 v7） —— */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, var(--flag-w)));
  gap: 20px 28px;
  justify-content: start;
  width: 100%;
}

.flag {
  position: relative;
  display: block;
  width: min(100%, var(--flag-w));
  max-width: var(--flag-w);
  text-decoration: none;
  color: #fff;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
  container-type: inline-size;
  container-name: flag;
  /* Scale metrics with plate width so mobile keeps gold ratios */
  --xh: calc(21 / 461 * 100cqw);
  --en-fs: calc(1.88 * var(--xh));
  --zh-fs: calc(2.25 * var(--xh));
  --gap: calc(14 / 461 * 100cqw);
  --shield: calc(63 / 461 * 100cqw);
  --digit-nudge-y: 0;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.flag:hover,
.flag:focus-visible {
  transform: translateX(4px);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)) brightness(1.06);
  outline: none;
}

.flag:focus-visible {
  outline: 3px solid var(--neon-amber);
  outline-offset: 4px;
}

.flag__plate {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

.flag__overlay {
  position: absolute;
  left: var(--inset-l);
  right: var(--inset-r);
  top: var(--inset-t);
  bottom: var(--inset-b);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--gap);
  pointer-events: none;
  overflow: visible;
}

.flag__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  line-height: 1;
  flex: 1;
  min-width: 0;
}

/* RSF EN: Transport Medium, 1.88 × xh */
.flag__text .en {
  font-family: "TransportMedium", sans-serif;
  font-size: var(--en-fs);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  color: #ffffff;
}

/* RSF ZH: Noto Sans TC Medium (500), 2.25 × xh */
.flag__text .zh {
  font-family: "Noto Sans TC", "Noto Sans HK", sans-serif;
  font-size: var(--zh-fs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: #ffffff;
  margin-top: calc(-0.30 * var(--xh));
}

.flag__shield {
  position: relative;
  flex-shrink: 0;
  width: var(--shield);
  height: var(--shield);
}

.flag__shield img,
.flag__shield svg.flag__shield-shape {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.flag__shield .num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  font-family: "TransportHeavy", sans-serif;
  font-size: calc(7.52 / 9 * var(--shield));
  font-weight: 700;
  color: #000;
  line-height: 1;
  transform: translateY(var(--digit-nudge-y));
}

.board {
  max-width: 60rem;
  margin: 2.25rem auto 0;
}

.board__plate {
  padding: 1.15rem 1.25rem;
  background: var(--ground);
  border: 1px solid #d8d8d4;
  border-left: 6px solid var(--route-yellow);
  border-radius: 8px;
}

.board__h {
  margin: 0 0 0.55rem;
  font-family: var(--zh);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.board__plate p {
  margin: 0;
  line-height: 1.7;
  color: var(--mute);
  max-width: 42rem;
}

.foot {
  max-width: 60rem;
  margin: 2.75rem auto 0;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-family: var(--en);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: var(--mute);
}

.foot__dot {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.45rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3a3a3a;
  box-shadow: none;
}

.foot__meta {
  min-width: 0;
}

.foot__credit {
  margin: 0;
  font-family: var(--zh), var(--en);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: var(--mute);
}

.foot__credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.foot__credit a:hover,
.foot__credit a:focus-visible {
  color: var(--ink);
}

@media (max-width: 720px) {
  .nav-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    justify-content: center;
    max-width: 22.5rem; /* ~360px; keep Flag plate readable, not edge-to-edge */
    margin-inline: auto;
    width: 100%;
  }
  .flag {
    width: 100%;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flag {
    transition: none;
  }
}

/* —— v0.15 Gantry：cache-bust + SVG 尺寸加固（唔改 Flag） —— */
.gantry-wrap {
  display: block;
  width: 100%;
  max-width: 60rem;
  margin: 1.75rem 0 0;
}

a.gantry {
  /* Gantry metrics scoped — do not touch Flag --xh */
  --g-xh: 16px;
  --g-sw: calc(var(--g-xh) / 4);
  --g-en-fs: calc(2.26 * var(--g-xh)); /* was 1.88; +~20% 張老師放大 */
  --g-zh-fs: calc(2.70 * var(--g-xh)); /* was 2.25; +~20% */
  --g-border: calc(1.5 * var(--g-sw));
  --g-pad-x: calc(2.5 * var(--g-sw));
  --g-pad-y: calc(2.5 * var(--g-sw)); /* outer bottom; nudge arrows down */
  --g-pad-top: calc(3.25 * var(--g-sw));
  --g-top-min: calc(4.2 * var(--g-xh));
  --g-board-min: calc(15 * var(--g-xh)); /* ~240px; room for larger lower-band glyphs */
  --g-radius-outer: calc(3 * var(--g-sw));
  /* modest arrow scale with taller board (was 54×24) */
  --g-arrow-w: 88px; /* was 65; +~35% — fill lower band between divider & bottom stroke */
  --g-arrow-h: 39px; /* was 29 */
  --g-express-h: calc(2.76 * var(--g-xh)); /* was 2.3; +20%; top-right anchored */
  --g-side-w: calc(2.8 * var(--g-xh));
  --g-shield-h: 32px; /* was 24; +~33% with arrows */
  --g-divider-h: calc(0.4 * var(--g-sw));
  --g-mark-inset: calc(2 * var(--g-sw));
  --g-green: #006928;
  --g-bottom-pad-y: calc(1.25 * var(--g-sw)); /* less under arrows; keep clear of stroke */
  --g-bottom-gap: calc(4 * var(--g-sw)); /* was 2.5; 下帶再下一點 */

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--g-board-min);
  box-sizing: border-box;
  text-decoration: none;
  color: #ffffff;
  background: var(--g-green);
  border: var(--g-border) solid #ffffff;
  border-radius: var(--g-radius-outer);
  padding: var(--g-pad-top) var(--g-pad-x) var(--g-pad-y);
  gap: 0; /* top grows; bottom locks via margin-top:auto */
  overflow: hidden; /* clip ExpresswayRed if CSS late / SVG intrinsic size */
  isolation: isolate;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
  transition: transform 0.15s ease, filter 0.15s ease;
}

a.gantry:hover,
a.gantry:focus-visible {
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)) brightness(1.06);
  outline: none;
}

a.gantry:focus-visible {
  outline: 3px solid var(--neon-amber);
  outline-offset: 4px;
}

.gantry__top {
  display: grid;
  grid-template-columns: var(--g-side-w) 1fr var(--g-side-w);
  align-items: stretch;
  column-gap: calc(1 * var(--g-sw));
  min-height: var(--g-top-min);
  flex: 1 1 auto; /* absorbs extra height above divider */
  width: 100%;
}

.gantry__side {
  display: flex;
  min-width: 0;
}

.gantry__side--left {
  justify-content: flex-start;
  align-items: center;
  align-self: center;
}

.gantry__side--right {
  justify-content: flex-end;
  align-items: flex-start;
  align-self: start;
}

.gantry__text {
  display: flex;
  flex-direction: column;
  align-items: center;          /* horizontal center of EN+ZH stack */
  justify-content: center;      /* vertical center within text flex */
  align-self: center;           /* geometric center of top band above divider */
  justify-self: center;
  min-width: 0;
  line-height: 1;
  text-align: center;
  padding-top: 0;
  transform: none;              /* drop v8 translateY(-0.40×xh) high nudge */
}

.gantry__text .en {
  font-family: "TransportMedium", sans-serif;
  font-size: var(--g-en-fs);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  color: #ffffff;
}

.gantry__text .zh {
  font-family: "Noto Sans TC", "Noto Sans HK", sans-serif;
  font-size: var(--g-zh-fs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: #ffffff;
  margin-top: calc(0.15 * var(--g-xh));
}

.gantry__express {
  position: absolute;
  top: var(--g-mark-inset);
  right: var(--g-mark-inset);
  z-index: 2;
  flex-shrink: 0;
  width: var(--g-express-h);
  height: var(--g-express-h);
  max-width: 48px;
  max-height: 48px;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Divider + arrow row locked as one lower band → follows board bottom */
.gantry__bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  margin-top: auto; /* pin to bottom as board grows */
  width: 100%;
  gap: var(--g-bottom-gap);
  padding-top: calc(1.5 * var(--g-sw)); /* air above divider inside bottom band */
  padding-bottom: var(--g-bottom-pad-y); /* air above bottom white stroke */
}

.gantry__divider {
  width: 100%;
  height: var(--g-divider-h);
  min-height: 1px;
  background: #ffffff;
  border: 0;
  margin: 0;
  flex-shrink: 0;
}

.gantry__lanes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  width: 100%;
  padding-top: 0;
  padding-bottom: 0;
  column-gap: 0;
}

.gantry__lane {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-width: 0;
}

.gantry__lane .gantry__arrow {
  grid-column: 2;
  justify-self: center;
}

.gantry__lane .gantry__shield {
  grid-column: 3;
  justify-self: start;
  margin-left: calc(1.25 * var(--g-sw)); /* modest gap arrow↔shield */
}

.gantry__arrow {
  display: block;
  width: var(--g-arrow-w);
  height: var(--g-arrow-h);
  flex-shrink: 0;
}

.gantry__shield {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--g-shield-h) * 1);
  height: var(--g-shield-h);
  flex-shrink: 0;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
}

.gantry__shield-shape {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  border: 0;
  outline: none;
  box-shadow: none;
}
.gantry__shield-shape path {
  fill: #E9B500;
  stroke: none;
  stroke-width: 0;
}

.gantry__shield .num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "TransportHeavy", sans-serif;
  font-weight: 700;
  font-size: calc(0.72 * var(--g-shield-h));
  line-height: 1;
  color: #000000;
  transform: translateY(calc(0.08 * var(--g-shield-h)));
  pointer-events: none;
}

@media (max-width: 720px) {
  a.gantry {
    --g-xh: 12px;
    --g-en-fs: calc(1.9 * var(--g-xh));
    --g-zh-fs: calc(2.25 * var(--g-xh));
    --g-board-min: calc(11.5 * var(--g-xh));
    --g-arrow-w: 52px;
    --g-arrow-h: 23px;
    --g-shield-h: 22px;
    --g-express-h: calc(2.4 * var(--g-xh));
    --g-side-w: calc(2.2 * var(--g-xh));
    --g-bottom-gap: calc(2.5 * var(--g-sw));
    --g-pad-x: calc(2 * var(--g-sw));
    --g-pad-y: calc(2 * var(--g-sw));
    --g-pad-top: calc(2.5 * var(--g-sw));
  }
  .gantry__express {
    width: var(--g-express-h);
    height: var(--g-express-h);
    max-width: 32px;
    max-height: 32px;
  }
  .gantry-wrap {
    margin-top: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  a.gantry {
    transition: none;
  }
}

/* —— v0.27 header: shared page wash · flush under nav · LRT Phase IV graphic —— */
.pin-scene {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  box-sizing: border-box;
  height: 145vh;
  background: var(--split-grad);
}

.pin-sticky {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: stretch;
  min-height: clamp(18rem, 42vh, 28rem);
  gap: clamp(0.75rem, 2vw, 1.5rem);
  padding: 0.85rem clamp(1rem, 2.5vw, 2rem) 2.1rem;
  overflow-x: hidden;
  overflow-y: hidden; /* clip train; avoid nested scroll */
  background: var(--split-grad);
}

/* Light Rail Phase IV side cutout (944×172) — ~24px tall (v0.29); original PNG untouched (ND) */
.train-bar {
  position: absolute;
  left: 0;
  bottom: 0.85rem;
  display: block;
  height: 1.5rem; /* 24px — enlarged train bar */
  width: auto;
  aspect-ratio: 944 / 172;
  max-width: 10rem;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border: 0;
  /* presentation edge only — does not modify/redistribute the asset */
  filter: drop-shadow(0 0.5px 0.6px rgba(0, 0, 0, 0.45));
  transform: translateX(-110%);
  will-change: transform;
  pointer-events: none;
  z-index: 6;
  user-select: none;
}

/* Left 大半：創科站 */
.pin-sticky .station-board {
  flex: 2.6 1 0;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0.65rem clamp(0.75rem, 2.5vw, 1.75rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: none;
  transform-origin: center center;
  will-change: transform, opacity;
}

.pin-sticky .station-board__zh {
  font-size: clamp(4.6rem, 13vw, 8.6rem);
  letter-spacing: 0.14em;
  line-height: 1.02;
}

.pin-sticky .station-board__en {
  margin-top: 0.65rem;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
}

/* Right：四個 Flag 直排 — 461×138 比例鎖死 · space-evenly */
.pin-sticky .nav-grid--stack {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: stretch;
  gap: 0;
  width: min(26rem, 36vw);
  max-width: 26rem;
  height: 100%;
  min-height: clamp(18rem, 42vh, 28rem);
  margin: 0 0 0 auto;
  align-self: stretch;
  box-sizing: border-box;
  padding: 0.15rem 0;
}

.pin-sticky .nav-grid--stack .flag {
  width: 100%;
  max-width: none;
  height: auto;
  flex: 0 0 auto;
  --flag-w: 100%;
  container-type: inline-size;
  aspect-ratio: 461 / 138;
}

.pin-sticky .nav-grid--stack .flag__plate {
  width: 100%;
  height: auto;
  aspect-ratio: 461 / 138;
  object-fit: contain;
  display: block;
}

.pin-sticky .nav-grid--stack .flag:hover,
.pin-sticky .nav-grid--stack .flag:focus-visible {
  transform: translateY(-2px);
}

@supports not (background: color-mix(in srgb, white 50%, black)) {
  :root {
    --split-grad: linear-gradient(90deg, #e8e9eb 0%, #e8e9eb 38%, #d7dee6 58%, #ccd6e2 82%, #c5d2e0 100%);
  }
}

@media (max-width: 720px) {
  .pin-scene {
    height: auto;
    width: 100%;
    max-width: none;
    margin-left: calc(-1 * clamp(1.5rem, 4vw, 3rem));
    margin-right: calc(-1 * clamp(1.5rem, 4vw, 3rem));
  }

  .pin-sticky {
    position: static;
    top: auto;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 1.25rem clamp(0.85rem, 3vw, 1.25rem) 1.35rem;
    overflow: visible;
    background: linear-gradient(
      180deg,
      var(--split-left) 0%,
      color-mix(in srgb, var(--split-left) 55%, var(--split-right)) 55%,
      var(--split-right) 100%
    );
  }

  .pin-sticky .station-board {
    flex: none;
    width: 100%;
    transform: none;
    will-change: auto;
  }

  .pin-sticky .station-board__zh {
    font-size: clamp(3.4rem, 14vw, 4.4rem);
  }

  .pin-sticky .station-board__en {
    font-size: clamp(1.15rem, 3.5vw, 1.55rem);
  }

  .pin-sticky .nav-grid--stack {
    flex: none;
    width: min(100%, 16rem);
    max-width: 16rem;
    margin-inline: auto;
    min-height: 0;
    height: auto;
    gap: 8px;
  }

  .train-bar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pin-scene {
    height: auto;
  }
  .pin-sticky {
    position: static;
    height: auto;
  }
  .pin-sticky .station-board {
    transform: none !important;
    opacity: 1 !important;
  }
  .train-bar {
    display: none;
  }
}


/* —— v0.18 project / resources —— */
.page--project {
  padding-top: 1.25rem;
}
.station-board--project {
  margin: 1.5rem auto 0;
  max-width: 60rem;
  text-align: left;
  padding-inline: 0.25rem;
}
.station-board--project .station-board__zh {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
}
.station-board--project .station-board__en {
  font-size: 1rem;
  letter-spacing: 0.14em;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin-bottom: 0.35rem;
}
.project-meta .board__h {
  margin: 0;
}
.ver-badge {
  display: inline-block;
  font-family: var(--en);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--mtr-navy);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  line-height: 1.2;
}
.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem !important;
}
.btn {
  display: inline-block;
  font-family: var(--zh);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #121212;
  border-radius: 6px;
  padding: 0.55rem 0.95rem;
  line-height: 1.3;
}
.btn:hover {
  background: #f3f3f0;
}
.btn--primary {
  background: var(--mtr-navy);
  border-color: var(--mtr-navy);
  color: #fff;
}
.btn--primary:hover {
  background: #003a6e;
  border-color: #003a6e;
  color: #fff;
}
.btn--ghost {
  border-color: #b0b0aa;
  color: var(--mute);
}
.project-shot {
  margin: 0.75rem 0 0;
}
.project-shot img {
  display: block;
  width: 100%;
  max-width: 42rem;
  height: auto;
  border: 1px solid #d8d8d4;
  border-radius: 6px;
  background: #fff;
}
.project-list {
  margin: 0.4rem 0 0.75rem;
  padding-left: 1.2rem;
  color: var(--mute);
  line-height: 1.75;
  max-width: 42rem;
}
.project-list li {
  margin: 0.2rem 0;
}
.project-list code,
.muted code,
.flash-stub code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #f0f0ec;
  padding: 0.08em 0.35em;
  border-radius: 3px;
}
.muted {
  margin-top: 0.75rem !important;
  font-size: 0.9rem;
}
.flash-stub {
  margin-top: 0.85rem !important;
  padding: 0.75rem 0.9rem;
  background: #f7f4e8;
  border-left: 4px solid var(--route-yellow);
  border-radius: 4px;
  color: var(--ink);
  max-width: 42rem;
}
.resource-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.resource-card {
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid #d8d8d4;
  border-left: 5px solid #006928;
  border-radius: 6px;
}
.resource-card__link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  text-decoration: none;
  color: inherit;
}
.resource-card__title {
  font-family: var(--zh);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.resource-card__acts {
  margin: 0.55rem 0 0 !important;
  font-family: var(--en);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}
.resource-card__acts a {
  color: var(--mtr-navy);
  font-weight: 600;
  text-decoration: none;
}
.resource-card__acts a:hover {
  text-decoration: underline;
}

/* —— secret entry target: station name (v0.20) —— */
#station-zh-secret {
  cursor: default;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
