/* fund/raise design system: tokens, base, layout, shell and the shared components
   (src/ui.tsx, src/wallet.tsx, src/App.tsx). Area files load after this one:
   brand-content.css, brand-fund.css, brand-decision.css, brand-forms.css.
   White first. Black type. Red only as a sparse accent (the slash, a thin rule, a small marker). */

/* ---- Tokens ---------------------------------------------------------------------- */

:root {
  /* Brand colours */
  --white: #ffffff;
  --black: #000000;
  --red: #e5232e;
  --gray: #f2f2f2;

  /* Derived neutrals. Text tokens meet WCAG AA on white and on --gray. */
  --ink: var(--black);
  --bg: var(--white);
  --panel: var(--gray);
  --muted: #666666; /* text: 5.74:1 on white, 5.13:1 on --gray */
  --line: #e0e0e0; /* decorative rules and card borders */
  --line-strong: #8a8a8a; /* control borders: 3.45:1 on white (non-text 3:1) */
  --hover: #262626; /* primary button hover */

  /* Type */
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --font-ui:
    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --fs-label: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-lead: clamp(18px, 1.6vw, 21px);
  --fs-h3: 22px;
  --fs-h2: clamp(28px, 3.2vw, 44px);
  --fs-h1: clamp(40px, 5.4vw, 76px);
  --fs-display: clamp(48px, 8vw, 112px);
  --tracking-display: -0.02em;
  --tracking-heading: -0.015em;
  --tracking-label: 0.08em;

  /* Space (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Shape */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --border: 1px solid var(--line);
  --border-strong: 1px solid var(--line-strong);
  --focus: 2px solid var(--black);
  --focus-offset: 3px;

  /* Layout: content width, side gutter and the full-bleed edge that aligns with it */
  --page: 1264px;
  --gutter: 48px;
  --edge: max(var(--gutter), calc((100% - var(--page)) / 2));
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

/* ---- Reset and base -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.6;
}
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: var(--tracking-heading);
  line-height: 1.1;
  text-wrap: balance;
}
h1 {
  font-size: var(--fs-h1);
  letter-spacing: var(--tracking-display);
  line-height: 1.04;
}
h2 {
  font-size: var(--fs-h2);
  line-height: 1.08;
}
h3 {
  font-size: var(--fs-h3);
}
h4 {
  font-size: var(--fs-md);
  font-weight: 600;
}
p {
  line-height: 1.6;
}
a {
  color: inherit;
  text-decoration: none;
}
/* Links inside running text stay distinguishable without colour. */
p a:not([class]),
li a:not([class]),
dd a:not([class]) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
img,
svg {
  max-width: 100%;
  display: block;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
button,
a,
input,
textarea,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
a,
button {
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    text-decoration-color 0.16s ease;
}
button:disabled {
  cursor: not-allowed;
}
:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}
::selection {
  background: var(--black);
  color: var(--white);
}
input,
textarea {
  caret-color: var(--ink);
}
strong,
b {
  font-weight: 600;
}
small {
  font-size: var(--fs-sm);
}
hr {
  border: 0;
  border-top: var(--border);
  margin: var(--space-6) 0;
}
.icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---- Text helpers ------------------------------------------------------------------ */

.muted {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.quiet {
  font-size: var(--fs-sm);
}
.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--muted);
}
/* The small uppercase label above a headline ("GOVERNANCE / PROPOSAL"). */
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
}
.numeric,
.address {
  font-variant-numeric: tabular-nums;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Layout ------------------------------------------------------------------------- */

.container {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.page {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter) var(--space-9);
  min-height: 65dvh;
}
.page:focus {
  outline: none;
}
.site-main {
  min-width: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.grid-2,
.grid-3,
.project-grid {
  display: grid;
  gap: var(--space-6);
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3,
.project-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.project-grid {
  gap: var(--space-7) var(--space-6);
}

/* ---- Skip link ---------------------------------------------------------------------- */

.skip-link {
  position: fixed;
  left: var(--space-4);
  top: -80px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}
.skip-link:focus {
  top: var(--space-4);
}

/* ---- Dev-only preview bar (src/preview/bar.tsx; never in a production build) ------- */

.review-bar {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--edge);
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1.3;
}

/* ---- Header ------------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 20;
  height: 84px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: 0 var(--edge);
  background: var(--white);
  border-bottom: var(--border);
}

/* The wordmark: "fund" + red "/" + "raise", Manrope ExtraBold, black letters. */
.wordmark,
.mark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0; /* logo-primary.png proportions (width:height 6.9) */
  line-height: 1;
  white-space: nowrap;
  color: var(--black);
}
.wordmark .slash,
.mark .slash {
  color: var(--red);
}
.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 30px;
  padding: var(--space-1) 0;
}
.brand:focus-visible {
  outline-offset: 6px;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-left: auto;
  font-size: 15px;
}
.primary-nav a {
  position: relative;
  padding: var(--space-2) 0;
  white-space: nowrap;
  color: var(--ink);
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s var(--ease);
}
.primary-nav a:hover::after {
  transform: scaleX(1);
  height: 1px;
}
/* The current section: a thin red rule. */
.primary-nav a[aria-current="page"]::after {
  height: 2px;
  background: var(--red);
  transform: scaleX(1);
}
/* "My activity" sits beside the wallet button on wide screens; the nav copy shows below 1200px. */
.primary-nav > a:last-child {
  display: none;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.header-activity {
  font-size: 15px;
  white-space: nowrap;
}
.header-activity:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.header-actions .mobile-menu {
  display: none;
}

/* ---- Footer ------------------------------------------------------------------------- */

.site-footer {
  margin-top: var(--space-8);
  padding: var(--space-8) var(--edge) var(--space-6);
  border-top: var(--border);
  font-size: var(--fs-sm);
}
.footer-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-6);
}
.footer-top .brand {
  font-size: 26px;
}
.footer-top p {
  color: var(--muted);
  font-size: var(--fs-md);
}
.footer-top nav {
  display: flex;
  gap: var(--space-5);
}
.footer-top nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--border);
  font-size: var(--fs-label);
  color: var(--muted);
}

/* ---- Buttons and links -------------------------------------------------------------- */

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 12px 24px;
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--black);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
}
.button .icon {
  filter: invert(1);
  width: 18px;
  height: 18px;
  transition: transform 0.2s var(--ease);
}
.button:hover {
  background: var(--hover);
  border-color: var(--hover);
}
.button:hover .icon {
  transform: translate(2px, -2px);
}
.button.secondary {
  background: var(--white);
  color: var(--ink);
  border-color: var(--black);
}
.button.secondary .icon {
  filter: none;
}
.button.secondary:hover {
  background: var(--gray);
}
.button.small {
  min-height: 40px;
  padding: 8px 18px;
  font-size: var(--fs-sm);
  gap: var(--space-2);
}
.button.full {
  width: 100%;
}
.button:disabled,
.button[aria-disabled="true"] {
  background: var(--gray);
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}
.button:disabled .icon,
.button[aria-disabled="true"] .icon {
  filter: none;
  opacity: 0.5;
  transform: none;
}
.button.secondary:disabled {
  background: var(--white);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 5px;
}
.text-link:hover {
  text-decoration-color: var(--black);
}
.text-link .icon {
  width: 16px;
  height: 16px;
}
.text-link:disabled {
  color: var(--muted);
  text-decoration-color: var(--line);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.icon-button:hover {
  background: var(--gray);
}
.icon-button:disabled {
  opacity: 0.4;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
  font-size: var(--fs-sm);
  color: var(--muted);
  width: max-content;
}
.back-link:hover {
  color: var(--ink);
}
.back-link .icon {
  width: 16px;
  height: 16px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--space-6);
}

/* ---- Forms -------------------------------------------------------------------------- */

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.form-field > span,
fieldset > legend {
  font-size: var(--fs-sm);
  font-weight: 500;
}
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--white);
  color: var(--ink);
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.form-field textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.6;
}
.form-field select {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--muted);
}
.form-field input:hover,
.form-field textarea:hover,
.form-field select:hover {
  border-color: var(--black);
}
.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible {
  outline-offset: 1px;
  border-color: var(--black);
}
.form-field input:disabled,
.form-field textarea:disabled,
.form-field select:disabled {
  background: var(--gray);
  color: var(--muted);
}
.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"],
.form-field select[aria-invalid="true"] {
  border-color: var(--black);
  border-left: 3px solid var(--red);
}
.form-field option {
  color: var(--ink);
  background: var(--white);
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
fieldset > legend {
  padding: 0;
  margin-bottom: var(--space-2);
}
.check-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.check-label input,
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--black);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.check-label input {
  margin: 2px 0 0;
}

.search-field {
  height: 44px;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
}
.search-field:focus-within {
  border-color: var(--black);
}
.search-field .icon {
  width: 18px;
  height: 18px;
}
.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  outline-offset: 10px;
}
.search-field input::placeholder {
  color: var(--muted);
}

/* ---- Cards, panels and notes -------------------------------------------------------- */

.card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
}
.panel {
  background: var(--gray);
  border-radius: var(--radius);
  padding: var(--space-5);
}
.disclosure,
.guide-note,
.wallet-preview {
  background: var(--gray);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin: var(--space-6) 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.disclosure h3 {
  font-size: 18px;
  margin: 0 0 var(--space-2);
}
.disclosure p {
  color: var(--muted);
}
.disclosure p + p {
  margin-top: var(--space-2);
}
.demo-note {
  margin: var(--space-5) 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.listing-note {
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: var(--border);
  font-size: 13px;
  color: var(--muted);
}
.initials {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--gray);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
}

details {
  border-bottom: var(--border);
  padding: var(--space-5) 0;
}
summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  list-style: none;
  cursor: pointer;
  font-weight: 500;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "+";
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}
details[open] > summary::after {
  content: "\2212";
}
details p {
  padding-top: var(--space-3);
  max-width: 68ch;
  font-size: 15px;
  color: var(--muted);
}

/* ---- Tabs and filters --------------------------------------------------------------- */

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-6);
  margin-top: var(--space-5);
  border-bottom: var(--border);
}
.detail-tabs button {
  position: relative;
  padding: var(--space-4) 0;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
}
.detail-tabs button:hover {
  color: var(--ink);
}
.detail-tabs button.active {
  color: var(--ink);
  font-weight: 600;
}
.detail-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--black);
}
.detail-tabs button:focus-visible {
  outline-offset: -2px;
}

.explore-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: var(--border);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.filters button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 8px 14px;
  border: var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.filters button span {
  font-size: var(--fs-label);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.filters button:hover {
  border-color: var(--black);
}
.filters button.active {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}
.filters button.active span {
  color: inherit;
}
.result-count {
  margin: var(--space-5) 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---- Tables, summary lists and stats ------------------------------------------------ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: var(--space-3) var(--space-3) var(--space-3) 0;
  text-align: left;
  border-bottom: var(--border);
  vertical-align: baseline;
}
th {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
}

.summary-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-3) 0;
  border-bottom: var(--border);
  font-size: var(--fs-sm);
}
.summary-list dt {
  color: var(--muted);
}
.summary-list dd {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.summary-list + p.muted {
  margin-top: var(--space-4);
}

.detail-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  margin: var(--space-6) 0;
  padding: var(--space-5) 0;
  border-top: var(--border);
  border-bottom: var(--border);
}
.detail-split > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.detail-split strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.detail-split span {
  font-size: 13px;
  color: var(--muted);
}

/* ---- Status, progress, countdown ---------------------------------------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}
/* Live states carry a small red marker. */
.status.live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

/* Example content (src/examples.ts, ExampleTag): a small neutral outline tag, never red.
   Its own font settings, so it reads the same inside a heading. */
.example-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.progress {
  height: 6px;
  margin: var(--space-3) 0;
  background: var(--gray);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--black);
}

.countdown-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 500;
}
.countdown-label > span:last-child {
  font-size: var(--fs-label);
  color: var(--muted);
}
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-2);
  font-variant-numeric: tabular-nums;
}
.countdown > div {
  padding: var(--space-3) var(--space-1) var(--space-2);
  background: var(--gray);
  border-radius: var(--radius-sm);
  text-align: center;
}
.countdown strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.countdown span {
  display: block;
  margin-top: var(--space-1);
  font-size: 11px;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
}
.close-date {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--fs-label);
  color: var(--muted);
}

/* ---- Headings, art and empty states ------------------------------------------------- */

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: var(--space-7);
  padding: var(--space-9) 0 var(--space-7);
}
.page-heading.illustrated-heading {
  grid-template-columns: minmax(0, 1fr) auto;
}
.heading-text .eyebrow {
  margin-bottom: var(--space-5);
}
.heading-text h1 {
  max-width: 18ch;
}
.heading-text > p {
  max-width: 58ch;
  margin-top: var(--space-5);
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--muted);
}
.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}
/* The engraving: a small, sparse accent, never a banner. */
.heading-art {
  width: clamp(120px, 14vw, 200px);
  justify-self: end;
  align-self: center;
}
.art {
  width: 100%;
  height: auto;
  filter: grayscale(1);
  mix-blend-mode: multiply;
}
.heading-art .art {
  max-height: 260px;
  object-fit: contain;
}
/* The Atlas plate has its own gray paper: lift it to white wherever it appears
   (guide plate, fund plates), as the dashboard heading does. */
.art[src$="/v2/atlas.webp"] {
  filter: grayscale(1) brightness(1.6) contrast(1.6);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.section-heading h2 {
  font-size: var(--fs-h2);
}
.section-heading .text-link {
  white-space: nowrap;
}

.empty-state {
  margin: var(--space-6) 0;
  padding: var(--space-8) var(--space-5);
  border: var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.empty-state h1,
.empty-state h2 {
  font-size: clamp(24px, 2.4vw, 32px);
  max-width: 24ch;
  margin: 0 auto;
}
.empty-state p {
  max-width: 54ch;
  margin: var(--space-3) auto var(--space-5);
  color: var(--muted);
  font-size: 15px;
}
.empty-state > :last-child {
  margin-bottom: 0;
}
.empty-state .empty-art {
  width: 96px;
  margin: 0 auto var(--space-5);
}
.empty-state .button {
  margin-top: var(--space-1);
}

/* ---- Address, copy and explorer links ----------------------------------------------- */

.address {
  overflow-wrap: anywhere;
}
.address button,
.address a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.address button:hover,
.address a:hover {
  color: var(--ink);
  text-decoration-color: var(--black);
}
a.address {
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

/* ---- Modal dialog ------------------------------------------------------------------- */

dialog {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: var(--space-7) var(--space-6) var(--space-6);
  background: var(--white);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-lg);
}
dialog::backdrop {
  background: rgb(0 0 0 / 0.55);
}
.modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}
.modal-close .icon {
  width: 18px;
  height: 18px;
}
dialog h2 {
  margin: 0 0 var(--space-3);
  padding-right: var(--space-5);
  font-size: 32px;
  line-height: 1.08;
}
dialog h2:focus {
  outline: none;
}
dialog h2:focus-visible {
  outline: var(--focus);
}
.modal-lead {
  margin: 0 0 var(--space-5);
  font-size: 15px;
  color: var(--muted);
}
.modal-emblem {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  border: var(--border);
  border-radius: var(--radius);
}
.modal-emblem .icon {
  width: 22px;
  height: 22px;
}
.wallet-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.wallet-list .button {
  justify-content: flex-start;
}
.wallet-list .button img:not(.icon) {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
}
.wallet-list .button .icon {
  margin-left: auto;
}
.wallet-preview strong {
  font-size: 15px;
  font-weight: 600;
}
.wallet-preview p {
  margin-top: var(--space-1);
  color: var(--muted);
}
dialog > .button {
  margin-top: var(--space-3);
}
dialog > .demo-note + .button {
  margin-top: var(--space-5);
}
dialog .summary-list {
  margin: var(--space-3) 0 var(--space-5);
}

/* ---- Toast -------------------------------------------------------------------------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  z-index: 80;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 14px 20px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s var(--ease);
}
#toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

/* ---- Responsive --------------------------------------------------------------------- */

@media (max-width: 1200px) {
  :root {
    --gutter: 32px;
  }
  .primary-nav {
    gap: var(--space-5);
    font-size: var(--fs-sm);
  }
  .header-actions {
    gap: var(--space-4);
  }
  .header-activity {
    display: none;
  }
  .primary-nav > a:last-child {
    display: inline;
  }
  .footer-top {
    grid-template-columns: auto 1fr;
  }
  .footer-top nav {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1000px) {
  .site-header {
    height: 68px;
    gap: var(--space-4);
  }
  .brand {
    font-size: 24px;
  }
  .header-actions {
    margin-left: auto;
    gap: var(--space-2);
  }
  .header-actions .mobile-menu {
    display: inline-flex;
  }
  .primary-nav {
    display: none;
  }
  .site-header.menu-open .primary-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: var(--space-2) var(--gutter) var(--space-4);
    background: var(--white);
    border-bottom: var(--border);
    font-size: var(--fs-md);
  }
  .site-header.menu-open .primary-nav a {
    padding: var(--space-4) 0;
    border-bottom: var(--border);
  }
  .site-header.menu-open .primary-nav a:last-child {
    border-bottom: 0;
  }
  .site-header.menu-open .primary-nav a::after {
    top: var(--space-4);
    bottom: var(--space-4);
    left: calc(-1 * var(--space-3));
    right: auto;
    width: 2px;
    height: auto;
  }
  .site-header.menu-open .primary-nav a:hover::after {
    transform: scaleX(0);
  }
  .site-header.menu-open .primary-nav a[aria-current="page"]::after {
    transform: scaleX(1);
  }
  .grid-3,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --gutter: 20px;
  }
  .header-actions .button.small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
  }
  .header-actions .button.small .icon {
    display: none;
  }
  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .footer-top nav {
    grid-column: auto;
    flex-wrap: wrap;
  }
  .footer-bottom {
    flex-direction: column;
    margin-top: var(--space-6);
  }
  .page-heading,
  .page-heading.illustrated-heading {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    padding: var(--space-7) 0 var(--space-6);
  }
  .heading-art {
    width: 104px;
    justify-self: start;
    order: -1;
  }
  .heading-text .eyebrow {
    margin-bottom: var(--space-4);
  }
  .heading-text > p {
    margin-top: var(--space-4);
  }
  .grid-2,
  .grid-3,
  .project-grid,
  .detail-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .explore-tools {
    flex-direction: column;
    align-items: stretch;
  }
  .search-field {
    width: 100%;
    min-width: 0;
  }
  .search-field input,
  .form-field input,
  .form-field textarea,
  .form-field select {
    font-size: 16px; /* no iOS zoom on focus */
  }
  .section-heading {
    gap: var(--space-4);
  }
  .empty-state {
    padding: var(--space-7) var(--space-4);
  }
  dialog {
    padding: var(--space-7) var(--space-5) var(--space-5);
  }
  dialog h2 {
    font-size: 28px;
  }
}

@media (max-width: 374px) {
  :root {
    --gutter: 16px;
  }
  .brand {
    font-size: 21px;
  }
  .header-actions .button.small {
    padding: 6px 10px;
    font-size: 12px;
  }
  .header-actions .mobile-menu {
    width: 36px;
  }
}

/* ---- Motion and forced colours ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .button:hover .icon {
    transform: none;
  }
  #toast {
    transform: translate(-50%, 0);
  }
}

@media (forced-colors: active) {
  .wordmark .slash,
  .mark .slash {
    color: CanvasText;
  }
  .button {
    border: 1px solid ButtonText;
  }
  .primary-nav a[aria-current="page"]::after,
  .detail-tabs button.active::after {
    background: Highlight;
  }
}
