/* ===========================================================
   UKCBA — shared design tokens + components
   Editorial Civic system. Keep this file authoritative.
   =========================================================== */

:root {
  --paper:        #F4F1EA;
  --paper-deep:   #ECE6D8;
  --paper-card:   #FAF6EC;
  --ink:          #0E1A24;
  --ink-soft:     #2A3A48;
  --ink-mute:     #6B7785;
  --rule:         #C9C0A9;
  --rule-strong:  #8E8366;
  --brass:        #A87C2A;
  --brass-deep:   #7E5A18;
  --brass-soft:   #D6BB7C;
  --brass-glow:   #E8CC85;
  --oxblood:      #7A2E2E;
  --moss:         #3E5A3F;

  --serif-display: "Fraunces", "Noto Serif SC", Georgia, serif;
  --serif-body:    "Newsreader", "Noto Serif SC", Georgia, serif;
  --cjk:           "Noto Serif SC", "Newsreader", serif;
  --mono:          "JetBrains Mono", ui-monospace, monospace;

  --gutter: 22px;
  --rail:   1px;
  --maxapp: 430px;
  --maxread: 680px;
  --maxadmin: 1280px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: oldstyle-nums proportional-nums;
  overflow-x: hidden;
}

/* paper grain — subtle SVG noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* =================================================================
   APP SHELLS — mobile / reading / admin
   ================================================================= */
.app {
  max-width: var(--maxapp);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 14px var(--gutter) 96px;
  position: relative;
}
/* legacy alias — kept so existing markup doesn't break, but reading
   pages now share the standard mobile width */
.app--read { max-width: var(--maxapp); padding: 14px var(--gutter) 96px; }

/* =================================================================
   TOP CHROME — wordmark + language toggle + back arrow
   ================================================================= */
.chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.wordmark {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: .04em;
  line-height: 1;
}
.wordmark .dot {
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--brass);
  border-radius: 50%;
  margin: 0 6px 2px;
  vertical-align: middle;
}
.wordmark em { font-style: italic; font-weight: 300; }

.back-link {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 300;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back-link::before { content: "←"; font-style: normal; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: var(--rail) solid var(--rule);
  border-radius: 999px;
  font-family: var(--serif-display);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.lang-toggle .opt {
  padding: 2px 6px;
  border-radius: 999px;
  transition: color .2s, background .2s;
}
.lang-toggle .opt.active {
  background: var(--ink);
  color: var(--paper);
}

/* =================================================================
   SECTION LABEL — more prominent than v1
   Big italic display numeral + brass vertical bar + section name
   ================================================================= */
.section {
  display: grid;
  grid-template-columns: 6px auto 1fr auto;
  align-items: end;
  gap: 14px;
  margin: 36px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.section .bar {
  width: 6px;
  height: 46px;
  background: var(--brass);
  align-self: end;
  margin-bottom: 2px;
}
.section .num {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 300;
  font-size: 38px;
  line-height: .85;
  color: var(--brass-deep);
  letter-spacing: -.01em;
  font-variant-numeric: lining-nums;
}
.section .label-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-self: end;
}
.section .label {
  font-family: var(--serif-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink);
}
.section .sub {
  font-family: var(--cjk);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.section .more {
  align-self: end;
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 14px;
  color: var(--brass-deep);
  text-decoration: none;
  white-space: nowrap;
}
.section .more:hover { color: var(--ink); }

/* =================================================================
   MEMBERSHIP CARD — the centrepiece artefact
   ================================================================= */
.card {
  position: relative;
  margin: 22px 0 12px;
  padding: 26px 24px 22px;
  background:
    radial-gradient(120% 80% at 0% 0%, var(--paper-card) 0%, var(--paper-deep) 60%, #E1D8BF 100%);
  border: var(--rail) solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 1px 0 #fff inset,
    0 24px 40px -28px rgba(14, 26, 36, .35),
    0 2px 0 -1px var(--ink);
}
/* Official UKCBA emblem — replaces the placeholder "U" brass seal on the
   membership tier card. The emblem PNG already contains its own red
   circular frame and bilingual wordmark, so no conic-brass ring is needed. */
.card::before {
  content: "";
  position: absolute;
  top: 12px; right: 12px;
  width: 56px; height: 56px;
  background-image: url("assets/logo-emblem@2x.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 50%;
  /* A faint paper backplate so the logo reads well on any card gradient */
  background-color: rgba(255, 255, 255, .55);
  box-shadow: 0 1px 0 #fff, 0 0 0 1px rgba(14, 26, 36, .08);
}
.card::after {
  /* Deliberately empty — the emblem image is on ::before. Keeping the
     selector lets us override back to a letter if a particular card needs
     its own glyph (e.g. partner-scoped cards in a future surface). */
  content: "";
  display: none;
}
.card .label {
  font-family: var(--serif-display);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.card .name {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -.005em;
}
.card .name-zh {
  display: block;
  font-family: var(--cjk);
  font-weight: 400;
  font-size: 18px;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: .04em;
}
.card .company {
  margin-top: 10px;
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}
.card .meta {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  border-top: var(--rail) solid var(--rule);
  padding-top: 16px;
}
.card .meta dt {
  font-family: var(--serif-display);
  font-size: 9.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 3px;
}
.card .meta dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--ink);
}
.card .tier-line {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 2px solid var(--brass);
  margin-top: 4px;
  padding-top: 14px;
  gap: 14px;
  flex-wrap: wrap;
}
.card .tier-name {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .005em;
  line-height: 1;
}
.card .tier-name .sub {
  font-family: var(--cjk);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-soft);
  margin-left: 8px;
  letter-spacing: .04em;
}
.card .tier-rank {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card .pips {
  display: inline-flex;
  gap: 5px;
}
.card .pips .pip {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--brass-deep);
  background: transparent;
  position: relative;
}
.card .pips .pip.on {
  background:
    radial-gradient(closest-side at 30% 30%, var(--brass-glow), var(--brass) 60%, var(--brass-deep) 100%);
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.2);
}
.card .rank-label {
  font-family: var(--serif-display);
  font-size: 10.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.2;
  text-align: right;
}
.card .rank-label .zh {
  display: block;
  font-family: var(--cjk);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-mute);
  text-transform: none;
  margin-top: 2px;
}

/* =================================================================
   NEWS — list cards + detail body
   ================================================================= */
.news article {
  position: relative;
  padding: 18px 0 22px 18px;
  border-bottom: var(--rail) solid var(--rule);
}
.news article:last-child { border-bottom: 0; }
.news article::before {
  content: "";
  position: absolute;
  left: 0; top: 22px; bottom: 26px;
  width: 2px;
  background: var(--brass);
}
.news .kicker {
  font-family: var(--serif-display);
  font-size: 10.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.news .kicker .tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  padding: 2px 6px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.news h2 {
  margin: 0 0 8px;
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: -.005em;
}
.news h2 .zh {
  display: block;
  font-family: var(--cjk);
  font-weight: 400;
  font-size: 16px;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: .03em;
  line-height: 1.4;
}
.news .summary {
  font-family: var(--serif-body);
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 4px 0 8px;
}
.news .byline {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.news .byline .dot { margin: 0 6px; color: var(--rule); font-style: normal; }
.news .byline .lock {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  font-family: var(--serif-display);
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* =================================================================
   QUICK RAIL — bigger, weightier than v1
   ================================================================= */
.rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.rail a {
  text-decoration: none;
  color: var(--ink);
  padding: 18px 12px 16px;
  border: var(--rail) solid var(--ink);
  border-radius: 4px;
  background: rgba(255,255,255,.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 110px;
  transition: background .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.rail a:hover {
  background: rgba(255,255,255,.85);
  transform: translateY(-1px);
}
.rail a::after {
  content: "→";
  position: absolute;
  bottom: 10px; right: 12px;
  font-family: var(--serif-display);
  font-size: 16px;
  color: var(--brass-deep);
  opacity: .7;
}
.rail .num {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 300;
  font-size: 13px;
  color: var(--brass-deep);
  letter-spacing: .04em;
}
.rail .name {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.05;
  letter-spacing: -.005em;
}
.rail .name .zh {
  display: block;
  font-family: var(--cjk);
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: .04em;
}

/* =================================================================
   TABBAR — flush bottom, editorial. No floating pill.
   Top edge brass indicator on the active item; safe-area aware.
   ================================================================= */
nav.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--paper);
  border-top: 1px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -8px 18px -14px rgba(14,26,36,.18);
}
nav.tabbar .tabbar-inner {
  max-width: var(--maxapp);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
nav.tabbar a {
  position: relative;
  text-decoration: none;
  color: var(--ink-mute);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 12px 4px 10px;
  font-family: var(--serif-display);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .01em;
  line-height: 1.1;
  transition: color .15s;
}
nav.tabbar a:hover { color: var(--ink); }
/* tiny editorial numeral above the label */
nav.tabbar a::before {
  content: attr(data-num);
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 300;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: .02em;
  margin-bottom: 1px;
}
nav.tabbar a.active {
  color: var(--ink);
  font-weight: 500;
}
nav.tabbar a.active::before { color: var(--brass-deep); }
/* brass top-edge indicator on the active cell */
nav.tabbar a.active::after {
  content: "";
  position: absolute;
  top: -1px; left: 16%; right: 16%;
  height: 3px;
  background: var(--brass);
}
/* zh label sits below the en label when both visible — but the
   locale-driven swap (.zh / .en) keeps only one visible at a time */
nav.tabbar a .zh { font-family: var(--cjk); font-size: 12px; }

/* =================================================================
   ARTICLE BODY (news detail)
   ================================================================= */
.article-head {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 24px;
  margin-bottom: 26px;
}
.article-head .kicker {
  font-family: var(--serif-display);
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.article-head .kicker .tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  padding: 2px 6px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  color: var(--ink-soft);
}
.article-head h1 {
  margin: 0 0 12px;
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(28px, 6vw, 38px);
  line-height: 1.08;
  letter-spacing: -.012em;
}
.article-head h1 .zh {
  display: block;
  font-family: var(--cjk);
  font-weight: 400;
  font-size: clamp(20px, 4.6vw, 26px);
  color: var(--ink-soft);
  margin-top: 8px;
  line-height: 1.35;
  letter-spacing: .02em;
}
.article-head .standfirst {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 14px 0 18px;
  padding-left: 16px;
  border-left: 2px solid var(--brass);
}
.article-head .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
}
.article-head .meta .who { font-style: normal; font-weight: 500; color: var(--ink); }

.article-body {
  font-family: var(--serif-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
}
.article-body p { margin: 0 0 18px; }
.article-body p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 56px;
  line-height: .9;
  float: left;
  margin: 4px 8px -2px 0;
  color: var(--brass-deep);
}
.article-body h3 {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 22px;
  margin: 28px 0 10px;
  letter-spacing: -.005em;
}
.article-body h3 .zh {
  display: block;
  font-family: var(--cjk);
  font-weight: 400;
  font-size: 16px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.article-body blockquote {
  margin: 22px 0;
  padding: 18px 0 18px 22px;
  border-left: 3px solid var(--brass);
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  line-height: 1.35;
  color: var(--ink);
}
.article-body blockquote cite {
  display: block;
  margin-top: 10px;
  font-family: var(--serif-display);
  font-style: normal;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.translation-pending {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: 0 0 18px;
  padding: 6px 10px;
  background: rgba(168, 124, 42, .08);
  border: 1px solid var(--brass-soft);
  border-radius: 3px;
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 12px;
  color: var(--brass-deep);
}
.translation-pending::before {
  content: "✻"; color: var(--brass);
}

/* =================================================================
   BENEFIT DETAIL — partner / offer / redeem
   ================================================================= */
.benefit-hero {
  position: relative;
  margin: 6px 0 26px;
  padding: 28px 24px 24px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background:
    linear-gradient(180deg, var(--paper-card) 0%, var(--paper-deep) 100%);
  overflow: hidden;
}
.benefit-hero::after {
  content: "";
  position: absolute;
  inset: auto -40% -60% auto;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--brass-glow), transparent 70%);
  opacity: .4;
  pointer-events: none;
}
.benefit-hero .partner-cat {
  font-family: var(--serif-display);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: 8px;
}
.benefit-hero .partner-name {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -.01em;
}
.benefit-hero .partner-name .zh {
  display: block;
  font-family: var(--cjk);
  font-weight: 400;
  font-size: 19px;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: .04em;
}
.benefit-hero .offer {
  margin-top: 18px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}
.benefit-hero .offer .pct {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 64px;
  line-height: .85;
  color: var(--brass-deep);
  letter-spacing: -.02em;
  font-variant-numeric: lining-nums;
}
.benefit-hero .offer .desc {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.25;
  color: var(--ink);
}
.benefit-hero .offer .desc .zh {
  display: block;
  font-family: var(--cjk);
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.benefit-hero .validity {
  margin-top: 18px;
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 22px;
  padding: 4px 0;
  font-size: 14px;
}
.kv dt {
  font-family: var(--serif-display);
  font-size: 10.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  align-self: center;
}
.kv dd {
  margin: 0;
  font-family: var(--serif-body);
  color: var(--ink);
}
.kv dd .zh {
  display: block;
  font-family: var(--cjk);
  font-size: 13px;
  color: var(--ink-soft);
}

.redeem {
  margin-top: 20px;
  padding: 22px 20px;
  border: 1px dashed var(--brass-deep);
  border-radius: 6px;
  background: rgba(168, 124, 42, .06);
  text-align: center;
}
.redeem .label {
  font-family: var(--serif-display);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.redeem .code {
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: .14em;
  color: var(--ink);
  margin-bottom: 14px;
}
.redeem .qr {
  width: 132px; height: 132px;
  margin: 0 auto;
  background:
    repeating-conic-gradient(var(--ink) 0% 25%, transparent 0% 50%) 50% / 18px 18px,
    var(--paper-card);
  border: 6px solid var(--paper-card);
  outline: 1px solid var(--ink);
}
.redeem .help {
  margin-top: 12px;
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-mute);
}

/* =================================================================
   ENTRANCE
   ================================================================= */
/* Reveal stagger — element starts at its resting visible state so the page
   renders correctly in headless Chrome / print / reduced-motion clients,
   and the animation plays from hidden -> visible when the browser honours it. */
.reveal { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.reveal.r1 { animation-delay: .05s; }
.reveal.r2 { animation-delay: .15s; }
.reveal.r3 { animation-delay: .28s; }
.reveal.r4 { animation-delay: .40s; }
.reveal.r5 { animation-delay: .52s; }
.reveal.r6 { animation-delay: .64s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
}

/* =================================================================
   BILINGUAL VISIBILITY (locale-driven)
   ================================================================= */
[data-locale="en"] .zh-only { display: none !important; }
[data-locale="zh"] .en-only { display: none !important; }
[data-locale="zh"] .en { display: none; }
[data-locale="en"] .zh { display: none; }
.both .en, .both .zh { display: revert !important; }

/* href-less anchors in demonstration pages still look clickable */
a:not([href]) { cursor: pointer; }
