/* ==========================================================================
   Eventiere marketing components
   Ticket stub (share-post), lanyard badge front/back with 3D flip.

   Drop-in: reads the host page's own design tokens where they exist
   (--paper, --white, --ink, --slate, --line, --indigo, --indigo-hover,
   --radius, --mock-shadow, --font-display, --font-body, exactly as set on
   website/index.html) and falls back to sane defaults when they do not, so
   this file works standalone. Every colour and radius in this file is a
   var() with a fallback; a page can restyle a component by setting the
   --ev-* custom properties on an ancestor, no edits needed here.

   Namespaced under .ev-ticket / .ev-lanyard / .ev-badge-* only. No global
   resets outside those selectors.
   ========================================================================== */

:root{
  --ev-paper: var(--paper, #FAFAFC);
  --ev-white: var(--white, #FFFFFF);
  --ev-ink: var(--ink, #0B0D2A);
  --ev-slate: var(--slate, #4A5070);
  --ev-line: var(--line, #E3E5EF);
  --ev-indigo: var(--indigo, #3331C5);
  --ev-indigo-hover: var(--indigo-hover, #2724A0);
  --ev-indigo-dark: #201D82;
  --ev-tint: var(--tint, #EEF0FF);

  /* the one place the gold accent survives: the lanyard clip + the rule
     under the badge name. Nowhere else. */
  --foil: #C9A96E;
  --foil-soft: rgba(201, 169, 110, .38);

  --ev-radius: var(--radius, 16px);
  --ev-radius-sm: 10px;
  --ev-shadow: 0 12px 32px var(--mock-shadow, rgba(11, 13, 42, .18));

  --ev-font-display: var(--font-display, "Instrument Serif", "Inter", serif);
  --ev-font-body: var(--font-body, "Inter", system-ui, sans-serif);
}

/* ==========================================================================
   1. TICKET STUB (share-post card)
   .ev-ticket
     .ev-ticket-stub        indigo perforated stub, vertical hashtag
     .ev-ticket-main
       .ev-ticket-who        avatar + guest name
       .ev-ticket-post       post text with an inline hashtag
       .ev-ticket-actions    X / LinkedIn / WhatsApp share links
   ========================================================================== */

.ev-ticket{
  --_tw: var(--ev-ticket-width, 360px);
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: var(--_tw);
  min-width: 0;
  border-radius: var(--ev-radius);
  overflow: hidden;
  box-shadow: var(--ev-shadow);
  background: var(--ev-white);
  font-family: var(--ev-font-body);
  isolation: isolate;
}

.ev-ticket-stub{
  flex: 0 0 60px;
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 0;
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, var(--ev-indigo) 0%, var(--ev-indigo-dark) 100%);
}
.ev-ticket-stub-label{
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  opacity: .92;
  white-space: nowrap;
}
/* perforation: a dashed punch-line between the stub and the card */
.ev-ticket-stub::after{
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: -1px; width: 2px;
  background-image: radial-gradient(circle at 1px 7px, var(--ev-white) 3px, transparent 3.4px);
  background-size: 2px 14px;
  background-repeat: repeat-y;
  z-index: 1;
}

.ev-ticket-main{
  flex: 1 1 auto;
  min-width: 0;
  padding: 18px 20px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ev-ticket-who{
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.ev-ticket-avatar{
  flex: 0 0 32px;
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  box-shadow: 0 0 0 2px var(--ev-white), 0 0 0 3px var(--ev-line);
}
.ev-ticket-avatar img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-ticket-name{
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ev-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-ticket-post{
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ev-slate);
}
.ev-ticket-hashtag{
  color: var(--ev-indigo);
  font-weight: 600;
}

.ev-ticket-actions{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.ev-ticket-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: var(--ev-slate);
  background: transparent;
  transition: background .18s ease, color .18s ease;
}
.ev-ticket-icon svg{ width: 17px; height: 17px; display: block; }
.ev-ticket-icon:hover,
.ev-ticket-icon:focus-visible{
  background: var(--ev-tint);
  color: var(--ev-indigo);
}
.ev-ticket-icon:focus-visible{
  outline: 2px solid var(--ev-indigo);
  outline-offset: 2px;
}

/* narrow phones: the stub becomes a top bar so nothing gets crushed */
@media (max-width: 420px){
  .ev-ticket{
    flex-direction: column;
    max-width: 100%;
  }
  .ev-ticket-stub{
    flex: 0 0 34px;
    width: 100%;
    padding: 0;
  }
  .ev-ticket-stub-label{
    writing-mode: horizontal-tb;
    transform: none;
  }
  .ev-ticket-stub::after{
    top: auto; right: 0; left: 0; bottom: -1px; height: 2px; width: auto;
    background-image: radial-gradient(circle at 7px 1px, var(--ev-white) 3px, transparent 3.4px);
    background-size: 14px 2px;
    background-repeat: repeat-x;
  }
  .ev-ticket-main{ padding: 16px 18px; }
}

/* ==========================================================================
   2. LANYARD BADGE, front + back, with a 3D flip
   .ev-lanyard                 hook + strap + clip + swinging rig
     .ev-lanyard-hook
     .ev-lanyard-strap
     .ev-lanyard-clip
     .ev-badge-scene           perspective + drop-shadow live HERE, never
                                on the transformed element (a filter on the
                                same element as a 3D transform flattens it
                                in Chromium)
       button.ev-badge-flip    the flip control: preserve-3d + rotateY
         span.ev-badge-face.ev-badge-front
         span.ev-badge-face.ev-badge-back
   ========================================================================== */

.ev-lanyard{
  --_bw: var(--ev-badge-width, 272px);
  width: fit-content;
  margin: 0 auto;
  padding-top: 4px;
  transform-origin: top center;
  animation: ev-swing 5.6s ease-in-out infinite;
}
@keyframes ev-swing{
  0%, 100%{ transform: rotate(-2.2deg); }
  50%{ transform: rotate(2.2deg); }
}

.ev-lanyard-hook{
  width: 30px; height: 15px;
  margin: 0 auto;
  border-radius: 15px 15px 0 0;
  border: 3px solid var(--ev-line);
  border-bottom: none;
}
.ev-lanyard-strap{
  width: 38px;
  height: 128px;
  margin: 0 auto;
  position: relative;
  background: linear-gradient(180deg, var(--ev-indigo) 0%, var(--ev-indigo-dark) 92%, #17144f 100%);
  box-shadow: inset -6px 0 10px rgba(0,0,0,.18), inset 6px 0 10px rgba(255,255,255,.08);
}
.ev-lanyard-strap::before{
  content: "";
  position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px;
  background: linear-gradient(180deg, var(--foil), var(--foil-soft));
  opacity: .9;
}
.ev-lanyard-strap::after{
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(180deg, rgba(255,255,255,.06) 0 2px, transparent 2px 5px);
}
.ev-lanyard-clip{
  width: 54px; height: 24px;
  margin: -2px auto 0;
  border-radius: 5px;
  background: linear-gradient(180deg, #f0e8d3, var(--foil) 55%, #96814f);
  box-shadow: 0 3px 8px rgba(11,13,42,.25), inset 0 1px 0 rgba(255,255,255,.55);
  position: relative;
  z-index: 2;
}
.ev-lanyard-clip::after{
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--ev-white);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.35);
}

.ev-badge-scene{
  perspective: 1600px;
  display: flex;
  justify-content: center;
  margin-top: -2px;
  /* the drop-shadow lives on this NON-transformed wrapper on purpose:
     a filter on the same element as transform-style:preserve-3d flattens
     the 3D flip in Chromium. Do not move this onto .ev-badge-flip. */
  filter: drop-shadow(0 22px 30px rgba(11, 13, 42, .28));
}

.ev-badge-flip{
  all: unset;
  box-sizing: border-box;
  display: block;
  position: relative;
  cursor: pointer;
  width: var(--_bw, 272px);
  /* matched to the front face's actual content height (photo + name + event
     line + rule + footer) at this width, checked by measuring computed
     boxes, not guessed - too shallow a ratio here silently squashes the
     square photo and shrinks the gold rule to nothing under flex-shrink */
  aspect-ratio: 0.7;
  transform-style: preserve-3d;
  transition: transform var(--ev-badge-dur, .9s) cubic-bezier(.4, .2, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.ev-badge-scene:hover .ev-badge-flip,
.ev-badge-flip.is-flipped{
  transform: rotateY(180deg);
}
.ev-badge-flip:focus-visible{
  outline: 2px solid var(--ev-indigo);
  outline-offset: 6px;
  border-radius: var(--ev-radius);
}

.ev-badge-face{
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--ev-radius);
  background: var(--ev-white);
  border: 1px solid var(--ev-line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}
.ev-badge-face::before{
  content: "";
  position: absolute;
  top: 9px; left: 50%; width: 32px; height: 7px; margin-left: -16px;
  border-radius: 4px;
  background: var(--ev-line);
}

.ev-badge-tag{
  display: inline-block;
  position: absolute;
  top: 30px; right: -6px;
  background: var(--ev-indigo);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px 5px 10px;
  border-radius: 3px 0 0 3px;
  box-shadow: 0 4px 10px rgba(51,49,197,.35);
}
.ev-badge-photo{
  display: block;
  flex-shrink: 0;
  margin-top: 12px;
  border-radius: var(--ev-radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  box-shadow: 0 1px 0 rgba(255,255,255,.6);
}
.ev-badge-photo img{ width: 100%; height: 100%; object-fit: cover; display: block; }

.ev-badge-name{
  display: block;
  flex-shrink: 0;
  font-family: var(--ev-font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.12;
  margin: 11px 0 2px;
  color: var(--ev-ink);
}
.ev-badge-event{
  display: block;
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--ev-slate);
  margin: 0 0 10px;
  line-height: 1.4;
}
.ev-badge-rule{
  display: block;
  flex-shrink: 0;
  margin-top: auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--foil), transparent);
}
.ev-badge-foot{
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ev-slate);
}
.ev-badge-role{ font-weight: 600; }
.ev-badge-qr{
  display: block;
  width: 24px; height: 24px;
  border-radius: 2px;
  background-image:
    linear-gradient(90deg, var(--ev-ink) 0 3px, transparent 3px 6px),
    linear-gradient(0deg, var(--ev-ink) 0 3px, transparent 3px 6px);
  background-size: 6px 6px;
  opacity: .7;
}

.ev-badge-back{
  transform: rotateY(180deg);
  justify-content: flex-start;
}
.ev-badge-back-heading{
  display: block;
  flex-shrink: 0;
  font-family: var(--ev-font-display);
  font-weight: 400;
  font-size: 20px;
  margin: 12px 0 3px;
  color: var(--ev-ink);
  line-height: 1.15;
}
.ev-badge-back-sub{
  display: block;
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--ev-slate);
  margin: 0 0 12px;
  line-height: 1.4;
}
.ev-badge-thumbs{
  display: grid;
  flex-shrink: 0;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ev-badge-thumbs img{
  border-radius: 6px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.ev-badge-cta{
  display: block;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ev-indigo);
}

/* phones: the badge scales down as one piece, height follows the fixed
   aspect-ratio above so nothing crops or overflows */
@media (max-width: 480px){
  .ev-lanyard{ --_bw: var(--ev-badge-width, 216px); }
  .ev-lanyard-strap{ height: 92px; }
  .ev-badge-name{ font-size: 20px; }
  .ev-badge-back-heading{ font-size: 17px; }
}

@media (prefers-reduced-motion: reduce){
  .ev-lanyard{ animation: none; }
  .ev-badge-flip{ transition: none; }
}
