/* Reef — design system
   One shared sheet for every page (landing, app, transparency, passport).
   Sans (Switzer) carries the whole UI; mono (Geist Mono) is reserved for
   addresses, hashes and tabular numerals only. One accent, used sparingly.
   Depth comes from 1px hairlines and low-alpha tints — never glow or glass.

   Token names the dashboard already references (--teal/--blue/--gold/--red/
   --success…) are preserved so app.html re-skins by VALUE; the marketing
   component layer is namespaced `.r-*`. */

:root {
  /* ── LIGHT theme is the default (light, bold, high-contrast). Dark is
     opt-in via html[data-theme="dark"]. Pages not yet light-themed pin
     data-theme="dark" so they render exactly as before. ── */
  color-scheme: light;

  /* Surfaces — soft off-white canvas, pure-white cards pop against it */
  --bg: #f4faf7;
  --bg-soft: #e8f4f0;
  --surface: #fffffb;
  --surface-2: #edf7f2;
  --surface-3: #d9ebe5;

  /* Hairlines — dark, low-alpha on light */
  --line: rgba(8, 39, 35, 0.12);
  --line-strong: rgba(8, 39, 35, 0.22);

  /* Text ramp — near-black for bold legibility */
  --text: #071513;
  --muted: #4a5f5b;
  --subtle: #78908a;

  /* Accent: reef aqua for trust, coral for attention */
  --accent: #007f70;
  --accent-deep: #005d52;
  --accent-2: #bf442e;
  --accent-soft: rgba(0, 127, 112, 0.1);
  --accent-line: rgba(0, 127, 112, 0.3);

  /* Semantic — deepened so they stay readable on white */
  --teal: #007f70;
  --blue: #006dff;
  --gold: #a66700;
  --gold-soft: rgba(166, 103, 0, 0.13);
  --gold-line: rgba(166, 103, 0, 0.32);
  --success-soft: rgba(0, 137, 96, 0.11);
  --success-line: rgba(0, 137, 96, 0.34);
  --danger-soft: rgba(191, 68, 46, 0.11);
  --danger-line: rgba(191, 68, 46, 0.34);
  --red: #bf442e;
  --success: #008960;
  --danger: #bf442e;
  --warning: #a66700;

  --shadow: rgba(8, 39, 35, 0.12);

  /* Theme-aware effect tokens (glass, orbs, depth, controls) */
  --on-accent: #ffffff;
  --btn-glow: 0 10px 30px -12px rgba(0, 127, 112, 0.52);
  --card-shadow:
    0 1px 2px rgba(8, 39, 35, 0.06), 0 18px 40px -24px rgba(0, 127, 112, 0.22);
  --glass: linear-gradient(
    180deg,
    rgba(255, 255, 251, 0.84),
    rgba(237, 247, 242, 0.68)
  );
  --glass-inset: rgba(255, 255, 251, 0.72);
  --glass-ring: rgba(0, 127, 112, 0.12);
  --glass-glow: 0 22px 56px -30px rgba(0, 127, 112, 0.36);
  --nav-glass: rgba(255, 255, 251, 0.74);
  --nav-glass-2: rgba(255, 255, 251, 0.92);
  --grid-line: rgba(8, 39, 35, 0.05);
  --orb-1: rgba(0, 190, 160, 0.18);
  --orb-2: rgba(255, 122, 89, 0.13);
  --orb-3: rgba(166, 103, 0, 0.11);
  --skel-1: #dfeee8;
  --skel-2: #f6fbf8;
  --code-bg: #eef7f2;
  --cmd-bg: linear-gradient(
    180deg,
    rgba(255, 255, 251, 0.96),
    rgba(241, 249, 245, 0.97)
  );
  --cmd-scrim: rgba(8, 39, 35, 0.32);
  --row-hover: rgba(0, 127, 112, 0.045);

  /* One radius scale */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* 4px spacing scale */
  --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;

  --maxw: 1160px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --sans: "Switzer", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "IBM Plex Mono", monospace;
}

/* ── DARK theme — the original palette, verbatim, so any page that pins
   data-theme="dark" renders identically to before. Only colours change;
   radius/spacing/fonts stay inherited from :root. ── */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #061211;
  --bg-soft: #081a18;
  --surface: #0d211f;
  --surface-2: #122d29;
  --surface-3: #173a35;

  --line: rgba(180, 255, 236, 0.1);
  --line-strong: rgba(180, 255, 236, 0.2);

  --text: #f4fffb;
  --muted: #a7c2bb;
  --subtle: #6f9088;

  --accent: #27e6bf;
  --accent-deep: #00b694;
  --accent-2: #ff7a59;
  --accent-soft: rgba(39, 230, 191, 0.1);
  --accent-line: rgba(39, 230, 191, 0.34);

  --teal: #27e6bf;
  --blue: #7ca8ff;
  --gold: #f2b84b;
  --gold-soft: rgba(242, 184, 75, 0.13);
  --gold-line: rgba(242, 184, 75, 0.34);
  --success-soft: rgba(39, 230, 191, 0.11);
  --success-line: rgba(39, 230, 191, 0.36);
  --danger-soft: rgba(255, 122, 89, 0.11);
  --danger-line: rgba(255, 122, 89, 0.38);
  --red: #ff7a59;
  --success: #27e6bf;
  --danger: #ff7a59;
  --warning: #f2b84b;

  --shadow: rgba(0, 0, 0, 0.5);

  --on-accent: #04110e;
  --btn-glow: 0 10px 30px -12px rgba(39, 230, 191, 0.72);
  --card-shadow: none;
  --glass: linear-gradient(
    180deg,
    rgba(18, 45, 41, 0.66),
    rgba(8, 26, 24, 0.48)
  );
  --glass-inset: rgba(255, 255, 255, 0.045);
  --glass-ring: rgba(39, 230, 191, 0.1);
  --glass-glow: 0 18px 50px -28px rgba(39, 230, 191, 0.45);
  --nav-glass: rgba(6, 18, 17, 0.66);
  --nav-glass-2: rgba(6, 18, 17, 0.86);
  --grid-line: rgba(180, 255, 236, 0.024);
  --orb-1: rgba(39, 230, 191, 0.22);
  --orb-2: rgba(255, 122, 89, 0.16);
  --orb-3: rgba(242, 184, 75, 0.08);
  --skel-1: #122d29;
  --skel-2: #173a35;
  --code-bg: #081a18;
  --cmd-bg: linear-gradient(
    180deg,
    rgba(18, 45, 41, 0.92),
    rgba(8, 26, 24, 0.94)
  );
  --cmd-scrim: rgba(2, 8, 7, 0.64);
  --row-hover: rgba(39, 230, 191, 0.032);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition:
    background-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--surface-3);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 140ms var(--ease);
}
a:hover {
  color: var(--accent-2);
}

:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 3.5px var(--accent);
  border-radius: var(--radius-sm);
}

/* ── Typography ── */
.r-tnum {
  font-variant-numeric: tabular-nums;
}
.r-mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.r-muted {
  color: var(--muted);
}

/* Eyebrow — sans, sparing. Not mono, not glowing. */
.r-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.r-h1 {
  font-size: clamp(2.4rem, 5.2vw, 3.9rem);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.028em;
  margin: 0;
  overflow-wrap: break-word;
}
.r-h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 0;
  overflow-wrap: break-word;
}
.r-h3 {
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0;
}
.r-lead {
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  line-height: 1.6;
  color: var(--muted);
  max-width: 58ch;
  margin: 0;
}

/* ── Layout ── */
.r-container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.r-section {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--line);
}
.r-section--plain {
  border-top: 0;
}
.r-section-head {
  max-width: 60ch;
  margin-bottom: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.r-benchblock + .r-benchblock {
  margin-top: var(--space-8);
}
.r-benchblock > .r-h3 {
  margin-bottom: var(--space-2);
}
.r-benchblock > .r-lead {
  margin-bottom: var(--space-4);
  max-width: 60ch;
}

/* ── Top nav ── */
.r-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    background 200ms var(--ease),
    border-color 200ms var(--ease);
}
.r-nav.is-scrolled {
  background: rgba(10, 10, 11, 0.9);
  border-bottom-color: var(--line);
}
.r-nav-inner {
  height: 60px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.r-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.r-brand:hover {
  color: var(--text);
}
.r-brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
}
.r-brand-mark img,
.r-brand-mark svg {
  display: block;
  width: 26px;
  height: 26px;
}

/* "Built on Mantle" lockup — real Mantle logomark + wordmark, used in footer/hero */
.r-mantle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.r-mantle:hover {
  color: var(--text);
}
.r-mantle img {
  display: block;
  height: 17px;
  width: auto;
  opacity: 0.92;
}
.r-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-left: auto;
}
.r-nav-links a:not(.r-btn) {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.r-nav-links a:not(.r-btn):hover,
.r-nav-links a[aria-current="page"]:not(.r-btn) {
  color: var(--text);
}
/* Mobile menu toggle (hamburger) — hidden on desktop */
.r-nav-toggle {
  display: none;
  margin-left: auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

/* ── Shared theme toggle (sun/moon) — used in every page nav ── */
.r-theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 160ms var(--ease),
    color 160ms var(--ease),
    transform 220ms var(--ease);
}
.r-theme-toggle:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}
.r-theme-toggle:active {
  transform: scale(0.92);
}
.r-theme-toggle .ic-sun {
  display: none;
}
.r-theme-toggle .ic-moon {
  display: block;
}
html[data-theme="dark"] .r-theme-toggle .ic-sun {
  display: block;
}
html[data-theme="dark"] .r-theme-toggle .ic-moon {
  display: none;
}

/* ── Buttons ── */
.r-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 140ms var(--ease),
    border-color 140ms var(--ease),
    color 140ms var(--ease);
}
.r-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.r-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.r-btn--primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--on-accent);
}
.r-btn--sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

/* ── Panels / cards ── */
.r-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: border-color 160ms var(--ease);
}
.r-panel--hover:hover {
  border-color: var(--line-strong);
}
.r-grid {
  display: grid;
  gap: var(--space-4);
}
.r-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}
.r-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}
.r-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ── Stat tiles ── */
.r-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.r-stat-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.5rem, 2.4vw, 1.95rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--text);
}
.r-stat-label {
  font-size: 13px;
  color: var(--muted);
}

/* ── Status pill — status only, never layout ── */
.r-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.r-pill--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-2);
}
.r-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ── Logo / counterparty strip ── */
.r-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
}
.r-logo {
  font-size: 14px;
  font-weight: 500;
  color: var(--subtle);
}

/* ── Data table ── */
.r-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.r-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--subtle);
  padding: 0 var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.r-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
.r-table tr:last-child td {
  border-bottom: 0;
}
.r-table .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Footer ── */
.r-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: var(--space-8) 0 var(--space-6);
}
.r-footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: var(--space-6);
}
.r-footer-col h4 {
  margin: 0 0 var(--space-3);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.r-footer-col a {
  display: block;
  color: var(--muted);
  font-size: 14px;
  padding: 5px 0;
}
.r-footer-col a:hover {
  color: var(--text);
}
.r-footer-bottom {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  color: var(--subtle);
  font-size: 13px;
}

/* ── Motion — fades only, honored under reduced-motion ── */
@media (prefers-reduced-motion: no-preference) {
  .r-reveal {
    opacity: 0;
    transform: translateY(8px);
    animation: r-rise 560ms var(--ease) forwards;
  }
  @keyframes r-rise {
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .r-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .r-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .r-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .r-section {
    padding: var(--space-8) 0;
  }
}
@media (max-width: 600px) {
  .r-nav-toggle {
    display: inline-grid;
  }
  .r-nav-links {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0 var(--space-5);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      max-height 240ms var(--ease),
      opacity 180ms var(--ease),
      padding 240ms var(--ease);
  }
  .r-nav.menu-open .r-nav-links {
    max-height: 70vh;
    opacity: 1;
    pointer-events: auto;
    padding: var(--space-2) var(--space-5) var(--space-5);
  }
  .r-nav-links a:not(.r-btn) {
    display: block;
    padding: 14px 2px;
    font-size: 15px;
    border-bottom: 1px solid var(--line);
  }
  .r-nav-links .r-btn {
    margin-top: var(--space-4);
    width: 100%;
  }
  .r-grid--2,
  .r-grid--3,
  .r-grid--4 {
    grid-template-columns: 1fr;
  }
  .r-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
  }
}
@media (max-width: 480px) {
  .r-container,
  .r-nav-inner {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
  .r-footer-grid {
    grid-template-columns: 1fr;
  }
}
