/* H4H membership ID card — CR80 (85.6 x 54 mm) so it prints true to size.
   Everything is sized in mm rather than px: the card has one correct
   physical size, and mm is the only unit that survives the trip to a
   printer unchanged. */

.h4h-card {
  --h4h-card-accent: #c8321f;
  --h4h-card-ink: #0f323c;
  width: 85.6mm;
  max-width: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
}

.h4h-card-face {
  position: relative;
  width: 100%;
  aspect-ratio: 85.6 / 54;
  border-radius: 3.6mm;
  overflow: hidden;
  padding: 3.6mm 4mm 3mm;
  display: flex;
  flex-direction: column;
  background:
    /* warm bloom behind the logo, top-left */
    radial-gradient(42% 62% at 6% 0%, rgba(200, 50, 31, .34) 0%, rgba(200, 50, 31, 0) 70%),
    /* cool lift, bottom-right, to stop the field going flat */
    radial-gradient(58% 78% at 100% 100%, rgba(64, 176, 190, .20) 0%, rgba(64, 176, 190, 0) 68%),
    linear-gradient(152deg, #174b59 0%, var(--h4h-card-ink) 46%, #071a22 100%);
  box-shadow:
    0 .4mm 1mm rgba(8, 26, 33, .18),
    0 2mm 6mm rgba(8, 26, 33, .28);
}

/* Hairline inner edge — the thing that most reads as "printed card"
   rather than "coloured rectangle". */
.h4h-card-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: .25mm solid rgba(255, 255, 255, .13);
  pointer-events: none;
}

/* Accent bar down the left edge, greyed out when the card is not valid. */
.h4h-card-face::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 1.5mm;
  background: linear-gradient(180deg, var(--h4h-card-accent) 0%, #8e1f11 100%);
}
.h4h-card.is-invalid .h4h-card-face::before { background: #5b6167; }

/* Wide arc sweeping out from behind the logo, echoing the shield. */
.h4h-card-arc {
  position: absolute;
  top: -14mm; right: -16mm;
  width: 46mm; height: 46mm;
  border-radius: 50%;
  border: .4mm solid rgba(255, 255, 255, .10);
  box-shadow: inset 0 0 0 3mm rgba(255, 255, 255, .035);
  pointer-events: none;
}

/* Header ---------------------------------------------------------------- */

.h4h-card-top { display: flex; align-items: center; gap: 2.2mm; position: relative; }

.h4h-card-logo {
  width: 8.4mm; height: 8.4mm;
  object-fit: contain;
  flex: none;
  /* No white plate behind it: the logo is a shield with its own silhouette,
     and a box around it looks like a sticker. */
  filter: drop-shadow(0 .3mm .6mm rgba(0, 0, 0, .45));
}

.h4h-card-org { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.h4h-card-org-name {
  font-size: 2.75mm; font-weight: 700; letter-spacing: -.008em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h4h-card-org-sub {
  font-size: 1.85mm; text-transform: uppercase; letter-spacing: .14em;
  color: rgba(255, 255, 255, .58); margin-top: .3mm;
}

/* Status moved up here as a pill — it is the first thing anyone checking a
   card wants to see, and the bottom strip was the wrong place for it. */
.h4h-card-status {
  margin-left: auto; flex: none;
  font-size: 1.7mm; font-weight: 700;
  text-transform: uppercase; letter-spacing: .11em;
  padding: .7mm 1.8mm;
  border-radius: 999px;
  color: #7df0ae;
  background: rgba(45, 212, 130, .14);
  box-shadow: inset 0 0 0 .2mm rgba(125, 240, 174, .38);
}
.h4h-card.is-invalid .h4h-card-status {
  color: #ffb9b0;
  background: rgba(255, 120, 105, .14);
  box-shadow: inset 0 0 0 .2mm rgba(255, 185, 176, .4);
}

/* Body ------------------------------------------------------------------ */

.h4h-card-body {
  display: grid;
  grid-template-columns: 16.5mm minmax(0, 1fr) 15.5mm;
  gap: 3mm;
  align-items: center;
  /* align-content, not just align-items: the body is stretched by flex:1,
     but a grid's single auto row defaults to align-content:start, which
     leaves all the slack piled up under the row. */
  align-content: center;
  flex: 1;
  position: relative;
}

.h4h-card-photo {
  width: 16.5mm; height: 21mm;
  border-radius: 1.6mm;
  overflow: hidden;
  background: rgba(255, 255, 255, .10);
  display: grid; place-items: center;
  box-shadow:
    0 0 0 .3mm rgba(255, 255, 255, .22),
    0 .6mm 1.6mm rgba(0, 0, 0, .3);
}
.h4h-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.h4h-card-initials { font-size: 5.4mm; font-weight: 700; color: rgba(255, 255, 255, .75); letter-spacing: .02em; }

.h4h-card-details { min-width: 0; display: flex; flex-direction: column; }
.h4h-card-name {
  font-size: 4.2mm; font-weight: 700; letter-spacing: -.024em; line-height: 1.06;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h4h-card-chapter {
  font-size: 2.1mm;
  margin-top: .5mm;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* Tinted from the accent so a chapter renaming the card's colours does
     not leave a salmon line sitting under a blue design. The flat fallback
     is for renderers without color-mix (some print pipelines). */
  color: #f0a091;
  color: color-mix(in srgb, var(--h4h-card-accent) 45%, #fff);
}

/* Rule between the name block and the data grid. */
.h4h-card-meta {
  margin: 1.7mm 0 0;
  padding-top: 1.5mm;
  border-top: .2mm solid rgba(255, 255, 255, .14);
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.2mm 2mm;
}
.h4h-card-meta div { min-width: 0; }
.h4h-card-meta dt {
  font-size: 1.5mm; text-transform: uppercase; letter-spacing: .12em;
  color: rgba(255, 255, 255, .45); margin: 0 0 .3mm;
}
.h4h-card-meta dd {
  font-size: 2.15mm; font-weight: 600; margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* QR -------------------------------------------------------------------- */

.h4h-card-qr { display: flex; flex-direction: column; align-items: center; gap: 1mm; }
.h4h-card-qr svg {
  width: 15.5mm; height: 15.5mm;
  border-radius: 1.2mm;
  background: #fff;
  padding: .7mm;
  box-shadow: 0 .5mm 1.4mm rgba(0, 0, 0, .28);
}
.h4h-card-scan {
  font-size: 1.45mm; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255, 255, 255, .45); text-align: center;
}

/* Stand-in for the QR on the join-form preview: the real code cannot
   exist until the member has a token, so show its footprint honestly. */
.h4h-card-qr-placeholder {
  width: 15.5mm; height: 15.5mm; border-radius: 1.2mm;
  border: .35mm dashed rgba(255, 255, 255, .38);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.10) 0 1mm, rgba(255,255,255,0) 1mm 2mm);
}

/* The preview toggles these with the hidden attribute; make sure a theme
   reset cannot leave both the photo and the initials showing at once. */
.h4h-card [hidden] { display: none !important; }

/* Footer strip ---------------------------------------------------------- */

.h4h-card-strip {
  display: flex; align-items: center; gap: 2.4mm;
  border-top: .2mm solid rgba(255, 255, 255, .13);
  margin-top: 2.4mm;
  padding-top: 1.5mm;
  font-size: 1.7mm; text-transform: uppercase; letter-spacing: .12em;
  color: rgba(255, 255, 255, .48);
}
.h4h-card-country {
  font-weight: 700; color: rgba(255, 255, 255, .8);
  padding: .3mm 1.3mm; border-radius: .8mm;
  background: rgba(255, 255, 255, .10);
  letter-spacing: .1em;
}
.h4h-card-domain { margin-left: auto; text-transform: none; letter-spacing: .04em; }

/* Standalone print page -------------------------------------------------- */

.h4h-print-body {
  margin: 0; padding: 32px; min-height: 100vh;
  background: radial-gradient(80% 60% at 50% 0%, #f4f7f8 0%, #e6ebee 100%);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.h4h-print-toolbar {
  display: flex; align-items: center; gap: 14px; margin-bottom: 26px;
  font-size: 13px; color: #4a5058; flex-wrap: wrap;
}
.h4h-print-toolbar button {
  background: #c8321f; color: #fff; border: 0; border-radius: 999px;
  padding: 10px 24px; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 8px rgba(200, 50, 31, .32);
}
.h4h-print-toolbar button:hover { background: #a92917; }

@media print {
  .h4h-print-toolbar { display: none !important; }
  .h4h-print-body { background: #fff; padding: 0; }
  .h4h-card { break-inside: avoid; }
  .h4h-card-face {
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
