/* BrainKeeper landing — dark cosmic theme, DOM-first.
   Default layout: linear scroll (no-JS, mobile, reduced-motion).
   html.journey (added by JS on capable desktops): canvas map + focused cards. */

:root {
  --bg0: #070510;
  --bg1: #14102e;
  --fiber: #6f7bd9;
  --glow: #a9b8f0;
  --core: #d9e0fa;
  --gold: #f5c97b;
  --gold-deep: #e0a94f;
  --text: #eaecf8;
  --muted: #9299be;
  --card-bg: rgba(16, 14, 40, 0.72);
  --card-line: rgba(169, 184, 240, 0.22);
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: radial-gradient(120% 120% at 50% 30%, var(--bg1) 0%, var(--bg0) 70%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* static background photo for linear mode */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(7, 5, 16, 0.55), rgba(7, 5, 16, 0.8)),
    url("../img/bg-desktop-1920.webp") center / cover no-repeat;
}
@media (max-width: 767px) {
  body::before {
    background:
      linear-gradient(rgba(7, 5, 16, 0.5), rgba(7, 5, 16, 0.82)),
      url("../img/bg-mobile-1080.webp") center / cover no-repeat;
  }
}
@media (max-width: 480px) {
  body::before {
    background-image:
      linear-gradient(rgba(7, 5, 16, 0.5), rgba(7, 5, 16, 0.82)),
      url("../img/bg-mobile-750.webp");
  }
}
@media (min-width: 768px) and (max-width: 1279px) {
  body::before {
    background-image:
      linear-gradient(rgba(7, 5, 16, 0.55), rgba(7, 5, 16, 0.8)),
      url("../img/bg-desktop-1280.webp");
  }
}
@media (min-width: 2200px) {
  body::before {
    background-image:
      linear-gradient(rgba(7, 5, 16, 0.55), rgba(7, 5, 16, 0.8)),
      url("../img/bg-desktop-2560.webp");
  }
}
/* journey mode: canvas replaces the static photo */
html.journey body::before { display: none; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--core);
  background: rgba(111, 123, 217, 0.16);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  overflow-wrap: anywhere;
}

/* ---------- chrome ---------- */

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--bg1);
  color: var(--text);
  padding: 0.6em 1em;
  border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

.chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  pointer-events: none;
}
.chrome a { pointer-events: auto; }

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  text-shadow: 0 0 18px rgba(169, 184, 240, 0.55);
}
.logo span { color: var(--gold); }

.lang {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  padding: 0.35em 0.9em;
  background: rgba(16, 14, 40, 0.6);
  transition: color 0.2s, border-color 0.2s;
}
.lang:hover, .lang:focus-visible { color: var(--text); border-color: var(--glow); }

.chrome-footer {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  padding: 2em 1em 3em;
  color: var(--muted);
  font-size: 0.8rem;
}
.chrome-footer a { color: var(--muted); }
html.journey .chrome-footer { display: none; }

/* ---------- canvas ---------- */

#net { display: none; }
html.journey #net {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ---------- sections: linear default ---------- */

main {
  position: relative;
  z-index: 1;
  padding: 90px 16px 40px;
}

.node { display: flex; justify-content: center; padding: 6vh 0; }

.card {
  width: 100%;
  max-width: 660px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 18px;
  padding: clamp(24px, 4vw, 40px);
  box-shadow: 0 0 40px rgba(111, 123, 217, 0.12), inset 0 0 60px rgba(111, 123, 217, 0.05);
}

/* ignite-on-scroll (linear mode, motion allowed) */
.node { opacity: 1; }
html.linear-fx .node { opacity: 0.25; transform: translateY(14px); transition: opacity 0.7s, transform 0.7s; }
html.linear-fx .node.lit { opacity: 1; transform: none; }

h1 {
  font-size: clamp(1.7rem, 4.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0.4em 0 0.5em;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.7em;
  text-wrap: balance;
}
h2::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.45em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--core), var(--fiber));
  box-shadow: 0 0 12px var(--glow);
}
#hero h1 { margin-top: 0.6em; }

p + p, ol + p, ul + p, div + p { margin-top: 0.9em; }
.lead { color: var(--text); }
.sub { color: var(--muted); font-size: 1.05rem; max-width: 46ch; }
.outro { margin-top: 1.1em; color: var(--muted); font-style: italic; }
.note { margin-top: 0.9em; color: var(--muted); font-size: 0.9rem; }

.points { margin: 0.8em 0 0 1.3em; display: grid; gap: 0.55em; }
.points li::marker { color: var(--gold); font-weight: 700; }
ul.points { list-style: none; margin-left: 0; }
ul.points li { padding-left: 1.3em; position: relative; }
ul.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 8px var(--glow);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--gold);
  border: 1px solid rgba(245, 201, 123, 0.35);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  background: rgba(245, 201, 123, 0.07);
}
.badge::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }
.badge-mini { color: var(--glow); border-color: var(--card-line); background: rgba(111, 123, 217, 0.1); margin-bottom: 0.8em; }
.badge-mini::before { background: var(--glow); box-shadow: 0 0 8px var(--glow); animation: none; }

/* ---------- buttons ---------- */

.cta-row { display: flex; flex-wrap: wrap; gap: 0.8em; align-items: center; margin-top: 1.3em; }

.btn {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.75em 1.6em;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.btn-primary {
  color: #241a05;
  background: radial-gradient(120% 160% at 30% 20%, #ffe3ae, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 24px rgba(245, 201, 123, 0.45), 0 2px 10px rgba(0, 0, 0, 0.4);
}
.btn-primary:hover, .btn-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 38px rgba(245, 201, 123, 0.65), 0 3px 12px rgba(0, 0, 0, 0.4);
}
.btn-ghost {
  color: var(--glow);
  border: 1px solid var(--card-line);
  background: rgba(111, 123, 217, 0.08);
}
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--text); border-color: var(--glow); }

a { color: var(--glow); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ---------- specific blocks ---------- */

.chat-mock {
  margin-top: 1.4em;
  display: grid;
  gap: 0.6em;
  max-width: 430px;
}
.msg {
  border-radius: 14px;
  padding: 0.7em 1em;
  font-size: 0.88rem;
  line-height: 1.45;
  width: fit-content;
  max-width: 100%;
}
.msg-in {
  justify-self: end;
  background: rgba(111, 123, 217, 0.25);
  border: 1px solid var(--card-line);
  border-bottom-right-radius: 4px;
}
.msg-in code { background: none; padding: 0; }
.msg-bot {
  background: rgba(16, 14, 40, 0.9);
  border: 1px solid rgba(245, 201, 123, 0.25);
  border-bottom-left-radius: 4px;
  display: grid;
  gap: 0.35em;
}
.type-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tags { display: flex; gap: 0.5em; flex-wrap: wrap; }
.tag { font-family: var(--font-mono); font-size: 0.75rem; color: var(--glow); }
.chat-mock figcaption { font-size: 0.75rem; color: var(--muted); font-style: italic; }

.tombstones { display: flex; gap: 1em; flex-wrap: wrap; margin: 0.4em 0 1.2em; }
.tombstone {
  display: grid;
  gap: 0.1em;
  border: 1px solid rgba(146, 153, 190, 0.25);
  border-radius: 12px 12px 4px 4px;
  padding: 0.8em 1.2em;
  color: var(--muted);
  background: rgba(10, 8, 26, 0.6);
  filter: saturate(0.4);
  font-size: 0.9rem;
}
.tombstone .died { font-family: var(--font-mono); font-size: 0.8rem; }
.tombstone .note { font-size: 0.75rem; }

.phases { list-style: none; display: grid; gap: 0.7em; margin-top: 0.5em; }
.phase {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  gap: 0.8em;
  align-items: start;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 0.8em 1em;
  background: rgba(111, 123, 217, 0.05);
}
.phase-n {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--glow);
  width: 1.8em;
  height: 1.8em;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--card-line);
}
.phase-current { border-color: rgba(245, 201, 123, 0.4); box-shadow: 0 0 18px rgba(245, 201, 123, 0.12); }
.phase-current .phase-n { color: var(--gold); border-color: rgba(245, 201, 123, 0.5); box-shadow: 0 0 10px rgba(245, 201, 123, 0.35); }
.phase-status { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); white-space: nowrap; padding-top: 0.35em; }
.phase-current .phase-status { color: var(--gold); }

.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.8em; margin-top: 0.6em; }
.tier {
  border: 1px solid var(--card-line);
  border-radius: 14px;
  padding: 1em;
  display: grid;
  gap: 0.4em;
  align-content: start;
  background: rgba(111, 123, 217, 0.05);
  font-size: 0.85rem;
  color: var(--muted);
}
.tier h3 { font-size: 0.95rem; color: var(--text); }
.tier .price { font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem; color: var(--core); }
.price-alt {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15em;
}
.tier-featured {
  border-color: rgba(245, 201, 123, 0.55);
  background: rgba(245, 201, 123, 0.07);
  box-shadow: 0 0 26px rgba(245, 201, 123, 0.18);
}
.tier-featured .price { color: var(--gold); }

.faq { display: grid; gap: 0.5em; margin-top: 0.4em; }
.faq details {
  border: 1px solid var(--card-line);
  border-radius: 12px;
  background: rgba(111, 123, 217, 0.05);
  padding: 0.7em 1em;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1em;
  align-items: baseline;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--gold); font-weight: 800; flex-shrink: 0; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: 0.6em; color: var(--muted); }

.identity {
  margin-top: 1.4em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.identity a { color: var(--glow); text-decoration-color: rgba(169, 184, 240, 0.4); }
.identity a:hover, .identity a:focus-visible { color: var(--core); }
.counter { margin-top: 0.8em; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }

/* ---------- constellation + hint ---------- */

.constellation { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 40; }
.constellation ol { list-style: none; display: flex; gap: 10px; align-items: center; }
.constellation button {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.constellation button span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(169, 184, 240, 0.35);
  box-shadow: 0 0 6px rgba(169, 184, 240, 0.25);
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
}
.constellation button:hover span, .constellation button:focus-visible span { background: var(--glow); }
.constellation button[aria-current="true"] span {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  transform: scale(1.35);
}

.hint {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #b6bfda;
  background: rgba(7, 5, 16, 0.78);
  border-radius: 999px;
  padding: 0.35em 1em;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- journey mode ---------- */

html.journey main { padding: 0; }
html.journey .node {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 76px 16px 90px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
html.journey .node.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.55s ease 0.25s, visibility 0s;
}
html.journey .card {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  scrollbar-width: thin;
  scrollbar-color: var(--fiber) transparent;
}
html.journey #hero .card {
  /* sits over the golden hero sprite — must stay opaque enough for 4.5:1 text contrast */
  background: rgba(12, 10, 30, 0.88);
  text-align: center;
  border-color: rgba(245, 201, 123, 0.25);
  box-shadow: 0 0 60px rgba(245, 201, 123, 0.1), inset 0 0 60px rgba(111, 123, 217, 0.05);
}
html.journey .card:focus { outline: none; }
html.journey #hero .cta-row { justify-content: center; }
html.journey #hero .sub { margin-inline: auto; }

@media (max-width: 767px) {
  body { font-size: 16px; }
  .phase { grid-template-columns: 2em 1fr; }
  .phase-status { grid-column: 2; padding-top: 0; }
  .tiers { grid-template-columns: 1fr 1fr; }
}
