/* ==========================================================================
   Bitfloww — shared design system
   Owned by the foundation agent. Pages add page-scoped styles in their own
   <style> blocks and must not restyle these components.
   Contents:
     1. Reset + base typography
     2. :root design tokens
     3. Shared components
     4. Site nav / app nav / footer
     5. Section rhythm helpers
     6. Responsive breakpoints (1024 / 768 / 560)
     7. Reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset + base typography
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px; /* clears the sticky nav on anchor jumps */
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 5.2vw, 3.9rem);
  line-height: 1.06;
}

h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
}

h3 {
  font-size: 1.25rem;
  line-height: 1.35;
}

h4 {
  font-size: 1.05rem;
}

.lead {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--body);
}

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

a:hover {
  color: var(--accent-ink);
}

strong {
  color: var(--ink);
  font-weight: 600;
}

small {
  font-size: 13px;
  color: var(--muted);
}

code,
kbd,
samp {
  font-family: var(--mono);
}

img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
}

svg {
  flex-shrink: 0;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

/* Focus ring on every interactive element (>=3:1 non-text contrast on light bgs) */
:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.75);
  outline-offset: 2px;
  border-radius: 2px;
}

.btn:focus-visible,
.tab:focus-visible,
.copy-btn:focus-visible,
.nav-toggle:focus-visible {
  border-radius: var(--r-pill);
}

/* Screen-reader-only utility */
.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;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* color */
  --ink: #0A2540;          /* headings, nav links */
  --body: #4A5B6E;         /* body text */
  --muted: #64748B;        /* captions, meta (4.5:1+ on --bg and --bg-alt) */
  --bg: #FFFFFF;
  --bg-alt: #F6F9FC;       /* alternating sections, app background */
  --surface: #FFFFFF;      /* cards */
  --line: #E6EBF1;         /* borders */
  --accent: #4F46E5;       /* indigo — primary actions, links */
  --accent-ink: #3730CF;   /* hover */
  --accent-soft: #EEF2FF;  /* tinted chips/backgrounds */
  --flow-a: #4F46E5;       /* gradient start (the "flow" gradient) */
  --flow-b: #06B6D4;       /* gradient end */
  --success: #059669; --success-text: #047857; --success-soft: #ECFDF5;
  --pending: #B45309; --pending-soft: #FFFBEB;
  --danger: #DC2626;
  /* type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  /* shape & elevation */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(10,37,64,.06), 0 1px 6px rgba(10,37,64,.04);
  --shadow-md: 0 6px 24px rgba(10,37,64,.08);
  --shadow-lg: 0 24px 64px rgba(10,37,64,.12);
  /* layout */
  --container: 1120px;
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   3. Shared components
   -------------------------------------------------------------------------- */

/* Container ---------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

/* Buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.btn svg {
  transition: transform 0.18s ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: var(--accent-ink);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
  border-color: var(--muted);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--secondary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn--lg {
  padding: 15px 30px;
  font-size: 16.5px;
}

.btn--ghost {
  padding: 8px 4px;
  background: transparent;
  border-color: transparent;
  color: var(--accent);
  box-shadow: none;
}

.btn--ghost:hover {
  color: var(--accent-ink);
  transform: none;
  box-shadow: none;
}

.btn--ghost:hover svg {
  transform: translateX(3px);
}

/* Eyebrow ------------------------------------------------------------------ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

/* Gradient text ------------------------------------------------------------ */

.grad-text {
  background: linear-gradient(90deg, var(--flow-a), var(--flow-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* Card ----------------------------------------------------------------------*/

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card--pad {
  padding: 32px;
}

/* Chips ---------------------------------------------------------------------*/

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.chip--success {
  background: var(--success-soft);
  color: var(--success-text);
}

.chip--pending {
  background: var(--pending-soft);
  color: var(--pending);
}

.chip--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip--neutral {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--body);
}

/* Verified badge ------------------------------------------------------------*/

.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-verified svg {
  width: 13px;
  height: 13px;
}

/* Step card -------------------------------------------------------------- */

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
}

.step-card h3 {
  margin-bottom: 8px;
}

.step-card p {
  font-size: 15px;
}

/* Table -------------------------------------------------------------------- */

.table-scroll {
  /* relative: absolutely-positioned descendants (e.g. .sr-only) must clip
     inside the scroll container instead of widening the page */
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--body);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* When a table sits inside a card, breathe at the edges */
.card .table th:first-child,
.card .table td:first-child {
  padding-left: 24px;
}

.card .table th:last-child,
.card .table td:last-child {
  padding-right: 24px;
}

/* Form fields ---------------------------------------------------------------*/

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.35);
}

.field input[aria-invalid='true'] {
  border-color: var(--danger);
}

.field--row {
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
}

.field--row > * {
  min-width: 0;
}

.field--row input {
  flex: 1 1 auto;
}

.field--row .btn {
  flex-shrink: 0;
}

/* Accordion ------------------------------------------------------------------*/

.accordion {
  border-top: 1px solid var(--line);
}

.accordion-item {
  border-bottom: 1px solid var(--line);
}

.accordion-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 4px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  transition: color 0.18s ease;
}

.accordion-item summary::-webkit-details-marker {
  display: none;
}

.accordion-item summary::marker {
  content: '';
}

.accordion-item summary:hover {
  color: var(--accent);
}

.accordion-item summary svg {
  color: var(--muted);
  transition: transform 0.25s ease;
}

.accordion-item[open] summary svg {
  transform: rotate(45deg);
}

.accordion-item p {
  padding: 0 4px 22px;
  max-width: 65ch;
}

/* Tabs ------------------------------------------------------------------------*/

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}

.tab {
  padding: 9px 22px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.tab:hover {
  color: var(--accent);
}

.tab.is-active {
  background: var(--accent);
  color: #fff;
}

.tab.is-active:hover {
  color: #fff;
}

/* Copy row ---------------------------------------------------------------------*/

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 12px 12px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
}

.copy-row > span,
.copy-row > code,
.copy-row__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 14px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.copy-btn:hover {
  background: rgba(79, 70, 229, 0.16);
  color: var(--accent-ink);
}

.copy-btn.is-copied {
  background: var(--success-soft);
  color: var(--success-text);
}

/* Preview banner ------------------------------------------------------------------*/

.preview-banner {
  width: 100%;
  padding: 9px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
}

/* Coin icons ------------------------------------------------------------------------*/

.coin-ic {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.coin-ic svg {
  width: 100%;
  height: 100%;
  display: block;
}

.coin-ic--sm {
  width: 28px;
  height: 28px;
}

/* Scroll reveal ------------------------------------------------------------------------*/

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   4. Site nav / app nav / footer
   -------------------------------------------------------------------------- */

/* Logo (shared by nav, app bar, footer) */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo__word {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
}

/* Marketing nav — sticky, blurred white */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav__links a:not(.btn) {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.18s ease;
}

.site-nav__links a:not(.btn):hover {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* App-page top bar — white, not sticky */

.app-nav {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.app-nav__inner,
.app-nav > .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.app-nav__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

/* Footer — ink navy */

.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.72);
  padding: 72px 0 40px;
  font-size: 15px;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.site-footer .logo__word {
  color: #fff;
}

.site-footer__brand p {
  margin-top: 16px;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.72);
}

.site-footer h4 {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.site-footer nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.site-footer nav a {
  padding: 6px 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  text-decoration: none;
  transition: color 0.18s ease;
}

.site-footer nav a:hover {
  color: #fff;
}

.site-footer a:focus-visible {
  outline-color: rgba(255, 255, 255, 0.6);
}

.site-footer__legal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 28px;
}

.site-footer__legal p {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  max-width: 78ch;
}

/* --------------------------------------------------------------------------
   5. Section rhythm helpers
   -------------------------------------------------------------------------- */

.section {
  padding: 96px 0;
}

.section--alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 720px;
  margin: 0 auto 56px;
  text-align: center;
}

.section-head .eyebrow {
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 16px;
}

.section-head .lead {
  max-width: 640px;
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   6. Responsive breakpoints
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .site-nav__links {
    gap: 20px;
  }
}

/* Nav collapses behind the hamburger at 920px — below that the full link row
   (with the "Request early access" pill) no longer fits on one line. */
@media (max-width: 920px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 24px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
  }

  .site-nav__links.is-open {
    display: flex;
  }

  .site-nav__links a:not(.btn) {
    padding: 10px 0;
    font-size: 16px;
  }

  .site-nav__links .btn {
    margin-top: 8px;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .section {
    padding: 64px 0;
  }

  .section-head {
    margin-bottom: 40px;
  }

  .card--pad {
    padding: 28px;
  }

  .btn--lg {
    padding: 14px 26px;
    font-size: 16px;
  }

  .site-footer {
    padding: 56px 0 36px;
  }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .container {
    padding-inline: 20px;
  }

  .card--pad {
    padding: 24px;
  }

  .field--row {
    flex-direction: column;
    align-items: stretch;
  }

  .field--row .btn {
    width: 100%;
  }

  .tabs {
    max-width: 100%;
  }

  .tab {
    padding: 9px 16px;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* --------------------------------------------------------------------------
   7. Reduced motion
   -------------------------------------------------------------------------- */

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

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
