.badge-intro {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(1.25rem, 4vw, 3rem);
}
.badge-notice { padding-inline-start: 1rem; border-inline-start: 2px solid #e7aa62; color: #ddd2bb; }

@media (max-width: 700px) {
  .badge-intro { grid-template-columns: 1fr; }
}

.badge-wall {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  width: min(100%, 49rem);
  margin: 4.5rem auto 0;
}
.badge-token {
  position: relative;
  grid-column: span 2;
  display: block;
  aspect-ratio: 100 / 114;
  margin: 0 1px -23%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  perspective: 650px;
  pointer-events: none;
}
.badge-token:nth-child(11n + 7) { grid-column: 2 / span 2; }
.badge-token:is(:hover, :focus-visible) { z-index: 2; }
.badge-token::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0, 98% 25%, 98% 75%, 50% 100%, 2% 75%, 2% 25%);
  pointer-events: auto;
}
.token-turn {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.token-face {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  clip-path: polygon(50% 0, 98% 25%, 98% 75%, 50% 100%, 2% 75%, 2% 25%);
  pointer-events: none;
}
.token-back {
  display: grid;
  place-items: center;
  background: #ffcb92; color: #20160e;
  transform: rotateY(180deg);
  font-family: Oswald, sans-serif;
  font-size: clamp(.78rem, 2.5vw, 1.2rem);
  text-transform: uppercase;
}
.token-back::before {
  content: "";
  position: absolute;
  inset: 3px;
  background: #e99143;
  clip-path: inherit;
}
.token-back span { position: relative; }
.badge-token:is([data-status="approved"], [data-status="excellent"]) .token-back {
  background: #a9c998;
  color: #f3f7ee;
}
.badge-token:is([data-status="approved"], [data-status="excellent"]) .token-back::before {
  background: #30583a;
}
.token-name {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: calc(100% + .6rem);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(12rem, 145%);
  padding: .2rem .4rem;
  background: #101010;
  line-height: 1.2;
  font-size: .85rem;
  opacity: 0;
}
.badge-token:is(:hover, :focus-visible) .token-name { opacity: 1; }
.badge-token:is(:hover, :focus-visible) .token-turn { transform: scale(1.15) rotateY(180deg); }
@media (prefers-reduced-motion: no-preference) {
  .token-turn { transition: transform .35s ease; }
  .token-name { transition: opacity .15s ease; }
}
@media (max-width: 620px) {
  .badge-wall { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .badge-token:nth-child(11n + 7) { grid-column: span 2; }
  .badge-token:nth-child(7n + 5) { grid-column: 2 / span 2; }
}
@media (max-width: 370px) {
  .badge-wall { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .badge-token:nth-child(7n + 5) { grid-column: span 2; }
  .badge-token:nth-child(5n + 4) { grid-column: 2 / span 2; }
}
@media (max-width: 760px), (hover: none) {
  .badge-token .token-name { display: none; }
  .badge-token:hover:not(:focus-visible) .token-turn { transform: none; }
}
.badge-library { padding-bottom: clamp(3rem, 8vw, 7rem); }

#proof { width: min(35rem,92vw); max-height: 87vh; padding: 1.25rem; background: #23271e; color: #f2eddf; border: 1px solid #a28255; }
#proof::backdrop { background: #000b; }
@media (prefers-reduced-motion: no-preference) {
  #proof[open] { animation: proof-open .28s cubic-bezier(.2, .65, .25, 1) both; }
  #proof[open]::backdrop { animation: proof-dim .28s ease-out both; }
}

@keyframes proof-open {
  from { opacity: 0; transform: translateY(12px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes proof-dim {
  from { opacity: 0; }
  to { opacity: 1; }
}
#proof .close { float: right; min-width: 44px; min-height: 44px; background: transparent; color: inherit; border: 1px solid #a28255; font-size: 1.35rem; }
#proof-form label, #proof-url { display: block; width: 100%; }
#proof-url { min-height: 44px; padding: .5rem; background: #161912; color: inherit; border: 1px solid #a28255; font: inherit; }
#proof-help { color: #d0cab9; font-size: .9rem; }

/* Keep the cutout just outside the stitched border of the artwork. */
img.token-face {
  clip-path: polygon(50% 0, 100% 24%, 100% 76%, 50% 100%, 0 76%, 0 24%);
  filter: grayscale(1);
}

.badge-intro p + p { margin-top: .8rem; }
.badge-intro h3 { font-size: clamp(1.35rem, 3vw, 2rem); }
#proof p { margin-block: .65rem; }
#proof button.button { border: 0; font-size: 1rem; }
.club-account-link { margin-top: 1rem; color: #201a13; text-decoration: none; }
.badge-token[data-status="approved"] img { filter: grayscale(1) sepia(1) hue-rotate(55deg) saturate(2); }
.badge-token[data-status="excellent"] img { filter: grayscale(1) sepia(1) saturate(2.4); }

/* Mobile audit: independent touch targets, no overlapping honeycomb rows. */
@media(max-width:760px){
 .badge-wall{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 8px;margin:2rem auto 0;max-width:30rem}
 .badge-wall .badge-token:nth-child(n){grid-column:auto;margin:0;pointer-events:auto;min-width:0;touch-action:manipulation}
 .badge-token .token-name{display:none}
 .badge-token:is(:hover,:focus-visible) .token-turn{transform:none}
 .badge-token:focus-visible{outline:2px solid #e7aa62;outline-offset:3px;border-radius:8px}
 .badge-token:is([data-status="approved"],[data-status="excellent"]):before{content:'✓';position:absolute;right:2px;top:7px;z-index:3;display:grid;place-items:center;width:21px;height:21px;border-radius:50%;background:#30583a;color:#fff;font:bold 14px system-ui;pointer-events:none}
 #proof{box-sizing:border-box;width:calc(100% - 24px);max-height:85vh;max-height:85dvh;overflow:auto;overscroll-behavior:contain;padding:1rem}
 #proof-title{font-size:clamp(1.4rem,7vw,2rem);overflow-wrap:anywhere}
 #proof-url{box-sizing:border-box;min-width:0;font-size:16px}
 #proof .button{max-width:100%;white-space:normal}
}
@media(min-width:540px) and (max-width:760px){.badge-wall{grid-template-columns:repeat(4,minmax(0,1fr))}}

/* Square embroidered collection: independent cells with room for the flip. */
.badge-wall{grid-template-columns:repeat(6,minmax(0,1fr));gap:clamp(8px,1.2vw,14px);width:min(100%,58rem);margin:3rem auto 0}
.badge-wall .badge-token:nth-child(n){grid-column:auto;aspect-ratio:1;margin:0;pointer-events:auto;min-width:0;touch-action:manipulation}
.badge-token::after{clip-path:none;inset:3%}
.token-face,img.token-face{clip-path:none;object-fit:contain;filter:none!important}
.token-back{inset:3%;width:94%;height:94%;border-radius:8%;border:3px solid #ffcb92;box-sizing:border-box;background:#e99143}
.token-back::before{border-radius:6%;inset:2px}
.badge-token:is(:hover,:focus-visible) .token-turn{transform:scale(1.04) rotateY(180deg)}
.badge-token:focus-visible{outline:2px solid #e7aa62;outline-offset:3px;border-radius:8%}
@media(max-width:760px){.badge-wall{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.badge-token:is(:hover,:focus-visible) .token-turn{transform:none}}
@media(max-width:450px){.badge-wall{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}}
