/* Premium Profile — Option 5. Its default values match Figma while the
   active card/tenant palette remains the source of truth. */
[data-template="premium-profile"] {
  --premium-brand: var(--qardora-brand, #4a0e5c);
  --premium-footer: var(--qardora-action, var(--premium-brand));
  --premium-icon: var(--qardora-icon, var(--premium-brand));
  --premium-page: var(--qardora-page, #f4f1f6);
  --premium-surface: var(--qardora-surface, #fff);
  --premium-ink: var(--qardora-ink, #1e1222);
  --premium-muted: var(--qardora-muted, #5a4e65);
  --premium-border: var(--qardora-border, #eadfef);
  position: relative;
  display: flex;
  width: min(100%, 390px);
  min-height: 812px;
  margin: 0 auto;
  flex-direction: column;
  overflow: clip;
  background: var(--premium-surface);
  color: var(--premium-ink);
  box-shadow: 0 16px 32px rgb(44 23 53 / 10%);
  --premium-font: Manrope, Inter, Arial, sans-serif;
  font-family: var(--premium-font);
}
[data-template="premium-profile"][data-premium-font="inter"] { --premium-font: Inter, Arial, sans-serif; }
[data-template="premium-profile"][data-premium-font="system"] { --premium-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
[data-template="premium-profile"][data-premium-font="serif"] { --premium-font: Georgia, "Times New Roman", serif; }
[data-template="premium-profile"][data-premium-font="custom"] { --premium-font: "Qardora Premium Custom", Manrope, Inter, Arial, sans-serif; }

body.public-card-classic:has([data-template="premium-profile"]) {
  min-width: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--premium-page);
}

/* The supplied desktop frame has no utility controls.  On mobile, Premium
   uses the same optional directory and locale controls as the other cards. */
[data-template="premium-profile"] > .public-card-home,
[data-template="premium-profile"] > .public-card-language { display: none !important; }
[data-template="premium-profile"] > .template-powered-by { display: grid !important; min-height: 40px; place-items: center; border-top: 1px solid var(--premium-border); background: var(--premium-surface); color: var(--premium-muted); font: 800 .62rem/1 Inter, Arial, sans-serif; letter-spacing: .05em; text-align: center; }
[data-template="premium-profile"] > .template-powered-by .template-powered-link { color: inherit; text-decoration: none; }

.premium-profile-hero {
  position: relative;
  height: 314px;
  min-height: 314px;
  overflow: hidden;
  /* The actual portrait is transparent beneath the wave mask, so this must
     be the same white surface that continues into the content below. */
  background: var(--premium-surface);
  border-radius: 24px 24px 0 0;
}
.premium-profile-hero::after {
  display: none;
}
.premium-profile-wave-divider {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 33.0825px;
  /* The Option 5 divider is the brand-colour wave over the portrait, not
     the darker action-footer colour. */
  background: var(--premium-brand);
  -webkit-mask: url('/static/vcard-templates/premium-profile-wave-divider.svg') center / 100% 100% no-repeat;
  mask: url('/static/vcard-templates/premium-profile-wave-divider.svg') center / 100% 100% no-repeat;
}
.premium-profile-hero > img {
  position: absolute;
  inset: 0;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  /* This is a full-image alpha mask, not an overlay. Android Chrome applies
     -webkit-mask to the image itself, so pixels cannot leak below the wave. */
  -webkit-mask: url('/static/vcard-templates/premium-profile-hero-mask.svg') center / 100% 100% no-repeat;
  mask: url('/static/vcard-templates/premium-profile-hero-mask.svg') center / 100% 100% no-repeat;
}
/* Wide artwork is usually a company logo. Keep it complete rather than
   enlarging it until the left/right edges are cropped. */
.premium-profile-hero > img[data-image-fit="contain"] { object-fit: contain; }
.premium-profile-initial { display: grid; width: 100%; height: 100%; place-items: center; color: var(--premium-brand); font-family: var(--premium-font); font-size: 8rem; font-weight: 800; }

.premium-profile-body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 24px;
  padding: 12px 24px 24px;
  background: var(--premium-surface);
}
.premium-profile-identity-qr { display: grid; min-height: 84px; grid-template-columns: minmax(0, 1fr) 84px; gap: 16px; align-items: center; }
.premium-profile-identity { display: grid; min-width: 0; gap: 4px; }
.premium-profile-identity h1,.premium-profile-identity p,.premium-profile-identity small { margin: 0; overflow-wrap: anywhere; }
.premium-profile-identity h1 { color: var(--premium-brand); font-family: var(--premium-font); font-size: 24px; font-weight: 800; letter-spacing: -.025em; line-height: 33px; }
.premium-profile-identity p { color: var(--premium-ink); font-family: var(--premium-font); font-size: 16px; font-weight: 600; line-height: 22px; }
.premium-profile-identity small { color: var(--premium-muted); font-size: 13px; font-weight: 500; line-height: 16px; }
.premium-profile-qr { position: relative; display: grid; width: 84px; height: 84px; place-items: center; padding: 5px; border: 0; border-radius: 8px; background: var(--premium-surface); isolation: isolate; }
.premium-profile-qr::before { position: absolute; z-index: 0; inset: 0; border: 1.5px solid var(--premium-brand); border-radius: inherit; content: ''; pointer-events: none; }
.premium-profile-qr img { position: relative; z-index: 1; display: block; width: 74px; height: 74px; image-rendering: pixelated; object-fit: contain; }
.premium-profile-qr:focus-visible,.premium-profile-vcf:focus-visible,.premium-profile-share:focus-visible,.premium-profile-social a:focus-visible,.premium-profile-contacts a:focus-visible { outline: 2px solid var(--premium-icon); outline-offset: 3px; }
.premium-profile-body > hr { width: 100%; height: 1px; margin: 0; border: 0; background: var(--premium-border); }
.premium-profile-contacts { display: grid; gap: 14px; align-content: start; }
.premium-profile-contacts > a,.premium-profile-contacts > .premium-profile-custom-contact { display: grid; min-width: 0; min-height: 32px; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; border: 0; border-radius: 0; background: transparent; color: var(--premium-ink); font-size: 13px; font-weight: 500; line-height: 16px; text-decoration: none; overflow-wrap: anywhere; }
.premium-profile-contacts > a:hover { color: var(--premium-brand); }
.premium-profile-contact-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--premium-brand) 8%, var(--premium-surface)); color: var(--premium-icon); }
.premium-profile-contact-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.premium-profile-contacts > .premium-profile-custom-contact { width: 100%; margin: 0; padding: 0; }
.premium-profile-custom-contact > svg { width: 16px; height: 16px; }
.premium-profile-custom-contact > span:not(.premium-profile-contact-icon) { display: block; min-width: 0; font: inherit; overflow-wrap: anywhere; }
.premium-profile-custom-contact span > span { font: inherit; overflow-wrap: anywhere; }

.premium-profile-social { display: flex; width: 100%; min-height: 74px; align-self: stretch; align-items: center; justify-content: center; gap: 16px; margin: 0; padding: 10px 24px 18px; background: var(--premium-surface); }
.premium-profile-social:empty { display: none; }
.premium-profile-social a { display: grid; width: 54px; height: 54px; place-items: center; border: 1.5px solid color-mix(in srgb, var(--premium-icon) 35%, transparent); border-radius: 50%; color: var(--premium-icon); text-decoration: none; transition: background .16s ease, color .16s ease, transform .16s ease; }
.premium-profile-social a:hover { background: var(--premium-brand); color: #fff; transform: translateY(-2px); }
.premium-profile-social svg { width: 24px; height: 24px; fill: currentColor; }
.premium-profile-actions { display: grid; min-height: 68px; margin-top: auto; grid-template-columns: 1fr 1fr; background: var(--premium-footer); color: #fff; }
.premium-profile-actions > a,.premium-profile-actions > button { display: flex; min-height: 68px; align-items: center; justify-content: center; gap: 10px; border: 0; border-left: 1px solid rgb(255 255 255 / 24%); background: transparent; color: inherit; cursor: pointer; font-family: var(--premium-font); font-size: 13px; font-weight: 700; line-height: 1; text-decoration: none; transition: background .16s ease; }
.premium-profile-actions > a { border-left: 0; }
.premium-profile-actions > a:hover,.premium-profile-actions > button:hover { background: rgb(255 255 255 / 12%); }
.premium-profile-actions svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }

@keyframes premium-wave-focus {
  from { opacity: 0; filter: blur(7px); transform: translateY(6px) scaleX(.98); }
  to { opacity: 1; filter: blur(0); transform: translateY(0) scaleX(1); }
}
@keyframes premium-qr-frame-focus {
  from { opacity: 0; filter: blur(4px); transform: scale(.94); }
  68% { opacity: 1; filter: blur(.7px); transform: scale(1.01); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}

/* The QR modules remain sharp for scanning; only its frame and the brand wave
   use this short mobile entrance. The editor's Mobile preview shares it. */
@media (max-width: 759px) {
  .premium-profile-wave-divider { animation: premium-wave-focus 680ms cubic-bezier(.2,.8,.2,1) both 120ms; will-change: filter, opacity, transform; }
  .premium-profile-qr::before { animation: premium-qr-frame-focus 620ms cubic-bezier(.2,.8,.2,1) both 260ms; will-change: filter, opacity, transform; }
}
body[data-preview-device="mobile"] .premium-profile-wave-divider { animation: premium-wave-focus 680ms cubic-bezier(.2,.8,.2,1) both 120ms; will-change: filter, opacity, transform; }
body[data-preview-device="mobile"] .premium-profile-qr::before { animation: premium-qr-frame-focus 620ms cubic-bezier(.2,.8,.2,1) both 260ms; will-change: filter, opacity, transform; }
[data-template="premium-profile"][data-premium-blur="off"] .premium-profile-wave-divider,
[data-template="premium-profile"][data-premium-blur="off"] .premium-profile-qr::before { animation: none !important; will-change: auto; }
@media (prefers-reduced-motion: reduce) {
  .premium-profile-wave-divider,.premium-profile-qr::before { animation: none !important; }
}

@media (min-width: 760px) {
  /* Premium utilities are mobile-only.  This explicitly wins over the shared
     preview-control rules that otherwise place them over the QR code. */
  body.public-card-classic:not([data-preview-device="mobile"]) [data-template="premium-profile"] > .public-card-home,
  body.public-card-classic:not([data-preview-device="mobile"]) [data-template="premium-profile"] > .public-card-language,
  body[data-preview-device="desktop"] [data-template="premium-profile"] > .public-card-home,
  body[data-preview-device="desktop"] [data-template="premium-profile"] > .public-card-language { display: none !important; }
  body.public-card-classic:has([data-template="premium-profile"]) { display: grid; box-sizing: border-box; padding: 32px; place-items: center; background: var(--premium-page) !important; }
  body.public-card-classic:not([data-preview-device]) [data-template="premium-profile"],
  body[data-preview-device="desktop"] [data-template="premium-profile"] {
    display: grid;
    width: min(900px, calc(100vw - 64px), calc((100svh - 64px) * 1.8));
    height: auto;
    min-height: 500px;
    aspect-ratio: auto;
    margin: 0;
    grid-template-columns: 340fr 560fr;
    grid-template-rows: minmax(392px, auto) 68px 40px;
    border-radius: 20px;
  }
  .premium-profile-hero { height: auto; min-height: 0; grid-column: 1; grid-row: 1 / 3; border-radius: 20px 0 0 20px; }
  .premium-profile-hero::after { display: none; }
  .premium-profile-hero > img { -webkit-mask: none; mask: none; }
  .premium-profile-wave-divider { display: none; }
  .premium-profile-body { min-height: 0; grid-column: 2; grid-row: 1; gap: 18px; padding: clamp(25px, 4.45vw, 40px); overflow: visible; }
  .premium-profile-identity-qr { grid-template-columns: minmax(0, 1fr) 84px; }
  .premium-profile-identity { gap: 2px; }
  .premium-profile-identity h1 { font-size: clamp(24px, 2.45vw, 32px); line-height: 1.05; }
  .premium-profile-identity p { display: none; }
  /* Figma desktop hierarchy for a card with a portrait: company, name, role. */
  .premium-profile-vcard:not(.premium-profile-vcard--without-image) .premium-profile-identity p { display: block; order: -1; color: var(--premium-brand); font-size: 14px; font-weight: 800; letter-spacing: .01em; line-height: 1.2; }
  .premium-profile-identity small { margin-top: 2px; font-size: 15px; font-weight: 600; line-height: 1.2; }
  .premium-profile-contacts { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: minmax(32px, auto); column-gap: clamp(20px, 4.4vw, 40px); row-gap: 12px; overflow: visible; }
  .premium-profile-social { min-height: 70px; padding: 10px clamp(25px, 4.45vw, 40px) 18px; }
  .premium-profile-actions { grid-column: 2; grid-row: 2; min-height: 68px; }
  [data-template="premium-profile"] > .template-powered-by { grid-column: 1 / -1; grid-row: 3; }

  /* The editor can request the Figma mobile frame inside a wide preview. */
  body[data-preview-device="mobile"] [data-template="premium-profile"] { display: flex; width: min(100%, 390px); min-height: 0; height: auto; aspect-ratio: auto; grid-template-columns: none; grid-template-rows: none; border-radius: 24px; }
  body[data-preview-device="mobile"] .premium-profile-hero { height: 314px; min-height: 314px; border-radius: 24px 24px 0 0; }
  body[data-preview-device="mobile"] .premium-profile-hero > img {
    -webkit-mask: url('/static/vcard-templates/premium-profile-hero-mask.svg') center / 100% 100% no-repeat;
    mask: url('/static/vcard-templates/premium-profile-hero-mask.svg') center / 100% 100% no-repeat;
  }
  body[data-preview-device="mobile"] .premium-profile-wave-divider { display: block; }
  body[data-preview-device="mobile"] .premium-profile-body { min-height: 0; padding: 12px 24px 24px; }
  body[data-preview-device="mobile"] .premium-profile-identity { gap: 4px; }
  body[data-preview-device="mobile"] .premium-profile-identity p { display: block; margin: 0; color: var(--premium-ink); font-family: var(--premium-font); font-size: 16px; font-weight: 600; letter-spacing: normal; line-height: 22px; text-transform: none; }
  body[data-preview-device="mobile"] .premium-profile-identity small { margin-top: 0; font-size: 13px; font-weight: 500; line-height: 16px; }
  body[data-preview-device="mobile"] .premium-profile-contacts { display: grid; grid-auto-flow: row; grid-template-columns: none; grid-template-rows: none; gap: 14px; overflow: visible; }
  body[data-preview-device="mobile"] .premium-profile-social { min-height: 70px; padding: 10px 24px 18px; }
  body[data-preview-device="mobile"] .premium-profile-actions { min-height: 68px; }
}

@media (max-width: 759px) {
  body[data-preview-device="desktop"] [data-template="premium-profile"] > .public-card-home,
  body[data-preview-device="desktop"] [data-template="premium-profile"] > .public-card-language { display: none !important; }
  [data-template="premium-profile"] { width: 100%; max-width: none; min-height: var(--qardora-card-viewport-height, 100svh); height: auto; }
  body[data-preview-device] [data-template="premium-profile"] { width: min(100%, 390px); min-height: min(var(--qardora-card-viewport-height, 100svh), 812px); border: 0; border-radius: 24px; }
  .premium-profile-hero { height: clamp(208px, 36svh, 314px); min-height: clamp(208px, 36svh, 314px); }
  body.public-card-classic:not([data-preview-device="desktop"]) [data-template="premium-profile"] > .public-card-home,
  body.public-card-classic:not([data-preview-device="desktop"]) [data-template="premium-profile"] > .public-card-language {
    display: grid !important;
    background: transparent !important;
    color: var(--qardora-icon, var(--qardora-brand, var(--premium-brand))) !important;
  }
  body.public-card-classic:not([data-preview-device="desktop"]) [data-template="premium-profile"] > .public-card-home {
    border-color: color-mix(in srgb, var(--qardora-icon, var(--qardora-brand, var(--premium-brand))) 62%, transparent) !important;
  }
  body.public-card-classic:not([data-preview-device="desktop"]) [data-template="premium-profile"] > .public-card-language > span {
    background: transparent !important;
  }
  .premium-profile-social { padding-right: 20px; padding-left: 20px; }
}

/* The mobile device preview can be wider than the mobile breakpoint. */
body[data-preview-device="mobile"] [data-template="premium-profile"] > .public-card-home,
body[data-preview-device="mobile"] [data-template="premium-profile"] > .public-card-language {
  display: grid !important;
  background: transparent !important;
  color: var(--qardora-icon, var(--qardora-brand, var(--premium-brand))) !important;
}
body[data-preview-device="mobile"] [data-template="premium-profile"] > .public-card-home {
  border-color: color-mix(in srgb, var(--qardora-icon, var(--qardora-brand, var(--premium-brand))) 62%, transparent) !important;
}
body[data-preview-device="mobile"] [data-template="premium-profile"] > .public-card-language > span { background: transparent !important; }

/* The desktop editor's mobile device preview uses a wide browser viewport.
   Keep its responsive card height and hero scale aligned with a real phone. */
body[data-preview-device="mobile"] [data-template="premium-profile"] { min-height: min(var(--qardora-card-viewport-height, 100svh), 812px); }
body[data-preview-device="mobile"] .premium-profile-hero { height: clamp(208px, 36svh, 314px); min-height: clamp(208px, 36svh, 314px); }

/* Premium owns its controls so they render inside the card. The mobile frame
   keeps them at top-right; desktop moves them over the image panel so they
   cannot cover the QR code in the details panel. */
body.public-card-classic [data-template="premium-profile"] > .public-card-home,
body.public-card-classic [data-template="premium-profile"] > .public-card-language {
  display: grid !important;
  background: transparent !important;
  color: var(--qardora-icon, var(--qardora-brand, var(--premium-brand))) !important;
}
body.public-card-classic [data-template="premium-profile"] > .public-card-home {
  border-color: color-mix(in srgb, var(--qardora-icon, var(--qardora-brand, var(--premium-brand))) 62%, transparent) !important;
}
body.public-card-classic [data-template="premium-profile"] > .public-card-language > span { background: transparent !important; }
@media (min-width: 760px) {
  body.public-card-classic:not([data-preview-device="mobile"]) [data-template="premium-profile"] > .public-card-home,
  body[data-preview-device="desktop"] [data-template="premium-profile"] > .public-card-home { top: 18px !important; right: auto !important; left: 18px !important; }
  body.public-card-classic:not([data-preview-device="mobile"]) [data-template="premium-profile"] > .public-card-language,
  body[data-preview-device="desktop"] [data-template="premium-profile"] > .public-card-language { top: 18px !important; right: auto !important; left: 68px !important; }
}
