/* ==========================================================
   The Obsidian Crown Society — design system
   Palette: Deep Black #0A0A0A · White #FFFFFF · Royal Purple #5B2A86
   ========================================================== */
:root {
  --bg: #0A0A0A;
  --text: #FFFFFF;
  --text-2: rgba(255, 255, 255, .62);
  --text-3: rgba(255, 255, 255, .38);
  --accent: #5B2A86;
  --accent-hi: #6d35a2;
  --accent-2: #a46ee0;
  --gold: #c9a96a;
  --ok: #34c98b;
  --warn: #ffb454;
  --danger: #ff5d6c;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .1);
  --r: 22px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "New York", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  background-image: radial-gradient(1100px 620px at 50% -220px, rgba(91, 42, 134, .5), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg.i { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  padding-top: env(safe-area-inset-top);
  background: rgba(10, 10, 10, .62);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--line);
}
.nav-in { max-width: 1080px; margin: auto; height: 68px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand .logo { display: flex; align-items: center; height: 48px; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: 13px; }
.nav-links a, .nav-links button { color: var(--text-2); transition: color .2s; background: none; border: 0; font-size: 13px; cursor: pointer; }
.nav-links a:hover, .nav-links button:hover { color: #fff; }
.pill-link { color: #fff !important; padding: 6px 14px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 680px) { .nav-links .hide-m { display: none; } }

main { padding-top: calc(68px + env(safe-area-inset-top)); }
.container { max-width: 1080px; margin: auto; padding: 0 20px; }

/* ---------- Typography ---------- */
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 14px; }
.h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 700; letter-spacing: -.03em; line-height: 1.08; }
.h2 { font-size: clamp(32px, 5.4vw, 58px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; margin-bottom: 18px; }
.lead { font-size: clamp(17px, 2.2vw, 21px); color: var(--text-2); max-width: 680px; line-height: 1.55; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

/* ---------- Hero ---------- */
.hero { min-height: calc(100svh - 68px); display: grid; place-items: center; text-align: center; padding: 70px 22px 90px; }
.hero .mark { display: flex; justify-content: center; align-items: center; margin: 0 auto 28px; color: var(--gold); }
.hero .mark .logo-img { filter: drop-shadow(0 0 26px rgba(91, 42, 134, .75)); }
.hero h1 {
  font-size: clamp(46px, 10vw, 112px); line-height: 1.01; letter-spacing: -.04em; font-weight: 700;
  background: linear-gradient(180deg, #fff 35%, rgba(255, 255, 255, .5));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-family: var(--serif); font-style: italic; font-size: clamp(24px, 4vw, 38px); color: var(--accent); margin: 24px 0 38px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .est { margin-top: 40px; font-size: 13px; color: var(--text-3); letter-spacing: .12em; text-transform: uppercase; }
.fade-up { animation: up .9s cubic-bezier(.2, .7, .2, 1) both; }
.d1 { animation-delay: .12s; } .d2 { animation-delay: .24s; } .d3 { animation-delay: .36s; } .d4 { animation-delay: .48s; }
@keyframes up { from { opacity: 0; transform: translateY(26px); } }

/* ---------- Sections ---------- */
.section { padding: 110px 0; }
.section.tight { padding: 60px 0; }
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 30px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .35s, box-shadow .35s; }
.card h3 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 8px; }
.card p { color: var(--text-2); }
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-top: 44px; }
.bento .card { grid-column: span 2; min-height: 230px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; }
.bento .card:nth-child(n+4) { grid-column: span 3; }
.bento .card::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 260px; height: 260px; background: radial-gradient(circle, rgba(91, 42, 134, .45), transparent 70%); opacity: .6; transition: opacity .4s; }
.bento .card:hover { transform: translateY(-5px); border-color: rgba(201, 169, 106, .5); box-shadow: 0 20px 60px rgba(91, 42, 134, .3); }
.bento .card:hover::before { opacity: 1; }
.ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(91, 42, 134, .35); color: #d8bcf5; margin-bottom: auto; position: relative; }
@media (max-width: 760px) { .bento { grid-template-columns: 1fr; } .bento .card, .bento .card:nth-child(n+4) { grid-column: auto; min-height: 190px; } }

/* ---------- Forms & buttons ---------- */
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.input {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 14px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: #fff;
  font: 400 16px var(--sans); transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(164, 110, 224, .22); background: rgba(255, 255, 255, .08); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
select.input option { background: #1a1620; color: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer; color: #fff;
  background: var(--accent); font: 600 15px var(--sans); letter-spacing: -.01em; white-space: nowrap;
  transition: transform .15s, background .2s, box-shadow .25s;
}
.btn:hover { background: var(--accent-hi); box-shadow: 0 10px 32px rgba(91, 42, 134, .55); }
.btn:active { transform: scale(.97); }
.btn.light { background: #fff; color: #0A0A0A; }
.btn.light:hover { background: #ececf0; box-shadow: 0 10px 32px rgba(255, 255, 255, .15); }
.btn.glass { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.glass:hover { background: rgba(255, 255, 255, .13); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: rgba(255, 93, 108, .14); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 93, 108, .24); box-shadow: none; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.icon { width: 36px; height: 36px; padding: 0; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 0; }
.badge.gold { color: var(--gold); background: rgba(201, 169, 106, .13); }
.badge.ok { color: var(--ok); background: rgba(52, 201, 139, .13); }
.badge.warn { color: var(--warn); background: rgba(255, 180, 84, .13); }
.badge.bad { color: var(--danger); background: rgba(255, 93, 108, .13); }
.badge.purple { color: #cfa8f3; background: rgba(164, 110, 224, .17); }
button.badge { cursor: pointer; }

/* ---------- Portal ---------- */
.portal { padding: 38px 20px 90px; }
.p-head { margin-bottom: 26px; }
.p-head .meta { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 36px; letter-spacing: -.03em; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--text-2); }
.seg { display: flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 14px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 11px; background: none; color: var(--text-2); font: 500 14px var(--sans); cursor: pointer; white-space: nowrap; transition: .2s; }
.seg button.on { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar .input { flex: 1; height: 46px; }
.toolbar .btn { height: 46px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.click { cursor: pointer; transition: background .2s; }
.item.click:hover { background: rgba(255, 255, 255, .04); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.item .acts { display: flex; gap: 6px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #2a1342); font-weight: 600; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.avatar.sq { border-radius: 12px; background: rgba(91, 42, 134, .35); color: #d8bcf5; }
.empty { padding: 50px 20px; text-align: center; color: var(--text-2); }
.empty svg { opacity: .5; margin-bottom: 10px; }

/* ---------- Centered gate / check-in ---------- */
.center { min-height: calc(100svh - 68px); display: grid; place-items: center; padding: 30px 20px; }
.narrow { width: 100%; max-width: 420px; text-align: center; }
.narrow .card { text-align: left; padding: 28px; }
.result { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; margin-top: 16px; text-align: left; font-weight: 500; font-size: 14px; animation: up .4s both; }
.result.ok { background: rgba(52, 201, 139, .12); color: var(--ok); }
.result.warn { background: rgba(255, 180, 84, .12); color: var(--warn); }
.result.bad { background: rgba(255, 93, 108, .12); color: var(--danger); }

/* ---------- Scanner ---------- */
.viewfinder { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 56vh; border-radius: 24px; overflow: hidden; background: #050505; border: 1px solid var(--line); margin: 14px 0; display: grid; place-items: center; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.viewfinder.live video { display: block; }
.viewfinder .idle { color: var(--text-3); text-align: center; font-size: 14px; }
.viewfinder.live .idle { display: none; }
.viewfinder .frame { position: absolute; inset: 18%; border-radius: 22px; border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 999px rgba(0, 0, 0, .42); display: none; }
.viewfinder.live .frame { display: block; }
.viewfinder .frame::after { content: ""; position: absolute; left: 8%; right: 8%; height: 2px; top: 10%; background: linear-gradient(90deg, transparent, var(--accent-2), transparent); animation: sweep 2.2s ease-in-out infinite; }
@keyframes sweep { 50% { top: 88%; } }

/* ---------- Sheets, toasts ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fade .25s both; }
.sheet { width: 100%; max-width: 460px; max-height: calc(100dvh - 40px); overflow-y: auto; padding: 28px; border-radius: 30px; background: rgba(26, 21, 33, .94); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); border: 1px solid var(--line); box-shadow: 0 40px 120px rgba(0, 0, 0, .65); animation: pop .4s cubic-bezier(.2, .9, .3, 1.1) both; }
.sh-title { font-size: 24px; letter-spacing: -.025em; margin-bottom: 6px; }
.sh-body { color: var(--text-2); margin-bottom: 22px; }
.sh-actions { display: flex; gap: 10px; margin-top: 8px; }
.sh-actions .btn { flex: 1; }
.sh-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 12px; }
.kv { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin: 16px 0; }
.kv div { display: flex; justify-content: space-between; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-2); }
.kv span:last-child { text-align: right; word-break: break-word; }
@media (max-width: 560px) {
  .scrim { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 30px 30px 0 0; padding-bottom: calc(28px + env(safe-area-inset-bottom)); animation: slide .45s cubic-bezier(.2, .8, .2, 1) both; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(12px); } }
@keyframes slide { from { transform: translateY(100%); } }

.cred { text-align: center; padding: 26px 22px; border-radius: 26px; background: linear-gradient(150deg, #1d1029, #0A0A0A 62%); border: 1px solid rgba(201, 169, 106, .45); box-shadow: 0 0 60px rgba(91, 42, 134, .45); }
.cred .cr-top { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--gold); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 18px; }
.cred h3 { font-size: 24px; letter-spacing: -.02em; }
.qrbox { display: inline-block; background: #fff; border-radius: 18px; padding: 14px; margin: 18px 0 12px; }
.qrbox svg { display: block; width: 172px; height: 172px; }
.cred .num { font-size: 20px; font-weight: 600; letter-spacing: .14em; }

#toast-root { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; width: max-content; max-width: 92vw; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: rgba(44, 36, 54, .92); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0, 0, 0, .5); font-size: 14px; font-weight: 500; animation: drop .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--warn); }
@keyframes drop { from { opacity: 0; transform: translateY(-16px) scale(.92); } }

.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { text-align: center; padding: 50px 20px 60px; color: var(--text-3); font-size: 13px; border-top: 1px solid var(--line); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 180, 84, .1); color: var(--warn); font-size: 13px; margin: 12px 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* Custom logo images: crest file is assets/crest-white.png (set in LOGOS, js/app.js) */
.logo-img { display: block; object-fit: contain; max-width: 100%; max-height: 100%; }
.logo-lg { display: flex; justify-content: center; margin: 0 auto 20px; color: var(--gold); }
.cred .cr-top .logo-img { margin: -4px 0; }

/* ---- LOGO SIZES: change these numbers to resize the crest everywhere ---- */
.logo-img { max-width: none; max-height: none; width: auto; }
.brand .logo .logo-img { height: 48px; }                      /* navbar */
.hero .mark .logo-img { height: clamp(150px, 26vw, 240px); }  /* home hero */
.logo-lg .logo-img { height: 110px; }                         /* member check-in page */
.cred .cr-top .logo-img { height: 48px; margin: -8px 0; }     /* member ID card */
