/* TEAMEET card — shared tokens and components (brand = the website, site/src/static/css/site.css).
   CSP: no inline style anywhere; dynamic values go through CSS custom properties set from JS (CSSOM). */

@font-face { font-family: "Instrument Serif"; src: url("../fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/InstrumentSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/InstrumentSans-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #FCF7EF; --paper-2: #F4EBDD; --paper-3: #EFE1CB; --rice: #FFFDF8;
  --ink: #2A1E16; --ink-2: #54463C; --ink-3: #6B5C50;
  --line: rgba(42, 30, 22, .13); --line-2: rgba(42, 30, 22, .3);
  --sage: #5A7650; --sage-deep: #3E5537; --sage-ink: #26301F; --sage-mist: #E4EAD9;
  --caramel: #A2672D; --cup: #EDD9B2; --cup-rim: #D2B583;
  --pink: #F8ABBD; --pink-ink: #4B2003; --pink-deep: #8A2F4C;
  --rock-green: #739E57; --rock-blue: #56A7DE; --rock-taupe: #A99891;
  --tint-sage: #E3E9D7; --tint-rose: #F6E4E0; --tint-cup: #F3E7CF; --tint-warm: #F0E3CF;
  --ok: #3E5537; --ok-bg: #E4EAD9;
  /* the Wallet pass = assets/pass/palette.json (boutique-cream: the awning cream, navy values, deep blue labels and
     accent; QA checks they agree): page previews of the pass (enrol preview, member card, counter / dashboard strip)
     use these. --pass-blob / -2 are the strip's chiffon washes pre-compensated for the member card's opacities
     (.62 / .3 over the cream: chiffon laid thinly on the cream turns grey); --pass-ground = the strip's ground lines. */
  --pass-bg: #F0E2CC; --pass-fg: #172B3B; --pass-label: #1C5876; --pass-blob: #6DA8D7; --pass-blob-2: #3278CC;
  --pass-ground: rgba(28, 88, 118, .5);
  /* the half-price drink's gold (the pass's « ½ » tag: gold leaf #B0843A → #F0D48C, deep caramel edge and sign) */
  --gold: #EFCB77; --gold-hi: #F8E6B0; --gold-edge: #B0843A; --gold-ink: #5A3210; --gold-deep: #7A4A1C;
  --warn: #7A4A12; --warn-bg: #F6E2CD;
  --bad: #8E2A1C; --bad-bg: #F7DED8;

  --cjk-serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC";
  --cjk-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei";
  --f-display: "Instrument Serif", var(--cjk-serif), Georgia, serif;
  --f-ui: "Instrument Sans", var(--cjk-sans), system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-cjk: var(--cjk-serif), serif;

  --fs-xs: .8125rem; --fs-sm: .9375rem; --fs-base: 1.0625rem;
  --radius: 4px; --radius-lg: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 18px 40px -28px rgba(42, 30, 22, .45);
  --grain: url("../img/tex/grain.svg");
  --fibre: url("../img/tex/fibre.svg");
  --gutter: clamp(16px, 4.4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background-color: var(--paper); background-image: var(--grain), var(--fibre);
  color: var(--ink-2); font-family: var(--f-ui); font-size: var(--fs-base); line-height: 1.55; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; overflow-x: clip; -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
p { margin: 0 0 1em; text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; color: var(--ink); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 em, h2 em, h3 em { font-style: italic; color: var(--sage-deep); }
[lang|="zh"] { font-family: var(--f-ui); font-synthesis: weight; }
:lang(zh) em, :lang(zh) i { font-style: normal; }
html:lang(zh-Hans) :is(h1, h2, h3) { font-family: "Instrument Serif", var(--f-cjk); letter-spacing: .02em; line-height: 1.22; }
::selection { background: var(--sage-mist); color: var(--ink); }
:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 3px; border-radius: 3px; }
.nw { white-space: nowrap; }                 /* one part of a rule line: « 10 tampons = 1 boisson offerte » never split */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px; text-decoration: none; font-weight: 700; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* eyebrow: — FIDÉLITÉ 会员卡 */
.eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: .4em .9em; margin: 0 0 1rem; font: 700 var(--fs-xs)/1.2 var(--f-ui);
  letter-spacing: .2em; text-transform: uppercase; color: var(--sage-deep); }
.eyebrow::before { content: ""; width: 32px; height: 1px; background: currentColor; flex: none; }
.eyebrow .zh { letter-spacing: .3em; font-weight: 400; font-size: 1.05em; color: var(--ink-3); text-transform: none; }
html:lang(zh-Hans) .eyebrow { letter-spacing: .14em; }
.lbl { font: 700 .75rem/1.2 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--sage-deep); }
html:lang(zh-Hans) .lbl { letter-spacing: .08em; font-size: .8125rem; }
.fine { font-size: var(--fs-xs); color: var(--ink-3); }
.vert { writing-mode: vertical-rl; text-orientation: upright; font-family: var(--f-cjk); line-height: 1; letter-spacing: .14em; white-space: nowrap; color: var(--ink-3); }

/* ---------- logo ---------- */
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 46px; width: auto; }

/* ---------- language switch ---------- */
.langs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(255, 253, 248, .6); }
.langs button { min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent;
  font: 700 .8125rem/1 var(--f-ui); letter-spacing: .06em; color: var(--ink-3); }
.langs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.langs button:not([aria-pressed="true"]):hover { color: var(--ink); background: var(--paper-2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-height: 52px; padding: .75em 1.5em;
  border: 1px solid var(--ink); border-radius: 999px; font: 700 var(--fs-sm)/1.15 var(--f-ui); letter-spacing: .02em;
  text-decoration: none; text-align: center; cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .1s; user-select: none; }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover:not(:disabled) { background: var(--sage-deep); border-color: var(--sage-deep); }
.btn-sage { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--paper); }
.btn-sage:hover:not(:disabled) { background: var(--sage-ink); border-color: var(--sage-ink); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--paper-2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #6E1F14; }
.btn-sm { min-height: 44px; padding: .5em 1.1em; font-size: var(--fs-xs); letter-spacing: .04em; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--paper); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-line[aria-busy="true"]::after, .btn-ghost[aria-busy="true"]::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { display: inline-flex; align-items: center; gap: .4em; min-height: 44px; font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); }
.link:hover { text-decoration-color: var(--ink); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 50%; background: var(--rice); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--ink); }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; margin: 0 0 18px; }
.field > label, .field > .label { font: 700 var(--fs-sm)/1.3 var(--f-ui); color: var(--ink); }
.field .hint { font-size: var(--fs-xs); color: var(--ink-3); margin: 0; }
.input { width: 100%; min-height: 54px; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--rice);
  font: 400 1.0625rem/1.3 var(--f-ui); color: var(--ink); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; }
.input::placeholder { color: #9A8B7E; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--sage-deep); box-shadow: 0 0 0 3px rgba(62, 85, 55, .18); }
.input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(142, 42, 28, .12); }
select.input { padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-err { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 0; font-size: var(--fs-sm); line-height: 1.4; color: var(--bad); font-weight: 700; }
.field-err::before { content: "!"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--bad); color: #fff; font-size: .75rem; }

/* custom checkbox — native input kept for a11y, 44px hit area via the label */
.check { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; padding: 12px 0; cursor: pointer; font-size: var(--fs-sm); line-height: 1.45; color: var(--ink-2); }
.check input { position: absolute; opacity: 0; width: 26px; height: 26px; margin: 0; top: 12px; left: 0; cursor: pointer; }
.check .box { width: 26px; height: 26px; border: 1.5px solid var(--ink-3); border-radius: 7px; background: var(--rice); display: grid; place-items: center; transition: .15s var(--ease); }
.check .box svg { width: 16px; height: 16px; opacity: 0; transform: scale(.6); transition: .15s var(--ease); color: var(--paper); }
.check input:checked + .box { background: var(--sage-deep); border-color: var(--sage-deep); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { outline: 2px solid var(--sage-deep); outline-offset: 3px; }
.check input[aria-invalid="true"] + .box { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(142, 42, 28, .14); }
.check a { color: var(--ink); font-weight: 700; }

/* switch */
.switch { position: relative; display: inline-block; width: 56px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #CFC3B5; transition: .2s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .2s var(--ease); }
.switch input:checked + .track { background: var(--sage-deep); }
.switch input:checked + .track::after { transform: translateX(24px); }
.switch input:focus-visible + .track { outline: 2px solid var(--sage-deep); outline-offset: 3px; }

/* ---------- notices ---------- */
.notice { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 14px 16px; border-radius: 12px; font-size: var(--fs-sm); line-height: 1.45; background: var(--paper-2); color: var(--ink); }
.notice::before { content: ""; width: 8px; height: 8px; margin-top: .45em; border-radius: 50%; background: currentColor; }
.notice[data-tone="bad"] { background: var(--bad-bg); color: var(--bad); }
.notice[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.notice[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.notice p { margin: 0; }
.notice strong { color: inherit; }
.notice .notice-body > * + * { margin-top: 6px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .5); font-weight: 700; font-size: var(--fs-sm); animation: toast-in .25s var(--ease); }
.toast[data-tone="bad"] { background: var(--bad); }
.toast[data-tone="ok"] { background: var(--sage-deep); }
.toast .grow { flex: 1; }
.toast button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: inherit; font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- dialogs ---------- */
dialog { border: 0; padding: 0; border-radius: 20px; background: var(--rice); color: var(--ink-2); width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px -30px rgba(42, 30, 22, .6); }
dialog::backdrop { background: rgba(38, 48, 31, .45); backdrop-filter: blur(2px); }
dialog.is-fallback { position: fixed; inset: 0; margin: auto; z-index: 95; height: fit-content; }
.dlg { padding: 24px; display: grid; gap: 14px; }
.dlg h2 { font-size: 1.75rem; line-height: 1.1; }
.dlg p { margin: 0; }
.dlg .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.dlg .row .btn { flex: 1 1 140px; }
.dlg [data-tone="danger"] { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------- misc ---------- */
.card { background: var(--rice); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--sage-mist); border-top-color: var(--sage-deep); animation: spin .8s linear infinite; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border-radius: 999px; font: 700 .75rem/1.1 var(--f-ui); letter-spacing: .04em; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pill[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.pill[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.pill[data-tone="bad"] { background: var(--bad-bg); color: var(--bad); }
.pill[data-tone="pink"] { background: var(--pink); color: var(--pink-ink); }
.pill[data-tone="dark"] { background: var(--ink); color: var(--paper); }
.pill[data-tone="gold"] { background: var(--gold-hi); color: var(--gold-ink); box-shadow: inset 0 0 0 1px var(--gold-edge); }

/* stamp slots: the HTML fallback of the Wallet strip (core.js stampSlots) — same language as the pass:
   a stamp is the real drink, an empty slot the client's drawn cup standing upright, the reward slot drawn in
   caramel, the next slot drawn in the pass's accent over a tick of the same colour, on ground lines of that colour
   (deep blue #1C5876 on the boutique-cream pass); all thirteen images share one canvas, scale and ground line.
   No circles, discs or rocks. */
.stamps { --gap: clamp(2px, 1.2vw, 8px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 6px; align-items: end; }
.stamps.is-many { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.slot { position: relative; display: block; padding: 0 var(--gap) 6px; border-bottom: 1px solid var(--pass-ground); }
.slot img { display: block; width: 100%; height: auto; }
.slot:not(.is-on) img { opacity: .62; }
.slot.is-next img { opacity: .84; }
.slot.is-goal:not(.is-on) img { opacity: .92; }
.slot.is-next::after { content: ""; position: absolute; left: 32%; right: 32%; bottom: 2px; height: 2.5px; border-radius: 1px 3px 2px 1px; background: var(--pass-label); }
.slot.is-goal.is-next::after { background: var(--caramel); }          /* the reward stays all gold, as on the strip */
.slot.is-on img { animation: pop .35s var(--ease) both; }
.stamps.is-void .slot img { opacity: .28; filter: grayscale(1); }
/* the half-price drink's « ½ » tag (stamps/milestone-*.webp, 182 × 151 at the stamps' scale of 123 × 195): bottom on the
   slot's ground line, right edge on the cup's centre line, UNDER the cup (the string runs behind the drink) */
.stamps .slot.has-tag > img:first-child { position: relative; z-index: 1; }
.stamps .slot img.ms-tag { position: absolute; z-index: 0; right: 50%; bottom: 6px; width: calc((100% - 2 * var(--gap)) * 182 / 123); height: auto;
  max-width: none; opacity: 1; animation: none; pointer-events: none; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Empty card (0 stamps): the owner's reference style — sage washes + the milk-tea line drawing on the right */
.empty-art { position: relative; overflow: hidden; }
.empty-art .wash { position: absolute; border-radius: 48% 52% 44% 56% / 58% 50% 50% 42%; background: #9FB191; opacity: .55; pointer-events: none; }
.empty-art .cup-sketch { position: absolute; pointer-events: none; }
