/* Holding a reference template inside one of our pages.
   This file is OURS — the only part of the card CSS that is not lifted
   verbatim. It exists because the reference cards are whole documents: they
   put the template class on <body>, style <body> itself, and let .shell fill
   the viewport. We draw a card inside an editor, a picker tile and a public
   page, so the same rules have to land on the card's own root instead. */

.st-card-template {
  /* What the reference stylesheet puts on <body>. Without these the card
     keeps the host page's font and background and nothing else looks right. */
  background: var(--page, var(--bg));
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}
.st-card-template *,
.st-card-template *::before,
.st-card-template *::after { box-sizing: border-box; }
.st-card-template img { max-width: 100%; display: block; }
.st-card-template a { color: inherit; }

/* THE OWNER'S LOGO IN THE TOP BAR, which the reference cards never had.
   It is drawn inside `.mk`, the slot the templates built for two
   INITIALS — 40x40 and filled with the accent on `br-square`, a disc on
   the circle axes, an outline on others. That slot is the wrong shape for
   a real logo, and putting one in it does not come out as branding:
   `max-width:100%` squeezes a 600x120 wordmark to 40px wide and 8px tall,
   unreadable, on a coloured tile the logo never asked for. The ten
   bespoke originals style no `.mk` at all and have the opposite problem —
   the image renders at whatever size it was uploaded at, 600px of logo
   across the head of the card.

   So a mark that holds a logo is NOT the initials mark. It keeps the
   bar's height and the logo's own proportions, and drops the tile, which
   is the same treatment the logo gets on every other public page
   (publicBrand's `.stp-top-logo`). This matters more now that the logo
   stands alone: the wordmark beside it used to carry the business's name
   even when the image was illegible. */
.st-card-template .brand .mk.st-logo {
  /* The ten bespoke templates leave `.mk` an inline span, and max-width,
     max-height and overflow all do nothing on one. The `br` axes that DO
     style it use `display:grid` with `place-items:center`; centring a lone
     child in a flex box is the same picture. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: auto;
  height: auto;
  max-width: 190px;
  max-height: 40px;
  padding: 0;
  border: 0;
  /* The initials badge is round on br-circle templates; a logo is only
     rounded when its owner chose the Circle shape (.st-logo-circle). Left
     round, a wide logo was clipped to an ellipse — its corners cut off. */
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: hidden;
}
.st-card-template .brand .mk.st-logo img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 40px;
  object-fit: contain;
}

/* .page-deco is `position:fixed` in the reference, where the card IS the
   page. Here it would cover the app, so it is pinned to the card instead. */
.st-card-template .page-deco { position: absolute; }
/* ...and BEHIND the content. In the reference it sits outside .shell, behind
   it; here it is inside, where z-index 0 painted the artwork (Party's clouds,
   Sprinkles, Stars) over the buttons and rows. .shell is a stacking context
   (position:relative; z-index:1), so -1 keeps it above the shell's own
   background and under everything on the card. */
.st-card-template .shell > .page-deco { z-index: -1; }

/* .shell fills the viewport on a real card and must not here. */
.st-card-template .shell {
  min-height: 0;
  margin: 0 auto;
  padding-bottom: 28px;
}

/* Until the template's own stylesheet has arrived, the markup would show as
   a column of unstyled system text. One frame of nothing beats that. */
.st-card-loading { visibility: hidden; }

/* THE PUBLIC CARD, where the template really is the whole page. The shell
   gets its viewport height and its desktop framing back. */
.st-card-page .st-card-template .shell {
  min-height: 100vh;
  padding-bottom: 110px;
}
@media (min-width: 768px) {
  .st-card-page .st-card-template .shell {
    min-height: 0;
    border-radius: var(--shell-radius, 28px);
    box-shadow: var(--shell-shadow, 0 30px 80px rgba(0, 0, 0, .25));
    margin-bottom: 0;
  }
  .st-card-page .st-card-template { padding: 48px 0 64px; }
}

/* THE BOTTOM BAR STAYS IN THE CARD. Fixed to the window, it floated past the
   card's end over the page around it. Sticky instead: it rides the bottom of
   the screen while the card scrolls, and comes to rest inside the card's
   bottom edge (the shell keeps 110px free for it), never beyond. Sticky needs
   no scroll container between it and the page, so the root clips sideways
   with `clip`, which makes none, rather than `hidden`. */
.st-card-page .st-card-template { overflow-x: clip; }
.st-card-page .st-card-template .sticky {
  position: sticky;
  margin-top: calc(-68px - env(safe-area-inset-bottom, 0px));
}
@media (min-width: 768px) {
  .st-card-page .st-card-template .sticky {
    border-radius: 0 0 var(--shell-radius, 28px) var(--shell-radius, 28px);
  }
}

/* A CARD DRAWN INSIDE A BOX rather than as the page — the editor's phone.
   `.sticky` is `position:fixed` on a real card, which would pin it to the
   app's viewport instead of to the bottom of the phone; sticky inside the
   scrolling box puts it where the design means it. The shell keeps no
   desktop framing here either: the box IS the frame, and a rounded, shadowed
   shell inside a rounded, shadowed phone draws the border twice. */
.st-card-boxed .st-card-template .sticky { position: sticky; max-width: none; }
.st-card-boxed .st-card-template .shell {
  min-height: 0;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* THE PICKER TILE: a whole card scaled down to a thumbnail. Transform rather
   than smaller type, so the tile shows the real proportions of the design
   instead of a redrawn approximation of it. */
.st-card-thumb { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* The scaling wrapper the thumb puts round the card. */
.st-card-thumb > * { transform-origin: top left; }
.st-card-thumb .st-card-template .shell { padding-bottom: 0; min-height: 0; }

/* A CARD AT ITS OWN SIZE — the website's page for one template.
   Not shrunk: a detail view of a design should not be a thumbnail of one.
   But a card is two thousand pixels tall, and beside a column of copy that
   leaves the copy stranded in the middle of an empty screen, so it is a
   phone here: capped, scrollable, and showing the design at the size a
   visitor will meet it. The shell caps itself at 460px already. */
.st-card-full {
  display: block;
  max-height: min(760px, 78vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 28px;
  box-shadow: 0 30px 70px -35px rgba(0, 0, 0, .45);
  scrollbar-width: none;
}
.st-card-full::-webkit-scrollbar { display: none; }
.st-card-full .st-card-template .shell {
  min-height: 0;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  padding-bottom: 24px;
}

/* ── WHAT THE OWNER HAS NOT GIVEN US ────────────────────────────────────
   The reference cards always carry a cover photo and a portrait, and the
   stylesheets are built on that: the identity block leaves 76-110px of room
   for an avatar hanging below the hero. Set neither and that is a hundred
   pixels of nothing above the name. Two classes on the card's root close the
   gap, with enough specificity to beat a template's own .identity rule. */

.st-card-template.st-no-avatar.st-no-hero .identity { padding-top: 26px; }

/* A portrait but no cover: the avatar has nothing to hang off, so it sits in
   the flow above the name instead of absolutely below a hero that is not
   there. Its own size, shape, border and ring all still come from the
   template — only the positioning changes. */
.st-card-template.st-no-hero .hero {
  display: flex;
  justify-content: center;
  padding-top: 18px;
}
.st-card-template.st-no-hero .avatar {
  position: static;
  transform: none;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
}
.st-card-template.st-no-hero .identity { padding-top: 18px; }

/* A floating top bar (tb-float) is drawn OVER the cover photo. With no cover
   there is nothing to float over, and it sat on the portrait instead, so it
   joins the flow above it. Its pill shape and blur stay the template's. */
.st-card-template.st-no-hero.tb-float .topbar {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  margin: 12px 12px 0;
}

/* A cover but no portrait: the hero stands on its own and the identity no
   longer needs to clear an avatar. */
.st-card-template.st-no-avatar:not(.st-no-hero) .identity { padding-top: 22px; }

/* Editor preview: the template's example cover photo, faded like the other
   examples, until the owner uploads their own (businessCardRender). */
.st-card-template .hero-media.st-sample-cover img { opacity: .45; }

/* A phone number never breaks across lines ("(555) 482-" / "6610"). */
.st-card-template a[href^="tel:"] .row-text > span:last-child { white-space: nowrap; }

/* "Open in Maps" is a real control: 44px tall (WCAG 2.5.8 / Apple HIG). */
.st-card-template .map-open { min-height: 44px; padding: 10px 14px; }

/* The [hidden] attribute must win over a template's display rule. */
.st-card-template .gal-nav[hidden] { display: none !important; }

/* OVERLAY COVER (h-overlay): the identity is written ON the photo, over a dark
   scrim, so it is light whatever the identity axis says (id-serif painted the
   role in the accent colour, unreadable on a photo). */
.st-card-template.h-overlay:not(.st-no-hero) .identity h1 { color: #fff; }
.st-card-template.h-overlay:not(.st-no-hero) .identity :is(.role, .org, .badge-line) { color: rgba(255, 255, 255, .94); }
/* Without a cover there is no photo to write on: the identity returns to the
   flow, in the template's own ink (it was white on a pale page). */
.st-card-template.h-overlay.st-no-hero .identity { margin-top: 0; min-height: 0; color: var(--ink); }
.st-card-template.h-overlay.st-no-hero .identity h1 { color: var(--ink); }
.st-card-template.h-overlay.st-no-hero .identity .role { color: var(--accent-text, var(--accent)); }
.st-card-template.h-overlay.st-no-hero .identity :is(.org, .badge-line) { color: var(--muted); }

/* THE OWNER'S LOGO, BY THE SHAPE IT WAS CROPPED TO (dashboard imageCrop).
   A wordmark is wide, a monogram square, a badge round, a crest tall — each
   sized to sit in the bar without dwarfing it or being lost in it. */
.st-card-template.st-logo-square .brand .mk.st-logo,
.st-card-template.st-logo-square .brand .mk.st-logo img { max-width: 44px; max-height: 44px; }
.st-card-template.st-logo-circle .brand .mk.st-logo { width: 44px; height: 44px; max-height: none; border-radius: 50%; overflow: hidden; }
.st-card-template.st-logo-circle .brand .mk.st-logo img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.st-card-template.st-logo-wide .brand .mk.st-logo,
.st-card-template.st-logo-wide .brand .mk.st-logo img { max-width: 200px; max-height: 40px; }
.st-card-template.st-logo-tall .brand .mk.st-logo,
.st-card-template.st-logo-tall .brand .mk.st-logo img { max-width: 44px; max-height: 58px; }

/* WHERE THE OWNER PUT IT. Centred keeps the share button on the right
   without pushing the logo off-centre; left overrides a centred template. */
.st-card-template.st-logo-center .topbar { justify-content: center; position: relative; }
.st-card-template.st-logo-center .topbar .brand { justify-content: center; }
.st-card-template.st-logo-center .topbar .top-right { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.st-card-template.st-logo-left .topbar { justify-content: space-between; }
.st-card-template.st-logo-left .topbar .brand { justify-content: flex-start; margin-right: auto; text-align: left; }

/* ── The portrait ─────────────────────────────────────────────────────────
   The photo takes its frame's shape. A template that rounds .avatar but
   does not clip it (several made in admin) showed a square photo poking out
   of a round frame. Equal weight to a template's own ".t-x .avatar img" and
   loaded before it, so a template that shapes the image itself still wins. */
.st-card-template .avatar img { border-radius: inherit; }

/* The default look, Enhance: a little light, contrast and colour. :where()
   keeps it at a template's weight, so a design that tints its portraits
   (sepia, duotone) keeps its own look. Anything the owner sets themselves
   (black and white, the adjustment sliders, enhance off) is drawn inline on
   the photo by cardTemplateView and wins. Keep in step with photoFilter(). */
.st-card-template:where(.st-photo-enhance) .avatar img { filter: brightness(1.03) contrast(1.06) saturate(1.1); }

/* ── Long contact values ──────────────────────────────────────────────────
   base.css let a value break between ANY two letters, so an address wrapped
   as "maryam@proofpoint.c" / "om". It now breaks only at the points
   cardTemplateView marks (after "@", before "." and "/"), and a word too long
   for a line on its own still breaks rather than overflowing. Long values
   also step down a size, so most stay on one line. The extra class in the
   selectors outranks a template's own ".t-x .row-text span" size. */
.st-card-template .row-text span { overflow-wrap: break-word; }
.st-card-template .row-link .row-text span.row-long { font-size: 13.5px; letter-spacing: -0.005em; }
.st-card-template .row-link .row-text span.row-xlong { font-size: 12.5px; letter-spacing: -0.01em; }

/* ── The owner's colours that no template token covers ───────────────────
   Buttons, text, links, panels, borders and the backgrounds are the
   templates' own tokens (cardTemplateView sets them on the root). These
   three have none, so they are applied by class, and !important because a
   template may paint them in a high-specificity rule or a gradient. */
.st-card-template.st-c-heading :is(.identity h1, .section-title, .wm) { color: var(--c-heading) !important; }
.st-card-template.st-c-icon :is(.row-ico, .row-ico i, .action i, .socials a, .socials a i, .icon-btn, .icon-btn i) { color: var(--c-icon) !important; }
.st-card-template.st-c-iconbg :is(.row-ico, .socials a) { background: var(--c-icon-bg) !important; }

/* ── Legal links inside the card's footer (the public page) ─────────────── */
.st-card-template .footer-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px auto 10px;
  max-width: 420px;
  opacity: .9;
}
.st-card-template .footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 10px;
  font-size: 12px;
  color: var(--muted);
}
.st-card-template .footer-legal p { flex-basis: 100%; margin: 0 0 4px; }
.st-card-template .footer-legal a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
