/* Persatuan Ng Malaysia — site styles, v2
   Concept: a quiet ancestral hall on paper. Generous white space, framed photographs,
   vertical Chinese section titles with a small seal, thin rules and outlined buttons.
   Red is a seal colour only, never a background. Single committed light look. */
:root {
  --paper: #F4F2EE;      /* xuan paper */
  --paper-2: #ECE8E1;    /* shaded paper band */
  --card: #FCFBF9;       /* white card on paper */
  --ink: #2B2623;        /* ink */
  --ink-soft: #6E655E;   /* light ink */
  --seal: #B8321F;       /* seal red, tuned toward the logo's red; accents only */
  --wood: #3A2A22;       /* plaque wood */
  --gold: #B8913F;       /* plaque gilding */
  --tide: #8FA3A1;       /* Qiantang tide, used for the fret pattern */
  --line: #D9D3C9;

  --f-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --wrap: 76rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--paper);
  /* faint paper fibre */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.25 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  font-family: var(--f-serif); font-weight: 400; font-size: 1.0625rem; line-height: 1.85; letter-spacing: 0.01em;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { color: var(--seal); }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--f-serif); margin: 0; line-height: 1.3; text-wrap: balance; font-weight: 600; }
p { margin: 0; }
.han { font-weight: 600; }

.wrap {
  max-width: var(--wrap); margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.band { padding-block: clamp(4rem, 9vw, 7.5rem); }
.band--shade { background: var(--paper-2); }

/* Fret (回纹) rule, used sparingly as a divider */
.fret {
  height: 12px; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 11.5H10V2.5H4V8H7V5.5' fill='none' stroke='%238FA3A1' stroke-width='1'/%3E%3Cpath d='M12 11.5H22V2.5H16V8H19V5.5' fill='none' stroke='%238FA3A1' stroke-width='1'/%3E%3Cpath d='M10 11.5H12M22 11.5H24' stroke='%238FA3A1' stroke-width='1'/%3E%3C/svg%3E") repeat-x center;
}
.divider { width: 5rem; height: 1px; background: var(--ink-soft); margin: 0 auto; opacity: .6; }

/* Seal mark */
.seal {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem;
  background: var(--seal); color: #FBF3EE; font-size: .95rem; font-weight: 600; line-height: 1;
  border-radius: 3px;
}

/* Vertical Chinese section title */
.vtitle { display: grid; grid-auto-flow: column; gap: .6rem; align-items: start; justify-content: start; }
.vtitle .zh { display: flex; flex-direction: column; font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 1.15; font-weight: 600; letter-spacing: .05em; }
.vtitle .en { writing-mode: vertical-rl; font-size: .8rem; letter-spacing: .14em; color: var(--ink-soft); padding-top: .3rem; }
.vtitle .seal { margin-top: .5rem; }

/* Buttons: outlined, like a framed label */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.6rem; min-width: 12rem; text-decoration: none; letter-spacing: .08em; font-size: .95rem;
  border: 1px solid var(--ink); background: var(--card); color: var(--ink);
  box-shadow: 3px 3px 0 0 var(--ink); transition: transform .15s, box-shadow .15s;
}
.btn:hover { color: var(--ink); transform: translate(2px, 2px); box-shadow: 1px 1px 0 0 var(--ink); }
.btn--seal { background: var(--seal); color: #FBF3EE; border-color: var(--seal); box-shadow: 3px 3px 0 0 #6E1F19; }
.btn--seal:hover { color: #FBF3EE; box-shadow: 1px 1px 0 0 #6E1F19; }

/* Header: hanging name tag in the middle, menu either side */
.site-header .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: clamp(1.5rem, 3vw, 3rem); }
.nav { display: flex; flex-wrap: wrap; gap: .4rem 2rem; padding-top: 1rem; font-size: .95rem; letter-spacing: .06em; }
.nav--left { justify-content: flex-end; }
.nav a { text-decoration: none; display: grid; justify-items: center; line-height: 1.4; }
.nav a small { font-size: .72rem; color: var(--ink-soft); letter-spacing: .1em; }
.nav a:hover small { color: var(--seal); }
.nav .nav-join { color: var(--seal); }
.tag {
  display: block; width: clamp(10.5rem, 15vw, 13.5rem); text-decoration: none;
  background: var(--card); padding: 1.5rem 1.35rem 1.35rem;
  border-radius: 0 0 4px 4px; position: relative;
  box-shadow: 0 1px 0 var(--line), 0 10px 24px -12px rgba(43,38,35,.28);
}
/* a thin inner rule, like the border of a name board */
.tag::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line); border-top: 0; pointer-events: none; border-radius: 0 0 2px 2px; }
.tag img { width: 100%; height: auto; }
.tag:hover { box-shadow: 0 1px 0 var(--line), 0 14px 28px -12px rgba(43,38,35,.34); }

/* Hero */
.hero { padding-top: 2rem; }
.hero-frame { margin: 0; background: var(--card); padding: clamp(6px, 1vw, 12px); box-shadow: 0 0 0 1px var(--line); }
/* Slider: photos cross-fade inside the white frame; caption and controls sit on the frame below */
.slides { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-2); }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .9s ease; }
.slide.is-active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.slider-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 2.1rem; height: 2.1rem; display: grid; place-items: center; cursor: pointer; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.7); background: rgba(252,251,249,.82); color: var(--ink);
  transition: background .15s, color .15s;
}
.slider-btn--prev { left: clamp(.6rem, 1.5vw, 1.25rem); }
.slider-btn--next { right: clamp(.6rem, 1.5vw, 1.25rem); }
.slider-btn:hover { background: var(--card); color: var(--seal); }
.hero-statement { text-align: center; display: grid; gap: 1.5rem; justify-items: center; padding-block: clamp(3rem, 7vw, 5.5rem) 0; }
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 3.2rem); font-weight: 400; letter-spacing: .01em; max-width: 22ch; }
.hero h1 .han { font-weight: 600; color: var(--seal); }
.hero-lede { max-width: 36rem; color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; justify-content: center; padding-top: .5rem; }

/* News card */
.news { background: var(--card); padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 4vw, 2.75rem); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem 2.5rem; box-shadow: 0 1px 0 var(--line); }
.news-title { display: grid; align-content: start; border-right: 1px solid var(--line); padding-right: 2rem; }
.news-title h2 { font-size: 1.3rem; }
.news-title span { font-size: .8rem; color: var(--ink-soft); letter-spacing: .1em; }
.news ul { list-style: none; margin: 0; padding: 0; display: grid; }
.news li { display: grid; grid-template-columns: 9.5rem 5.5rem minmax(0, 1fr); gap: .25rem 1rem; padding-block: .7rem; border-bottom: 1px solid var(--line); align-items: baseline; }
.news li:last-child { border-bottom: 0; }
.news time { font-variant-numeric: tabular-nums; font-size: .92rem; color: var(--ink-soft); }
.news .kind { font-size: .75rem; letter-spacing: .08em; text-align: center; padding: .05rem .4rem; border: 1px solid var(--tide); color: #4E6664; }
.news .kind--event { border-color: var(--seal); color: var(--seal); }

/* Feature blocks: photo + text + vertical title */
.feature { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: clamp(1.5rem, 4vw, 4rem); align-items: center; }
.feature--rev { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.1fr); }
.feature--rev .feature-photo { order: 3; }
.feature--rev .vtitle { order: 1; }
.feature--rev .feature-body { order: 2; }
.feature-photo { margin: 0; display: grid; gap: .5rem; background: var(--card); padding: 8px 8px 10px; box-shadow: 0 0 0 1px var(--line); }
.feature-photo img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.feature-photo figcaption { font-size: .82rem; color: var(--ink-soft); padding-inline: 2px; }
.feature-body { display: grid; gap: 1.25rem; align-content: center; min-width: 0; }
.feature-body h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 400; }
.feature-body p { color: var(--ink-soft); }

.chapters { list-style: none; margin: 0; padding: 0; display: grid; }
.chapters li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .75rem; padding-block: .8rem; border-top: 1px solid var(--line); }
.chapters li:last-child { border-bottom: 1px solid var(--line); }
.chapters .n { color: var(--seal); font-weight: 600; }
.chapters a { text-decoration: none; font-weight: 600; }
.chapters a:hover { text-decoration: underline; }
.chapters p { font-size: .95rem; }

blockquote { margin: 0; display: grid; gap: .9rem; padding-left: 1.25rem; border-left: 2px solid var(--seal); }
blockquote p { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.7; color: var(--ink) !important; }
blockquote cite { font-style: normal; font-size: .88rem; color: var(--ink-soft); }

/* Route */
.route-head { text-align: center; display: grid; gap: .75rem; justify-items: center; margin-bottom: 3rem; }
.route-head h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 400; }
.route-head p { color: var(--ink-soft); max-width: 36rem; }
.route { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; position: relative; }
.route::before { content: ""; position: absolute; left: 4%; right: 4%; top: 2.1rem; border-top: 1px dashed var(--tide); }
.route li { display: grid; gap: .3rem; justify-items: center; text-align: center; position: relative; min-width: 0; }
.route .place { font-size: 2.1rem; font-weight: 600; line-height: 1.6; background: var(--paper-2); padding-inline: .6rem; }
.route li:last-child .place { color: var(--seal); }
.route .en { font-weight: 600; font-size: .95rem; }
.route .when { font-size: .78rem; letter-spacing: .08em; color: #4E6664; }
.route p { font-size: .88rem; color: var(--ink-soft); line-height: 1.6; max-width: 14rem; }

/* Plaques */
.plaques-head { text-align: center; display: grid; gap: .75rem; justify-items: center; margin-bottom: 3rem; }
.plaques-head h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 400; }
.plaques-head p { color: var(--ink-soft); max-width: 34rem; }
.plaque-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 3vw, 2.5rem); }
.plaque { display: grid; gap: 1rem; justify-items: center; text-align: center; min-width: 0; }
.plaque-board {
  display: block; width: 100%; max-width: 20rem; font-size: clamp(1.7rem, 2.8vw, 2.2rem); font-weight: 600; letter-spacing: .3em; text-indent: .3em;
  color: var(--gold); background: var(--wood); padding: .9rem .5rem; line-height: 1.4;
  box-shadow: inset 0 0 0 4px var(--wood), inset 0 0 0 5px var(--gold);
}
.plaque h3 { font-size: 1.05rem; }
.plaque p { font-size: .95rem; color: var(--ink-soft); max-width: 20rem; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 1rem; padding-block: .65rem; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.timeline b { color: var(--seal); font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline span { font-size: .95rem; color: var(--ink-soft); }

/* Bottom cards: four doors */
.doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2rem); }
.door { display: grid; gap: .9rem; grid-template-rows: auto 1fr auto; min-width: 0; }
.door img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.door-label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: start; margin-top: -2.4rem; position: relative; }
.door-label .zh { display: flex; flex-direction: column; font-size: 1.5rem; line-height: 1.15; font-weight: 600; background: var(--paper); padding: .5rem .45rem .2rem; }
.door-label div { padding-top: 2.6rem; display: grid; gap: .35rem; }
.door-label h3 { font-size: 1rem; }
.door-label p { font-size: .9rem; color: var(--ink-soft); line-height: 1.7; }
.door .btn { min-width: 0; width: 100%; }

/* Footer */
.site-footer { padding-top: 2.5rem; }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; padding-block: 2.5rem 2rem; border-top: 1px solid var(--ink); }
.footer-brand { display: grid; gap: .6rem; align-content: start; }
.footer-logo { width: 11rem; height: auto; margin-bottom: .4rem; }
.footer-brand address { font-style: normal; font-size: .92rem; color: var(--ink-soft); line-height: 1.8; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; font-size: .9rem; justify-content: flex-end; align-content: start; }
.footer-nav a { text-decoration: none; }
.footer-contact { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .75rem 2rem; font-size: .92rem; }
.footer-contact span { color: var(--ink-soft); }
.legal { grid-column: 1 / -1; font-size: .78rem; color: var(--ink-soft); }

/* ===== Inner pages ===== */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-head .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: end; }
.crumbs { font-size: .85rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 400; max-width: 20ch; }
.page-head .lede { margin-top: 1.25rem; max-width: 40rem; color: var(--ink-soft); font-size: 1.1rem; }
.page-head .vtitle .zh { font-size: clamp(2.2rem, 4vw, 3.2rem); }

.subnav { border-block: 1px solid var(--line); }
.subnav .wrap { display: flex; flex-wrap: wrap; gap: .25rem 2rem; padding-block: .8rem; font-size: .92rem; }
.subnav a { text-decoration: none; color: var(--ink-soft); padding-block: .2rem; border-bottom: 1px solid transparent; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--seal); }

.prose { max-width: 42rem; display: grid; gap: 1.2rem; }
.prose h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); font-weight: 400; margin-top: 1.5rem; }
.prose h3 { font-size: 1.1rem; margin-top: .75rem; }
.prose ul, .prose ol { margin: 0; padding-left: 1.25rem; display: grid; gap: .4rem; }
.prose .note { font-size: .92rem; color: var(--ink-soft); border-left: 2px solid var(--line); padding-left: 1rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.two-col > * { min-width: 0; }
.sticky { position: sticky; top: 1.5rem; }
.photo { margin: 0; display: grid; gap: .5rem; }
.photo img { width: 100%; height: auto; }
.photo--frame { background: var(--card); padding: 8px; box-shadow: 0 0 0 1px var(--line); }
.photo figcaption { font-size: .82rem; color: var(--ink-soft); }
.photo-stack { display: grid; gap: 1.5rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: .65rem .75rem .65rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-weight: 600; font-size: .85rem; color: var(--ink-soft); border-bottom-color: var(--ink); }
table.data td:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); }
.card { background: var(--card); box-shadow: 0 0 0 1px var(--line); padding: 1.5rem; display: grid; gap: .7rem; align-content: start; min-width: 0; }
.card h3 { font-size: 1.1rem; }
.card p { font-size: .95rem; color: var(--ink-soft); }
.card .meta { font-size: .8rem; color: #4E6664; letter-spacing: .04em; }
.card img { width: calc(100% + 3rem); max-width: none; margin: -1.5rem -1.5rem .5rem; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.card a.more { font-size: .92rem; }

.chapter-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.chapter-nav a { text-decoration: none; display: grid; gap: .2rem; }
.chapter-nav a span { font-size: .8rem; color: var(--ink-soft); }
.chapter-nav .next { text-align: right; }

.story { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.5rem; padding-block: 2rem; border-top: 1px solid var(--line); }
.story:last-child { border-bottom: 1px solid var(--line); }
.story-place { display: grid; gap: .3rem; align-content: start; }
.story-place b { font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.story-place span { font-size: .82rem; color: var(--ink-soft); }
.story h2 { font-size: 1.3rem; font-weight: 600; }
.story p { color: var(--ink-soft); margin-top: .5rem; }
.story .src { font-size: .8rem; margin-top: .75rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: .75rem; }
.gallery a { display: block; background: var(--card); padding: 5px; box-shadow: 0 0 0 1px var(--line); }
.gallery img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.album { display: grid; gap: 1rem; padding-block: 2rem; border-top: 1px solid var(--line); }
.album h2 { font-size: 1.3rem; font-weight: 400; display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.album h2 small { font-size: .85rem; color: var(--ink-soft); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 1rem; padding-block: 1.1rem; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--seal); color: var(--seal); display: grid; place-items: center; font-size: .9rem; }
.steps b { display: block; font-weight: 600; }
.steps span { color: var(--ink-soft); font-size: .95rem; }

.bank { background: var(--card); box-shadow: 0 0 0 1px var(--line); padding: 1.5rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; }
.bank dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1.25rem; }
.bank dt { color: var(--ink-soft); font-size: .9rem; }
.bank dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.qr { width: 9rem; aspect-ratio: 1; display: grid; place-items: center; text-align: center; font-size: .78rem; color: var(--ink-soft); border: 1px dashed var(--ink-soft); padding: .75rem; background: var(--paper); }

.todo { border: 1px dashed var(--seal); color: var(--seal); background: rgba(184,50,31,.04); padding: .9rem 1.1rem; font-size: .9rem; line-height: 1.6; }
.todo b { font-weight: 600; }

.dl-list { list-style: none; margin: 0; padding: 0; display: grid; }
.dl-list li { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; padding-block: 1.5rem; border-top: 1px solid var(--line); }
.dl-list li:last-child { border-bottom: 1px solid var(--line); }
.dl-list img, .dl-list .thumb { width: 6rem; height: auto; aspect-ratio: 3 / 4; object-fit: cover; box-shadow: 0 0 0 1px var(--line); background: var(--card); }
.dl-list .thumb { display: grid; place-items: center; font-size: 1.6rem; color: var(--seal); font-weight: 600; }
.dl-list h2 { font-size: 1.15rem; }
.dl-list p { font-size: .92rem; color: var(--ink-soft); }
.dl-list .size { font-size: .8rem; color: #4E6664; }
.dl-list .btn { min-width: 9rem; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 0 2rem; }
.people div { display: grid; grid-template-columns: 12rem minmax(0, 1fr); align-items: baseline; gap: .75rem; padding-block: .6rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
.people dt { color: var(--ink-soft); font-size: .85rem; }
.people dd { margin: 0; font-weight: 600; }

.callout { background: var(--paper-2); padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; gap: 1rem; justify-items: start; }
.callout h2 { font-size: 1.4rem; font-weight: 400; }
.callout p { color: var(--ink-soft); max-width: 40rem; }

/* Responsive */
@media (max-width: 980px) {
  .feature, .feature--rev { grid-template-columns: minmax(0, 1fr); }
  .feature .vtitle, .feature--rev .vtitle { order: 0; grid-auto-flow: row; }
  .feature .vtitle .zh, .feature--rev .vtitle .zh { flex-direction: row; gap: .1em; }
  .feature .vtitle .en { writing-mode: horizontal-tb; padding-top: 0; }
  .feature--rev .feature-photo { order: 1; }
  .feature--rev .feature-body { order: 2; }
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2.5rem; }
  .route { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .route::before { left: 50%; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 1px dashed var(--tide); }
}
@media (max-width: 760px) {
  .page-head .wrap { grid-template-columns: minmax(0, 1fr); }
  .page-head .vtitle { display: none; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .story { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .bank { grid-template-columns: minmax(0, 1fr); }
  .dl-list li { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .dl-list img, .dl-list .thumb { width: 4.5rem; }
  .dl-list .btn { grid-column: 1 / -1; }
  .chapter-nav { grid-template-columns: minmax(0, 1fr); }
  .chapter-nav .next { text-align: left; }
  .site-header .wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: .75rem; }
  .tag { order: -1; width: 11rem; padding: 1.1rem 1rem 1rem; }
  .nav { padding-top: 0; justify-content: center; gap: .25rem 1.25rem; }
  .nav--left { justify-content: center; }
  .slides { aspect-ratio: 4 / 3; }
  .slider-btn { width: 1.9rem; height: 1.9rem; }
  .news { grid-template-columns: minmax(0, 1fr); }
  .news-title { border-right: 0; padding-right: 0; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
  .news li { grid-template-columns: auto auto; }
  .news li a { grid-column: 1 / -1; }
  .plaque-row { grid-template-columns: minmax(0, 1fr); }
  .site-footer .wrap { grid-template-columns: minmax(0, 1fr); }
  .footer-nav { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .doors { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Contact list */
.contacts, .prose .contacts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.contacts li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem 1.25rem; align-items: baseline; padding-block: .7rem; border-top: 1px solid var(--line); }
.contacts li:last-child { border-bottom: 1px solid var(--line); }
.contact-name { font-weight: 600; }
.contact-num { font-variant-numeric: tabular-nums; text-decoration: none; }
.contact-wa { font-size: .85rem; color: var(--seal); }
@media (max-width: 520px) { .contacts li { grid-template-columns: minmax(0, 1fr) auto; } .contact-name { grid-column: 1 / -1; } }
.contact-name small { font-weight: 400; font-size: .82rem; color: var(--ink-soft); }
.contacts li { align-items: center; }
.people .zh-role { display: block; font-size: .8rem; color: var(--ink-soft); opacity: .85; margin-top: .1rem; }
.people div { align-items: start; }

/* Route timeline: align stops to the top, and a quiet draw-in when it scrolls into view */
.route li { align-content: start; }
.route.is-armed::before { transform: scaleX(0); transform-origin: left center; }
.route.is-armed li { opacity: 0; transform: translateY(10px); }
.route.is-armed.is-in::before { transform: scaleX(1); transition: transform 1.6s cubic-bezier(.4, 0, .2, 1); }
.route.is-armed.is-in li { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; }
.route.is-armed.is-in li:nth-child(1) { transition-delay: .15s; }
.route.is-armed.is-in li:nth-child(2) { transition-delay: .45s; }
.route.is-armed.is-in li:nth-child(3) { transition-delay: .75s; }
.route.is-armed.is-in li:nth-child(4) { transition-delay: 1.05s; }
.route.is-armed.is-in li:nth-child(5) { transition-delay: 1.35s; }
@media (max-width: 980px) {
  .route.is-armed::before { transform: scaleY(0); transform-origin: center top; }
  .route.is-armed.is-in::before { transform: scaleY(1); }
}

/* =====================================================================
   MOBILE OPTIMISATIONS (max-width: 760px)
   Everything below only applies on phones. The two hidden-by-default
   rules are the only base rules, and they render nothing on desktop.
   ===================================================================== */
.menu-btn, .mobile-menu { display: none; }

@media (max-width: 760px) {
  /* Header: logo tag centred, burger on the right */
  .site-header .wrap { grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; justify-items: center; align-items: center; gap: .5rem; }
  .site-header .nav { display: none; }
  .tag { order: 0; grid-column: 2; width: 9.25rem; padding: 1rem .9rem .9rem; }
  .menu-btn {
    grid-column: 3; justify-self: end; display: grid; align-content: center; gap: 6px;
    width: 2.75rem; height: 2.75rem; padding: 0 .35rem; background: none; border: 0; cursor: pointer; color: var(--ink);
    position: relative; z-index: 60;
  }
  .menu-btn span { display: block; height: 2px; width: 100%; background: currentColor; border-radius: 1px; transition: transform .25s ease, opacity .2s ease; }
  .menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* Menu sheet: drops in under the header, paper ground */
  .mobile-menu {
    display: grid; align-content: start; gap: 2rem;
    position: fixed; inset: 0; z-index: 50; overflow-y: auto;
    background: var(--paper);
    padding: calc(9.5rem + env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
    opacity: 0; transform: translateY(-8px); transition: opacity .25s ease, transform .25s ease;
  }
  .mobile-menu[hidden] { display: none !important; }
  .mobile-menu.is-open { opacity: 1; transform: none; }
  .mobile-menu-links { display: grid; border-top: 1px solid var(--line); }
  .mobile-menu-links a {
    display: flex; align-items: center; justify-content: space-between;
    padding-block: 1rem; border-bottom: 1px solid var(--line);
    font-size: 1.3rem; text-decoration: none; letter-spacing: .02em; color: var(--ink);
  }
  .mobile-menu-links a::after { content: ""; width: .5rem; height: .5rem; border-top: 1px solid var(--ink-soft); border-right: 1px solid var(--ink-soft); transform: rotate(45deg); }
  .mobile-menu-links a[aria-current="page"] { color: var(--seal); }
  .mobile-menu-links a[aria-current="page"]::after { border-color: var(--seal); }
  .mobile-menu-join { justify-self: stretch; }
  .mobile-menu-foot { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-size: .9rem; color: var(--ink-soft); }
  .site-header { position: relative; z-index: 55; }
  .tag { position: relative; z-index: 56; }
  body.menu-open { overflow: hidden; }
}

/* Mobile: fixed header that turns white and compact once the page scrolls */
@media (max-width: 760px) {
  body { padding-top: calc(var(--hdr, 6.6rem) + env(safe-area-inset-top, 0px)); }
  .site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 55;
    padding-top: env(safe-area-inset-top, 0px);
    background: transparent; transition: background .25s ease, box-shadow .25s ease;
  }
  .site-header .wrap { min-height: 0; padding-bottom: 0; transition: padding .25s ease; }
  .tag { transition: width .25s ease, padding .25s ease, box-shadow .25s ease; }
  .site-header.is-scrolled { background: #FFFFFF; box-shadow: 0 1px 0 var(--line), 0 6px 16px -10px rgba(43,38,35,.25); }
  .site-header.is-scrolled .wrap { padding-block: .45rem; }
  .site-header.is-scrolled .tag { width: 5.6rem; padding: .35rem .4rem; box-shadow: none; background: transparent; }
  .site-header.is-scrolled .tag::after { display: none; }
  .site-header.is-scrolled ~ .mobile-menu { padding-top: calc(5.5rem + env(safe-area-inset-top, 0px)); }
  .menu-open .site-header { background: var(--paper); box-shadow: none; }
}

/* Stacked feature blocks (tablet and phone): the vertical title always leads the section */
@media (max-width: 980px) {
  .feature .vtitle, .feature--rev .vtitle { order: -1; }
}

/* Stacked route (tablet and phone): no connecting line, it runs through the centred text */
@media (max-width: 980px) {
  .route::before, .route.is-armed::before, .route.is-armed.is-in::before { display: none; }
}

/* Lightbox (only visible after a photo is clicked) */
.lightbox{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;padding:4rem 1.5rem 2rem;background:rgba(28,24,21,.88);opacity:0;transition:opacity .2s ease}
.lightbox[hidden]{display:none}
.lightbox.is-open{opacity:1}
.lightbox-fig{margin:0;display:flex;flex-direction:column;align-items:center;gap:.75rem;max-width:100%;max-height:100%}
.lightbox-fig img{display:block;max-width:min(92vw,1400px);max-height:calc(100vh - 8rem);width:auto;height:auto;object-fit:contain;background:var(--card);border:6px solid var(--card);box-shadow:0 10px 40px rgba(0,0,0,.35)}
.lightbox-fig figcaption{color:#EEE9E2;font-size:.95rem;text-align:center;max-width:60ch}
.lightbox-close{position:absolute;top:1rem;right:1rem;width:2.75rem;height:2.75rem;border-radius:50%;border:1px solid rgba(255,255,255,.5);background:rgba(0,0,0,.25);color:#fff;font-size:1.9rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 0 .15rem}
.lightbox-close:hover,.lightbox-close:focus-visible{background:var(--seal);border-color:var(--seal);outline:none}
body.lightbox-open{overflow:hidden}
@media (prefers-reduced-motion:reduce){.lightbox{transition:none}}

/* Phone: 3:2 door photos; keep the children's heads in frame */
@media (max-width: 520px) {
  .door img { aspect-ratio: 3 / 2; }
  .door--tall img { object-position: center 18%; }
}

/* Resources door: keep the Wu Zixu cover title in frame */
.door img.door-img--top { object-position: center 18%; }

/* Wider screens: align the Join Us photo to the top so both children's heads stay in frame */
@media (min-width: 521px) {
  .door--tall img { object-position: center 14%; }
}

/* Sitemap page */
.sitemap-home { font-size: 1.15rem; font-weight: 600; padding-bottom: 1.25rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--ink); display: flex; gap: .6rem; align-items: baseline; }
.sitemap-home span { font-size: .95rem; color: var(--seal); }
.sitemap { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 2.5rem clamp(1.5rem, 3vw, 2.5rem); }
.sitemap-group { display: grid; gap: .9rem; align-content: start; min-width: 0; }
.sitemap-group h2 { font-size: 1.1rem; display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; padding-bottom: .5rem; border-bottom: 2px solid var(--seal); }
.sitemap-group h2 span { font-size: .9rem; font-weight: 400; color: var(--ink-soft); }
.sitemap-list { list-style: none; margin: 0; padding: 0; display: grid; }
.sitemap-list > li { padding-block: .75rem; border-bottom: 1px solid var(--line); display: grid; gap: .25rem; }
.sitemap-list > li > a { font-weight: 600; text-decoration: none; }
.sitemap-list > li > a:hover { text-decoration: underline; }
.sitemap-list p { font-size: .9rem; color: var(--ink-soft); line-height: 1.7; }
.sitemap-list ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: var(--ink-soft); line-height: 1.7; }
.legal a { color: inherit; }

/* Download form pop-up (only visible after a Download link is clicked) */
.dlform{position:fixed;inset:0;z-index:210;display:flex;align-items:center;justify-content:center;padding:1.5rem max(16px,env(safe-area-inset-right,0px)) 1.5rem max(16px,env(safe-area-inset-left,0px));background:rgba(28,24,21,.6);opacity:0;transition:opacity .2s ease;overflow-y:auto}
.dlform[hidden]{display:none}
.dlform.is-open{opacity:1}
.dlform-card{position:relative;width:100%;max-width:28rem;margin:auto;background:var(--card);box-shadow:0 0 0 1px var(--line),0 20px 50px -20px rgba(0,0,0,.45);padding:2rem clamp(1.25rem,4vw,2rem) 1.75rem;display:grid;gap:.6rem;transform:translateY(8px);transition:transform .2s ease}
.dlform.is-open .dlform-card{transform:none}
.dlform-card::before{content:"";position:absolute;inset:6px;border:1px solid var(--line);pointer-events:none}
.dlform-close{position:absolute;top:.6rem;right:.6rem;z-index:1;width:2.5rem;height:2.5rem;border:0;background:none;color:var(--ink-soft);font-size:1.7rem;line-height:1;cursor:pointer;border-radius:50%}
.dlform-close:hover,.dlform-close:focus-visible{color:var(--seal);background:var(--paper-2)}
.dlform-kicker{font-size:.78rem;letter-spacing:.14em;text-transform:uppercase;color:var(--seal)}
.dlform-title{font-size:1.3rem;padding-right:2rem}
.dlform-form,.dlform-ok{display:grid;gap:.9rem;margin-top:.4rem}
.dlform-form[hidden],.dlform-ok[hidden]{display:none}
.dlform-intro{font-size:.92rem;color:var(--ink-soft);line-height:1.7}
.dlform-field{display:grid;gap:.3rem}
.dlform-field span{font-size:.88rem;font-weight:600}
.dlform-field input{font:inherit;font-size:1rem;color:var(--ink);background:#fff;border:1px solid var(--line);border-bottom-color:var(--ink-soft);padding:.65rem .75rem;border-radius:0;width:100%}
.dlform-field input:focus{outline:2px solid var(--seal);outline-offset:0;border-color:var(--seal)}
.dlform-trap{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}
.dlform-error{font-size:.88rem;color:var(--seal);border-left:2px solid var(--seal);padding-left:.75rem;line-height:1.6}
.dlform-error[hidden]{display:none}
.dlform-submit,.dlform-open{width:100%;min-width:0;margin-top:.2rem}
.dlform-submit[disabled]{opacity:.7;cursor:progress}
.dlform-note{font-size:.8rem;color:var(--ink-soft);line-height:1.6}
.dlform-test{font-size:.8rem;color:var(--seal);border:1px dashed var(--seal);padding:.4rem .6rem}
.dlform-ok p:first-child{font-weight:600}
body.dlform-open-body{overflow:hidden}
@media (prefers-reduced-motion:reduce){.dlform,.dlform-card{transition:none}}

/* Photo protection: no iOS long-press "Save image", no dragging photos out */
img { -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* DuitNow QR: real image replaces the placeholder. It stays saveable (no photo protection)
   so phone users can save it and upload it in their banking app. */
.qr.qr--img { width: 17rem; aspect-ratio: auto; padding: .6rem .6rem .75rem; border: 1px solid var(--line); background: #fff; display: grid; gap: .45rem; justify-items: center; margin: 0; }
.qr--img img { width: 100%; height: auto; -webkit-touch-callout: default; -webkit-user-drag: auto; user-select: auto; -webkit-user-select: auto; }
.qr--img figcaption { font-size: .75rem; line-height: 1.4; color: var(--ink-soft); }
.qr-save { font-size: .82rem; color: var(--seal); text-underline-offset: .2em; }
@media (max-width: 760px) { .qr.qr--img { width: min(100%, 16rem); justify-self: center; } }

/* Bank block with QR: details and QR sit side by side when there is room,
   otherwise the QR drops below the details, centred */
.bank { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem 2rem; }
.bank dl { flex: 1 1 16rem; min-width: 0; }
.bank .qr--img { flex: 0 0 auto; margin-inline: auto; }

/* Committee page: English names under the Chinese names; past terms fold open */
.people dd .en-name { display: block; font-weight: 400; font-size: .85rem; color: var(--ink-soft); margin-top: .1rem; }
.past-term { border-top: 1px solid var(--line); }
.past-term:last-of-type { border-bottom: 1px solid var(--line); }
.past-term summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; padding: 1rem 2rem 1rem 0; position: relative; font-size: 1.1rem; }
.past-term summary::-webkit-details-marker { display: none; }
.past-term summary::after { content: ""; position: absolute; right: .4rem; top: 1.45rem; width: .5rem; height: .5rem; border-right: 1px solid var(--ink-soft); border-bottom: 1px solid var(--ink-soft); transform: rotate(45deg); transition: transform .2s ease; }
.past-term[open] summary::after { transform: rotate(-135deg); top: 1.7rem; }
.past-term summary:hover .past-term-name { color: var(--seal); }
.past-term-zh { font-size: .9rem; color: var(--ink-soft); }
.past-term .people { padding-bottom: 1.5rem; }
