/**
 * Kosala Gamage — Digital Business Card
 * Flash Energy International (Pvt) Ltd · Max Minerals (Pvt) Ltd
 * Built by Uvin Vindula — IAMUVIN · iamuvin.com
 *
 * Light editorial letterhead. Self-hosted fonts, zero external calls.
 * Restraint over decoration: whitespace, hairlines, one accent.
 */

/* ---------- Fonts (self-hosted, no external font CDN — China-safe) ---------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2122, U+2212;
}
@font-face {
  font-family: 'Geist';
  font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../fonts/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2122, U+2212;
}

/* ---------- Tokens ---------- */
:root {
  --paper:      #FAF9F6;   /* warm paper */
  --paper-tint: #F3F1EC;   /* faint section wash */
  --ink:        #122539;   /* navy — headings */
  --ink-soft:   #3E4C5A;   /* body */
  --muted:      #46586E;   /* labels, meta (palette ink-2, 4.5:1+) */
  --hairline:   rgba(18, 37, 57, 0.12);
  --hairline-2: rgba(18, 37, 57, 0.22);
  --accent:     #0E7A6E;   /* refined jade-teal */
  --accent-dk:  #0A5C53;
  --accent-wash:rgba(14, 122, 110, 0.08);
  --on-accent:  #FFFFFF;

  --font-cjk:  'PingFang SC', 'HarmonyOS Sans SC', 'Noto Sans SC', 'Microsoft YaHei', 'Heiti SC';
  --font-head: 'Fraunces', var(--font-cjk), Georgia, 'Times New Roman', serif;
  --font-body: 'Geist', var(--font-cjk), ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --maxw: 400px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink-soft);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* i18n — instant swap, no reload */
html[data-lang="en"] .lang-zh { display: none !important; }
html[data-lang="zh"] .lang-en { display: none !important; }

/* ---------- Shell ---------- */
.wrap {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 0 22px calc(40px + env(safe-area-inset-bottom));
  animation: enter .6s var(--ease) both;
}
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Header ---------- */
.head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 16px) 0 14px;
  border-bottom: 1px solid var(--hairline);
}
.masthead { display: flex; align-items: center; min-width: 0; flex: 1 1 auto; }
.wm { display: flex; flex-direction: column; min-width: 0; }
.wm-1 {
  font-size: 13.5px; letter-spacing: .045em; text-transform: uppercase; font-weight: 700;
  color: var(--ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wm-2 {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600;
  color: var(--muted); line-height: 1.25; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.head-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.lang {
  font-size: 12px; letter-spacing: .04em; color: var(--muted);
  display: inline-flex; align-items: center; gap: 2px;
}
.lang button { padding: 3px 5px; color: var(--muted); font-weight: 500; border-radius: 4px; transition: color .2s; }
.lang button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.lang .bar { color: var(--hairline-2); }
.install {
  display: none; align-items: center; gap: 5px; font-size: 11.5px; letter-spacing: .02em;
  font-weight: 600; color: var(--accent); padding: 4px 2px; transition: opacity .2s var(--ease);
}
.install svg { width: 14px; height: 14px; }
.install.show { display: inline-flex; }
.install:active { opacity: .55; }

/* ---------- Identity ---------- */
.identity { padding-top: 38px; }
.portrait {
  width: 116px; height: 140px; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--hairline-2); background: var(--paper-tint);
}
.portrait img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 22%;
}

.name {
  font-family: var(--font-head); font-weight: 500;
  font-size: clamp(30px, 8.4vw, 37px); line-height: 1.04; letter-spacing: -0.018em;
  color: var(--ink); margin-top: 24px;
}
.title {
  margin-top: 13px; font-size: 11.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.tagline {
  margin-top: 15px; font-size: 15px; color: var(--ink-soft); max-width: 33ch; line-height: 1.55;
}
.rule { width: 40px; height: 2px; background: var(--accent); margin-top: 22px; border-radius: 2px; }

/* ---------- Section label ---------- */
.eyebrow {
  font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; margin: 34px 0 4px;
}

/* ---------- Contact / link rows ---------- */
.rows { border-top: 1px solid var(--hairline); }
.row {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 16px 4px; border-bottom: 1px solid var(--hairline);
  transition: background .18s var(--ease);
}
.row:active { background: var(--accent-wash); }
@media (hover: hover) { .row:hover { background: var(--accent-wash); } }
.row .ic { width: 20px; height: 20px; flex: none; color: var(--ink-soft); }
.row .ic svg { width: 100%; height: 100%; }
.row .rt { flex: 1; min-width: 0; }
.row .rl { display: block; font-size: 15px; color: var(--ink); font-weight: 500; line-height: 1.3; letter-spacing: -0.005em; }
.row .rv { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; letter-spacing: .01em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .arw { width: 16px; height: 16px; flex: none; color: #7C8894; transition: transform .2s var(--ease), color .2s; }
.row:hover .arw, .row:active .arw { color: var(--accent); transform: translateX(3px); }

/* ---------- Primary CTA ---------- */
.save {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  margin-top: 20px; padding: 16px; border-radius: 8px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .01em;
  transition: transform .16s var(--ease), background .2s var(--ease);
}
.save:active { transform: scale(.985); background: #0B1B2C; }
.save svg { width: 18px; height: 18px; }
.save .sub { font-weight: 400; font-size: 12px; opacity: .7; }

/* ---------- Expandable "more" ---------- */
.more-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  margin-top: 14px; padding: 12px; font-size: 13px; color: var(--muted); font-weight: 500;
  transition: color .2s;
}
.more-btn:hover { color: var(--ink); }
.more-btn .chev { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.more.open .more-btn .chev { transform: rotate(180deg); }
.more-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s var(--ease); }
.more.open .more-panel { grid-template-rows: 1fr; }
.more-inner { overflow: hidden; }

/* ---------- Location ---------- */
.addr { padding: 14px 6px; border-bottom: 1px solid var(--hairline); display: flex; gap: 15px; }
.addr:first-of-type { border-top: 1px solid var(--hairline); }
.addr .ic { width: 21px; height: 21px; flex: none; color: var(--ink); margin-top: 1px; }
.addr .al { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.addr .av { font-size: 14px; color: var(--ink); margin-top: 3px; line-height: 1.45; }
.link-inline {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  font-size: 14px; font-weight: 600; color: var(--accent);
}
.link-inline svg { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.link-inline:hover svg { transform: translateX(3px); }

/* ---------- Share ---------- */
.share { margin-top: 6px; }
.qr-block { display: flex; align-items: center; gap: 18px; padding: 18px 0; }
.qr-box {
  width: 116px; height: 116px; flex: none; padding: 9px; background: #fff;
  border: 1px solid var(--hairline-2); border-radius: 8px; display: grid; place-items: center;
}
.qr-box img, .qr-box canvas, .qr-box table { width: 98px !important; height: 98px !important; }
.qr-copy .qc-t { font-size: 14px; color: var(--ink); font-weight: 500; }
.qr-copy .qc-s { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.share-actions { display: flex; gap: 10px; margin-top: 12px; }
.sbtn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border: 1px solid var(--hairline-2); border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  transition: border-color .2s, background .2s, transform .16s var(--ease);
}
.sbtn:active { transform: scale(.97); }
.sbtn:hover { border-color: var(--ink); }
.sbtn svg { width: 15px; height: 15px; }
.sbtn.done { border-color: var(--accent); color: var(--accent); }

/* ---------- WeChat sheet ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(18, 37, 57, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.sheet.open { display: flex; animation: fade .22s var(--ease); }
.sheet-card {
  width: 100%; max-width: 300px; text-align: center; background: var(--paper);
  border: 1px solid var(--hairline-2); border-radius: 14px; padding: 28px 24px;
  animation: pop .28s var(--ease);
}
.sheet-card h3 { font-family: var(--font-head); font-weight: 500; color: var(--ink); font-size: 20px; }
.sheet-card .s-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.sheet-qr { width: 190px; height: 190px; margin: 20px auto; padding: 12px; background: #fff; border: 1px solid var(--hairline); border-radius: 8px; display: grid; place-items: center; }
.sheet-qr img { width: 166px; height: 166px; object-fit: contain; border-radius: 4px; }
.qr-ph { width: 166px; height: 166px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); text-align: center; }
.qr-ph svg { width: 54px; height: 54px; }
.qr-ph span { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.wname { font-family: var(--font-head); font-weight: 500; font-size: 18px; color: var(--ink); margin-top: 2px; }
.wphone { font-size: 13px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.wid-copy {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; padding: 9px 16px;
  background: var(--accent-wash); border: 1px solid rgba(14, 122, 110, .38); border-radius: 999px;
  font-size: 13px; color: var(--accent-dk);
  transition: background .2s, border-color .2s, transform .15s var(--ease);
}
.wid-copy:active { transform: scale(.97); }
.wid-copy:hover { background: rgba(14, 122, 110, .14); border-color: var(--accent); }
.wid-copy .wid-k { color: var(--accent); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; }
.wid-copy .wid-v { font-weight: 600; letter-spacing: .01em; color: var(--accent-dk); }
.wid-copy svg { width: 14px; height: 14px; color: var(--accent); }
.wid-copy.done { background: var(--accent); border-color: var(--accent); }
.wid-copy.done .wid-k, .wid-copy.done .wid-v, .wid-copy.done svg { color: #fff; }
.ph-note { font-size: 10.5px; color: var(--muted); margin-top: 14px; line-height: 1.45; }
.ph-note[data-i18n="directNote"] { margin-top: 10px; }
.sheet-close { margin-top: 18px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98) } to { opacity: 1; transform: none } }

/* ---------- Footer ---------- */
.foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--hairline); font-size: 11px; color: var(--muted); line-height: 1.7; }
.foot a { color: var(--ink-soft); font-weight: 500; }

/* ---------- Motion prefs ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
