/* Lanyard badge, (c) 2026 David Pena, licence MIT : https://github.com/Darideivi/lanyard-badge */
/* Lanyard badge: framework-free styles. Pair with badge.js + dock.js.
 *
 * Geometry is fixed (280 x 650: strap 0-140, clasp 128-158, holder 150-646); keep W/H/CLASP_TOP
 * in dock.js in sync if you change it. JS drives `transform` on .badge-root (dock position),
 * .badge-swing (swing spring) and .badge-flip (rotateY), so CSS only animates .badge-sway.
 *
 * THEME: set any --badge-* variable on :root, any parent, or .badge-slot to restyle the badge.
 * Defaults are a dark card with an orange accent and a red lanyard; for a light site set
 * --badge-surface-top/--badge-surface to light colours and --badge-ink/--badge-muted to dark.
 * Needs a browser with color-mix() (all current browsers).
 */
/* Theme variables (set any of them on :root, a parent, or .badge-slot; defaults in brackets):
     --badge-accent [#fe622d]
     --badge-on-accent [#0a0b0d]
     --badge-strap [#d62f2f]
     --badge-strap-dark [#7d1818]
     --badge-strap-light [#ee4b43]
     --badge-surface-top [#171a21]
     --badge-surface [#0d0f13]
     --badge-ink [#e9edf1]
     --badge-muted [#8b93a1]
     --badge-faint [#565d68]
     --badge-line [#232830]
     --badge-line-strong [#2a303a]
     --badge-shine [#fff]   (light that runs around the holder edge; transparent turns it off)
     --badge-font-display ["Space Grotesk", ui-sans-serif, system-ui, sans-serif]
     --badge-font-body [Inter, ui-sans-serif, system-ui, sans-serif]
     --badge-font-mono ["JetBrains Mono", ui-monospace, monospace]
 */

.badge-slot {
  position: relative;
  width: 100%;
  min-height: 650px;
}
.badge-slot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 320px;
  height: 320px;
  margin: -160px 0 0 -160px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--badge-accent, #fe622d) 10%, transparent);
  filter: blur(64px);
  z-index: -1;
  pointer-events: none;
}
.badge-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2rem;
  text-align: center;
  font: 400 0.6875rem/1 var(--badge-font-mono, "JetBrains Mono", ui-monospace, monospace);
  letter-spacing: 0.08em;
  color: var(--badge-faint, #565d68);
}

.badge-root {
  position: relative;
  z-index: var(--badge-z, 30); /* keep below a fixed header (often z-40) so the lanyard emerges from beneath it */
  width: 280px;
  height: 650px;
  margin-inline: auto;
  transform-origin: 50% 0; /* hero fit-scale shrinks it toward the strap */
}
.badge-root:not(.is-in) {
  visibility: hidden;
}
.badge-root.is-floating {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  transform-origin: 0 0; /* dock.js positions the top-left corner directly */
  will-change: transform;
}

.badge-swing {
  position: absolute;
  inset: 0;
  transform-origin: 50% 0;
}
.badge-sway {
  position: absolute;
  inset: 0;
  transform-origin: 50% 0;
  perspective: 1400px;
}

@media (prefers-reduced-motion: no-preference) {
  .badge-root.is-in .badge-sway {
    animation: badge-drop 1000ms var(--badge-ease, cubic-bezier(0.23, 1, 0.32, 1)) backwards, badge-sway 7s ease-in-out 1s infinite;
  }
  .badge-chip-dot {
    animation: badge-pulse 2.4s ease-in-out infinite;
  }
}
@keyframes badge-drop {
  0% {
    opacity: 0;
    transform: translateY(-90px) rotate(-5deg);
  }
  60% {
    opacity: 1;
    transform: translateY(10px) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
@keyframes badge-sway {
  0%,
  100% {
    transform: rotate(-1deg);
  }
  50% {
    transform: rotate(1deg);
  }
}
@keyframes badge-pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* ---- Red lanyard strap, steel clasp, ring ---- */
.badge-strap {
  position: absolute;
  left: 50%;
  top: 0;
  width: 46px;
  height: 140px;
  margin-left: -23px;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 4px),
    linear-gradient(90deg, var(--badge-strap-dark, #7d1818) 0%, var(--badge-strap, #d62f2f) 14%, var(--badge-strap-light, #ee4b43) 50%, var(--badge-strap, #d62f2f) 86%, var(--badge-strap-dark, #7d1818) 100%);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.1), inset -2px 0 0 rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.3);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 48px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 48px);
}
.badge-strap::before {
  content: "";
  position: absolute;
  inset: 0 5px;
  border-inline: 1px dashed rgba(255, 255, 255, 0.3);
}
.badge-clasp {
  position: absolute;
  left: 50%;
  top: 128px;
  width: 40px;
  height: 30px;
  margin-left: -20px;
  border-radius: 6px 6px 8px 8px;
  background: linear-gradient(90deg, #565c64, #c9ced6 30%, #f1f3f6 50%, #a5acb6 70%, #50565e);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 -2px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.badge-clasp::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 9px;
  height: 2px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.45);
}
.badge-ring {
  position: absolute;
  left: 50%;
  top: 150px;
  width: 22px;
  height: 34px;
  margin-left: -11px;
  border-radius: 12px;
  border: 4px solid;
  border-color: #c4cad2 #9097a1 #6c727b #9097a1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ---- Clear holder + flipping faces ---- */
.badge-flip {
  position: absolute;
  top: 150px;
  left: 0;
  width: 280px;
  height: 496px;
  transform-style: preserve-3d;
  transition: transform 800ms cubic-bezier(0.3, 0.7, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
  .badge-flip {
    transition: none;
  }
}
.badge-face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.05) 38%, rgba(255, 255, 255, 0.09));
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 34px 60px -24px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.badge-face-back {
  transform: rotateY(180deg);
  cursor: pointer;
}
.badge-slot-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 56px;
  height: 11px;
  margin-left: -28px;
  border-radius: 6px;
  background: #05060a;
  box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255, 255, 255, 0.2);
}
.badge-glare {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  background: linear-gradient(118deg, transparent 30%, rgba(255, 255, 255, 0.1) 42%, rgba(255, 255, 255, 0.02) 50%, transparent 60%);
}
/* Edge shine: four beams run around the holder edge in turn, with soft corner dots. The beams are
   their own elements, so animating their transform leaves the JS-driven ones alone. */
.badge-beams {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  overflow: hidden;
  pointer-events: none;
  color: var(--badge-shine, #fff);
}
.badge-beam {
  position: absolute;
  opacity: 1;
  filter: drop-shadow(0 0 3px currentColor);
  background: linear-gradient(var(--beam-dir), transparent, currentColor, transparent);
  animation: badge-beam-run 3.5s ease-in-out var(--beam-delay) infinite backwards, badge-beam-fade 1.2s ease-in-out var(--beam-delay) infinite alternate;
}
.badge-beam.is-top {
  --beam-dir: to right;
  --beam-from: translateX(-100%);
  --beam-to: translateX(200%);
  --beam-delay: 0s;
  top: 0;
  left: 0;
  width: 50%;
  height: 2px;
}
.badge-beam.is-right {
  --beam-dir: to bottom;
  --beam-from: translateY(-100%);
  --beam-to: translateY(200%);
  --beam-delay: 0.6s;
  top: 0;
  right: 0;
  width: 2px;
  height: 50%;
}
.badge-beam.is-bottom {
  --beam-dir: to right;
  --beam-from: translateX(100%);
  --beam-to: translateX(-200%);
  --beam-delay: 1.2s;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 2px;
}
.badge-beam.is-left {
  --beam-dir: to bottom;
  --beam-from: translateY(100%);
  --beam-to: translateY(-200%);
  --beam-delay: 1.8s;
  bottom: 0;
  left: 0;
  width: 2px;
  height: 50%;
}
/* Dots sit on the rounded corners (about 6px in from the box corner on a 22px radius). */
.badge-spot {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px;
  border-radius: 9999px;
  background: currentColor;
  filter: blur(1px);
  opacity: 0.3;
  animation: badge-spot-fade 2s ease-in-out infinite alternate;
}
.badge-spot.is-tr,
.badge-spot.is-br {
  width: 8px;
  height: 8px;
  margin: -4px;
  filter: blur(2px);
}
.badge-spot.is-tl { top: 6.5px; left: 6.5px; }
.badge-spot.is-tr { top: 6.5px; right: 6.5px; animation-duration: 2.4s; animation-delay: 0.5s; }
.badge-spot.is-br { bottom: 6.5px; right: 6.5px; animation-duration: 2.2s; animation-delay: 1s; }
.badge-spot.is-bl { bottom: 6.5px; left: 6.5px; animation-duration: 2.3s; animation-delay: 1.5s; }
@keyframes badge-beam-run {
  0% {
    transform: var(--beam-from);
  }
  71.4%, /* 2.5s run, then 1s off the edge */
  100% {
    transform: var(--beam-to);
  }
}
@keyframes badge-beam-fade {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}
@keyframes badge-spot-fade {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 0.7;
  }
}
@media (prefers-reduced-motion: reduce) {
  .badge-beams {
    display: none;
  }
}
.badge-hit {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  cursor: pointer;
  transition: none;
}
.badge-hit:active {
  transform: none;
}
.badge-card {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 42px;
  bottom: 12px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--badge-line, #232830);
  background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--badge-accent, #fe622d) 14%, transparent), transparent 60%), linear-gradient(180deg, var(--badge-surface-top, #171a21), var(--badge-surface, #0d0f13));
}

/* ---- Front ---- */
.badge-front {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 14px;
  text-align: center;
}
.badge-photo {
  display: block;
  width: 188px;
  height: 188px;
  padding: 5px;
  border-radius: 9999px;
  background: conic-gradient(from 200deg, var(--badge-accent, #fe622d), var(--badge-strap, #d62f2f), var(--badge-accent, #fe622d) 55%, var(--badge-strap-dark, #7d1818), var(--badge-accent, #fe622d));
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--badge-accent, #fe622d) 50%, transparent);
}
.badge-photo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  border: 3px solid var(--badge-surface, #0d0f13);
  object-fit: cover;
}
.badge-name {
  margin-top: 22px;
  font: 700 1.75rem/1.1 var(--badge-font-display, "Space Grotesk", ui-sans-serif, system-ui, sans-serif);
  letter-spacing: -0.01em;
  color: var(--badge-ink, #e9edf1);
}
.badge-role {
  margin-top: 10px;
  max-width: 212px;
  font: 400 0.8125rem/1.45 var(--badge-font-body, Inter, ui-sans-serif, system-ui, sans-serif);
  color: var(--badge-muted, #8b93a1);
}
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--badge-accent, #fe622d) 40%, transparent);
  border-radius: 9999px;
  background: color-mix(in srgb, var(--badge-accent, #fe622d) 10%, transparent);
  font: 500 0.6875rem/1 var(--badge-font-mono, "JetBrains Mono", ui-monospace, monospace);
  letter-spacing: 0.04em;
  color: var(--badge-accent, #fe622d);
  white-space: nowrap;
}
.badge-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--badge-accent, #fe622d);
}
.badge-hint {
  margin-top: auto;
  font: 400 0.625rem/1 var(--badge-font-mono, "JetBrains Mono", ui-monospace, monospace);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--badge-faint, #565d68);
}

/* ---- Back ---- */
.badge-back {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 14px;
}
.badge-back-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.badge-back-label {
  font: 500 0.6875rem/1 var(--badge-font-mono, "JetBrains Mono", ui-monospace, monospace);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--badge-accent, #fe622d);
}
.badge-flip-back {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--badge-line-strong, #2a303a);
  border-radius: 9999px;
  background: transparent;
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--badge-muted, #8b93a1);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.badge-flip-back:hover {
  border-color: var(--badge-accent, #fe622d);
  color: var(--badge-accent, #fe622d);
}
.badge-tiles {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.badge-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid var(--badge-line, #232830);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.badge-tile-icon {
  display: grid;
  flex: none;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--badge-accent, #fe622d) 12%, transparent);
  color: var(--badge-accent, #fe622d);
}
.badge-tile-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.badge-tile-title {
  font: 600 0.8125rem/1.25 var(--badge-font-display, "Space Grotesk", ui-sans-serif, system-ui, sans-serif);
  color: var(--badge-ink, #e9edf1);
}
.badge-tile-detail {
  font: 400 0.71875rem/1.35 var(--badge-font-body, Inter, ui-sans-serif, system-ui, sans-serif);
  color: var(--badge-muted, #8b93a1);
}
.badge-back-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.badge-links {
  display: flex;
  gap: 8px;
}
.badge-link {
  flex: 1;
  padding: 7px 0;
  border: 1px solid var(--badge-line-strong, #2a303a);
  border-radius: 8px;
  text-align: center;
  font: 500 0.71875rem/1 var(--badge-font-mono, "JetBrains Mono", ui-monospace, monospace);
  color: var(--badge-ink, #e9edf1);
  transition: color 160ms ease, border-color 160ms ease;
}
.badge-link:hover {
  border-color: var(--badge-accent, #fe622d);
  color: var(--badge-accent, #fe622d);
}
.badge-cta {
  display: block;
  padding: 10px 0;
  border-radius: 8px;
  background: var(--badge-accent, #fe622d);
  text-align: center;
  font: 600 0.78125rem/1 var(--badge-font-mono, "JetBrains Mono", ui-monospace, monospace);
  color: var(--badge-on-accent, #0a0b0d);
  transition: background-color 160ms ease;
}
.badge-cta:hover {
  background: color-mix(in srgb, var(--badge-accent, #fe622d) 90%, transparent);
}
