/* ==========================================================================
   Ledger website — shared base styles
   Used by every page. Page-specific styles live alongside in css/<page>.css
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────────
   Design tokens
   ────────────────────────────────────────────────────────────────────────── */
:root {
  /* Surface — deep slate gradient base */
  --bg-base:        #060912;
  --bg-surface:     #0a1020;
  --bg-elevated:    #0f1729;
  --bg-card:        #111a2e;
  --bg-hover:       #16223a;

  /* Borders & dividers */
  --border:         rgba(148, 163, 184, 0.12);
  --border-strong:  rgba(148, 163, 184, 0.22);
  --border-accent:  rgba(94, 234, 212, 0.32);

  /* Text */
  --text-primary:   #e8eef5;
  --text-secondary: #aab4c4;
  --text-muted:     #6b7689;
  --text-faint:     #4a5468;

  /* Accents */
  --accent-teal:    #5eead4;     /* primary accent — electric teal */
  --accent-teal-dim:#2dd4bf;
  --accent-teal-glow: rgba(94, 234, 212, 0.18);
  --accent-green:   #16a34a;     /* Ledger brand — secondary accent */
  --accent-green-bright: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.15);
  --accent-warm:    #fbbf24;     /* warm highlight — used very sparingly */

  /* Status */
  --danger:         #f87171;
  --danger-bg:      rgba(248, 113, 113, 0.1);

  /* Typography */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter Tight', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;

  /* Type scale (fluid) */
  --fs-xs:    0.75rem;
  --fs-sm:    0.875rem;
  --fs-base:  1rem;
  --fs-lg:    1.125rem;
  --fs-xl:    1.25rem;
  --fs-2xl:   1.5rem;
  --fs-3xl:   2rem;
  --fs-4xl:   clamp(2.25rem, 4vw, 3rem);
  --fs-5xl:   clamp(3rem, 6vw, 4.5rem);
  --fs-6xl:   clamp(3.5rem, 8vw, 6rem);

  /* Spacing */
  --container-max: 1280px;
  --container-narrow: 880px;
  --section-pad-y: clamp(4rem, 9vw, 8rem);

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg:  0 20px 60px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 60px rgba(94, 234, 212, 0.15);

  /* Easings */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --d-fast: 160ms;
  --d-mid:  280ms;
  --d-slow: 480ms;
}

/* ──────────────────────────────────────────────────────────────────────────
   Reset & base
   ────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg-base);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "ss03"; /* Inter Tight stylistic alts */
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--accent-teal);
  text-decoration: none;
  transition: color var(--d-fast) var(--ease-out);
}
a:hover { color: var(--accent-green-bright); }

::selection {
  background: var(--accent-teal);
  color: var(--bg-base);
}

/* ──────────────────────────────────────────────────────────────────────────
   Atmospheric background — applied to body via ::before
   Subtle gradient halos that move slowly. The "premium" feeling.
   ────────────────────────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(94, 234, 212, 0.08), transparent 60%),
    radial-gradient(ellipse 70% 60% at 85% 5%, rgba(34, 197, 94, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(94, 234, 212, 0.05), transparent 60%);
  pointer-events: none;
  z-index: -2;
}

/* Faint grid texture for editorial feel */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center;
  pointer-events: none;
  z-index: -1;
  mask-image: radial-gradient(ellipse 80% 60% at center, black, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at center, black, transparent 90%);
}

/* ──────────────────────────────────────────────────────────────────────────
   Typography classes
   ────────────────────────────────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.025em; }
.font-mono    { font-family: var(--font-mono); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin: 0 0 0.5em;
  line-height: 1.05;
  /* Fraunces optical size variation */
  font-variation-settings: "opsz" 144, "SOFT" 30;
}

h1 { font-size: var(--fs-6xl); font-weight: 300; letter-spacing: -0.035em; }
h2 { font-size: var(--fs-5xl); font-weight: 400; }
h3 { font-size: var(--fs-3xl); font-weight: 500; }
h4 { font-size: var(--fs-xl); font-weight: 500; font-family: var(--font-body); letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-teal);
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent-teal);
  opacity: 0.6;
}

p { margin: 0 0 1em; color: var(--text-secondary); }
p.lead { font-size: var(--fs-xl); line-height: 1.55; color: var(--text-secondary); max-width: 60ch; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: rgba(94, 234, 212, 0.08);
  color: var(--accent-teal);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(94, 234, 212, 0.15);
}

pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  line-height: 1.55;
  margin: 1.5rem 0;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
}

/* ──────────────────────────────────────────────────────────────────────────
   Layout primitives
   ────────────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 3vw, 2rem);
}
.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 3vw, 2rem);
}

section { padding: var(--section-pad-y) 0; }

.section-header { margin-bottom: 4rem; max-width: 64ch; }
.section-header.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ──────────────────────────────────────────────────────────────────────────
   Navigation
   ────────────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 9, 18, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 3vw, 2rem);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  transition: opacity var(--d-fast) var(--ease-out);
}
.nav-brand:hover { opacity: 0.85; color: var(--text-primary); }
.nav-brand svg { color: var(--accent-green-bright); flex-shrink: 0; }

.nav-version {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: rgba(94, 234, 212, 0.1);
  color: var(--accent-teal);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(94, 234, 212, 0.2);
  margin-left: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
  position: relative;
  transition: color var(--d-fast) var(--ease-out);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--accent-teal); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -28px;
  height: 2px;
  background: var(--accent-teal);
  box-shadow: 0 0 12px var(--accent-teal);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-cta .btn-secondary { display: none; }
  .nav-mobile-toggle { display: flex; }
  .nav-links.is-open {
    display: flex;
    position: fixed;
    inset: 72px 0 auto 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    gap: 1rem;
  }
  .nav-links.is-open a { padding: 0.5rem 0; font-size: 1.1rem; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Buttons
   ────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--d-fast) var(--ease-out);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent-teal);
  color: var(--bg-base);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.3), 0 8px 24px rgba(94, 234, 212, 0.18);
}
.btn-primary:hover {
  background: var(--accent-teal-dim);
  color: var(--bg-base);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.5), 0 12px 32px rgba(94, 234, 212, 0.28);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.04); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

/* ──────────────────────────────────────────────────────────────────────────
   Pills / badges
   ────────────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-accent);
  background: rgba(94, 234, 212, 0.06);
  color: var(--accent-teal);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 8px var(--accent-teal);
  animation: pulse-soft 2.4s ease-in-out infinite;
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ──────────────────────────────────────────────────────────────────────────
   Cards
   ────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color var(--d-mid) var(--ease-out), transform var(--d-mid) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* Subtle gradient edge on hover — premium feel */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.3), transparent 40%);
  -webkit-mask: linear-gradient(black, black) content-box, linear-gradient(black, black);
  mask: linear-gradient(black, black) content-box, linear-gradient(black, black);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--d-mid) var(--ease-out);
  pointer-events: none;
}
.card:hover::before { opacity: 1; }

/* ──────────────────────────────────────────────────────────────────────────
   Footer
   ────────────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
  margin-top: var(--section-pad-y);
  background: linear-gradient(180deg, transparent, rgba(6, 9, 18, 0.6));
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  max-width: 30ch;
}
.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.footer-col ul a {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.footer-col ul a:hover { color: var(--accent-teal); }

.footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-meta .font-mono { font-size: 0.75rem; }

/* ──────────────────────────────────────────────────────────────────────────
   Reveal-on-scroll utility
   ────────────────────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }

@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; transform: none; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Helper utility classes
   ────────────────────────────────────────────────────────────────────────── */
.text-accent { color: var(--accent-teal); }
.text-brand { color: var(--accent-green-bright); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

.gradient-text {
  background: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-green-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ──────────────────────────────────────────────────────────────────────────
   Copy-to-clipboard button (attached by base.js to .copyable elements)
   Used on every page that has installable code snippets.
   ────────────────────────────────────────────────────────────────────────── */
.copyable { position: relative; }
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 41, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--d-fast) var(--ease-out);
  z-index: 2;
}
.copy-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent-teal);
  background: rgba(94, 234, 212, 0.1);
}
.copy-btn.is-copied {
  color: var(--accent-green-bright);
  border-color: rgba(34, 197, 94, 0.4);
  background: var(--accent-green-glow);
}
.copy-btn svg { flex-shrink: 0; }
