/* Constitution Forge — style tokens lifted from nouns.wtf bundled CSS */

:root {
  --cool-bg: #d5d7e1;
  --cool-accent: #e9ebf3;
  --cool-border: #bdc0cf;
  --cool-dark: #151c3b;
  --cool-light: #79809c;

  --warm-bg: #e1d7d5;
  --warm-accent: #f9f1f1;
  --warm-border: #cfbdba;
  --warm-dark: #221b1a;
  --warm-light: #8f7e7c;

  --gray-bg: #f4f4f8;
  --gray-border: #e2e3eb;
  --gray-dark: #14161b;
  --gray-light: #8c8d92;
  --gray-hover: #fafafb;

  --red: #e40536;
  --red-soft: rgba(214, 60, 94, 0.1);
  --green: #43b369;
  --green-soft: rgba(67, 179, 105, 0.1);
  --blue: #4965f0;
  --black: #212529;

  --radius: 12px;
  --font-heading: "Londrina Solid", "Arial Black", sans-serif;
  --font-body: "PT Root UI", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--black);
  background: var(--gray-bg);
  font-size: 1.05rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

h1 { font-size: clamp(2.6rem, 6vw, 4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.4rem; margin-bottom: 0.4rem; }

a { color: inherit; }
p + p { margin-top: 0.9rem; }

.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 760px; }

/* ---- nav ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}
.nav .wordmark {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav .noggles { letter-spacing: -1px; margin-right: 0.4rem; color: var(--red); }
.nav ul { display: flex; gap: 1.4rem; list-style: none; flex-wrap: wrap; }
.nav ul a {
  text-decoration: none;
  font-weight: 700;
  color: var(--cool-dark);
  opacity: 0.75;
}
.nav ul a:hover, .nav ul a.active { opacity: 1; }

/* ---- sections ---- */
.section { padding: 4rem 0; }
.section.cool { background: var(--cool-bg); color: var(--cool-dark); }
.section.warm { background: var(--warm-bg); color: var(--warm-dark); }
.section.cool .muted { color: var(--cool-light); }
.section.warm .muted { color: var(--warm-light); }
.muted { color: var(--gray-light); }

.hero { padding: 3.5rem 0 4.5rem; }
.hero .lede {
  font-size: 1.3rem;
  max-width: 40rem;
  margin-top: 1rem;
  font-weight: 500;
}

/* ---- hero gallery (delegated nouns) ---- */
.hero-flex {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}
.hero-flex > div:first-child { flex: 1 1 24rem; min-width: 0; }
.noun-gallery {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  gap: 1.1rem;
}
.noun-gallery.filled { display: flex; }

.noun-card {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: 16px;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.15s ease;
  z-index: 1;
}
.noun-card img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  display: block;
  border-radius: 16px;
  border: 3px solid #fff;
  box-shadow: 0 6px 18px rgba(21, 28, 59, 0.22);
}
.noun-card.featured { width: 272px; height: 272px; }
.noun-card.side { width: 88px; height: 88px; margin: -6px 0; }
.noun-card:hover {
  z-index: 9;
  transform: rotate(0deg) translateY(-6px) scale(1.06);
}

.noun-side {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.noun-more {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--cool-dark);
  margin-top: 0.4rem;
  line-height: 1;
  cursor: default;
}
/* hover label: "Noun 1251 — delegated by 0x…" */
.noun-card::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -0.6rem;
  transform: translate(-50%, 100%);
  background: var(--gray-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.noun-card:hover::after { opacity: 1; }

@media (max-width: 720px) {
  .hero-flex { flex-direction: column; align-items: flex-start; }
  .noun-gallery { align-self: center; transform: scale(0.72); transform-origin: top center; margin: -1rem 0 -2.5rem; }
}

/* ---- buttons ---- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-dark { background: var(--gray-dark); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-outline {
  background: transparent;
  border-color: currentColor;
}
.btn[disabled], .btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-row { display: flex; gap: 0.8rem; margin-top: 1.75rem; flex-wrap: nowrap; align-items: center; }
.btn { white-space: nowrap; }
@media (max-width: 560px) {
  .btn-row { flex-wrap: wrap; }
}

/* ---- cards ---- */
.card {
  background: #fff;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.section.cool .card { background: var(--cool-accent); border-color: var(--cool-border); }
.section.warm .card { background: var(--warm-accent); border-color: var(--warm-border); }

/* ---- pills / tags ---- */
.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pill-for { background: var(--green-soft); color: var(--green); }
.pill-against { background: var(--red-soft); color: var(--red); }
.pill-flag { background: var(--cool-accent); color: var(--cool-dark); border: 1px solid var(--cool-border); }

/* ---- constitution articles ---- */
.article { margin-top: 2.5rem; }
.article h3 { display: flex; align-items: baseline; gap: 0.6rem; }
.article .clause-id {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-light);
}
.article ol { padding-left: 1.4rem; margin-top: 0.6rem; }
.article ol li { margin-top: 0.55rem; }
.param {
  background: var(--cool-accent);
  border: 1px dashed var(--cool-border);
  border-radius: 6px;
  padding: 0 0.35rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin-top: 1.25rem; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.97rem;
}
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-border);
  vertical-align: top;
}
th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-light);
  background: var(--gray-hover);
}
tr:last-child td { border-bottom: none; }

.reason-cell { vertical-align: top; }
.reason-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.reason-toggle {
  display: block;
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
}
.reason-toggle:hover { text-decoration: underline; }

/* ---- verdict detail modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 28, 59, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  position: relative;
  background: #fff;
  color: var(--black);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(21, 28, 59, 0.35);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--gray-hover);
  color: var(--gray-light);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--gray-border); color: var(--black); }
.modal-card h3 { padding-right: 2.5rem; font-size: 1.5rem; }
.modal-meta { margin-top: 0.6rem; font-size: 0.9rem; line-height: 1.6; }
.modal-section { margin-top: 1.5rem; }
.modal-section h4 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-light);
  margin-bottom: 0.4rem;
}
.modal-reason { white-space: pre-wrap; }
.history-entry {
  padding: 0.9rem 0;
  border-top: 1px solid var(--gray-border);
}
.history-entry:first-child { border-top: none; }
.history-meta { font-size: 0.9rem; margin-bottom: 0.3rem; }
.history-meta b { font-family: var(--font-body); }

/* ---- timeline ---- */
.timeline { list-style: none; margin-top: 1.5rem; }
.timeline li {
  position: relative;
  padding: 0 0 1.5rem 1.75rem;
  border-left: 2px solid var(--warm-border);
  margin-left: 0.5rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
}
.timeline .when {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--warm-light);
}

/* ---- big stat ---- */
.stat-row { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-top: 1.75rem; }
.stat .num {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  line-height: 1;
}
.stat .label { font-size: 0.9rem; font-weight: 700; opacity: 0.7; }

/* ---- footer ---- */
footer {
  padding: 2.5rem 0 3rem;
  color: var(--gray-light);
  font-size: 0.9rem;
}
footer a { color: var(--gray-light); }

@media (max-width: 640px) {
  .section { padding: 2.75rem 0; }
  .hero { padding: 2.5rem 0 3rem; }
}

/* ---- delegate flow status ---- */
.delegate-status {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  max-width: 30rem;
}
.delegate-status[data-state="ok"] { color: var(--green); }

/* ---- wallet chooser (EIP-6963 multi-wallet) ---- */
.wallet-choice {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
  margin: 0 0.35rem 0.25rem 0;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.wallet-choice:hover { background: rgba(21, 28, 59, 0.08); }
