/* =====================================================================
   SX Connect — card base styles (shared by all 10 templates)
   Every colour and font comes from the card's CSS variables:
   --c-bg --c-surface --c-text --c-muted --c-primary --c-accent --c-button-text
   --f-heading --f-body   (set inline on .sx-card by CardStyle::vars()).
   Template files (cards/{key}.css) only add layout + variable mixes.
   ===================================================================== */

.sx-card {
  --c-bg: #f5f7fb;
  --c-surface: #ffffff;
  --c-text: #14213d;
  --c-muted: #4a5a7a;
  --c-primary: #24427a;
  --c-accent: #14213d;
  --c-button-text: #ffffff;
  --f-heading: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sx-line: color-mix(in srgb, var(--c-text) 10%, transparent);
  --sx-r: 14px;

  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
.sx-card *, .sx-card *::before, .sx-card *::after { box-sizing: border-box; }
.sx-card :where(h1, h2, h3, h4, p, ul, ol, li, figure, hr) { margin: 0; padding: 0; }
.sx-card :where(ul, ol) { list-style: none; }
.sx-card a { color: inherit; text-decoration: none; }
.sx-card button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
.sx-card img { display: block; max-width: 100%; }
.sx-card :focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.sx-card .sx-i { width: 20px; height: 20px; flex: none; }
.sx-card .sx-i-sm { width: 15px; height: 15px; }

.sx-c { display: flex; flex-direction: column; min-height: inherit; }

.sx-name {
  font-family: var(--f-heading);
  line-height: 1.08;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  font-synthesis: none;
}
.sx-role { overflow-wrap: anywhere; }
.sx-badge { display: block; margin-top: 6px; font-size: 12.5px; color: var(--c-muted); }

/* Avatar / initials */
.sx-card .sx-av, .sx-card .sx-arch, .sx-card .sx-ph-top, .sx-card .sx-mono { display: grid; place-items: center; overflow: hidden; }
.sx-card .sx-av img, .sx-card .sx-arch img, .sx-card .sx-ph-top img, .sx-card .sx-mono img { width: 100%; height: 100%; object-fit: cover; }
.sx-initials { font-family: var(--f-heading); line-height: 1; font-synthesis: none; }

/* Quick actions */
.sx-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.sx-acts[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.sx-acts[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.sx-acts[data-count="1"] { grid-template-columns: 1fr; }
.sx-card .sx-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 66px;
  padding: 12px 4px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  transition: transform .15s ease, filter .15s ease;
}
.sx-card .sx-act:hover { filter: brightness(.97); }
.sx-card .sx-act:active { transform: scale(.97); }

/* Contact list */
.sx-list { display: flex; flex-direction: column; }
.sx-card .sx-li { display: flex; align-items: center; gap: 13px; min-height: 50px; padding: 12px 0; }
.sx-li-text { display: flex; flex-direction: column; min-width: 0; }
.sx-val { overflow-wrap: anywhere; }
.sx-li small { display: block; font-size: 12px; opacity: .65; margin-top: 1px; }
.sx-list-kv .sx-li { justify-content: space-between; }
.sx-k { width: 92px; flex: none; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }
.sx-list-kv .sx-val { flex: 1; text-align: right; }

/* Save contact */
.sx-card .sx-save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 15px;
  border-radius: 13px;
  font-weight: 700;
  background: var(--c-primary);
  color: var(--c-button-text);
  transition: transform .15s ease, filter .15s ease;
}
.sx-card a.sx-save:hover { filter: brightness(1.05); }
.sx-card a.sx-save:active { transform: scale(.98); }
.sx-card .sx-save[aria-disabled="true"] { cursor: default; }

/* Social icons */
.sx-soc { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sx-card .sx-soc a, .sx-card .sx-soc button { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: inherit; }

/* Optional sections */
.sx-bio { line-height: 1.6; color: var(--c-muted); white-space: pre-line; overflow-wrap: anywhere; }

.sx-stats {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), 1fr);
  text-align: center;
  padding: 14px 4px;
  border-radius: 16px;
  background: var(--c-surface);
}
.sx-stats > div { padding: 0 4px; min-width: 0; }
.sx-stats b { display: block; font-family: var(--f-heading); font-size: 19px; line-height: 1.2; color: var(--c-primary); }
.sx-stats span { display: block; font-size: 11.5px; color: var(--c-muted); }

.sx-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sx-chips li { font-size: 12.5px; line-height: 1.4; padding: 3px 11px; border: 1.5px solid currentColor; border-radius: 99px; }

.sx-sec-h { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 13px; font-weight: 700; }
.sx-sec-h .sx-sec-count { margin-left: auto; font-weight: 400; color: var(--c-muted); }
.sx-hours { background: var(--c-surface); border-radius: 16px; padding: 6px 16px 8px; text-align: left; }
.sx-hours-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; font-size: 13.5px; border-top: 1px solid var(--sx-line); }
.sx-hours-row b { font-weight: 600; text-align: right; }

.sx-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sx-g { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--c-surface); }
.sx-g img { width: 100%; height: 100%; object-fit: cover; }

.sx-card .sx-btn { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 14px; border-radius: 13px; font-weight: 700; }
.sx-card .sx-btn-primary { background: var(--c-primary); color: var(--c-button-text); }

.sx-links { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.sx-card .sx-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--c-surface);
  border: 1px solid var(--sx-line);
}
.sx-link > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sx-link b { font-weight: 600; overflow-wrap: anywhere; }
.sx-link small { font-size: 12px; color: var(--c-muted); overflow-wrap: anywhere; }
.sx-upi { display: flex; gap: 8px; }
.sx-upi .sx-link { flex: 1; min-width: 0; }
.sx-card .sx-copy { width: 50px; flex: none; display: grid; place-items: center; border-radius: 13px; background: var(--c-surface); border: 1px solid var(--sx-line); }

/* Footer */
.sx-foot { margin-top: auto; padding: 14px 18px 22px; text-align: center; position: relative; }
.sx-tools { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.sx-card .sx-tools button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.sx-card .sx-tools .sx-i { width: 16px; height: 16px; }
.sx-card .sx-pw { display: inline-block; padding: 6px; font-size: 11.5px; opacity: .6; }
.sx-card .sx-pw:hover { opacity: .9; }

/* ---------------------------------------------------------------------
   Public card page shell (cards/page.blade.php)
   --------------------------------------------------------------------- */
.sx-page { margin: 0; min-height: 100vh; background: var(--c-bg, #f6f7f4); }
.sx-page-main { margin: 0 auto; }
.sx-page .sx-card { min-height: 100vh; min-height: 100dvh; }
@media (min-width: 520px) {
  .sx-page {
    background:
      radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--c-primary, #0f7a5a) 22%, transparent), transparent 70%),
      radial-gradient(700px 500px at 110% 110%, color-mix(in srgb, var(--c-accent, #e7b53c) 18%, transparent), transparent 70%),
      color-mix(in srgb, var(--c-bg, #f6f7f4) 86%, var(--c-text, #14181f));
    background-attachment: fixed;
  }
  .sx-page-main { padding: 48px 16px 64px; }
  .sx-page .sx-card {
    min-height: 0;
    border-radius: 28px;
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .45), 0 0 0 1px color-mix(in srgb, var(--c-text) 8%, transparent);
  }
}

/* ---------------------------------------------------------------------
   QR modal + toast (created by card.js, appended to <body>)
   --------------------------------------------------------------------- */
.sx-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(10, 14, 12, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: var(--f-body, system-ui, sans-serif);
}
.sx-modal[hidden] { display: none; }
.sx-modal-box {
  width: 100%; max-width: 340px;
  background: #fff; color: #14181f;
  border-radius: 22px;
  padding: 22px 22px 18px;
  text-align: center;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5);
}
.sx-modal-box h2 { margin: 0 0 4px; font-family: var(--f-heading, system-ui, sans-serif); font-size: 20px; }
.sx-modal-box p { margin: 0 0 14px; font-size: 13.5px; color: #5f6862; }
.sx-modal-qr { display: grid; place-items: center; min-height: 240px; margin: 0 auto 12px; background: #fff; border-radius: 14px; border: 1px solid #e2e5df; padding: 10px; }
.sx-modal-qr svg, .sx-modal-qr img { width: 220px; height: 220px; display: block; }
.sx-modal-url { display: block; font-size: 12.5px; color: #5f6862; word-break: break-all; margin-bottom: 14px; }
.sx-modal-actions { display: flex; gap: 8px; }
.sx-modal-actions > * {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 10px; border-radius: 11px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid #e2e5df; background: #fff; color: #14181f;
}
.sx-modal-actions .sx-modal-primary { background: var(--c-primary, #0f7a5a); border-color: transparent; color: var(--c-button-text, #fff); }
.sx-modal-close { margin-top: 10px; background: none; border: 0; font: inherit; font-size: 13.5px; color: #5f6862; cursor: pointer; padding: 6px 10px; }
.sx-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 1001;
  transform: translateX(-50%) translateY(20px);
  opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 99px;
  background: #14181f; color: #fff; font: 500 14px/1.3 var(--f-body, system-ui, sans-serif);
  transition: opacity .2s ease, transform .2s ease;
}
.sx-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------------
   Inactive card page
   --------------------------------------------------------------------- */
.sx-page-inactive { background: #f6f7f4; color: #14181f; font-family: "DM Sans", system-ui, sans-serif; }
.sx-inactive { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; }
.sx-inactive-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid #e2e5df; border-radius: 22px; padding: 32px 24px; text-align: center; }
.sx-inactive-av { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: #e3f2ec; color: #0b5a43; font: 700 26px/1 "Bricolage Grotesque", system-ui, sans-serif; }
.sx-inactive h1 { margin: 0 0 10px; font: 700 26px/1.15 "Bricolage Grotesque", system-ui, sans-serif; }
.sx-inactive p { margin: 0 0 22px; color: #5f6862; line-height: 1.55; }
.sx-inactive-btn { display: block; padding: 14px; border-radius: 10px; background: #0f7a5a; color: #fff; font-weight: 700; text-decoration: none; }
.sx-inactive-link { display: inline-block; margin-top: 14px; font-size: 14px; color: #0b5a43; }
.sx-inactive .sx-pw { color: #5f6862; font-size: 13px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .sx-card *, .sx-toast { transition: none !important; }
}
