/* ---------------------------------------------------------------------------
   The Tr. visiting card: 3.5 in x 2 in, front and back.

   The card is laid out in units of its own width (1em on the card = 1 % of it),
   so the preview at 350 px on a phone, at 670 px on a laptop and the 3.5 in PDF
   page are the same card at different sizes — nothing is fixed in px.

   `1cqw` gives that unit in browsers with container queries; promo.js also
   writes the same value as an inline px font-size, which covers older browsers
   and the html2canvas capture used for the download.

   The backgrounds (static/media/visitingCardFront.jpg / visitingCardBack.jpg)
   are the team's chalkboard and whiteboard artwork re-proportioned from
   3.5 x 2.1 in to 3.5 x 2 in; only the plain board between the chalk and the
   "Tr. for Teacher" logo was widened, the frame and logo are untouched.

   `--fit` (set by promo.js on .nameCardContent, 1 by default) scales the text
   down when an unusually long name, school or address would otherwise reach
   the logo — the paddings stay put, only the type shrinks.

   The site's own stylesheet styles these elements with !important, so some
   overrides below carry !important too.
   --------------------------------------------------------------------------- */

.nameCard {
  container-type: inline-size;
  font-size: 1cqw;
  width: 100%;
  overflow: hidden;
}

.nameCard--front .nameCardFrame,
.nameCard--back .nameCardFrameBack {
  position: relative;
  aspect-ratio: 7 / 4;              /* 3.5 in : 2 in */
  width: 100%;
  overflow: hidden;
  font-family: Montaga, Georgia, "Times New Roman", serif;
}

.nameCardBg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: fill;                 /* the image is exactly 7:4 */
}

.nameCardContent {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* --- Front: chalkboard --------------------------------------------------
   The card is 57 units tall. Free area is the board above the chalk
   (bottom-left) and the "Tr. for Teacher" logo (bottom-right, from about
   70 units across and 43 units down). */
.nameCardContent:not(.nameCardContent--back) {
  padding: 9.5em 8em 3em 8em;
  text-align: left;
}

/* margins and paddings on the text elements are written as calc(<card units> /
   <the element's own font-size>) so everything stays in card units */
.nameCardName {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 calc(2.4em / 6) !important;
  padding: 0 0 calc(1.5em / 6);
  border-bottom: calc(0.25em / 6) solid rgba(255, 255, 255, 0.45);
  color: #fff !important;
  font-family: Montaga, Georgia, "Times New Roman", serif !important;
  font-size: calc(6em * var(--fit, 1)) !important;
  font-weight: 400 !important;
  line-height: 1.15 !important;
  text-align: left !important;
  letter-spacing: 0.01em;
}

.nameCardLine {
  display: block;
  margin: 0 0 calc(0.5em / 3.3) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  font-family: Montaga, Georgia, "Times New Roman", serif !important;
  font-size: calc(3.3em * var(--fit, 1)) !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  text-align: left !important;
}

/* the old design's front logo — not used with the chalkboard artwork, which
   already carries it */
.nameCardLogo { display: none !important; }

/* --- Back: whiteboard ---------------------------------------------------- */
.nameCardContent--back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8em 11em 14em;           /* extra at the bottom keeps clear of the logo */
  text-align: center;
}

.nameCardNameBack {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 calc(1.8em / 6) !important;
  padding: 0 0 calc(1.3em / 6);
  border-bottom: calc(0.25em / 6) solid rgba(0, 56, 118, 0.35);
  color: #003876 !important;
  font-family: Montaga, Georgia, "Times New Roman", serif !important;
  font-size: calc(6em * var(--fit, 1)) !important;
  font-weight: 400 !important;
  line-height: 1.15 !important;
  letter-spacing: 0.01em;
}

.nameCardSchoolBack {
  margin: 0 0 calc(1.8em / 3.6) !important;
  color: #2b2b2b !important;
  font-family: Montaga, Georgia, "Times New Roman", serif !important;
  font-size: calc(3.6em * var(--fit, 1)) !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
}

.nameCardAddrBack {
  max-width: calc(76em / 3.1 / var(--fit, 1));
  margin: 0 !important;
  color: #4a4a4a !important;
  font-family: Montaga, Georgia, "Times New Roman", serif !important;
  font-size: calc(3.1em * var(--fit, 1)) !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  text-align: center !important;
}

.nameCardLogoBack {
  position: absolute !important;
  right: 6em !important;
  bottom: 5.5em !important;
  width: auto !important;
  height: 7em !important;
}

/* --- Preview column ------------------------------------------------------ */
.namePreview + .namePreview {
  margin-top: 18px;
}
