/* ═══════════════════════════════════════════════
   FLOW INDEX — premium liquidity terminal
   ═══════════════════════════════════════════════ */

:root {
  --bg: #04080b;
  --bg-2: #071017;
  --panel: rgba(10, 22, 30, 0.55);
  --panel-solid: #0a161e;
  --line: rgba(86, 214, 202, 0.14);
  --line-soft: rgba(86, 214, 202, 0.07);
  --text: #d7e6e6;
  --text-dim: #7d9599;
  --teal: #38e0c8;
  --cyan: #5ac8e8;
  --turquoise: #2fb8a8;
  --danger: #e86a6a;
  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 10px;
  --header-h: 64px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

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

::selection { background: rgba(56, 224, 200, 0.25); }

/* ── static terminal background ────────────── */
.site-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(68% 52% at 18% 8%, rgba(47, 184, 168, 0.10), transparent 62%),
    radial-gradient(58% 50% at 86% 92%, rgba(90, 200, 232, 0.08), transparent 60%),
    radial-gradient(140% 120% at 50% -10%, #08161d 0%, #050c11 48%, #03070a 100%);
}
/* faint financial-terminal grid, faded toward the edges */
.site-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(86, 214, 202, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 214, 202, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(circle at 50% 26%, black 5%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 26%, black 5%, transparent 78%);
}
/* vignette to settle the edges */
.site-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(125% 95% at 50% 38%, transparent 52%, rgba(2, 5, 7, 0.8) 100%);
}

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

/* ── header ────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(4, 8, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  width: min(1280px, 94vw); margin: 0 auto;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: 0.14em; font-size: 0.95rem;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-mark { color: var(--teal); display: grid; place-items: center; }

.site-nav { display: flex; gap: 26px; }
.site-nav a {
  color: var(--text-dim); text-decoration: none;
  font-size: 0.86rem; letter-spacing: 0.05em;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--teal); }

.header-actions { display: flex; align-items: center; gap: 12px; }

/* ── buttons ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-ui); font-size: 0.86rem; font-weight: 500;
  letter-spacing: 0.04em;
  padding: 10px 20px; border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s, opacity 0.2s;
}

.btn-primary {
  background: rgba(56, 224, 200, 0.12);
  border-color: rgba(56, 224, 200, 0.4);
  color: var(--teal);
}
.btn-primary:hover:not(:disabled) { background: rgba(56, 224, 200, 0.2); border-color: var(--teal); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(86, 214, 202, 0.35); }

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-connect {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  padding: 8px 16px; font-size: 0.82rem;
}
.btn-connect:hover { border-color: var(--teal); }
.btn-connect .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s, box-shadow 0.3s;
}
.btn-connect.connected .dot {
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}
.btn-connect.connected { border-color: rgba(56, 224, 200, 0.4); color: var(--teal); }

/* mobile nav toggle */
.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); transition: transform 0.25s, opacity 0.25s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ── hero ──────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center;
  padding: calc(var(--header-h) + 60px) 0 80px;
  overflow: hidden;
}

.hero-inner {
  width: min(1160px, 92vw);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center; gap: 40px;
}

.eyebrow {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-dim);
  font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 22px;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 224, 200, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(56, 224, 200, 0); }
}

.hero-title {
  font-size: clamp(3.6rem, 13vw, 8.5rem);
  font-weight: 600; line-height: 0.94;
  letter-spacing: 0.06em;
  background: linear-gradient(115deg, #e8f6f4 30%, var(--teal) 75%, var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.tagline {
  margin-top: 20px;
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  color: var(--text);
  letter-spacing: 0.02em;
}

.lede {
  margin-top: 12px; max-width: 46ch;
  color: var(--text-dim); font-size: 0.98rem;
}

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.hero-figure {
  position: relative;
  display: grid; place-items: center;
  min-width: 0;
}
.hero-figure img {
  width: min(100%, 420px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
  filter: saturate(1.05);
  animation: floaty 7s ease-in-out infinite;
  -webkit-mask-image: radial-gradient(circle, black 55%, transparent 72%);
  mask-image: radial-gradient(circle, black 55%, transparent 72%);
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ── live strip ────────────────────────────── */
.live-strip {
  margin-top: 64px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.live-cell {
  padding: 18px 22px;
  display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--line-soft);
}
.live-cell:last-child { border-right: none; }

.live-label {
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim);
}
.live-value { font-size: 1.15rem; font-weight: 500; }
.live-value.accent { color: var(--teal); }

/* ── sections ──────────────────────────────── */
.section { padding: 88px 0; border-top: 1px solid var(--line-soft); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 36px;
}
.section-head h2 {
  font-size: 1.5rem; font-weight: 600; letter-spacing: 0.04em;
}
.section-head .index {
  color: var(--teal); font-family: var(--font-mono);
  font-size: 0.85rem; margin-right: 10px; font-weight: 400;
}
.section-sub { color: var(--text-dim); font-size: 0.92rem; }

/* ── live flow chart ───────────────────────── */
.pressure-tag {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pressure-badge {
  font-size: 0.78rem; letter-spacing: 0.08em;
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--cyan);
}
.pressure-badge.high { color: var(--danger); border-color: rgba(232, 106, 106, 0.35); }
.pressure-badge.low { color: var(--teal); border-color: rgba(56, 224, 200, 0.35); }

.chart-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 22px;
}
#flow-chart { width: 100%; height: 300px; display: block; }

.chart-legend {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 16px;
  font-size: 0.78rem; color: var(--text-dim); letter-spacing: 0.04em;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.key { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.key-buy { background: var(--teal); }
.key-sell { background: var(--danger); opacity: 0.8; }
.key-pressure { background: var(--cyan); }
.key-fee { background: #d7e6e6; }

/* ── mechanism steps ───────────────────────── */
.steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px 24px;
  transition: border-color 0.25s, transform 0.25s;
}
.step:hover { border-color: rgba(56, 224, 200, 0.35); transform: translateY(-3px); }
.step-num {
  color: var(--teal); font-size: 0.85rem;
  display: inline-block; margin-bottom: 14px;
  border: 1px solid rgba(56, 224, 200, 0.3);
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
}
.step h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; letter-spacing: 0.02em; }
.step p { color: var(--text-dim); font-size: 0.9rem; }
.step strong { color: var(--teal); font-weight: 500; }

.fee-scale { margin-top: 44px; }
.fee-scale-track {
  position: relative; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(56,224,200,0.18), rgba(90,200,232,0.2), rgba(232,106,106,0.25));
}
.fee-scale-fill {
  position: absolute; inset: 0 auto 0 0; width: 33%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--turquoise), var(--cyan));
  transition: width 0.8s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.fee-scale-marker {
  position: absolute; top: 50%; left: 33%;
  transform: translate(-50%, -50%);
  transition: left 0.8s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.fee-scale-marker::before {
  content: ""; display: block;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--teal);
  box-shadow: 0 0 12px rgba(56, 224, 200, 0.5);
}
.fee-scale-marker span {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  font-size: 0.78rem; color: var(--teal); white-space: nowrap;
}
.fee-scale-ends {
  display: flex; justify-content: space-between;
  margin-top: 12px; font-size: 0.72rem; color: var(--text-dim);
  letter-spacing: 0.08em;
}

/* ── epochs ────────────────────────────────── */
.epoch-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-wide { grid-column: 1 / -1; align-items: flex-start; }
.epoch-count { font-size: 2rem; color: var(--teal); letter-spacing: 0.06em; }
.epoch-bar {
  width: 100%; height: 4px; border-radius: 999px;
  background: rgba(86, 214, 202, 0.1); overflow: hidden;
}
.epoch-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--turquoise), var(--teal));
  transition: width 1s linear;
}

/* ── wallet ────────────────────────────────── */
.wallet-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.wallet-lock {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(4, 8, 11, 0.55);
  backdrop-filter: blur(6px);
  color: var(--text-dim);
  transition: opacity 0.4s;
}
.wallet-card[data-locked="false"] .wallet-lock {
  opacity: 0; pointer-events: none;
}

.wallet-body { padding: 28px; }
.wallet-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.wallet-actions {
  margin-top: 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.wallet-id {
  font-size: 0.82rem; color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px;
}
.btn-claim { min-width: 180px; }
.claim-note { margin-top: 14px; font-size: 0.82rem; color: var(--teal); min-height: 1.2em; }

/* ── contract ──────────────────────────────── */
.contract-grid {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px;
}
.contract-facts, .contract-addresses {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 26px;
}
.contract-facts dl { display: grid; gap: 0; }
.contract-facts dl > div {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.contract-facts dl > div:last-child { border-bottom: none; }
.contract-facts dt { color: var(--text-dim); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; }
.contract-facts dd { font-weight: 500; font-size: 0.95rem; }

.addr-row { margin-bottom: 18px; }
.addr {
  margin-top: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 10px 14px;
  font-size: 0.78rem; color: var(--cyan);
  overflow-wrap: anywhere;
}
.copy-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1rem; line-height: 1;
  transition: color 0.2s; flex-shrink: 0;
}
.copy-btn:hover { color: var(--teal); }

.contract-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* contract placeholder */
.contract-placeholder {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 40px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
}
.contract-placeholder p { color: var(--text-dim); font-size: 0.95rem; }
.ph-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--teal);
  animation: pulse 2.4s ease-in-out infinite;
}

/* The [hidden] attribute must win over the display rules below, otherwise a hidden panel keeps
   rendering — display:flex/grid silently overrides hidden's default display:none. */
[hidden] { display: none !important; }

/* ── live contract panel (shown once FLOW_ADDRESS is set) ── */
.contract-live { display: grid; gap: 18px; }
.contract-live .addr-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; margin-bottom: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 10px 14px;
}
.contract-live .addr {
  margin-top: 0; border: none; padding: 0;
  font-size: 0.8rem; flex: 1 1 auto;
}
.contract-live .copy-btn {
  font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
}
.contract-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px;
}

/* ── buy button ──
   Disabled until the pool exists. It is an <a> without href in that state, so it is already
   inert to clicks and keyboard — these rules just make that legible. */
.btn-buy {
  border: 1px solid rgba(56, 224, 200, 0.4);
  background: rgba(56, 224, 200, 0.12);
  color: var(--teal);
}
.btn-buy:hover:not(.is-disabled) {
  background: rgba(56, 224, 200, 0.22);
  border-color: var(--teal);
}
.btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
}

/* ── chain status pill ── */
.chain-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 6px 14px;
  margin-bottom: 22px;
}
.chain-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); flex-shrink: 0;
}
.chain-status[data-state="live"] { color: var(--teal); border-color: rgba(56, 224, 200, 0.3); }
.chain-status[data-state="live"]::before {
  background: var(--teal); box-shadow: 0 0 8px var(--teal);
  animation: pulse 2.4s ease-in-out infinite;
}
.chain-status[data-state="error"] { color: var(--danger); border-color: rgba(232, 106, 106, 0.3); }
.chain-status[data-state="error"]::before { background: var(--danger); }
.ph-addr {
  font-size: 0.8rem; color: var(--cyan);
  border: 1px solid var(--line-soft);
  padding: 8px 16px; border-radius: 999px;
  overflow-wrap: anywhere;
}

/* ── footer ────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 30px 0 40px;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
  font-size: 0.8rem; color: var(--text-dim); letter-spacing: 0.1em;
}
.brand-foot { font-weight: 600; letter-spacing: 0.14em; color: var(--text); }
.footer-inner a { color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.footer-inner a:hover { color: var(--teal); }

/* ── toast ─────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translate(-50%, 20px);
  background: var(--panel-solid);
  border: 1px solid rgba(56, 224, 200, 0.4);
  color: var(--teal);
  font-size: 0.82rem;
  padding: 12px 22px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── reveal on scroll ──────────────────────── */
/* Scroll-reveal. Content is visible by default and only hidden once JS has confirmed it can
   un-hide it (html.js-reveal is set by app.js), so a script failure or an environment where the
   IntersectionObserver never fires leaves the page readable instead of blank. */
.reveal { transition: opacity 0.7s ease, transform 0.7s ease; }
.js-reveal .reveal { opacity: 0; transform: translateY(24px); }
.js-reveal .reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal { opacity: 1; transform: none; transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ── responsive ────────────────────────────── */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { order: -1; }
  .hero-figure img { width: min(60vw, 300px); }
  .live-strip { grid-template-columns: repeat(2, 1fr); }
  .live-cell:nth-child(2n) { border-right: none; }
  .live-cell { border-bottom: 1px solid var(--line-soft); }
  .steps { grid-template-columns: 1fr; }
  .epoch-grid { grid-template-columns: repeat(2, 1fr); }
  .wallet-stats { grid-template-columns: repeat(2, 1fr); }
  .contract-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: rgba(4, 8, 11, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
  }
  .site-nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .site-nav a { padding: 12px 6vw; font-size: 0.95rem; }
  .nav-toggle { display: flex; }
  .section { padding: 64px 0; }
  .epoch-grid, .wallet-stats { grid-template-columns: 1fr; }
  .live-strip { grid-template-columns: 1fr; }
  .live-cell { border-right: none; }
}
