/* Dunbar — minimal ship theme.
   Constraints (docs 9/10): pitch black-first; wordmark in spaced capitals
   (capitals are exclusive to the wordmark); everything else sentence case.
   Visual tokens are placeholders until the design system exists. */

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

:root {
  --black: #000;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --faint: #6b6b6b;
  --line: #262626;
}

html { background: var(--black); }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); }

/* --- top bar: thin, translucent, no solid fill --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.6rem;
}

.wordmark {
  font-size: 0.95rem;
  letter-spacing: 0.42em;
  text-decoration: none;
  font-weight: 600;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.topnav a:hover { color: var(--text); }

/* --- homepage hero: nebula background (docs 9/10, marketing nebula —
       atmosphere only, deliberately NOT a data view, doc 10 §1) --- */
body.home {
  background-image: url("nebula.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.1rem;
  padding: 2rem 1.5rem 4rem;
  /* soft black circle behind hero content so it stays readable
     over the nebula */
  background-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.28) 45%,
    transparent 70%
  );
  background-repeat: no-repeat;
  background-position: center;
  background-size: 64rem 36rem;
  /* fade the whole hero block (glow + text + button) in after 1s,
     so the nebula lands first */
  animation: hero-fade-in 1.6s ease-out 1s both;
}

@keyframes hero-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.tagline {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sub { color: var(--text); max-width: 34rem; }

.cta { margin-top: 1.2rem; }

.button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}
.button:hover { background: rgba(255, 255, 255, 0.09); }

/* --- waitlist signup (below the CTA): bare text + field + button, with
       its own soft black shade behind it so it stays readable over the
       nebula — same treatment as the hero glow --- */
.waitlist {
  margin-top: 2.2rem;
  padding: 1.6rem 2.2rem;
  background-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.28) 45%,
    transparent 70%
  );
  background-repeat: no-repeat;
  background-position: center;
}

.waitlist > * + * { margin-top: 0.9rem; }

.signup-line { font-weight: 600; }

/* --- the waitlist form --- */
.waitlist-form {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
/* the flex rule above would otherwise override the hidden attribute —
   the form starts hidden (JS reveals it) and hides again on success */
.waitlist-form[hidden] { display: none; }

/* accessible but not visual (waitlist email label) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.waitlist-form input[type="email"] {
  flex: 1;
  min-width: 12rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
}
.waitlist-form input[type="email"]::placeholder { color: var(--faint); }
.waitlist-form input[type="email"]:focus {
  outline: none;
  border-color: var(--muted);
}

.waitlist-form .button {
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.privacy-note, .status {
  color: var(--muted);
  font-size: 0.85rem;
}
.status { min-height: 1.4em; margin-bottom: -0.4em; }
/* focus is moved here programmatically after a submit — not a keyboard
   target (tabindex=-1), so no focus ring */
.status:focus { outline: none; }

/* --- long-form reading pages (whitepaper; later /privacy, /terms) --- */
.layout {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 1rem 1.6rem 4rem;
  display: block;
}

.toc { display: none; }

.content { max-width: 42rem; }

.content h1 {
  font-size: 1.9rem;
  margin: 1.5rem 0 0.5rem;
  line-height: 1.25;
}

.content h2 {
  font-size: 1.3rem;
  margin: 2.4rem 0 0.8rem;
  line-height: 1.3;
}

.content h3 {
  font-size: 1.05rem;
  margin: 1.8rem 0 0.6rem;
}

.content p, .content li { color: #d9d9d9; }
.content p { margin: 0.9rem 0; }
.content ul, .content ol { margin: 0.9rem 0 0.9rem 1.4rem; }
.content li { margin: 0.35rem 0; }
.content strong { color: var(--text); }
.content hr { border: none; border-top: 1px solid var(--line); margin: 2.2rem 0; }
.content a { text-underline-offset: 3px; }
.content em { color: var(--muted); }

/* sticky mini-TOC on wide screens only (doc 10 §3) */
@media (min-width: 1100px) {
  .layout {
    display: grid;
    grid-template-columns: 15rem 1fr;
    gap: 3rem;
  }
  .toc {
    display: block;
    position: sticky;
    top: 4.5rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    font-size: 0.85rem;
  }
  .toc nav { display: flex; flex-direction: column; gap: 0.45rem; }
  .toc a {
    color: var(--muted);
    text-decoration: none;
    line-height: 1.35;
  }
  .toc a:hover { color: var(--text); }
}

/* --- footer: minimal single row, chrome not sitemap (doc 10 §3) --- */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.4rem 1.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.footer nav a { color: var(--muted); text-decoration: none; }
.footer nav a:hover { color: var(--text); }

/* --- social row: single X link just above the footer --- */
.social {
  display: flex;
  justify-content: center;
  padding: 0.4rem 1.6rem 0;
}
.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.social a:hover { color: var(--text); }

/* =====================================================================
   /app — the app shell (doc 10 §4) and the canonical Trust Card
   (doc 4 §2). Same theme as the site: the nebula's register on black,
   sentence case, glass panes with a thin light border (doc 10 §3).
   The background here is an ambient field, deliberately not a data view
   (doc 10 §1) — the graph renderer owns that space in M5 phase 3.
   ===================================================================== */

body.app {
  background-image:
    radial-gradient(ellipse 70rem 45rem at 78% -8%,
                    rgba(120, 96, 200, 0.16), transparent 62%),
    radial-gradient(ellipse 55rem 38rem at 12% 108%,
                    rgba(60, 120, 180, 0.13), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.app-topbar { align-items: center; gap: 1rem; }

.app-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.capacity { color: var(--muted); font-size: 0.85rem; }

.menu-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.09); }

.menu-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 5;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 0.9rem;
}
.menu-panel[hidden] { display: none; }
.menu-panel a { color: var(--muted); text-decoration: none; }
.menu-panel a:hover { color: var(--text); }
.menu-who { color: var(--text); font-variant-numeric: tabular-nums; }
.menu-item {
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { color: var(--text); }

.app-main {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1.4rem 4rem;
}
.app-loading, .app-foot { color: var(--muted); font-size: 0.9rem; }
.app-foot { margin-top: 1.1rem; }

/* --- panels (onboarding steps) --- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.panel-title { font-size: 1.5rem; font-weight: 600; }
.panel-lead { color: #d9d9d9; }
.panel-note { color: var(--muted); font-size: 0.85rem; }

.choices { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.choices-providers { flex-direction: column; align-items: stretch; }

.choice {
  padding: 0.8rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.choice:hover { background: rgba(255, 255, 255, 0.1); }

/* --- the Trust Card --- */
.card {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.card-head { display: flex; flex-direction: column; gap: 0.5rem; }
.card-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.55rem; }
.card-name {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.card-identities { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; }
.card-identities-label {
  color: var(--faint);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.chip {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: nowrap;
}
.chip-nature { color: var(--text); }
.chip-unclaimed { border-style: dashed; }

.card-views { display: flex; flex-direction: column; gap: 1.1rem; }
.view { display: flex; flex-direction: column; gap: 0.3rem; }
.view-label {
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.score { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.score-value {
  font-size: 2.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.view-reference .score-value { font-size: 1.5rem; color: #d9d9d9; }
.view-secondary, .view-note { color: var(--muted); font-size: 0.9rem; }
.view-locked .view-note { max-width: 26rem; }
.view-action { color: var(--text); font-size: 0.9rem; }

.standing-line { display: flex; align-items: center; gap: 0.6rem; }
.standing { color: var(--muted); font-size: 0.9rem; }

.severity {
  width: 5rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.severity-fill { height: 100%; background: #e0574a; }

.verdict { color: var(--text); font-size: 0.9rem; }
.verdict-warn::before { content: "\26a0 "; }

/* tooltips: hover (title) on desktop, click/tap on the ? button */
.tip-wrap { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.tip-btn {
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}
.tip-btn:hover { color: var(--text); border-color: var(--muted); }
.tip-text {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 28rem;
}
.tip-text[hidden] { display: none; }

.card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.card-facts dt { color: var(--faint); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.card-facts dd { color: var(--text); }

/* presence progress — D44: circle size, never a count or a threshold */
.presence { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.4rem; }
.presence-ring { width: 2.3rem; height: 2.3rem; flex: none; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 3; }
.ring-arc { fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.ring-full { stroke: #8ee0a1; }
.presence-copy { color: var(--muted); font-size: 0.85rem; }

/* scoped to the onboarding panels so the homepage's button is untouched;
   the app's other action buttons (the signup form, invite generation)
   wear the same shape */
.panel > .button, .signup-form > .button, .invite-actions > .button,
.invite-code-row > .button {
  font: inherit;
  color: var(--text);
  cursor: pointer;
  align-self: flex-start;
  padding: 0.7rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.panel > .button:hover, .signup-form > .button:hover,
.invite-actions > .button:hover, .invite-code-row > .button:hover {
  background: rgba(255, 255, 255, 0.09);
}
.signup-form > .button:disabled, .invite-actions > .button:disabled {
  color: var(--faint);
  cursor: default;
  background: none;
}
/* ---------------------------------------------------------------- */
/* M5 phase 2 — the email-first entry journey, My Circle in list     */
/* form, invites, and the Dunbar ID label. All of it app-scoped; the */
/* public pages carry none of these classes.                         */
/* ---------------------------------------------------------------- */

/* the Dunbar ID label: the account address is not a wallet, and the
   label is what says so wherever the address renders */
.chip-id-label {
  border-style: solid;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.menu-who { display: flex; align-items: baseline; gap: 0.5rem; }
.menu-id-label {
  color: var(--faint);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.menu-note { color: var(--faint); font-size: 0.78rem; max-width: 16rem; }

/* growth-phase honesty: the locked personal view is maturing, not broken */
.view-note-quiet { color: var(--faint); font-size: 0.85rem; }

/* the signup form (email + invite code) */
.signup-form { display: flex; flex-direction: column; gap: 0.45rem; }
.field-label { color: var(--muted); font-size: 0.85rem; }
.field {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font: inherit;
}
.field:focus { outline: none; border-color: var(--muted); }
.field-code { letter-spacing: 0.12em; text-transform: uppercase; }
.signup-form .button { align-self: flex-start; margin-top: 0.4rem; }
.status { color: var(--muted); font-size: 0.85rem; min-height: 1.2rem; }

.button-quiet {
  border-color: transparent;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.4rem 0;
  align-self: flex-start;
}
.button-quiet:hover { color: var(--text); }
.button-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }

/* My Circle: own card, invites, then the two lists */
.circle-head { margin-bottom: 1.1rem; }
.circle-list, .invite-panel {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.circle-title { font-size: 1.05rem; font-weight: 600; }
.circle-note { color: var(--muted); font-size: 0.88rem; max-width: 32rem; }
.circle-empty { color: var(--faint); font-size: 0.9rem; }

.mini-cards { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.4rem; }
.mini-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}
.mini-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.mini-name { font-size: 1rem; font-weight: 600; }
.mini-identities { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.mini-standing { display: flex; align-items: baseline; gap: 0.5rem; }
.mini-score { font-size: 1.1rem; font-weight: 600; }
.mini-score-label, .mini-reason, .mini-ramp {
  color: var(--muted);
  font-size: 0.85rem;
}
.mini-link { color: var(--muted); font-size: 0.85rem; align-self: flex-start; }
.mini-link:hover { color: var(--text); }

/* invites: a code is shown once, at generation, and copied from here */
.invite-count { color: var(--text); font-size: 0.9rem; }
.invite-actions { margin-top: 0.2rem; }
.invite-output {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
/* [hidden] must win over the display above: an explicit display beats
   the user-agent rule for the attribute */
.invite-output[hidden] { display: none; }
.invite-code-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem; }
.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  letter-spacing: 0.1em;
  word-break: break-all;
}
.invite-warning { color: #e0a24a; font-size: 0.85rem; max-width: 32rem; }
.invite-created { color: var(--text); font-size: 0.9rem; }
.invite-held { color: var(--faint); font-size: 0.82rem; }

/* ------------------------------------------------------------------ */
/* The nebula (M5 phase 3, doc 8). The renderer draws into .nebula-host;
   the labels/tooltip/status layers are positioned by nebula.js. */
.nebula-section {
  position: relative;
  width: calc(100% + 2.8rem);
  margin-left: -1.4rem;
  margin-bottom: 1.4rem;
}
.nebula-canvas {
  position: relative;
  width: 100%;
  min-height: min(64vh, 560px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 45%,
    rgba(40, 44, 70, 0.22), rgba(0, 0, 0, 0) 70%);
  overflow: hidden;
}
/* the renderer adds .nebula-host to its container; it must NOT re-size it
   (a height:100% here resolves against an auto-height parent and collapsed
   the live canvas to a 2px sliver — the 2026-09-18 lesson: assert the
   rendered box, not just the mount) */
.nebula-host { position: relative; }
.nebula-stage { position: absolute; inset: 0; }
.nebula-stage canvas { display: block; width: 100%; height: 100%; }
.nebula-labels { position: absolute; inset: 0; pointer-events: none;
  z-index: 2; }
/* the tooltip is sized to its content and moved by transform — it must
   NOT span the host, or its text would sit at the box's origin */
.nebula-tooltip { position: absolute; top: 0; left: 0; width: max-content;
  pointer-events: none; z-index: 3; }
.nebula-label {
  position: absolute; top: 0; left: 0;
  font-size: 0.68rem; color: #d9d9d9; white-space: nowrap;
  text-shadow: 0 0 6px #000, 0 0 12px #000;
}
.nebula-label-hub { color: #9fb0c8; font-size: 0.64rem;
  letter-spacing: 0.04em; }
.nebula-tip-name { font-size: 0.82rem; color: #fff; text-shadow: 0 0 6px #000; }
.nebula-tip-meta { font-size: 0.72rem; color: var(--muted);
  text-shadow: 0 0 6px #000; }
.nebula-status { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: var(--faint); font-size: 0.85rem; pointer-events: none; }
.nebula-status[hidden] { display: none; }
.nebula-note { color: var(--muted); font-size: 0.88rem; padding: 1.2rem 1.4rem; }
.nebula-legend {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem;
  padding: 0.5rem 1.4rem 0;
  color: var(--faint); font-size: 0.74rem;
}
.nebula-legend-item::before {
  content: "\2022"; margin-right: 0.4rem; color: var(--muted);
}
.nebula-legend-red::before { color: #e0574a; }
.nebula-legend-ghost::before { color: #9fb0c8; }

/* Trust Card popup — tap a star (doc 8 §3.7; beta ruling: tap must open
   the card, never recenter the graph). */
.card-popup {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 3.2rem 1rem 1rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  overflow-y: auto;
}
.card-popup-frame {
  position: relative; width: 100%; max-width: 40rem;
}
.card-popup-close {
  position: absolute; top: -2.2rem; right: 0;
}
.card-popup-body .card { margin-top: 0.4rem; }
