@import "tailwindcss";

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1e1e1e;
  --accent: #ff8c00;
  --accent-hover: #e07d00;
  --text-primary: #e0e0e0;
  --text-secondary: #888888;
  --border: #2a2a2a;
  --status-idle: #4a9eff;
  --status-running: #00c853;
  --status-error: #ff3d00;
  --status-waiting: #ffab00;
}

@theme inline {
  --color-bg-primary: var(--bg-primary);
  --color-bg-secondary: var(--bg-secondary);
  --color-bg-tertiary: var(--bg-tertiary);
  --color-accent: var(--accent);
  --color-accent-hover: var(--accent-hover);
  --color-text-primary: var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-border: var(--border);
  --color-status-idle: var(--status-idle);
  --color-status-running: var(--status-running);
  --color-status-error: var(--status-error);
  --color-status-waiting: var(--status-waiting);
  /* Three-role type system. `font-display` → headings, `font-sans` → body,
     `font-mono` → the terminal signature (labels, code, data, nav). */
  --font-display: var(--font-display), var(--font-geist), ui-sans-serif, system-ui, sans-serif;
  --font-sans: var(--font-geist), ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: var(--font-jetbrains), "SF Mono", "Menlo", monospace;
}

* {
  border-radius: 0 !important;
}

/* Deliberate exception to the sharp-corner rule (macOS traffic lights, etc.). */
.round-full {
  border-radius: 9999px !important;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}

/* Display headings get tighter tracking + leading; body stays airy. */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

::selection {
  background: var(--accent);
  color: #000;
}

/* ------------------------------------------------------------------ */
/*  Focus — one crisp, consistent keyboard ring everywhere.            */
/*  (Was missing entirely; WCAG 2.4.7. Sharp to match the system.)     */
/* ------------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Don't show the ring for mouse/touch activation. */
:focus:not(:focus-visible) {
  outline: none;
}

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

body {
  overflow-x: hidden;
}

/* ------------------------------------------------------------------ */
/*  Branded scrollbar (global) — dark, thin, accent on hover.          */
/*  Applies to every scroll region on the site so all panes feel       */
/*  native to the dark/mono aesthetic.                                 */
/* ------------------------------------------------------------------ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
*:hover {
  scrollbar-color: var(--accent) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Treasury terminal page — fully viewport-locked, never scrolls the page. */
html.page-locked,
html.page-locked body {
  overflow: hidden !important;
  height: 100dvh;
  overscroll-behavior: none;
}

.dot-grid {
  background-image: radial-gradient(circle, #1a1a1a 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ------------------------------------------------------------------ */
/*  Docs — viewport-locked shell with independent scroll panes.        */
/*  (Stripe / Mintlify / Next.js API-reference layout: the page never  */
/*  scrolls as a whole — the nav + sidebar stay pinned and only the    */
/*  content pane scrolls.) Authored as plain CSS so the structural     */
/*  height / flex-direction rules are deterministic.                   */
/* ------------------------------------------------------------------ */
.docs-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.docs-body {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  max-width: 72rem; /* = max-w-6xl */
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  padding: 6rem 1rem 0; /* clears the floating nav */
}
@media (min-width: 640px) {
  .docs-body { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
  .docs-body { flex-direction: row; gap: 2.5rem; padding-top: 7rem; }
}
.docs-pane {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Left nav rail — independent scroll, pinned full height (desktop). */
.docs-sidebar {
  flex-shrink: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (min-width: 1024px) {
  .docs-sidebar { width: 14rem; height: 100%; }
}
/* Right "On this page" rail. Shows once there's room for both rails. */
.docs-toc { display: none; }
@media (min-width: 1152px) {
  .docs-toc { display: block; width: 12rem; flex-shrink: 0; }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor-blink {
  animation: blink 1s step-end infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 171, 0, 0); }
  50% { box-shadow: 0 0 12px 2px rgba(255, 171, 0, 0.3); }
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/*  Redesign primitives                                                */
/* ------------------------------------------------------------------ */

/* Animated engineering grid — used behind hero / CTA. Sharp, terminal-native. */
.bg-grid {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
}

/* Radial spotlight that fades the grid toward the edges. */
.grid-fade {
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 40%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 60% at 50% 40%, #000 30%, transparent 78%);
}

/* Warm accent bloom for hero / CTA backdrops. */
.accent-bloom {
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(255, 140, 0, 0.16) 0%, transparent 70%);
}

/* Cursor-tracked spotlight card (vars set inline via JS). */
.spotlight {
  position: relative;
  isolation: isolate;
}
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 140, 0, 0.12),
    transparent 60%
  );
}
.spotlight:hover::before { opacity: 1; }

/* Top hairline that lights up on hover. */
.rule-accent {
  background-image: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: top;
}

/* CRT scanline overlay for terminal surfaces.
   No mix-blend-mode — blending forces a costly compositing pass per surface
   and hurts scroll. A flat low-opacity gradient reads the same and is cheap. */
.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Offscreen sections skip layout + paint until scrolled near.
   contain-intrinsic-size reserves space so the scrollbar doesn't jump. */
.cv-auto {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

/* GPU-composited attention pulse (opacity only — no per-frame repaint,
   unlike animating box-shadow directly on the element). */
.attention { position: relative; }
.attention::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 16px 1px rgba(255, 171, 0, 0.45);
  opacity: 0;
  animation: attn 2s ease-in-out infinite;
  will-change: opacity;
}
@keyframes attn {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* Infinite marquee. */
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
  will-change: transform;
  backface-visibility: hidden;
}
.marquee-mask {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

/* Single sweep on hover — a deliberate moment, not a casino loop.
   (Previously ran infinitely on every primary CTA, which read cheap.) */
@keyframes sheen {
  0% { transform: translateX(-150%) skewX(-12deg); }
  100% { transform: translateX(260%) skewX(-12deg); }
}
.btn-sheen { position: relative; overflow: hidden; }
.btn-sheen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-150%) skewX(-12deg);
}
.btn-sheen:hover::after {
  animation: sheen 0.9s ease-out;
}

/* Soft float for the hero window. */
@keyframes float-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.float-soft { animation: float-soft 7s ease-in-out infinite; }

/* Respect reduced motion globally. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .marquee-track { animation: none; }
  .float-soft { animation: none; }
}
