:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --surface: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --border: #374151;
  --quote: #86efac;
}

:root.light {
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --surface: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --accent: #15803d;
  --accent-dark: #166534;
  --border: #cbd5e1;
  --quote: #166534;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.55;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
}

.container {
  width: min(1000px, 92%);
  margin: 0 auto;
}

.site-header {
  padding: clamp(3.5rem, 8vw, 5rem) 0 3rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.82), rgba(6, 78, 59, 0.62)),
    url("assets/GreenTeaParty_underground.jpeg") center 35% / cover no-repeat;
}

.hero-copy {
  width: min(100%, 42rem);
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1rem;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(3px);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.3);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.site-header .eyebrow,
.site-header .intro {
  color: rgba(248, 250, 252, 0.82);
}

h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(2rem, 6vw, 3.75rem);
}

.tagline {
  margin: 0;
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 700;
}

.intro {
  margin-top: 1.25rem;
  max-width: 60ch;
  color: var(--muted);
}

.cta-row {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.65rem 0.95rem;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04120a;
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary,
.btn-tertiary {
  background: var(--surface);
}

.ledger-return-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.88rem;
}

.ledger-return-link:hover {
  text-decoration: underline;
}

.site-header .btn {
  border-color: rgba(255, 255, 255, 0.24);
}

.site-header .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
}

.site-header .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

h2 {
  margin-top: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

blockquote {
  margin: 0;
  border-left: 4px solid var(--quote);
  padding: 0.5rem 0 0.5rem 1rem;
  max-width: 75ch;
  color: var(--muted);
}

.section-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.65rem;
}

.section-grid li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.7rem 0.8rem;
}

.section-lead {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
}

.how-it-works-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  max-width: 78ch;
  display: grid;
  gap: 0.65rem;
}

.metrics-strip,
.project-grid,
.activity-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.metric-card,
.project-card,
.activity-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem;
}

.metric-label,
.project-meta,
.activity-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.project-meta--placeholder {
  opacity: 0.8;
}

.metric-value {
  margin: 0.25rem 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.filters {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filters label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
}

.filters select {
  min-width: 170px;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem;
  font: inherit;
}

.dashboard-subheading {
  margin: 1.5rem 0 0;
  font-size: 1.15rem;
}

.dashboard-note {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.dashboard-note a {
  color: var(--accent);
  text-decoration: none;
}

.dashboard-note a:hover {
  text-decoration: underline;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.project-title {
  margin: 0;
}

.project-links {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.project-links a {
  color: var(--accent);
}

.activity-list {
  display: grid;
  gap: 0.65rem;
}

.guiding-text {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0;
}

.site-footer {
  padding: 1rem 0 2.5rem;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ---- Stewardship KPI panel ---- */

.kpi-panel {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem;
}

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.kpi-info-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0 0.15rem;
  line-height: 1;
  opacity: 0.65;
}

.kpi-info-btn:hover {
  opacity: 1;
}

.kpi-value {
  margin: 0.35rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.kpi-subtext {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .site-header {
    padding-top: 3.5rem;
    background-position: center;
  }

  .hero-copy {
    padding: 1.15rem;
  }
}

.mode-badge {
  display: inline-block;
  margin-left: 0.65rem;
  font-size: 0.75rem;
  vertical-align: middle;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}

.mode-badge--prototype {
  border-color: #22c55e;
  color: #22c55e;
}

.mode-badge--app {
  border-color: #3b82f6;
  color: #3b82f6;
}

.operations-session-status {
  margin: 1rem 0 0;
  color: rgba(248, 250, 252, 0.88);
  font-weight: 600;
}

.app-state-panel {
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem;
  background: var(--surface);
}

.app-state-meta {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.operations-snapshot-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.operations-snapshot-card {
  min-height: 100%;
}

.operations-link-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.operations-link-card {
  display: grid;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.9rem;
}

.operations-link-card span {
  color: var(--muted);
}

.ledger-header-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.ledger-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.ledger-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
}

.public-ledger-shell {
  margin-top: 1rem;
  overflow-x: auto;
}

.public-ledger-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  overflow: hidden;
}

.public-ledger-table th,
.public-ledger-table td {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

.public-ledger-table th {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.public-ledger-table tbody tr:last-child td {
  border-bottom: none;
}

.public-ledger-state-row td {
  text-align: center;
}

.public-ledger-state {
  margin: 0.2rem 0;
  color: var(--muted);
}

.public-ledger-state--error {
  color: #f59e0b;
}

.ledger-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.ledger-status-badge--confirmed {
  border-color: #22c55e;
  color: #22c55e;
}

.ledger-status-badge--pending {
  border-color: #f59e0b;
  color: #f59e0b;
}

.ledger-status-badge--failed {
  border-color: #ef4444;
  color: #ef4444;
}

.ledger-view-more-btn {
  margin-top: 0.75rem;
}

.app-state-warning {
  margin: 0.5rem 0 0;
  color: #f59e0b;
  font-size: 0.88rem;
}

.wallet-control {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
  margin-top: 0;
  z-index: 40;
  width: 3.25rem;
  height: 3.25rem;
  max-width: none;
  pointer-events: auto;
}

.wallet-control-orbiter {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.wallet-fx-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.28);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.wallet-fx-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.wallet-control--connected .wallet-fx-btn {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.24),
    0 0 16px rgba(34, 197, 94, 0.55),
    0 10px 24px rgba(2, 6, 23, 0.3);
}

.wallet-control--error .wallet-fx-btn {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35), 0 10px 24px rgba(2, 6, 23, 0.28);
}

.wallet-fx-btn:disabled {
  opacity: 0.72;
  cursor: progress;
}

.wallet-fx-icon,
.wallet-fx-fallback {
  width: 1.55rem;
  height: 1.55rem;
  object-fit: contain;
}

.wallet-fx-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
}

.wallet-address-orbit {
  position: absolute;
  inset: -1.45rem;
  border-radius: 999px;
  --char-count: 14;
  --orbit-radius: 1.3rem;
  --orbit-size: 0.92rem;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.45);
  pointer-events: none;
  z-index: 0;
  animation: wallet-orbit 14s linear infinite;
}

.wallet-address-orbit::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(34, 197, 94, 0.18);
}

.wallet-address-orbit-char {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--orbit-size);
  height: var(--orbit-size);
  margin: calc(var(--orbit-size) * -0.5);
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  line-height: 1;
  transform:
    rotate(calc((360deg / var(--char-count)) * var(--char-index)))
    translateY(calc(-1 * var(--orbit-radius)))
    rotate(calc((360deg / var(--char-count)) * var(--char-index) * -1));
}

@keyframes wallet-orbit {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .wallet-control {
    top: 0.65rem;
    right: 0.65rem;
    width: 3rem;
    height: 3rem;
  }

  .ledger-header-actions {
    flex-wrap: wrap;
  }

  .wallet-address-orbit {
    inset: -1rem;
    font-size: 0.55rem;
  }
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html,
body {
  min-height: 100%;
}

html {
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.site-background-video,
.site-background-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.site-background-video {
  object-fit: cover;
  opacity: 0.22;
}

.site-background-overlay {
  background:
    radial-gradient(circle at top, rgba(21, 128, 61, 0.14), transparent 40%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.82) 0%, rgba(15, 23, 42, 0.74) 45%, rgba(15, 23, 42, 0.9) 100%);
}

[data-route-variant="unified-root"] .site-background-video {
  object-fit: contain;
  opacity: 0.28;
}

[data-route-variant="unified-root"] .site-background {
  background: #000;
}

[data-route-variant="unified-root"] .site-background-overlay {
  background:
    radial-gradient(circle at top, rgba(21, 128, 61, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.72) 0%, rgba(15, 23, 42, 0.58) 45%, rgba(15, 23, 42, 0.78) 100%);
}

.unified-main {
  position: relative;
}

.fractal-landing {
  padding: 0;
  border-bottom: none;
}

#fractal-experience,
#public-ledger {
  scroll-margin-top: 4.5rem;
}

.fractal-landing .spiral-shell {
  min-height: 100vh;
}

.fractal-intro {
  position: absolute;
  top: clamp(5rem, 11vw, 7rem);
  left: 1rem;
  z-index: 18;
  width: min(38rem, calc(100% - 2rem));
  padding: clamp(1rem, 2.6vw, 1.5rem);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 1rem;
  background: rgba(2, 6, 23, 0.46);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.28);
}

.fractal-intro .eyebrow,
.fractal-intro .intro,
.fractal-intro .operations-session-status {
  color: rgba(248, 250, 252, 0.84);
}

.fractal-intro .tagline {
  color: #bbf7d0;
}

.panel-section {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
}

[data-route-variant="unified-root"] .panel-section,
[data-route-variant="unified-root"] .site-footer {
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(8px);
}

[data-route-variant="unified-root"] .wallet-control {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 40;
  max-width: min(calc(100vw - 1.5rem), 32rem);
}

.panel-section .eyebrow {
  margin-bottom: 0.4rem;
}

.public-ledger-shell,
.app-state-panel,
.metric-card,
.project-card,
.activity-item,
.kpi-card,
.operations-link-card,
.section-grid li,
.filters select,
.ledger-chip,
.wallet-address-pill,
.wallet-warning,
.wallet-connect-btn,
.wallet-disconnect-btn {
  background-color: rgba(31, 41, 55, 0.82);
}

.wallet-control {
  padding: 0.75rem;
  border-radius: 0.9rem;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(10px);
}

.public-ledger-table {
  background: rgba(15, 23, 42, 0.82);
}

@media (prefers-reduced-motion: reduce) {
  .site-background-video {
    display: none;
  }

  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 900px) {
  .fractal-intro {
    top: auto;
    bottom: 5.5rem;
    width: min(32rem, calc(100% - 1.5rem));
  }
}

@media (max-width: 640px) {
  .fractal-intro {
    left: 0.75rem;
    bottom: 4.75rem;
    width: calc(100% - 1.5rem);
  }

  .wallet-control {
    max-width: calc(100vw - 1.3rem);
  }
}
