/* FaceFind — Denning Campus Launch theme:
   deep purple-black night, royal purple glow, champagne-gold highlights, Montserrat. */
:root {
  --bg: #050208;
  --panel: rgba(255, 255, 255, 0.030);
  --panel-2: rgba(255, 255, 255, 0.055);
  --border: rgba(139, 92, 246, 0.16);
  --border-strong: rgba(139, 92, 246, 0.55);
  --text: #f4f0e8;
  --muted: #9a92ab;
  --purple: #8b5cf6;
  --purple-deep: #7c3aed;
  --purple-soft: #b39bff;
  --gold: #e7c066;
  --gold-bright: #f7e3a1;
  --gold-deep: #c99633;
  --gold-ink: #221503;
  --danger: #ff6b5e;
  --radius: 16px;
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(124, 58, 237, 0.20), transparent 60%),
    radial-gradient(900px 700px at -15% 110%, rgba(59, 34, 116, 0.30), transparent 62%),
    linear-gradient(180deg, #0c0620 0%, var(--bg) 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- comet / streak motif (gold comet on purple night) ---------- */
.streak {
  position: fixed;
  top: -160px;
  right: -200px;
  width: 720px;
  height: 720px;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(closest-side, rgba(124, 58, 237, 0.22), transparent 70%);
  transform: rotate(-18deg);
  filter: blur(2px);
  animation: drift 14s ease-in-out infinite alternate;
}
.streak::before, .streak::after {
  content: "";
  position: absolute;
  height: 3px;
  border-radius: 3px;
  /* bright white comet core — stands out against the purple-black night */
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92), #ffffff);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.55), 0 0 44px rgba(139, 92, 246, 0.45);
}
.streak::before { left: 6%; top: 44%; width: 74%; }
.streak::after {
  left: 22%; top: 58%; width: 46%; height: 2px; opacity: 0.55;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), #f2ecff);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.4);
}
@keyframes drift {
  from { transform: rotate(-18deg) translateY(0); opacity: 0.9; }
  to   { transform: rotate(-16deg) translateY(26px); opacity: 1; }
}

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 26px 22px 90px; }

/* ---------- header ---------- */
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; row-gap: 12px;
  margin-bottom: 34px; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { height: 54px; width: auto; display: block; }
.brand-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.18); flex: none; }
.brand .wordmark {
  font-weight: 700; font-size: 1.08rem; letter-spacing: 0.02em; white-space: nowrap;
}
.brand .wordmark small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.brand .wordmark .fx { color: var(--gold); }
#whoami { max-width: 38vw; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; display: inline-block; }

@media (max-width: 680px) {
  header.topbar { margin-bottom: 24px; }
  .brand-logo { height: 42px; }
  .brand .wordmark small { display: none; }
  /* tabs drop to their own full-width row instead of squeezing the brand */
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tabs a { padding: 8px 12px; font-size: 0.85rem; }
}

/* ---------- nav tabs ---------- */
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs a {
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: 0.9rem;
  padding: 8px 14px; border-radius: 10px; transition: color 0.15s ease, background 0.15s ease;
}
.tabs a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tabs a.active { color: var(--gold); background: rgba(231, 192, 102, 0.10); }

/* ---------- dashboard ---------- */
.stat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 18px;
}
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; animation: rise 0.45s ease both;
}
.stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }
.stat-extra { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.stat.gold .stat-value { color: var(--gold); }
.stat.alert { border-color: rgba(255, 107, 94, 0.45); }
.stat.alert .stat-value { color: var(--danger); }

.bars { display: flex; gap: 6px; align-items: flex-end; height: 120px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  height: 100%; text-align: center; }
.bar {
  background: linear-gradient(180deg, var(--gold-bright), var(--purple-deep));
  border-radius: 6px 6px 2px 2px; min-height: 2px;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.35);
}
.bar-label { color: var(--muted); font-size: 0.66rem; margin-top: 6px; }
@media (max-width: 560px) {
  /* 14 day labels don't fit a phone — show every other one */
  .bar-col:nth-child(odd) .bar-label { visibility: hidden; }
}

h1 { font-size: 1.75rem; margin: 0 0 6px; letter-spacing: -0.01em; font-weight: 800; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0 0 12px; font-weight: 700; letter-spacing: 0.01em; text-wrap: balance; }
p.sub { color: var(--muted); margin: 0 0 22px; line-height: 1.55; max-width: 68ch; text-wrap: pretty; }

/* ---------- panels ---------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(6px);
  animation: rise 0.45s ease both;
}
.panel + .panel { margin-top: 18px; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- buttons & inputs ---------- */
button, .btn {
  appearance: none; cursor: pointer;
  font: inherit; font-weight: 700; letter-spacing: 0.01em;
  border-radius: 12px; padding: 11px 18px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.15s ease, border-color 0.2s ease;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
button:hover, .btn:hover { filter: brightness(1.18); border-color: rgba(139, 92, 246, 0.45); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button.primary, .btn.primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  color: var(--gold-ink); border-color: transparent;
  box-shadow: 0 4px 24px rgba(231, 192, 102, 0.28);
}
button.primary:hover, .btn.primary:hover { box-shadow: 0 6px 32px rgba(231, 192, 102, 0.42); }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.45; cursor: default; transform: none !important; box-shadow: none; }
button.link { background: none; border: none; padding: 4px 6px; color: var(--muted); font-weight: 600; }
button.link:hover { color: var(--gold); transform: none; }

input[type="text"], input[type="password"], select {
  font: inherit; color: var(--text);
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px; padding: 12px 14px; width: 100%;
  outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
select { width: auto; padding: 11px 12px; cursor: pointer; }
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
input::placeholder { color: #8d86a0; }

/* keyboard focus — visible on every interactive element */
button:focus-visible, .btn:focus-visible, .tabs a:focus-visible,
input:focus-visible, select:focus-visible, input[type="range"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px; font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--muted);
}
.badge.accent { color: var(--gold); border-color: rgba(231, 192, 102, 0.45); background: rgba(231, 192, 102, 0.08); }
.badge.warn { color: #ffcf6b; border-color: rgba(255, 207, 107, 0.35); }
.badge.err { color: var(--danger); border-color: rgba(255, 107, 94, 0.4); }

.error-box {
  background: rgba(255, 107, 94, 0.08); border: 1px solid rgba(255, 107, 94, 0.35);
  color: #ffb4ac; border-radius: 12px; padding: 12px 14px; margin-top: 12px;
  display: none; line-height: 1.45; white-space: pre-line;
}
.error-box.show { display: block; }

/* ---------- login ---------- */
.login-logo { display: block; margin: 0 auto 26px; width: min(300px, 72%); height: auto; }

/* ---------- events list ---------- */
.event-card {
  display: flex; align-items: center; gap: 16px;
  padding: 17px 19px; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  margin-bottom: 12px; cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  animation: rise 0.45s ease both;
}
.event-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.event-card .name { font-weight: 700; font-size: 1.04rem; }
/* non-clickable rows (scan log entries) must not pretend to be links */
.event-card.static { cursor: default; }
.event-card.static:hover { border-color: var(--border); transform: none; }

/* ---------- photo grid ---------- */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-top: 16px;
}
.grid .cell {
  position: relative; border-radius: 12px; overflow: hidden;
  background: rgba(0, 0, 0, 0.5); border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  transition: border-color 0.2s ease;
}
.grid .cell:hover { border-color: var(--border-strong); }
.grid .cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.35s ease;
}
.grid .cell:hover img { transform: scale(1.06); }
.grid .cell .tag {
  position: absolute; left: 8px; bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: rgba(5, 2, 8, 0.85); backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px; padding: 3px 9px; font-size: 0.72rem; font-weight: 700;
}
.grid .cell .del {
  position: absolute; top: 7px; right: 7px; width: 34px; height: 34px;
  border-radius: 9px; background: rgba(5, 2, 8, 0.8); border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff; font-size: 15px; line-height: 1; padding: 0; display: none;
  align-items: center; justify-content: center;
}
.grid .cell:hover .del, .grid .cell:focus-within .del { display: flex; }
@media (hover: none) {
  /* touch screens have no hover — keep delete reachable */
  .grid .cell .del { display: flex; }
}

/* ---------- dropzone / progress ---------- */
.dropzone {
  border: 2px dashed rgba(139, 92, 246, 0.30); border-radius: var(--radius);
  padding: 36px 20px; text-align: center; color: var(--muted);
  cursor: pointer; transition: all 0.2s ease; margin-top: 14px;
  background: rgba(124, 58, 237, 0.04);
}
.dropzone.drag, .dropzone:hover {
  border-color: var(--border-strong); color: var(--text);
  background: rgba(124, 58, 237, 0.09);
}
.progress-outer { height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress-inner {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--purple-deep), var(--gold));
  border-radius: 99px; transition: width 0.2s ease;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.65);
}

/* ---------- share box ---------- */
.share-link {
  display: flex; gap: 8px; align-items: center;
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px; padding: 8px 8px 8px 14px;
}
.share-link .url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gold); }
.qr-img { background: #fff; padding: 10px; border-radius: 14px; width: 190px; height: 190px; }

input[type="range"] { accent-color: var(--purple); width: 100%; }

/* ============ public scan page ============ */
.scan-hero { text-align: center; padding: 30px 0 8px; }
.scan-hero .sub { margin-left: auto; margin-right: auto; }
.hero-logo { width: min(340px, 74%); height: auto; margin: 0 auto 28px; display: block; }
.scan-hero .eyebrow {
  color: var(--gold); font-weight: 700; letter-spacing: 0.24em; font-size: 0.72rem;
  text-transform: uppercase;
}
.scan-hero h1 { font-size: clamp(1.9rem, 5.5vw, 2.8rem); margin: 12px 0 8px; font-weight: 800; }
.big-scan {
  font-size: 1.05rem; padding: 16px 32px; border-radius: 15px;
  position: relative;
}
.big-scan::after {
  content: ""; position: absolute; inset: -7px; border-radius: 20px;
  border: 1.5px solid rgba(231, 192, 102, 0.5);
  animation: pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%   { transform: scale(0.96); opacity: 0.9; }
  70%  { transform: scale(1.08); opacity: 0; }
  100% { transform: scale(1.08); opacity: 0; }
}
#results-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* ---------- phone layout ---------- */
@media (max-width: 560px) {
  :root { --radius: 14px; }
  .wrap { padding: 18px 14px 64px; }
  h1 { font-size: 1.42rem; }
  .panel { padding: 18px 16px; }
  .modal { padding: 18px 16px; }
  .event-card { padding: 14px 14px; gap: 12px; }
  .dropzone { padding: 26px 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 15px; }
  .stat-value { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; }
  #results-grid { grid-template-columns: repeat(2, 1fr); }
  .share-link { padding-left: 10px; }
  .qr-img { width: 160px; height: 160px; }
  .scan-hero { padding-top: 16px; }
  .scan-hero h1 { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .privacy-note { padding: 0 6px; }
  .results-head h1 { font-size: 1.3rem; }
  footer.credit { margin-top: 44px; padding: 0 10px; line-height: 1.6; }
  .streak { width: 480px; height: 480px; top: -120px; right: -160px; }
}
@media (max-width: 420px) {
  .big-scan { padding: 14px 20px; font-size: 1rem; }
  .hero-logo { margin-bottom: 22px; }
}
.privacy-note {
  max-width: 480px; margin: 26px auto 0; color: var(--muted);
  font-size: 0.85rem; line-height: 1.6; text-wrap: pretty;
}
.privacy-note strong { color: #cfc6de; }

/* ---------- camera modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 1, 6, 0.84);
  backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 18px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: linear-gradient(180deg, #170d2c, #0a0514);
  border: 1px solid rgba(139, 92, 246, 0.28); border-radius: 20px;
  width: min(470px, 96vw); padding: 24px; text-align: center;
  max-height: 94vh; overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 60px rgba(124, 58, 237, 0.12);
  animation: rise 0.3s ease both;
}
.cam-stage { position: relative; width: min(320px, 78vw); margin: 16px auto; }
.cam-stage video { width: 100%; display: block; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 50% / 42%; transform: scaleX(-1); background: #000; }
.cam-ring {
  position: absolute; inset: -7px; border-radius: 50% / 42%;
  border: 3px solid rgba(139, 92, 246, 0.35); pointer-events: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.cam-ring.active {
  border-color: var(--gold);
  box-shadow: 0 0 34px rgba(231, 192, 102, 0.45), inset 0 0 24px rgba(139, 92, 246, 0.18);
}
.scan-status { min-height: 24px; color: var(--gold); font-weight: 600; margin-top: 6px; }

/* ---------- results ---------- */
.results-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.lightbox-backdrop {
  position: fixed; inset: 0; background: rgba(3, 1, 6, 0.93); z-index: 60;
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out;
}
.lightbox-backdrop.show { display: flex; }
.lightbox-backdrop img { max-width: 96vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 30px 90px rgba(0,0,0,0.7); }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid rgba(34, 21, 3, 0.25); border-top-color: rgba(34, 21, 3, 0.85);
  animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
footer.credit {
  margin-top: 70px; text-align: center; color: var(--muted); font-size: 0.8rem;
  letter-spacing: 0.05em;
}
footer.credit .fx { color: var(--gold); }

::selection { background: rgba(139, 92, 246, 0.45); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.25); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
