/* Phone business card (card.php). Standalone page: no sidebar, built for a phone held up to someone. */
:root {
  --dcard-bg: #070b12;
  --dcard-panel: #0d1624;
  --dcard-border: #2e3c53;
  --dcard-text: #f8fbff;
  --dcard-muted: #9cabc3;
  --dcard-primary: #52e5a5;
  --dcard-on-primary: #06110d;
  --dcard-bg-top: #0b1422;
  --dcard-button: #131e2f;
  --dcard-button-border: #3b4a63;
}
/* Owner designs (inc-card-design.php) set the variables above on <body>; the border follows the buttons. */
body.digital-card-page { --dcard-border: var(--dcard-button-border); }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.digital-card-page {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--dcard-text);
  background: radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--dcard-primary) 12%, transparent), transparent 40%), linear-gradient(180deg, var(--dcard-bg-top) 0%, var(--dcard-bg) 70%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* Owner's background photo: veiled with the card colour so text stays readable. */
body.digital-card-page.has-bg-image {
  background: linear-gradient(180deg, color-mix(in srgb, var(--dcard-bg-top) 55%, transparent), color-mix(in srgb, var(--dcard-bg) 85%, transparent)), var(--dcard-bg-image) center / cover no-repeat fixed, var(--dcard-bg);
}
.dcard-logo { display: block; max-width: 170px; max-height: 44px; width: auto; height: auto; object-fit: contain; }
.dcard-foot-brand { margin: 0; text-align: center; font-size: 15px; font-weight: 950; color: var(--dcard-muted); }
.dcard-foot-brand span { color: var(--dcard-primary); }
.dcard {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dcard-top { display: flex; align-items: center; justify-content: space-between; }
.dcard-brand { font-size: 24px; font-weight: 950; letter-spacing: -.01em; }
.dcard-brand span { color: var(--dcard-primary); }
a.dcard-brand, .dcard-foot-brand a { color: inherit; text-decoration: none; }
.dcard-top small { color: var(--dcard-muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }

.dcard-identity { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.dcard-avatar {
  width: 96px; height: 96px; margin-bottom: 8px;
  display: grid; place-items: center; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 22px;
  color: var(--dcard-on-primary); background: var(--dcard-accent, var(--dcard-primary));
  font-size: 40px; font-weight: 950;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.dcard-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dcard-avatar.shape-circle { border-radius: 50%; }
.dcard-avatar.shape-square { border-radius: 6px; }
.dcard-identity h1 { margin: 0; font-size: clamp(24px, 7vw, 30px); line-height: 1.15; overflow-wrap: anywhere; }
.dcard-identity p { margin: 0; color: var(--dcard-primary); font-size: 15px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }

.dcard-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dcard-qr-frame {
  position: relative; width: min(100%, 320px); aspect-ratio: 1;
  display: grid; place-items: center; padding: 18px;
  border-radius: 20px; background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.dcard-qr-frame > div { width: 100%; height: 100%; }
.dcard-qr-frame svg { display: block; width: 100%; height: 100%; }
.dcard-qr-mark {
  position: absolute; width: 44px; height: 44px; display: grid; place-items: center;
  border: 5px solid #fff; border-radius: 12px; color: var(--dcard-on-primary); background: var(--dcard-primary);
  font-size: 19px; font-weight: 950;
}
.dcard-qr p { margin: 0; color: var(--dcard-muted); font-size: 14px; line-height: 1.45; text-align: center; }

.dcard-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dcard-action, .dcard-keep-button {
  min-height: 48px; padding: 12px 14px;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--dcard-button-border); border-radius: 14px;
  color: var(--dcard-text); background: var(--dcard-button);
  font: inherit; font-size: 15px; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dcard-action:hover, .dcard-keep-button:hover { border-color: var(--dcard-primary); }
/* A button left alone on the last row spans the full width like the others. */
.dcard-actions .dcard-action:nth-child(even):last-child { grid-column: 1 / -1; }
.dcard-action.primary { grid-column: 1 / -1; border-color: var(--dcard-primary); color: var(--dcard-on-primary); background: var(--dcard-primary); }
.dcard-action.primary:hover { filter: brightness(1.08); }

.dcard-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.dcard-links a {
  min-width: 44px; max-width: 100%; height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--dcard-button-border); border-radius: 999px; color: var(--dcard-text); background: var(--dcard-button);
  font-size: 13px; font-weight: 850; text-decoration: none;
}

.dcard-keep { display: grid; gap: 10px; padding-top: 6px; border-top: 1px solid var(--dcard-border); }
.dcard-keep-button.wallet { color: #06110d; background: #fff; border-color: #fff; }
.dcard-keep-button.wallet:hover { border-color: var(--dcard-primary); background: #f2f6f4; }
.dcard-keep[hidden], .dcard-keep-button[hidden], .dcard-action[hidden], .dcard-qr[hidden] { display: none; }
.dcard-status { min-height: 18px; margin: 0; color: var(--dcard-primary); font-size: 13px; text-align: center; }

.dcard-hint {
  width: min(420px, calc(100% - 32px)); padding: 22px;
  border: 1px solid var(--dcard-border); border-radius: 18px;
  color: var(--dcard-text); background: var(--dcard-panel);
}
.dcard-hint::backdrop { background: rgba(3, 6, 12, .7); }
.dcard-hint h2 { margin: 0 0 10px; font-size: 19px; }
.dcard-hint p { margin: 0 0 18px; color: var(--dcard-muted); line-height: 1.55; }
.dcard-hint button { width: 100%; min-height: 46px; border: 0; border-radius: 14px; color: var(--dcard-on-primary); background: var(--dcard-primary); font: inherit; font-weight: 850; cursor: pointer; }

@media (display-mode: standalone) {
  .dcard { min-height: 100dvh; justify-content: center; }
  .dcard-keep { display: none; }
}
