:root {
  --bg-0: #14100d;
  --bg-1: #221a13;
  --ink: #f3e9d8;
  --ink-dim: #cbb99c;
  --accent: #d99a3d;
  --panel-bg: rgba(20, 15, 11, 0.72);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: radial-gradient(120% 100% at 50% 20%, var(--bg-1), var(--bg-0));
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 14px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.35), transparent);
}

.topbar .brand { font-weight: 600; color: var(--ink); }
.topbar .counter { font-variant-numeric: tabular-nums; }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: calc(14px + var(--safe-top)) 18px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(-6px);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(203, 185, 156, 0.35);
  background: rgba(20, 15, 11, 0.6);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
}

.back-to-top-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Corner back-to-first button ---------- */
.corner-top-btn {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + var(--safe-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.2s ease;
}

.corner-top-btn.is-visible {
  opacity: 0.55;
  transform: translateY(0);
  pointer-events: auto;
}

.corner-top-btn.is-visible:hover,
.corner-top-btn.is-visible:focus-visible {
  opacity: 1;
  background: rgba(217, 154, 61, 0.12);
  outline: none;
}

/* ---------- Scroll hint ---------- */
.scroll-hint {
  position: fixed;
  left: 50%;
  top: calc(43px + var(--safe-top));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink-dim);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.scroll-hint.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}

.scroll-hint .chevron {
  font-size: 1.4rem;
  line-height: 1;
  animation: bob 1.6s ease-in-out infinite;
  color: var(--accent);
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ---------- Scroll track / stage ---------- */
.track {
  position: relative;
  width: 100%;
}

.stage {
  position: sticky;
  top: 0;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(60px + var(--safe-top));
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(42% 32% at 50% 46%, rgba(217, 154, 61, 0.18), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.mask-img {
  position: absolute;
  z-index: 1;
  max-width: 78vw;
  max-height: 56svh;
  width: auto;
  height: auto;
  will-change: transform, opacity, filter;
  filter: blur(0px) drop-shadow(0 14px 34px rgba(0, 0, 0, 0.55));
  user-select: none;
  -webkit-user-drag: none;
  transition: none;
  cursor: pointer;
}

/* ---------- Info panel ---------- */
.info-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 28px 20px calc(20px + var(--safe-bottom));
  background: linear-gradient(to top, var(--panel-bg) 40%, transparent);
  pointer-events: none;
  text-align: center;
}

.mask-name {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mask-region {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.mask-desc {
  margin: 0 auto;
  max-width: 34ch;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-dim);
}

.progress {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.progress span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-dim);
  opacity: 0.4;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.progress span.active {
  opacity: 1;
  background: var(--accent);
  transform: scale(1.5);
}

/* ---------- Epilogue ---------- */
.epilogue {
  position: relative;
  z-index: 10;
  max-width: 60ch;
  margin: 0 auto;
  padding: 180px 24px calc(64px + var(--safe-bottom));
  text-align: center;
}

.epilogue h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  font-weight: 700;
}

.epilogue p {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.epilogue-source {
  font-size: 0.78rem;
  opacity: 0.75;
  margin-bottom: 0;
}

.about-illustrations {
  border-top: 1px solid rgba(203, 185, 156, 0.25);
  padding-top: 26px;
  margin-top: 28px;
}

.about-illustrations h2 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.about-illustrations p {
  font-size: 0.78rem;
  line-height: 1.45;
  margin-bottom: 10px;
}

.about-illustrations .epilogue-source {
  font-size: 0.68rem;
}

/* ---------- Links back to the main Afrohemian site ---------- */
/* The topbar itself ignores pointer events so it never blocks mask taps;
   only the home link opts back in. */
.topbar .home-link {
  pointer-events: auto;
  color: var(--ink-dim);
  text-decoration: none;
  font-weight: 500;
  padding: 10px 0;
}
.topbar .home-link:hover { color: var(--accent); }
.topbar .brand-sep { margin: 0 0.6em; opacity: 0.5; font-weight: 400; }

.epilogue .site-return {
  margin: 36px 0 0;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-return a { color: var(--accent); text-decoration: none; }
.site-return a:hover { text-decoration: underline; }
.epilogue .site-legal { margin: 14px 0 0; text-align: center; font-size: 0.75rem; }
.site-legal a { color: var(--ink-dim); }
.site-legal a:hover { color: var(--accent); }

/* ---------- Lead magnet ---------- */

/* Image and copy are one plain content block: no sticky, no independent
   positioning on either piece. #leadMagnet alone carries the fade+blur-in
   (triggered once via the .is-visible class, see script.js), so the two
   move and reveal together and can never drift apart or overlap. */
.lead-magnet {
  opacity: 0;
  filter: blur(18px);
  transition: opacity 0.9s ease, filter 0.9s ease;
}

.lead-magnet.is-visible {
  opacity: 1;
  filter: blur(0);
}

.lead-image {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 22px;
}

.lead-image img {
  display: block;
  width: 100%;
  height: auto;
}

.lead-image-placeholder {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 22px;
  border: 1px dashed rgba(203, 185, 156, 0.35);
  border-radius: 12px;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--ink-dim);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

.lead-magnet h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.lead-copy > p {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.lead-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-submit[disabled] { opacity: 0.7; cursor: wait; }

.lead-opt {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-dim);
  cursor: pointer;
}
.lead-opt input { margin-top: 0.2rem; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }

/* Honeypot: hidden from people, filled in by spam bots. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.epilogue .lead-msg {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #e08a6a;
}
.epilogue .lead-msg:empty { display: none; }

.lead-note a, .lead-note a:visited { color: var(--ink-dim); }

.lead-unlocked p {
  margin: 0 0 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.lead-download {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #201306;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}
.lead-download:hover { filter: brightness(1.08); }
.lead-download[hidden] { display: none; }
#leadTitle:focus { outline: none; }

.epilogue .lead-reset { margin: 16px 0 0; }
.lead-reset button {
  background: none;
  border: 0;
  padding: 6px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-dim);
  text-decoration: underline;
  cursor: pointer;
}
.lead-reset button:hover { color: var(--accent); }

.lead-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid rgba(203, 185, 156, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
}

.lead-input::placeholder { color: var(--ink-dim); opacity: 0.7; }

.lead-input:focus {
  outline: none;
  border-color: var(--accent);
}

.lead-submit {
  width: 100%;
  padding: 13px 20px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #201306;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.lead-submit:hover { filter: brightness(1.08); }

.lead-note {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--ink-dim);
  opacity: 0.7;
}

.lead-success {
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- End screen (dynamic, loaded from assets/end-screen.json) ---------- */
.end-screen {
  position: relative;
  z-index: 10;
  max-width: 60ch;
  margin: 0 auto;
  padding: 0 24px calc(100px + var(--safe-bottom));
  text-align: center;
}

.end-screen-image-link {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 22px;
}

.end-screen-image {
  display: block;
  width: 100%;
  border-radius: 12px;
}

.end-screen-title {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.end-screen-text {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.end-screen-cta {
  display: inline-block;
  padding: 13px 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #201306;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.end-screen-cta:hover { filter: brightness(1.08); }

/* ---------- Larger screens ---------- */
@media (min-width: 700px) {
  .mask-img { max-width: 46vw; max-height: 64svh; }
  .stage { padding-top: calc(75px + var(--safe-top)); }
  .mask-name { font-size: 2rem; }
  .mask-desc { font-size: 1rem; max-width: 42ch; }
  .topbar { font-size: 0.8rem; padding: calc(20px + var(--safe-top)) 32px 16px; }
  .scroll-hint { top: calc(55px + var(--safe-top)); }
  .info-panel { padding: 36px 20px calc(28px + var(--safe-bottom)); }
  .epilogue { padding: 220px 24px calc(80px + var(--safe-bottom)); }
  .epilogue p { font-size: 1rem; }
  .about-illustrations p { font-size: 0.85rem; }
  .about-illustrations .epilogue-source { font-size: 0.72rem; }
  .lead-magnet > p { font-size: 1rem; }
  .lead-row { flex-direction: row; }
  .lead-input { flex: 1; }
  .lead-submit { width: auto; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint .chevron { animation: none; }
}
