:root {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --ink: #101828;
  --ink-2: #344054;
  --ink-3: #475467;
  --muted: #667085;
  --line: #E4E7EC;
  --accent: #1F3A5F;
  --gold: #E0A800;
  --col: 430px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* driven by app.js on scroll */
  --y: 0;
  --p: 0;
  --q: 0;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #E7E5E0;
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; cursor: pointer; color: inherit; }
h1, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ms {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  flex: none;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
}
.ms-fill { font-variation-settings: 'FILL' 1; }

/* ---------- Card column ---------- */
.card {
  position: relative;
  max-width: var(--col);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(120px + var(--safe-b));
  background: var(--bg);
  box-shadow: 0 30px 60px -20px rgba(20, 33, 58, .35);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  height: 400px;
  overflow: hidden;
  background: radial-gradient(ellipse 75% 62% at 50% 46%, #FFFFFF 0%, #EEF1F5 60%, #DCE1E9 100%);
}
.hero-inner {
  position: absolute;
  inset: 0;
  transform-origin: 50% 40%;
  transform: translateY(calc(var(--y) * .5px)) scale(calc(1 - .18 * var(--p)));
  opacity: calc(1 - .85 * var(--p));
  will-change: transform, opacity;
}
.hero-floor {
  position: absolute;
  left: 50%;
  top: 330px;
  width: 260px;
  height: 28px;
  margin-left: -130px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(16, 24, 40, .34), rgba(16, 24, 40, 0));
}
.hero-img {
  position: absolute;
  left: 50%;
  top: 52px;
  height: 292px;
  width: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 16px 18px rgba(16, 24, 40, .26));
}
.hero-badge {
  position: absolute;
  right: 16px;
  bottom: 62px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .1);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .06em;
  opacity: calc(1 - .85 * var(--p));
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

/* ---------- Identity ---------- */
.body { padding: 0 20px; }
.avatar {
  width: 96px;
  height: 96px;
  margin-top: -48px;
  position: relative;
  z-index: 1;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(16, 24, 40, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.avatar img { width: 86%; height: 86%; object-fit: contain; display: block; }
.name { margin-top: 12px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.honorific { margin-left: 4px; font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.role { margin-top: 2px; font-size: 15px; color: var(--ink-3); }
.company { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--accent); }
.company .ms { font-size: 18px; }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.quick a {
  height: 68px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.quick .ms { font-size: 22px; color: var(--accent); }
.quick a:active, .socials a:active, .directions:active, .row:active { background: #F7F8FA; }

/* ---------- Tabs ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  background: var(--line);
  border-radius: 12px;
}
.tabs button {
  height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
}

.panel { margin-top: 14px; }
.tile { background: var(--surface); border-radius: 14px; }

/* About */
.about { display: flex; flex-direction: column; gap: 10px; }
.bio { padding: 18px; font-size: 15px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat span { font-size: 12px; color: var(--muted); }
.award { padding: 16px 18px; display: flex; gap: 12px; align-items: center; }
.award-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #EEF2F7;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.award > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.award strong { font-size: 14px; font-weight: 700; }
.award small { font-size: 12px; color: var(--muted); }
.socials { display: flex; gap: 8px; }
.socials a {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

/* Products */
.products { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product { background: var(--surface); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.thumb { aspect-ratio: 4 / 3; background: var(--bg); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 85%; height: 85%; object-fit: contain; }
.product span { font-size: 13px; font-weight: 700; padding: 0 2px 2px; }

/* Contact */
.rows { padding: 4px 18px; }
.row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row.top { align-items: flex-start; }
.row .ms { font-size: 20px; color: var(--accent); }
.row > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row small { font-size: 12px; color: var(--muted); }
.row b { font-size: 15px; font-weight: 600; }
.row b.sm { font-size: 14px; overflow-wrap: anywhere; }
.row b.addr { line-height: 1.45; }
.directions {
  margin-top: 10px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.directions .ms { font-size: 20px; }

/* ---------- Pinned layer (column-width, centred) ---------- */
.layer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--col));
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
}
.layer > * { pointer-events: auto; }

.topbar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(60px + var(--safe-t));
  padding: var(--safe-t) 16px 0 20px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 3;
  opacity: var(--q);
  transform: translateY(calc((1 - var(--q)) * -12px));
  pointer-events: none;
}
.topbar.on { pointer-events: auto; }
.topbar-logo {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.topbar-logo img { width: 72%; height: 72%; object-fit: contain; }
.topbar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.topbar-text b { font-size: 15px; font-weight: 800; }
.topbar-text span { font-size: 12px; color: var(--muted); }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn .ms { font-size: 20px; }

.scrim { position: absolute; inset: 0; background: rgba(16, 24, 40, .35); z-index: 3; }
.menu {
  position: absolute;
  right: 20px;
  bottom: calc(90px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 4;
}
.menu > * {
  height: 46px;
  padding: 0 16px 0 12px;
  border-radius: 23px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .15);
  animation: pop .18s ease-out both;
}
.menu .ms { font-size: 20px; color: var(--accent); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.dock {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(16px + var(--safe-b));
  display: flex;
  gap: 10px;
  z-index: 4;
}
.save {
  flex: 1;
  height: 58px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(31, 58, 95, .3);
}
.save .ms { font-size: 20px; }
.more {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(16, 24, 40, .12);
}
.more .ms { font-size: 24px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(90px + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  z-index: 7;
  pointer-events: none;
}

/* ---------- QR screen ---------- */
.qr {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow-y: auto;
  background: var(--bg);
  padding: calc(12px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  animation: rise .22s ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.qr-head { display: flex; align-items: center; justify-content: space-between; height: 44px; flex: none; font-size: 16px; font-weight: 600; }
.qr-head-spacer { width: 40px; }
.round-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.round-btn .ms { font-size: 20px; }
.qr-card {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.qr-frame { background: #fff; padding: 16px; border-radius: 12px; border: 1px solid #E6E6E6; }
#qr-code { width: 212px; height: 212px; color: #0A0A0A; }
#qr-code svg { width: 100%; height: 100%; display: block; }
.qr-name { margin-top: 22px; font-size: 26px; font-weight: 500; }
.qr-role { margin-top: 4px; font-size: 14px; color: var(--muted); }
.qr-url {
  margin-top: 14px;
  max-width: 100%;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.qr-hint { margin-top: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.qr-spacer { flex: 1; min-height: 24px; }
.qr-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; flex: none; }
.qr-actions button {
  height: 76px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.qr-actions .ms { font-size: 22px; }

@media (hover: hover) {
  .quick a:hover, .socials a:hover, .directions:hover, .menu > *:hover, .qr-actions button:hover { background: #F7F8FA; }
  .save:hover { background: #18304F; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-inner { transform: none; }
  .topbar { transform: none; }
  .menu > *, .qr { animation: none; }
}
