/* La carte de visite du Cerema, au gabarit de la carte imprimée du DG (85 × 55 mm). */
@font-face { font-family: "Marianne"; src: url("../fonts/Marianne-Light.otf") format("opentype"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Marianne"; src: url("../fonts/Marianne-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Marianne"; src: url("../fonts/Marianne-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Marianne"; src: url("../fonts/Marianne-ExtraBold.otf") format("opentype"); font-weight: 800; font-display: swap; }

:root {
  --bleu: #2c3379;
  --encre: #231f20;
  --orange: #f36450;
  --gris: #6b6f7b;
  --fond: #eef0f4;
  --carte-l: min(92vw, 880px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Marianne", "Helvetica Neue", Arial, sans-serif;
  background: var(--fond);
  color: var(--encre);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(12px, 3vw, 40px) 16px 24px;
  -webkit-font-smoothing: antialiased;
}

/* ---- la carte ---- */
.carte {
  width: var(--carte-l);
  aspect-ratio: 85 / 55;
  background: #fff;
  border-radius: calc(var(--carte-l) * 0.018);
  box-shadow: 0 18px 50px rgba(30, 36, 80, 0.16), 0 2px 6px rgba(30, 36, 80, 0.08);
  padding: calc(var(--carte-l) * 0.055) calc(var(--carte-l) * 0.06);
  display: grid;
  grid-template-columns: 34% 1fr;
  grid-template-rows: auto 1fr;
  column-gap: calc(var(--carte-l) * 0.04);
  font-size: calc(var(--carte-l) * 0.0195);
  line-height: 1.32;
}
.carte .marianne { width: calc(var(--carte-l) * 0.17); align-self: start; }
.carte .marianne img { width: 100%; height: auto; display: block; }
.carte .logo { justify-self: end; width: calc(var(--carte-l) * 0.40); }
.carte .logo img { width: 100%; height: auto; display: block; }

.scan {
  align-self: end;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: calc(var(--carte-l) * 0.01);
  row-gap: calc(var(--carte-l) * 0.012);
}
.scan .qr { grid-column: 1 / 3; width: calc(var(--carte-l) * 0.235); height: auto; display: block; image-rendering: pixelated; }
.scan .legende { font-size: 0.9em; line-height: 1.2; color: var(--encre); align-self: center; }
.scan .legende b { color: var(--bleu); font-weight: 800; display: block; font-size: 1.15em; }
.scan .tel-icone { width: calc(var(--carte-l) * 0.042); height: auto; align-self: start; }

.identite { align-self: end; text-align: right; display: flex; flex-direction: column; gap: 0.15em; }
.identite .nom { color: var(--bleu); font-weight: 800; font-size: 2.35em; line-height: 1.05; letter-spacing: -0.01em; }
.identite .fonction { font-size: 1.55em; line-height: 1.15; margin-bottom: 0.25em; }
.identite .service { color: var(--gris); font-size: 0.95em; margin-bottom: 0.5em; }
.identite .adresse { font-size: 1.15em; }
.identite .tel { font-size: 1.15em; margin-top: 0.25em; }
.identite .tel a, .identite .mail a { color: inherit; text-decoration: none; }
.identite .mail { color: var(--bleu); font-size: 1.15em; margin-top: 0.25em; }
.identite .mail b { font-weight: 800; }
.identite .pied {
  margin-top: 0.9em;
  display: flex; align-items: center; justify-content: flex-end; gap: 0.9em;
  font-size: 1.05em;
}
.identite .pied .www { color: var(--orange); font-weight: 700; text-decoration: none; }
.identite .pied img { height: 1.15em; width: auto; }
.identite .pied .arobase { color: var(--bleu); }

/* ---- sous la carte ---- */
.actions { width: var(--carte-l); margin-top: clamp(14px, 2.5vw, 26px); text-align: center; }
.bouton {
  display: inline-flex; align-items: center; gap: 0.6em;
  background: var(--bleu); color: #fff; text-decoration: none;
  font-weight: 700; font-size: clamp(1rem, 2.6vw, 1.2rem);
  padding: 0.85em 1.6em; border-radius: 999px;
  box-shadow: 0 8px 22px rgba(44, 51, 121, 0.28);
}
.bouton:hover, .bouton:focus-visible { background: #1f2560; }
.bouton svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aide { color: var(--gris); font-size: 0.9rem; margin: 0.8em auto 0; max-width: 42em; }
.liens { margin-top: 1.2em; font-size: 0.9rem; }
.liens a { color: var(--bleu); }
.pied-page { margin-top: auto; padding-top: 28px; color: var(--gris); font-size: 0.8rem; }

/* ---- téléphone ---- */
@media (max-width: 640px) {
  .carte {
    aspect-ratio: auto;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    row-gap: 18px;
    font-size: clamp(11px, 2.9vw, 15px);
    padding: 22px 20px 24px;
  }
  .carte .marianne { width: 34%; }
  .carte .logo { width: 62%; }
  /* Sur un téléphone, l'identité d'abord : le QR-vCard ne sert qu'à être montré à quelqu'un d'autre. */
  .identite { grid-column: 1 / 3; text-align: left; align-items: flex-start; }
  .identite .pied { justify-content: flex-start; }
  .scan { grid-column: 1 / 3; order: 2; grid-template-columns: auto auto auto; justify-content: start; align-items: center; column-gap: 12px; margin-top: 6px; }
  .scan .qr { grid-column: auto; width: 120px; }
  .scan .tel-icone { width: 22px; align-self: center; }
  .actions { position: sticky; bottom: 0; padding: 12px 0 8px; background: linear-gradient(to top, var(--fond) 70%, transparent); }
  .bouton { width: 100%; justify-content: center; }
}

/* ---- impression : la carte seule, au format ---- */
@media print {
  @page { size: 95mm 65mm; margin: 5mm; }
  body { background: #fff; padding: 0; }
  .carte { --carte-l: 85mm; box-shadow: none; border: 0.2mm solid #ddd; }
  .actions, .pied-page { display: none; }
}

/* ---- pages annexes ---- */
.page { width: min(92vw, 720px); background: #fff; border-radius: 14px; padding: clamp(20px, 4vw, 40px); box-shadow: 0 10px 34px rgba(30, 36, 80, 0.10); }
.page h1 { color: var(--bleu); font-weight: 800; margin: 0 0 0.4em; font-size: clamp(1.4rem, 4vw, 2rem); }
.page p { line-height: 1.5; }
.page code, .page pre { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; background: #f4f5f9; border-radius: 6px; }
.page code { padding: 0.1em 0.35em; }
.page pre { padding: 12px 14px; overflow-x: auto; }
.page form { display: grid; gap: 10px; grid-template-columns: 1fr auto auto auto; align-items: end; margin: 1.2em 0; }
.page label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--gris); }
.page input, .page select { font: inherit; padding: 0.55em 0.7em; border: 1px solid #cfd3de; border-radius: 8px; min-width: 0; }
.page button { font: inherit; font-weight: 700; background: var(--bleu); color: #fff; border: 0; border-radius: 8px; padding: 0.65em 1.2em; cursor: pointer; }
.page .resultat { display: flex; justify-content: center; padding: 10px; }
.page .resultat img { max-width: 100%; image-rendering: pixelated; }
.page .logo-cerema { width: 180px; height: auto; display: block; margin-bottom: 10px; }
@media (max-width: 640px) { .page form { grid-template-columns: 1fr 1fr; } .page form label:first-child, .page form button { grid-column: 1 / 3; } }
