/* ══════════════════════════════════════════════════
   Effe – v4: Visual interactive demo
   ══════════════════════════════════════════════════ */

:root {
  --paper: #f7f1e6;
  --paper-2: #fff7ec;
  --ink: #14110f;
  --ink-2: #2b2621;
  --muted: #6c6157;
  --hair: rgba(20, 17, 15, 0.12);
  --hair-2: rgba(20, 17, 15, 0.18);
  --accent: #b3262b;
  --teal: #0a6f6a;
  --good: #10713f;
  --warn: #b36b00;
  --radius: 18px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: var(--sans); line-height: 1.45; letter-spacing: 0.01em;
  overflow-x: hidden;
}
::selection { background: rgba(179, 38, 43, 0.16); }
code { font-family: var(--mono); font-size: 0.9em; background: rgba(20,17,15,0.06); padding: 1px 5px; border-radius: 4px; }

/* ── Background ──────────────────────────────────── */

.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg__mesh {
  position: absolute; inset: -80px;
  background:
    radial-gradient(1200px 600px at 18% 12%, rgba(179, 38, 43, 0.10), transparent 60%),
    radial-gradient(900px 500px at 78% 18%, rgba(10, 111, 106, 0.10), transparent 62%),
    linear-gradient(180deg, var(--paper-2), var(--paper));
}
.bg__grain {
  position: absolute; inset: -10%; opacity: 0.12; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

.wrap { max-width: 780px; padding: 20px 24px 56px; margin: 0 auto; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ── Top bar ─────────────────────────────────────── */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--paper) 80%, transparent);
}
.mark { display: inline-grid; gap: 1px; text-decoration: none; color: inherit; user-select: none; }
.mark__sig {
  font-family: var(--serif); font-weight: 820;
  font-variation-settings: "opsz" 96, "SOFT" 20;
  letter-spacing: -0.02em; font-size: 20px; line-height: 1;
}
.mark__sub { font-size: 11px; color: var(--muted); }
.top__wallet { display: flex; align-items: center; gap: 8px; }
.wallet-dot { width: 8px; height: 8px; border-radius: 999px; background: rgba(20,17,15,0.18); flex-shrink: 0; }
.wallet-dot--on { background: var(--good); box-shadow: 0 0 0 3px rgba(16,113,63,0.14); }
.wallet-label { font-size: 12px; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────── */

.btn {
  appearance: none; border: 1px solid var(--hair-2);
  background: rgba(255,255,255,0.48); color: var(--ink);
  font-family: var(--sans); font-weight: 650;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; font-size: 13px;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 8px 20px rgba(20,17,15,0.04);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  border-color: rgba(179,38,43,0.24);
  background: linear-gradient(180deg, rgba(179,38,43,0.92), rgba(179,38,43,0.78));
  color: #fff6ef; box-shadow: 0 12px 28px rgba(179,38,43,0.18);
}
.btn--primary:hover { box-shadow: 0 14px 34px rgba(179,38,43,0.26); }
.btn--ghost { background: rgba(255,255,255,0.3); }
.btn--sm { padding: 5px 10px; min-height: 28px; font-size: 12px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── Hero ────────────────────────────────────────── */

.hero { padding: 24px 0 8px; }
h1 {
  margin: 0 0 8px; font-family: var(--serif); font-weight: 870;
  font-variation-settings: "opsz" 120, "SOFT" 60;
  letter-spacing: -0.03em; line-height: 1.05;
  font-size: clamp(26px, 3.4vw, 42px);
  animation: rise 500ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.lead {
  margin: 0; color: var(--ink-2); font-size: 14px; max-width: 60ch;
  animation: rise 600ms cubic-bezier(0.2, 0.9, 0.2, 1) 30ms both;
}
.lead--sub {
  margin-top: 6px; font-size: 12px; color: var(--muted);
  animation: rise 600ms cubic-bezier(0.2, 0.9, 0.2, 1) 60ms both;
}

/* ════════════════════════════════════════════════════
   PIPELINE — horizontal flow diagram
   ════════════════════════════════════════════════════ */

.pipeline {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin: 20px 0 24px;
  padding: 16px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: rgba(255,255,255,0.50);
  box-shadow: 0 16px 44px rgba(20,17,15,0.06);
  animation: rise 500ms cubic-bezier(0.2, 0.9, 0.2, 1) 60ms both;
}

.pipe-node {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 10px; border-radius: 14px;
  transition: background 300ms ease, color 300ms ease, box-shadow 300ms ease, border-color 300ms ease;
  border: 1.5px solid transparent;
  color: rgba(20,17,15,0.35);
  min-width: 60px;
}
.pipe-node__icon { display: flex; align-items: center; justify-content: center; }
.pipe-node__label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

.pipe-node--active {
  color: var(--teal); border-color: rgba(10,111,106,0.28);
  background: rgba(10,111,106,0.08);
  box-shadow: 0 0 0 4px rgba(10,111,106,0.06);
  animation: pulse-node 1.2s ease-in-out infinite;
}
.pipe-node--done {
  color: var(--good); border-color: rgba(16,113,63,0.24);
  background: rgba(16,113,63,0.06);
}
.pipe-node--fail {
  color: var(--accent); border-color: rgba(179,38,43,0.24);
  background: rgba(179,38,43,0.06);
}

@keyframes pulse-node {
  0%, 100% { box-shadow: 0 0 0 4px rgba(10,111,106,0.06); }
  50% { box-shadow: 0 0 0 8px rgba(10,111,106,0.10); }
}

.pipe-arrow {
  width: 24px; height: 2px; flex-shrink: 0;
  background: rgba(20,17,15,0.12);
  border-radius: 2px;
  transition: background 300ms ease;
  position: relative;
}
.pipe-arrow::after {
  content: ""; position: absolute; right: -1px; top: -3px;
  width: 0; height: 0;
  border-left: 5px solid rgba(20,17,15,0.12);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: border-color 300ms ease;
}
.pipe-arrow--done { background: rgba(16,113,63,0.30); }
.pipe-arrow--done::after { border-left-color: rgba(16,113,63,0.30); }
.pipe-arrow--active { background: rgba(10,111,106,0.30); }
.pipe-arrow--active::after { border-left-color: rgba(10,111,106,0.30); }
.pipe-arrow--fail { background: rgba(179,38,43,0.25); }
.pipe-arrow--fail::after { border-left-color: rgba(179,38,43,0.25); }

/* ════════════════════════════════════════════════════
   STEP CARDS
   ════════════════════════════════════════════════════ */

.demo { display: grid; gap: 14px; }

.card {
  display: grid; grid-template-columns: 36px 1fr; gap: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(20,17,15,0.12); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.58), rgba(255,255,255,0.38));
  box-shadow: 0 16px 44px rgba(20,17,15,0.06);
  animation: rise 400ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.card__step {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid rgba(20,17,15,0.10);
  background: rgba(255,255,255,0.5);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: rgba(20,17,15,0.50);
}
.card__main h2 {
  margin: 0 0 4px; font-family: var(--serif); font-weight: 860;
  font-variation-settings: "opsz" 80, "SOFT" 44;
  letter-spacing: -0.02em; font-size: 18px;
}
.card__main > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; max-width: 62ch; line-height: 1.5; }
.card__row { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 14px; }
.card__text { flex: 1; }
.card__text h2 { margin-bottom: 4px; }
.card__text p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 50ch; }

/* ════════════════════════════════════════════════════
   GROUP VISUALIZATION — ring of dots
   ════════════════════════════════════════════════════ */

.group-viz {
  width: 120px; height: 120px; flex-shrink: 0;
  position: relative;
}
.group-viz__ring {
  width: 120px; height: 120px;
  position: relative;
}
.group-viz__center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.group-viz__count {
  font-family: var(--serif); font-weight: 860; font-size: 22px;
  line-height: 1; letter-spacing: -0.02em;
  color: var(--ink);
}
.group-viz__label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.10em;
  text-transform: uppercase; color: var(--muted);
}

.group-dot {
  position: absolute; width: 10px; height: 10px;
  border-radius: 999px;
  background: rgba(20,17,15,0.18);
  transform: translate(-50%, -50%);
  transition: background 300ms ease, box-shadow 300ms ease, transform 300ms ease;
}
.group-dot--you {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(10,111,106,0.20);
  width: 12px; height: 12px;
  z-index: 2;
  animation: dot-pop 400ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes dot-pop {
  0% { transform: translate(-50%, -50%) scale(0); }
  60% { transform: translate(-50%, -50%) scale(1.3); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ── Member bar ──────────────────────────────────── */

.member-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(20,17,15,0.08);
  background: rgba(255,255,255,0.44);
}
.member-bar__left { display: flex; align-items: center; gap: 10px; }
.member-bar__avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 13px;
  border: 1px solid rgba(20,17,15,0.10);
  background: rgba(255,255,255,0.5);
  color: var(--ink-2);
}
.member-bar__name { font-weight: 700; font-size: 13px; }
.member-bar__addr { font-size: 11px; color: var(--muted); margin-top: 1px; }
.member-bar__right { display: flex; align-items: center; gap: 10px; }

.member-bar__status {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.10em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid rgba(20,17,15,0.10);
}
.member-bar__status--in {
  border-color: rgba(16,113,63,0.26); background: rgba(16,113,63,0.07);
  color: color-mix(in oklab, var(--good) 88%, var(--ink));
}
.member-bar__status--out {
  border-color: rgba(179,38,43,0.22); background: rgba(179,38,43,0.05);
  color: color-mix(in oklab, var(--accent) 86%, var(--ink));
}

/* ── Toggle switch ───────────────────────────────── */

.toggle-switch {
  appearance: none; border: none; background: none; cursor: pointer;
  padding: 0; display: inline-flex;
}
.toggle-switch[disabled] { opacity: 0.4; cursor: not-allowed; }
.toggle-switch__track {
  width: 42px; height: 24px; border-radius: 999px;
  background: rgba(20,17,15,0.14);
  display: flex; align-items: center; padding: 2px;
  transition: background 200ms ease;
}
.toggle-switch--on .toggle-switch__track { background: var(--good); }
.toggle-switch__thumb {
  width: 20px; height: 20px; border-radius: 999px;
  background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.16);
  transition: transform 200ms ease;
}
.toggle-switch--on .toggle-switch__thumb { transform: translateX(18px); }

/* ════════════════════════════════════════════════════
   ACTION BUTTONS
   ════════════════════════════════════════════════════ */

.action-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }

.action-btn {
  appearance: none; cursor: pointer;
  border: 1px solid rgba(20,17,15,0.12); border-radius: 12px;
  background: rgba(255,255,255,0.44);
  padding: 12px; text-align: left;
  display: flex; align-items: flex-start; gap: 10px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 8px 22px rgba(20,17,15,0.04);
}
.action-btn:hover:not([disabled]) {
  transform: translateY(-1px);
  border-color: rgba(20,17,15,0.20);
  box-shadow: 0 12px 30px rgba(20,17,15,0.08);
}
.action-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.action-btn__icon { flex-shrink: 0; margin-top: 1px; color: var(--muted); }
.action-btn__label { font-weight: 700; font-size: 13px; display: block; }
.action-btn__hint { font-size: 11px; color: var(--muted); display: block; margin-top: 1px; }

.action-btn--good { border-color: rgba(16,113,63,0.18); }
.action-btn--good .action-btn__icon { color: var(--good); }
.action-btn--good .action-btn__label { color: color-mix(in oklab, var(--good) 80%, var(--ink)); }

.action-btn--bad { border-color: rgba(179,38,43,0.16); }
.action-btn--bad .action-btn__icon { color: var(--accent); }
.action-btn--bad .action-btn__label { color: color-mix(in oklab, var(--accent) 80%, var(--ink)); }

/* Highlighted "next step" button — animated dashed border */
.action-btn--highlight {
  border-style: dashed;
  border-color: var(--teal);
  background: rgba(10,111,106,0.04);
  animation: highlight-pulse 1.6s ease-in-out infinite;
  position: relative;
}
.action-btn--highlight::before {
  content: "next";
  position: absolute; top: -8px; right: 10px;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--teal);
  background: var(--paper); padding: 0 5px;
}

@keyframes highlight-pulse {
  0%, 100% {
    border-color: rgba(10,111,106,0.45);
    box-shadow: 0 0 0 0px rgba(10,111,106,0);
  }
  50% {
    border-color: rgba(10,111,106,0.70);
    box-shadow: 0 0 0 4px rgba(10,111,106,0.08);
  }
}

/* ════════════════════════════════════════════════════
   NARRATIVE CARDS — human-readable output
   ════════════════════════════════════════════════════ */

.narrative {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 12px; padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(20,17,15,0.10);
  background: rgba(255,255,255,0.50);
  animation: narr-in 300ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes narr-in {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.narr__icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 900; font-size: 14px;
  border: 1px solid rgba(20,17,15,0.10);
}
.narr__icon--ok {
  background: rgba(16,113,63,0.08); color: var(--good);
  border-color: rgba(16,113,63,0.22);
}
.narr__icon--fail {
  background: rgba(179,38,43,0.06); color: var(--accent);
  border-color: rgba(179,38,43,0.20);
}
.narr__icon--info {
  background: rgba(10,111,106,0.06); color: var(--teal);
  border-color: rgba(10,111,106,0.20);
}
.narr__icon--wait {
  background: rgba(179,107,0,0.06); color: var(--warn);
  border-color: rgba(179,107,0,0.18);
  animation: pulse-node 1.2s ease-in-out infinite;
}

.narr__content { flex: 1; min-width: 0; }
.narr__title { font-weight: 750; font-size: 14px; margin-bottom: 3px; }
.narr__body { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.narr__body a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
.narr__body strong { font-weight: 700; color: var(--ink); }

.narr__details { margin-top: 8px; }
.narr__details summary {
  font-family: var(--mono); font-size: 11px; cursor: pointer;
  color: var(--muted); letter-spacing: 0.04em;
}
.narr__pre {
  margin: 6px 0 0; padding: 10px;
  border-radius: 10px;
  background: rgba(15,15,16,0.92);
  color: rgba(255,250,240,0.88);
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  max-height: 200px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
}

.tx-link {
  font-family: var(--mono); font-size: 12px;
}

/* ════════════════════════════════════════════════════
   EXPLAINER — how it works
   ════════════════════════════════════════════════════ */

.explainer {
  margin-top: 36px; padding: 20px;
  border: 1px solid var(--hair); border-radius: var(--radius);
  background: rgba(255,255,255,0.42);
}
.explainer h2 {
  margin: 0 0 14px; font-family: var(--serif); font-weight: 860;
  font-variation-settings: "opsz" 80, "SOFT" 44;
  letter-spacing: -0.02em; font-size: 18px;
}
.explainer__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.explainer__item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(20,17,15,0.06);
  background: rgba(255,255,255,0.40);
}
.explainer__num {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  border: 1px solid rgba(20,17,15,0.10);
  background: rgba(255,255,255,0.5);
  color: rgba(20,17,15,0.50);
}
.explainer__item strong { font-size: 13px; display: block; margin-bottom: 2px; }
.explainer__item p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ════════════════════════════════════════════════════
   VERIFIED CONTRACTS
   ════════════════════════════════════════════════════ */

.contracts {
  margin-top: 28px; padding: 20px;
  border: 1px solid var(--hair); border-radius: var(--radius);
  background: rgba(255,255,255,0.42);
}
.contracts h2 {
  margin: 0 0 4px; font-family: var(--serif); font-weight: 860;
  font-variation-settings: "opsz" 80, "SOFT" 44;
  letter-spacing: -0.02em; font-size: 18px;
}
.contracts__desc {
  margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.5;
}
.contracts__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.contract-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(20,17,15,0.06);
  background: rgba(255,255,255,0.40);
  text-decoration: none; color: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.contract-card:hover {
  border-color: rgba(10,111,106,0.24);
  box-shadow: 0 6px 20px rgba(10,111,106,0.06);
  transform: translateY(-1px);
}
.contract-card__icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  border: 1px solid rgba(10,111,106,0.18);
  background: rgba(10,111,106,0.06);
  color: var(--teal);
}
.contract-card__info strong { font-size: 13px; display: block; }
.contract-card__info span { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* ── Footer ──────────────────────────────────────── */

.arch-note {
  margin-top: 32px; padding: 16px 20px; border-radius: 10px;
  background: rgba(20, 17, 15, 0.03); border: 1px solid var(--hair);
}
.arch-note h3 {
  margin: 0 0 8px; font-size: 13px; font-family: var(--sans);
  font-weight: 600; color: var(--ink-2);
}
.arch-note p {
  margin: 0 0 8px; font-size: 12px; line-height: 1.55; color: var(--muted);
}
.arch-note p:last-child { margin-bottom: 0; }

.foot {
  margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--hair);
  display: flex; justify-content: space-between; gap: 10px;
  color: var(--muted); font-size: 11px; flex-wrap: wrap;
}

/* ── Animations ──────────────────────────────────── */

@keyframes rise {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 680px) {
  .pipeline { flex-wrap: wrap; gap: 4px; padding: 12px 8px; }
  .pipe-arrow { width: 16px; }
  .pipe-node { min-width: 48px; padding: 6px; }
  .pipe-node__label { font-size: 8px; }
  .card { grid-template-columns: 1fr; }
  .card__step { display: none; }
  .card__row { flex-direction: column; }
  .group-viz { align-self: center; }
  .member-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .member-bar__right { justify-content: space-between; }
  .action-btns { grid-template-columns: 1fr; }
  .explainer__grid { grid-template-columns: 1fr; }
  .contracts__grid { grid-template-columns: 1fr; }
  .top__wallet .wallet-label { display: none; }
}

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