/* Coordinates match the paper insert in the generated 1024 × 1536 image.
   The layout box crops transparent side margins without changing the image. */
.badge {
  --badge-progress: 0;
  position: fixed;
  z-index: 40;
  top: auto;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: clamp(16px, 2.3vw, 36px);
  width: min(clamp(249.6px, 21.6vw, 312px), calc(88svh * 616 / 1536));
  aspect-ratio: 616 / 1536;
  color: #151818;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(-100lvh - 64px));
  will-change: transform;
  container-type: inline-size;
}
.badge[data-visible="true"] { visibility: visible; }
.badge[data-ready="true"]:not([data-collapsed="true"]) .idcard { pointer-events: auto; }
.badge-visual { width: 100%; height: 100%; transition: opacity .35s ease, translate .45s var(--ease), visibility 0s; }
.badge[data-collapsed="true"] .badge-visual { opacity: 0; translate: 0 24px; visibility: hidden; transition: opacity .3s ease, translate .45s var(--ease), visibility 0s .45s; }
.badge-toggle {
  position: absolute; right: -4px; bottom: calc(52% + 56px); z-index: 2;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 50%;
  background: #F3F4FA; color: #070A18; box-shadow: 0 4px 20px #0005;
  font: 500 28px/1 Arial, sans-serif;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: bottom .45s var(--ease), background-color .2s ease;
}
.badge[data-ready="true"] .badge-toggle { pointer-events: auto; }
.badge[data-collapsed="true"] .badge-toggle { bottom: 0; }
.badge-toggle:hover { background: #fff; }
.badge-toggle:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.badge-swing { position: relative; width: 100%; height: 100%; transform-origin: 50% 0; }
.badge-art {
  position: absolute; top: 0; left: -33.117%;
  width: 166.234%; height: 100%; max-width: none;
  user-select: none; pointer-events: none;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .24));
}
.idcard {
  position: absolute; left: 5.844%; top: 45.182%; width: 88.474%; height: 51.172%;
  padding: 6cqw 4cqw 4cqw;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2;
}
.id-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 2cqw; padding-bottom: 2.2cqw; border-bottom: 1px solid #2b3030; }
.id-title { font-size: 11cqw; font-weight: 900; letter-spacing: -.065em; line-height: .9; }
.id-year { font-size: 4.5cqw; font-weight: 700; }
.id-role { margin-top: 2cqw; font-size: 5.3cqw; font-weight: 700; letter-spacing: -.025em; white-space: nowrap; }
.id-photo {
  position: relative; width: 28cqw; height: 32cqw; margin: 3cqw auto;
  overflow: hidden; border-radius: 2cqw; background: #dedfdb;
}
.id-photo img { display: block; width: 100%; height: auto; }
.id-rows { margin: 0; }
.id-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1cqw;
  padding: 1.2cqw 0; border-bottom: 1px solid #a8aeaa;
  font-size: 5.5cqw; font-weight: 600;
}
.id-row dt, .id-row dd { margin: 0; }
.id-row dt { font-size: 4.5cqw; text-transform: uppercase; }
.id-row dd { text-align: right; overflow-wrap: anywhere; }
.id-row:first-child dd, .id-row:nth-child(3) dd { font-size: 6.8cqw; font-weight: 700; }
.id-row:last-child { display: block; border-bottom: 0; }
.id-row:last-child dd { margin-top: 1cqw; text-align: left; }
.id-row a { text-transform: none; }
.id-row a:hover { text-decoration: underline; }
.id-row a:focus-visible { outline-color: #202a25; outline-offset: 2px; }

@media (min-width: 1100px) {
  :root { --badge-room: clamp(0px, 2000px - 100vw, 360px); }
}

/* Another 20% larger, with a reachable hide/show control. */
@media (max-width: 1099px) {
  :root {
    --mobile-badge-width: min(172.8px, calc((100svh - 96px) * 616 / 1536));
    --mobile-badge-bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
  }
  .badge {
    right: 12px;
    bottom: var(--mobile-badge-bottom);
    width: var(--mobile-badge-width);
  }
  footer { padding-bottom: calc(var(--mobile-badge-bottom) + 56px); }
}
/* Short landscape screens need room beside the badge, not below the footer. */
@media (max-width: 1099px) and (max-height: 480px) {
  :root { --badge-room: calc(var(--mobile-badge-width) + 28px); }
  body.past-hero .nav { transform: translateX(-50%); }
  footer { padding-bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .badge { will-change: auto; transition: none; }
  .badge-visual, .badge[data-collapsed="true"] .badge-visual, .badge-toggle { transition: none; }
}
