/* EventSignupHub Certificates — public site. Hub design language: midnight stage, soft glows,
   Bricolage Grotesque display + Manrope text, magenta accent, paper panels, race-bib cards. */
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-latin.woff2") format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --midnight: #0e0c26; --midnight-deep: #09081b; --stage: #17153a; --stage-raised: #221f4d;
  --paper: #f4f2ff; --muted: #aba7cf; --dim: #8f8bb8;
  --violet: #7b61ff; --violet-soft: #a08cff; --magenta: #ff4fa3; --magenta-soft: #ff8cc4;
  --coral: #ff7a5c; --cyan: #38d9f5; --lime: #b6f36a;
  --ink: #17153a; --ink-soft: #5b5880;
  --line: rgb(244 242 255 / .1); --line-strong: rgb(244 242 255 / .18);
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem); --max: 76rem;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --accent: var(--magenta);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--midnight); color: var(--paper); font-family: var(--sans); font-size: 16px; line-height: 1.55; overflow-x: hidden; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 10px; }

/* ---------- Sky: glows, beams, grain ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 80% at 50% -10%, #1d1a4a 0%, var(--midnight) 55%, var(--midnight-deep) 100%); }
.glow { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.g1 { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: radial-gradient(circle, rgb(255 79 163 / .55), transparent 65%); animation: drift 22s var(--ease) infinite alternate; }
.g2 { width: 40vw; height: 40vw; right: -10vw; top: 8vh; background: radial-gradient(circle, rgb(123 97 255 / .6), transparent 65%); animation: drift 26s var(--ease) infinite alternate-reverse; }
.g3 { width: 36vw; height: 36vw; left: 30vw; bottom: -18vw; background: radial-gradient(circle, rgb(56 217 245 / .32), transparent 65%); animation: drift 30s var(--ease) infinite alternate; }
.beam { position: absolute; top: -20vh; width: 2px; height: 140vh; background: linear-gradient(to bottom, transparent, rgb(255 140 196 / .16), transparent); transform-origin: top; }
.b1 { left: 22%; transform: rotate(-16deg); animation: sway 19s ease-in-out infinite alternate; }
.b2 { right: 18%; transform: rotate(14deg); background: linear-gradient(to bottom, transparent, rgb(139 233 250 / .12), transparent); animation: sway 23s ease-in-out infinite alternate-reverse; }
.grain { position: absolute; inset: 0; opacity: .06; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }
@keyframes drift { to { transform: translate(6vw, 4vh) scale(1.08); } }
@keyframes sway { from { transform: rotate(-16deg); } to { transform: rotate(-4deg); } }

/* ---------- Header ---------- */
.top { max-width: var(--max); margin: 0 auto; padding: 18px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-size: 1.05rem; letter-spacing: -.01em; }
.brand svg { width: 34px; height: 34px; }
.brand b { color: var(--magenta-soft); font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: .84rem; font-weight: 600; border: 1px solid var(--line-strong); background: rgb(244 242 255 / .05); text-decoration: none; }
.pill.ghost:hover { background: rgb(244 242 255 / .1); }
.pill.small { font-size: .78rem; padding: 5px 11px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgb(182 243 106 / .18); }

/* ---------- Hero ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 40px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(28px, 5vw, 72px); align-items: center; padding: clamp(18px, 4vw, 56px) 0 clamp(24px, 4vw, 40px); }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.5rem, 6.2vw, 4.6rem); line-height: .98; letter-spacing: -.035em; margin: 18px 0 14px;
  background: linear-gradient(100deg, #fff 30%, var(--magenta-soft) 62%, var(--violet-soft) 92%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 34rem; margin: 0 0 26px; }

/* ---------- Finder (paper panel) ---------- */
.finder { position: relative; background: var(--paper); color: var(--ink); border-radius: 26px; padding: clamp(18px, 2.6vw, 26px); display: grid; gap: 14px;
  box-shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 40px 80px -30px rgb(0 0 0 / .65), 0 0 0 1px rgb(123 97 255 / .25); }
.finder::before { content: ""; position: absolute; inset: -1px; border-radius: 27px; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--angle, 0deg), transparent 0 70%, var(--magenta) 80%, var(--violet) 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: spin 6s linear infinite; }
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --angle: 360deg; } }
.finder-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; }
.field { display: grid; gap: 6px; position: relative; min-width: 0; }
.field label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); padding-left: 2px; }
.combo-box, .search-box { position: relative; min-width: 0; display: flex; align-items: center; background: #fff; border: 1.5px solid #dcd8f5; border-radius: 14px; transition: border-color .2s, box-shadow .2s; }
.combo-box:focus-within, .search-box:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px rgb(123 97 255 / .16); }
.combo-box .ico, .search-box .ico { width: 20px; height: 20px; margin-left: 13px; color: var(--violet); flex: none; }
.combo-box input, .search-box input { flex: 1; width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; padding: 14px 12px; font-size: 1rem; color: var(--ink); }
.combo-box input:disabled, .search-box input:disabled { cursor: not-allowed; }
.combo-box:has(input:disabled), .search-box:has(input:disabled) { background: #f0eef9; border-style: dashed; }
input::placeholder { color: #9a96bd; }
.combo-toggle { border: 0; background: transparent; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); }
.combo-toggle svg { width: 18px; height: 18px; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: 300px; overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: #fff; border-radius: 16px; box-shadow: 0 24px 50px -16px rgb(14 12 38 / .45), 0 0 0 1px #e4e0f8; }
.combo-list li { padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.combo-list li small { color: var(--ink-soft); font-size: .78rem; white-space: nowrap; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: #f1edff; }
.combo-list li mark { background: rgb(255 79 163 / .18); color: inherit; border-radius: 3px; }
.combo-list .empty { color: var(--ink-soft); cursor: default; }
.hint { margin: 2px 2px 0; font-size: .82rem; color: var(--ink-soft); min-height: 1.2em; }
.hint.error { color: #c8236a; font-weight: 600; }
.cta { position: relative; border: 0; border-radius: 16px; padding: 16px 20px; font-family: var(--display); font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--midnight); background: linear-gradient(100deg, var(--magenta), #ff6fb3 45%, var(--violet-soft));
  box-shadow: 0 18px 34px -14px rgb(255 79 163 / .8); transition: transform .2s var(--ease), box-shadow .2s, filter .2s; }
.cta svg { width: 22px; height: 22px; transition: transform .25s var(--ease); }
.cta:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 24px 40px -14px rgb(255 79 163 / .9); }
.cta:hover:not(:disabled) svg { transform: translateX(4px); }
.cta:disabled { filter: grayscale(.6) opacity(.55); cursor: not-allowed; box-shadow: none; }
.cta.loading span::after { content: "…"; }

/* ---------- Showcase ---------- */
.showcase { position: relative; display: grid; place-items: center; min-height: 420px; }
.cert-stack { position: relative; width: min(100%, 440px); aspect-ratio: var(--ratio, 1080 / 1475); }
.cert { position: absolute; inset: 0; border-radius: 14px; background: linear-gradient(160deg, #fff, #ece8ff); box-shadow: 0 50px 90px -30px rgb(0 0 0 / .8); }
.cert.ghost-1 { transform: rotate(-7deg) translate(-8%, 3%); background: linear-gradient(160deg, rgb(123 97 255 / .55), rgb(56 217 245 / .25)); opacity: .55; }
.cert.ghost-2 { transform: rotate(5deg) translate(7%, 2%); background: linear-gradient(160deg, rgb(255 79 163 / .55), rgb(255 122 92 / .25)); opacity: .5; }
.cert.main { margin: 0; overflow: hidden; transform: rotate(-2deg); transition: transform .6s var(--ease); animation: float 7s ease-in-out infinite; display: grid; place-items: center;
  background: repeating-linear-gradient(135deg, #f7f5ff 0 14px, #efecff 14px 28px); }
.cert.main::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / .55) 48%, transparent 60%); transform: translateX(-120%); animation: shine 6s ease-in-out infinite 1.5s; pointer-events: none; }
.cert.main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.cert.main img.ready { opacity: 1; }
.cert.main figcaption { position: relative; z-index: 1; color: var(--ink); }
.cert.main figcaption .chip { background: #fff; border-color: #e1dcfb; color: var(--ink-soft); }
.cert.main.has-img figcaption { display: none; }
@keyframes float { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(-1deg) translateY(-10px); } }
@keyframes shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.stamp { position: absolute; right: max(0px, calc(50% - 280px)); bottom: 6%; width: 116px; height: 116px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: var(--lime); color: var(--midnight); transform: rotate(10deg); box-shadow: 0 18px 36px -12px rgb(182 243 106 / .55); font-size: .66rem; line-height: 1.15; font-weight: 700; }
.stamp b { font-family: var(--display); font-size: 1.7rem; line-height: 1; letter-spacing: -.03em; }
.stamp::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1.5px dashed rgb(14 12 38 / .45); }

/* ---------- Results: race-bib tickets ---------- */
.results { padding: 10px 0 30px; scroll-margin-top: 20px; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.results h2, .section-head h2 { font-family: var(--display); font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.025em; margin: 0; }
.results-head p, .section-head p { margin: 0; color: var(--muted); }
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 14px; }
.ticket { --notch: 13px; position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); background: var(--paper); color: var(--ink); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 48px -26px rgb(0 0 0 / .8); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
  -webkit-mask: radial-gradient(circle var(--notch) at 96px 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle var(--notch) at 96px 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle var(--notch) at 96px 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle var(--notch) at 96px 100%, #0000 98%, #000) bottom / 100% 51% no-repeat; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.stub { display: grid; place-content: center; text-align: center; gap: 2px; padding: 14px 8px; background: linear-gradient(170deg, var(--accent), var(--violet)); color: var(--midnight); border-right: 2px dashed rgb(14 12 38 / .25); }
.stub small { font-size: .62rem; font-weight: 800; letter-spacing: .06em; opacity: .75; }
.stub b { font-family: var(--display); font-size: 1.35rem; line-height: 1.05; word-break: break-word; }
.stub svg { width: 34px; height: 34px; margin: 0 auto; }
.ticket-body { padding: 14px 16px 14px 18px; display: grid; gap: 8px; min-width: 0; }
.ticket-name { font-family: var(--display); font-weight: 700; font-size: 1.22rem; letter-spacing: -.015em; line-height: 1.2; overflow-wrap: anywhere; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.ticket-meta span { font-size: .76rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #e9e5fd; color: #3d3870; }
.ticket-meta span.mask { background: transparent; border: 1px solid #ddd8f6; color: var(--ink-soft); font-weight: 500; }
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 11px; font-weight: 700; font-size: .88rem; text-decoration: none; transition: transform .15s var(--ease), background .15s; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--midnight); color: var(--paper); }
.btn.primary:hover { background: #241f5c; transform: translateY(-1px); }
.btn.light { background: #fff; color: var(--ink); border: 1.5px solid #dcd8f5; }
.btn.light:hover { border-color: var(--violet); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 34px 20px; border: 1.5px dashed var(--line-strong); border-radius: 22px; color: var(--muted); }
.empty-state b { display: block; font-family: var(--display); font-size: 1.3rem; color: var(--paper); margin-bottom: 6px; }

/* ---------- Event bibs ---------- */
.events { padding: 34px 0 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.bibs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.bib { position: relative; padding: 18px 18px 16px; border-radius: 20px; background: linear-gradient(160deg, var(--stage-raised), var(--stage)); border: 1px solid var(--line); overflow: hidden; transition: transform .3s var(--ease), border-color .3s; }
.bib::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--accent), var(--violet)); }
.bib:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.bib-top { display: flex; justify-content: space-between; align-items: center; }
.bib-no { font-family: var(--display); font-weight: 800; font-size: 2.2rem; letter-spacing: -.04em; color: transparent; -webkit-text-stroke: 1.2px var(--accent); }
.pins { display: flex; gap: 6px; }
.pins i { width: 10px; height: 10px; border-radius: 50%; background: var(--midnight); box-shadow: inset 0 0 0 2px var(--line-strong); }
.bib h3 { font-family: var(--display); font-size: 1.28rem; margin: 6px 0 4px; letter-spacing: -.015em; }
.bib p { margin: 0 0 10px; color: var(--muted); font-size: .9rem; }
.years { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.year-chip { cursor: pointer; background: rgb(244 242 255 / .07); color: var(--paper); }
.year-chip:hover { background: var(--accent); color: var(--midnight); border-color: transparent; }

/* ---------- How it works ---------- */
.how ol { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; counter-reset: step; }
.how li { counter-increment: step; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: rgb(244 242 255 / .03); display: grid; gap: 2px; }
.how li::before { content: counter(step); font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--magenta-soft); line-height: 1; margin-bottom: 4px; }
.how b { font-family: var(--display); font-size: 1.1rem; }
.how span { color: var(--muted); font-size: .9rem; }

/* ---------- Footer ---------- */
.foot { max-width: var(--max); margin: 30px auto 0; padding: 26px var(--gutter) 40px; border-top: 1px solid var(--line); color: var(--dim); font-size: .9rem; display: grid; gap: 6px; }
.foot p { margin: 0; }
.foot a { color: var(--magenta-soft); }
.foot .tiny { font-size: .78rem; }
.noscript { position: fixed; bottom: 16px; left: 16px; right: 16px; padding: 14px; border-radius: 14px; background: var(--coral); color: var(--midnight); font-weight: 700; text-align: center; }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .showcase { order: -1; min-height: 0; margin-top: 4px; }
  .cert-stack { width: min(62%, 300px); }
  .stamp { width: 86px; height: 86px; right: 4%; bottom: 0; }
  .stamp b { font-size: 1.25rem; }
  .how ol { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .finder-row { grid-template-columns: 1fr; }
  .hero h1 { margin-top: 12px; }
  .ticket { grid-template-columns: 78px minmax(0, 1fr); -webkit-mask: none; mask: none; }
  .stub b { font-size: 1.1rem; }
  .brand span { font-size: .95rem; }
  .pill.ghost { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
