:root {
  --surface: #f9f9f6;
  --surface-container-low: #f4f4f1;
  --surface-container: #eeeeeb;
  --on-surface: #1a1c1b;
  --on-surface-variant: #464555;
  --outline: #777587;
  --outline-variant: #c7c4d8;
  --gray-200: #e5e5e0;
  --primary: #3525cd;
  --on-primary: #ffffff;
  --secondary: #06b6d4;

  --radius: 8px;
  --radius-input: 6px;
  --radius-lg: 12px;

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 48px;

  --font-headline: "Outfit", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  padding: clamp(8px, 2dvh, 24px) clamp(8px, 4vw, 24px);
}

.card {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  background: var(--surface-container-low);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: clamp(10px, 2.5dvh, 24px) clamp(12px, 4vw, 24px);
  box-shadow: 0 1px 2px rgba(26, 28, 27, 0.04), 0 8px 24px rgba(26, 28, 27, 0.08);
  overflow: hidden;

  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas:
    "brand  brand    brand"
    "qr     divider  info"
    "links  links    links"
    "actions actions actions";
  row-gap: clamp(6px, 1.5dvh, 16px);
  column-gap: clamp(10px, 3vw, 20px);
  align-items: center;
}

/* Décor : nuage de points, coin supérieur droit, comme sur la carte physique */
.card::before {
  content: "";
  position: absolute;
  top: clamp(8px, 2.5dvh, 20px);
  right: clamp(8px, 2.5dvh, 20px);
  width: 34px;
  height: 26px;
  background-image: radial-gradient(var(--primary) 1.4px, transparent 1.4px);
  background-size: 8px 8px;
  opacity: 0.55;
  pointer-events: none;
}

/* ── Bloc marque : logo + wordmark + slogan ─────────────────── */
.card__brand {
  grid-area: brand;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.card__brand-mark {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.2vw, 8px);
}

/* Logo : coins nets, jamais arrondis (Brand Core) */
.card__logo {
  height: clamp(22px, 4.2dvh, 34px);
  border-radius: 0;
}

.card__wordmark {
  font-family: var(--font-headline);
  font-size: clamp(16px, 3.4dvh, 24px);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--on-surface);
}

.card__slogan {
  margin: 0;
  font-size: clamp(8px, 1.2dvh, 10px);
  font-weight: 500;
  color: var(--primary);
}

/* ── QR code ─────────────────────────────────────────────────── */
.card__qr {
  grid-area: qr;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1dvh, 8px);
  justify-self: center;
}

.card__qr-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 1dvh, 8px);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--on-primary);
}

.card__qr canvas,
.card__qr img {
  width: clamp(64px, 13dvh, 118px) !important;
  height: clamp(64px, 13dvh, 118px) !important;
  display: block;
}

.card__qr-caption {
  margin: 0;
  max-width: 12ch;
  text-align: center;
  font-size: clamp(8px, 1.2dvh, 10px);
  font-weight: 500;
  color: var(--outline);
}

/* ── Séparateur vertical ─────────────────────────────────────── */
.card__divider {
  grid-area: divider;
  width: 1px;
  height: 100%;
  background: var(--gray-200);
  justify-self: center;
}

/* ── Bloc identité : photo + nom + fonction ─────────────────── */
.card__info {
  grid-area: info;
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.5vw, 14px);
  min-width: 0;
}

.card__photo {
  width: clamp(40px, 9dvh, 72px);
  height: clamp(40px, 9dvh, 72px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface-container);
  flex-shrink: 0;
}

.card__identity-text {
  min-width: 0;
}

.card__name {
  font-family: var(--font-headline);
  font-size: clamp(15px, 3.2dvh, 23px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin: 0;
}

.card__title {
  margin: 2px 0 0;
  font-size: clamp(10px, 1.6dvh, 13px);
  font-weight: 500;
  color: var(--on-surface-variant);
}

.card__org {
  margin: 2px 0 0;
  font-size: clamp(9px, 1.3dvh, 11px);
  color: var(--outline);
}

/* ── Trois boutons d'information ────────────────────────────── */
.card__links {
  grid-area: links;
  display: flex;
  justify-content: space-between;
  gap: clamp(6px, 2vw, 12px);
}

.link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--on-surface);
  text-align: center;
}

.link__icon-box {
  width: clamp(28px, 6dvh, 40px);
  height: clamp(28px, 6dvh, 40px);
  border-radius: var(--radius);
  background: var(--surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.link:hover .link__icon-box,
.link:focus-visible .link__icon-box {
  background: var(--outline-variant);
}

.link__icon {
  width: 55%;
  height: 55%;
  color: var(--primary);
}

.link__text {
  font-size: clamp(8px, 1.2dvh, 10px);
  font-weight: 500;
  line-height: 1.25;
  word-break: break-word;
}

/* ── Bouton d'action ─────────────────────────────────────────── */
.card__actions {
  grid-area: actions;
}

.btn {
  width: 100%;
  min-height: clamp(34px, 5.5dvh, 44px);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: clamp(12px, 2dvh, 15px);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  opacity: 0.9;
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

/* ── Paysage / carte "recto" : logo+slogan et QR à gauche,
   identité + boutons + action à droite, séparés par une ligne ── */
@media (min-width: 640px) {
  .card {
    grid-template-columns: minmax(120px, 1fr) auto 1.5fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "brand   divider  info"
      "qr      divider  links"
      "qr      divider  actions";
    align-items: stretch;
  }

  .card__brand {
    align-items: flex-start;
    text-align: left;
  }

  .card__qr {
    justify-self: start;
    align-self: start;
  }

  .card__info {
    align-items: center;
  }

  .card__links {
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .link {
    flex: 1;
    max-width: none;
  }

  .card__actions {
    display: flex;
    align-items: center;
  }
}
