/* ---------------------------------------------------------------------
   Design tokens
   All color pairs below are verified against WCAG AA (4.5:1 for text,
   3:1 for large text/UI) — see the contrast check run before writing this.
--------------------------------------------------------------------- */
:root {
  --bg: #0b0b12;
  --surface: #14141f;
  --surface-2: #191926;
  --border: #2c2c3d;
  --text: #f2f2f6;
  --text-muted: #a0a0b2;
  --accent: #7c6cf6;       /* text/icons/links on dark bg — 4.98:1 */
  --accent-btn: #5b3df0;   /* button fill, white text — 6.23:1 */
  --accent-btn-hover: #6c4ef5;
  --accent-strong: #4c37c9; /* worker band section bg, white text — 6.97:1 */
  --success: #34d399;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --space-8: 6.5rem;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --container-max: 1180px;

  color-scheme: dark;
}

/* ---------------------------------------------------------------------
   Reset
--------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Defense-in-depth only, not the fix — the real horizontal-overflow bug
     (grid items refusing to shrink below content min-width) is fixed at
     its source further down. This just guards against the next one. */
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
code { font-family: var(--font-mono); }

.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-3);
  background: var(--accent-btn);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: var(--space-3);
}

/* Visible, high-contrast focus ring on every interactive element —
   :focus-visible so mouse clicks don't show a ring, only keyboard/AT use. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
pre:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@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;
  }
}

/* ---------------------------------------------------------------------
   Layout helpers
--------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: var(--space-7);
}
.section-alt {
  background: var(--surface);
}

.section-heading {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}
.section-sub {
  color: var(--text-muted);
  max-width: 46rem;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  margin-bottom: var(--space-6);
}

/* Scroll-reveal: JS adds .is-visible; CSS handles the transition.
   Starts fully visible (opacity 1) so content is never hidden if JS
   fails to load — progressive enhancement, not a requirement to see it. */
.reveal {
  opacity: 1;
  transform: none;
}
.js-reveal-ready .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js-reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-btn);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px rgba(124, 108, 246, 0.6);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-on-dark.btn-secondary {
  border-color: rgba(255, 255, 255, 0.35);
}
.btn-on-dark.btn-secondary:hover,
.btn-on-dark.btn-secondary:focus-visible {
  border-color: #fff;
}

/* ---------------------------------------------------------------------
   Header
--------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 18, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
  flex-shrink: 0;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-bar::before { transform: translateY(-6px); }
.nav-toggle-bar::after { transform: translateY(4px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(0) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-2px) rotate(-45deg); }

.primary-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.primary-nav.is-open {
  max-height: 24rem;
}
.primary-nav ul {
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--space-4) var(--space-4);
  gap: var(--space-1);
}
.primary-nav a {
  display: block;
  padding: var(--space-2) 0;
  color: var(--text-muted);
  font-weight: 500;
}
.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--text);
}
.nav-cta {
  margin-top: var(--space-2);
  color: var(--accent) !important;
  font-weight: 600 !important;
}

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .primary-nav {
    position: static;
    max-height: none;
    background: none;
    border: none;
    overflow: visible;
  }
  .primary-nav ul {
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: var(--space-5);
  }
  .primary-nav a { padding: 0; }
  .nav-cta {
    margin-top: 0;
    padding: 0.6rem 1.1rem !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease;
  }
  .nav-cta:hover, .nav-cta:focus-visible { border-color: var(--accent); }
}

/* ---------------------------------------------------------------------
   Hero
--------------------------------------------------------------------- */
.hero {
  padding-block: var(--space-7) var(--space-8);
}
.hero-grid {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}
@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: 1.1fr 1fr;
    gap: var(--space-7);
  }
}
/* Grid/flex items default to min-width:auto, which means they refuse to
   shrink below their content's intrinsic width — a wide unbreakable code
   line inside .terminal was overflowing the viewport horizontally on
   narrow screens even though .terminal-body itself has overflow-x:auto.
   min-width:0 lets the item actually shrink to the track/container width
   so the *inner* scroll container is what handles the overflow. */
.hero-demo,
.dev-grid > .terminal {
  min-width: 0;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
}
.hero h1 {
  font-size: clamp(2.4rem, 1.9rem + 2.8vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-bottom: var(--space-4);
}
.hero-sub {
  color: var(--text-muted);
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  max-width: 34rem;
  margin-bottom: var(--space-5);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.hero-actions.center { justify-content: center; }

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}
.hero-trust li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hero-trust strong {
  font-size: 1.1rem;
  font-weight: 700;
}
.hero-trust span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   Terminal / code snippet
--------------------------------------------------------------------- */
.terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.terminal-title {
  margin-left: var(--space-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  /* Truncate instead of wrapping to a second line — at narrow widths
     (~320px) the dots + title + copy button don't all fit on one line
     otherwise, and a wrapped title crowds the copy button. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}
.copy-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover,
.copy-btn:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}
.copy-btn-done {
  color: var(--success) !important;
  border-color: var(--success) !important;
}
.terminal-body {
  padding: var(--space-4);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
}
.terminal-body code { white-space: pre; }
.tok-muted { color: var(--text-muted); }
.tok-string { color: var(--success); }
.tok-key { color: var(--accent); }
.tok-status { color: #ffbd2e; }
.tok-brace { color: var(--text-muted); }

/* ---------------------------------------------------------------------
   Try it now (sandbox widget)
--------------------------------------------------------------------- */
.try-it-inner {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 860px) {
  .try-it-inner {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: var(--space-7);
  }
}
.try-it-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}
.try-it-card input[type="text"] {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  width: 100%;
}
.try-it-result {
  min-height: 88px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  padding: var(--space-3);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.try-it-placeholder,
.try-it-status {
  color: var(--text-muted);
}
.try-it-status {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-bottom: var(--space-1);
}
.try-it-answer {
  font-weight: 600;
  font-size: 1rem;
}
.try-it-result.is-loading { border-style: solid; border-color: var(--accent); }
.try-it-result.is-resolved {
  border-style: solid;
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.08);
}
.try-it-result.is-refunded {
  border-style: solid;
  border-color: #ffbd2e;
  background: rgba(255, 189, 46, 0.08);
}
.try-it-result.is-error {
  border-style: solid;
  border-color: #ff5f56;
  background: rgba(255, 95, 86, 0.08);
}

/* ---------------------------------------------------------------------
   How it works
--------------------------------------------------------------------- */
.steps {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 640px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .steps { grid-template-columns: repeat(4, 1fr); }
}
.step {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.step-index {
  display: inline-block;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: var(--space-2);
}
.step h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-1);
}
.step p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------
   Feature grid
--------------------------------------------------------------------- */
.feature-grid {
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}
.feature-card {
  padding: var(--space-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.feature-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  margin-bottom: var(--space-3);
}
.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-2);
}
.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------
   Developers section
--------------------------------------------------------------------- */
.dev-grid {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}
@media (min-width: 960px) {
  .dev-grid { grid-template-columns: 1fr 1fr; }
}
.dev-list {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.dev-list li {
  position: relative;
  padding-left: var(--space-4);
  color: var(--text-muted);
}
.dev-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ---------------------------------------------------------------------
   Pricing
--------------------------------------------------------------------- */
.pricing-grid {
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 860px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1140px) {
  .pricing-grid { grid-template-columns: repeat(4, 1fr); }
}
.price-card {
  position: relative;
  padding: var(--space-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.price-card-featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(124, 108, 246, 0.12), var(--surface-2) 40%);
}
.price-badge {
  display: inline-block;
  background: var(--accent-btn);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  margin-bottom: var(--space-3);
}
.price-card h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-2);
}
.price {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-4);
}
.price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}
.price-card ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.price-card li {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-left: var(--space-4);
  position: relative;
}
.price-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.pricing-note {
  margin-top: var(--space-5);
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 40rem;
}

/* ---------------------------------------------------------------------
   Worker band
--------------------------------------------------------------------- */
.worker-band {
  background: var(--accent-strong);
  color: #fff;
}
.worker-band-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-block: var(--space-6);
}
.worker-band h2 {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem);
  margin-bottom: var(--space-1);
}
.worker-band p {
  color: #d8d3fb;
}
@media (min-width: 640px) {
  .worker-band-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ---------------------------------------------------------------------
   Trust strip
--------------------------------------------------------------------- */
.trust-strip { padding-block: var(--space-6); }
.trust-grid {
  display: grid;
  gap: var(--space-5);
  text-align: center;
}
@media (min-width: 640px) {
  .trust-grid { grid-template-columns: repeat(4, 1fr); }
}
.trust-grid strong {
  display: block;
  font-size: clamp(1.6rem, 1.4rem + 0.8vw, 2rem);
  font-weight: 800;
  color: var(--accent);
}
.trust-grid span {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.trust-live {
  display: none;
  text-align: center;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.trust-live.is-visible {
  display: block;
}

/* ---------------------------------------------------------------------
   FAQ
--------------------------------------------------------------------- */
.faq-container { max-width: 46rem; }
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-1);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  color: var(--text-muted);
  margin-top: var(--space-2);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------
   Final CTA
--------------------------------------------------------------------- */
.final-cta {
  padding-block: var(--space-8);
  text-align: center;
}
.final-cta h2 {
  font-size: clamp(1.6rem, 1.3rem + 1.5vw, 2.4rem);
  margin-bottom: var(--space-5);
  max-width: 32rem;
  margin-inline: auto;
}

/* ---------------------------------------------------------------------
   Footer
--------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-5);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}
.footer-inner nav ul {
  display: flex;
  gap: var(--space-4);
}
.footer-inner nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-inner nav a:hover,
.footer-inner nav a:focus-visible {
  color: var(--text);
}
.footer-note {
  color: var(--text-muted);
  font-size: 0.8rem;
}
@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ---------------------------------------------------------------------
   Very large screens: keep content from feeling lost in whitespace
--------------------------------------------------------------------- */
@media (min-width: 1600px) {
  :root { --container-max: 1320px; }
  .hero h1 { font-size: 4.4rem; }
}

/* Very small screens: tighten spacing scale a touch so nothing feels
   over-padded on a 320px-wide device. */
@media (max-width: 380px) {
  :root {
    --space-6: 2.25rem;
    --space-7: 3rem;
    --space-8: 4rem;
  }
  .btn { width: 100%; }
  .hero-actions { flex-direction: column; }
}
