/* ==========================================================================
   Đại Thuận — Digital business card
   ========================================================================== */

:root {
  --brand: #FF6C34;          /* màu chính doanh nghiệp */
  --brand-deep: #F05028;     /* cam đậm (gradient, hover) */
  --brand-text: #C8461C;     /* cam cho chữ nhỏ — đủ tương phản trên nền trắng */
  --gold: #FFA014;
  --brand-soft: #FFF3ED;
  --brand-soft-2: #FDE3D6;

  --ink: #1F1F1F;
  --ink-2: #4A4744;
  --muted: #8A857F;
  --line: #EFECE8;
  --bg: #FFFFFF;

  --font: "Gotham", "Montserrat", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout: mọi thứ nằm trên một trục giữa ---------- */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(32px + var(--safe-t)) 20px calc(20px + var(--safe-b));
}

.layout {
  width: 100%;
  max-width: 400px;
  display: grid;
  justify-items: center;
}

@media (min-width: 860px) {
  .layout {
    max-width: none;
    width: auto;
    grid-template-columns: 380px auto;
    align-items: center;
    column-gap: 64px;
  }
}

.profile {
  width: 100%;
  text-align: center;
}

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand__mark { width: 40px; height: 40px; object-fit: contain; }
.brand__word { height: 24px; width: auto; }

/* ---------- Identity ---------- */

.page > .brand { margin-bottom: 36px; }
@media (min-width: 860px) { .page > .brand { margin-bottom: 48px; } }

.identity { margin: 0; }

.avatar {
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.name {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.role {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-text);
}

.company {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  text-wrap: balance;
}

/* ---------- Quick actions ---------- */

.quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 24px;
}

.quick__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: transform .15s ease, background-color .15s ease;
}
.quick__item .icon { width: 17px; height: 17px; color: var(--brand-deep); }
.quick__item:hover { background: var(--brand-soft-2); }
.quick__item:active { transform: scale(.97); }

/* ---------- Info list ---------- */

.list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  text-align: left;
}

.row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.list > li:last-child { border-bottom: 0; }

.row__link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 11px 2px;
}
.row__link .icon { color: var(--brand-deep); }

.row__value {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
  transition: color .15s ease;
}
.row__value--sm { font-size: 13.5px; font-weight: 400; color: var(--ink-2); line-height: 1.45; text-wrap: pretty; }
.row__tag { flex: none; font-size: 11.5px; color: var(--muted); }
.row__link:hover .row__value { color: var(--brand-deep); }

/* Nút sao chép — icon nhỏ, đổi thành dấu tích khi đã chép */
.row__copy {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  margin-right: -8px;
  border-radius: 10px;
  color: #B5AFA8;
  transition: background-color .15s ease, color .15s ease;
}
.row__copy .icon { grid-area: 1 / 1; width: 17px; height: 17px; transition: opacity .15s ease, transform .15s ease; }
.row__copy .icon--done { opacity: 0; transform: scale(.6); color: #1E9E5A; stroke-width: 2.2; }
.row__copy:hover { background: var(--brand-soft); color: var(--brand-deep); }
.row__copy.is-done .icon:first-child { opacity: 0; transform: scale(.6); }
.row__copy.is-done .icon--done { opacity: 1; transform: none; }

/* ---------- CTA ---------- */

.cta { display: flex; gap: 8px; margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }

.btn--primary {
  flex: 1;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: 0 8px 18px -10px rgba(240, 80, 40, .7);
}
.btn--primary:hover { box-shadow: 0 12px 24px -10px rgba(240, 80, 40, .8); }

.btn--ghost { width: 50px; padding: 0; background: var(--brand-soft); color: var(--brand-deep); }
.btn--ghost .icon { width: 20px; height: 20px; }
.btn--ghost:hover { background: var(--brand-soft-2); }

.btn--soft { flex: 1; background: var(--brand-soft); color: var(--brand-deep); }
.btn--soft:hover { background: var(--brand-soft-2); }

.btn--line { flex: 1; background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px #E6E2DD; }
.btn--line:hover { box-shadow: inset 0 0 0 1px #D3CDC6; }

@media (min-width: 860px) { .cta .btn--ghost { display: none; } }

/* ---------- Footer ---------- */

.foot {
  margin-top: 32px;
  font-size: 11.5px;
  letter-spacing: .02em;
  color: var(--muted);
  text-align: center;
}

/* ---------- QR (desktop) ---------- */

.aside {
  display: none;
  width: 248px;
  padding-left: 64px;
  border-left: 1px solid var(--line);
  box-sizing: content-box;
  text-align: center;
}
@media (min-width: 860px) { .aside { display: block; } }

.aside__title { margin: 0; font-size: 15px; font-weight: 700; }
.aside__text { margin: 4px 0 18px; font-size: 12.5px; color: var(--muted); }

.qr {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.qr svg { width: 100%; height: 100%; }

.aside__actions { display: grid; gap: 8px; margin-top: 18px; }
.aside__actions .btn { height: 42px; font-size: 13.5px; border-radius: 12px; }

.url-chip { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Share sheet (mobile) ---------- */

.sheet {
  --sheet-in: .38s cubic-bezier(.32, .72, 0, 1);    /* mở: bung nhanh, dừng êm */
  --sheet-out: .26s cubic-bezier(.4, 0, .9, .6);     /* đóng: tăng tốc dần, gọn */
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  justify-items: center;
  visibility: hidden;
  pointer-events: none;
  /* giữ visible tới khi trượt xuống xong rồi mới ẩn */
  transition: visibility 0s linear .26s;
}
.sheet.is-open { visibility: visible; pointer-events: auto; transition: none; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 10, .45);
  opacity: 0;
  transition: opacity var(--sheet-out);
}
.sheet.is-open .sheet__backdrop { opacity: 1; transition: opacity var(--sheet-in); }

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 20px calc(32px + var(--safe-b));
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(20, 14, 10, .08);
  text-align: center;
  outline: none;
  transform: translate3d(0, 100%, 0);
  transition: transform var(--sheet-out);
  will-change: transform;
}
.sheet.is-open .sheet__panel { transform: translate3d(0, 0, 0); transition: transform var(--sheet-in); }
/* đang vuốt: panel bám theo ngón tay, không transition */
.sheet.is-dragging .sheet__panel,
.sheet.is-dragging .sheet__backdrop { transition: none; }

.sheet__grip { width: 36px; height: 4px; margin: 0 auto 16px; border-radius: 4px; background: #E0DCD7; }
.sheet__grip::before { content: ""; display: block; height: 28px; margin: -12px -40px 0; } /* mở rộng vùng chạm */
.sheet .qr { max-width: min(232px, 34vh); }
.sheet__actions { display: flex; gap: 8px; margin-top: 20px; }
.sheet__actions .btn { height: 48px; font-size: 14.5px; }

.sheet__close {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border-radius: 14px;
  background: #F3F1EE;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background-color .15s ease;
}
.sheet__close:hover { background: #EAE7E3; }
.sheet__close:active { transform: scale(.98); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #1F1F1F;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Motion ---------- */


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Small phones ---------- */

/* Màn hình thấp (iPhone SE…) — rút khoảng cách để gần như không phải cuộn */
@media (max-height: 700px) and (max-width: 859px) {
  .page { padding-top: calc(20px + var(--safe-t)); }
  .page > .brand { margin-bottom: 24px; }
  .quick { margin-top: 18px; }
  .row__link { min-height: 44px; padding: 9px 2px; }
  .foot { margin-top: 20px; }
}

@media (max-width: 360px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .name { font-size: 23px; }
  .row__tag { display: none; }
}

/* ---------- Print ---------- */

@media print {
  .cta, .quick, .aside, .sheet, .toast, .row__copy { display: none !important; }
  .page { min-height: 0; }
}
