/* Self-hosted fonts (SIL OFL 1.1, licences in fonts/): no requests to third parties */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-Variable.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/JetBrainsMono-Variable.woff') format('woff');
}

/* ==========================================================================
   BudgetScan: design tokens
   One neutral dark surface, thin borders, one accent. No glows or gradients.
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #0b0b0d;
  --surface: #131316;
  --surface-2: #1a1a1f;
  --border: #26262c;
  --border-strong: #3a3a43;

  --text: #ececef;
  --text-body: #c4c4cc;
  --muted: #9b9ba6;
  --dim: #71717a;

  --accent: #9aa8ff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;

  --radius: 10px;
  --max: 1080px;

  /* Names used by inline styles and per-page <style> blocks on older pages */
  --bg-dark: var(--bg);
  --bg-card: var(--surface);
  --bg-card-hover: var(--surface-2);
  --bg-dark-section: var(--bg);
  --border-color: var(--border);
  --border-color-glow: var(--border-strong);
  --text-main: var(--text);
  --text-muted: var(--muted);
  --text-dim: var(--dim);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: var(--accent);
  --accent-cyan: #67d4e8;
  --accent-emerald: var(--ok);
  --accent-amber: var(--warn);
  --accent-rose: var(--danger);
  --radius-sm: 6px;
  --radius-md: var(--radius);
  --radius-lg: 14px;
  --radius-full: 9999px;
  --shadow-glow: none;
  --shadow-cyan-glow: none;
  --shadow-card: none;
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  /* clip, not hidden: hidden makes html/body a scroll container and breaks the sticky navbar */
  overflow-x: clip;
}

body {
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 {
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

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

/* Decorative layers from the old design; markup may still exist on some pages */
.bg-glow,
.bg-grid {
  display: none;
}

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

.gradient-text {
  color: var(--muted);
}

.code-tag {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  color: var(--text);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font: 600 0.9rem/1.4 var(--font-sans);
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-primary:hover {
  background: #fff;
}

.btn-secondary,
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover,
.btn-outline:hover {
  background: var(--surface-2);
}

.btn-lg {
  padding: 12px 22px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  display: flex;
  color: var(--accent);
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.badge-v {
  display: none;
}

.nav-links {
  display: flex;
  gap: 22px;
  margin-right: auto;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.lang-btn {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 4px;
}

.lang-btn:hover {
  color: var(--text);
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-container { gap: 12px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
}

/* Hero */
.hero {
  padding: 96px 0 72px;
  text-align: center;
}

.hero-container {
  max-width: 820px;
}

.eyebrow,
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.hero-title {
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}

.hero-subtitle {
  max-width: 620px;
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
  text-wrap: pretty;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-proof {
  color: var(--dim);
  font-size: 0.9rem;
}

.hero-proof a {
  color: var(--muted);
}

.status-note {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--warn);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: left;
}

.status-note strong {
  color: var(--text);
}

@media (max-width: 640px) {
  .hero { padding: 56px 0 48px; }
  .hero-cta-group .btn { width: 100%; }
}

/* Sections */
.section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.section-header {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
}

.section-subtitle {
  color: var(--muted);
  font-size: 1rem;
}

@media (max-width: 640px) {
  .section { padding: 52px 0; }
  .section-header { margin-bottom: 28px; }
}

/* Feature cards */
.features-grid,
.workflow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

.features-grid > *,
.workflow-steps > *,
.stories-grid > * {
  min-width: 0;
}

.feature-card,
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.feature-card h3,
.step-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p,
.step-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.feature-icon {
  display: flex;
  width: 22px;
  height: 22px;
  margin-bottom: 14px;
  color: var(--accent);
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

.icon-purple,
.icon-cyan,
.icon-emerald,
.icon-amber,
.icon-rose,
.icon-indigo {
  color: var(--accent);
}

.step-num {
  margin-bottom: 10px;
  color: var(--dim);
  font: 600 0.8rem var(--font-mono);
}

.result-number {
  display: block;
  color: var(--text);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* Landing: availability disclosure */
.more {
  max-width: 720px;
  margin: 28px auto 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.more summary {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.more summary:hover {
  color: var(--text);
}

.more p {
  padding: 0 16px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Landing: how it works, steps beside a small diagram */
.how {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: center;
  max-width: 860px;
  margin: 0 auto;
}

.how-steps {
  list-style: none;
  counter-reset: how;
  display: grid;
  gap: 18px;
}

.how-steps li {
  counter-increment: how;
  position: relative;
  padding-left: 40px;
  color: var(--muted);
  font-size: 0.95rem;
}

.how-steps li::before {
  content: counter(how);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  font: 600 0.75rem/22px var(--font-mono);
  text-align: center;
}

.how-steps strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.diagram a {
  display: block;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.diagram img {
  display: block;
  width: 100%;
  height: auto;
}

.diagram figcaption {
  margin-top: 8px;
  color: var(--dim);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 760px) {
  .how {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .diagram {
    max-width: 300px;
    margin: 0 auto;
  }
}

/* Landing: compact story cards */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

.mini-story {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.mini-story:hover {
  border-color: var(--border-strong);
}

.mini-story h3 {
  font-size: 1rem;
  font-weight: 600;
}

.mini-story blockquote {
  flex-grow: 1;
  color: var(--text-body);
  font-size: 0.95rem;
}

.mini-story cite {
  color: var(--dim);
  font-size: 0.85rem;
  font-style: normal;
}

.section-foot {
  margin-top: 28px;
  color: var(--dim);
  font-size: 0.9rem;
  text-align: center;
}

.section-foot .btn {
  margin-bottom: 16px;
}

/* Landing: pro-bono strip */
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.strip h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.strip p {
  max-width: 560px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Contact */
.contact {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.contact h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.contact > p {
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.05rem;
}

.contact-mails {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-top: 20px;
  list-style: none;
  font: 0.9rem var(--font-mono);
}

.contact-mails a {
  color: var(--text-body);
  user-select: all;
}

.contact .contact-who {
  margin: 20px 0 0;
  color: var(--dim);
  font-size: 0.88rem;
}

/* Footer */
.footer {
  padding: 28px 0 36px;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
}

.footer-bottom p {
  max-width: 640px;
}

.footer a {
  color: var(--muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

/* ==========================================================================
   Long-form pages (stories)
   ========================================================================== */
.doc {
  padding: 56px 0 88px;
  max-width: 100%;
  overflow-x: hidden;
}

.doc-container {
  max-width: 780px;
}

.doc h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 12px 0 18px;
}

.doc h2 {
  scroll-margin-top: 80px;
  font-size: 1.35rem;
  margin: 44px 0 12px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.doc h3 {
  font-size: 1.05rem;
  margin: 26px 0 8px;
}

.doc p,
.doc li {
  color: var(--text-body);
}

.doc p {
  margin: 0 0 14px;
}

.doc ul,
.doc ol {
  margin: 0 0 16px 22px;
}

.doc li {
  margin-bottom: 6px;
}

.doc blockquote {
  margin: 0 0 16px;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--border-strong);
}

.doc blockquote p {
  margin: 0;
  color: var(--text);
}

.doc pre {
  max-width: 100%;
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: 0.84rem/1.55 var(--font-mono);
}

/* long identifiers in running text must wrap on phones */
.doc .code-tag {
  overflow-wrap: anywhere;
}

.table-wrap,
.doc-table-wrap {
  max-width: 100%;
  margin: 0 0 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.doc th,
.doc td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
}

.doc th {
  color: var(--text);
  font-weight: 600;
}

.tag-status,
.story-badge {
  display: inline-block;
  padding: 1px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.tag-available,
.story-badge {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
}

.tag-testing,
.tag-draft {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

.tag-planned {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Story cards (stories hub) */
.story-card {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.story-card + .story-card {
  margin-top: 20px;
}

.story-card h3 {
  font-size: 1.2rem;
  margin: 12px 0 10px;
}

.story-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.story-card h3 a:hover {
  text-decoration: underline;
}

.story-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.story-timeline {
  list-style: none;
  margin: 0 0 18px 4px;
  padding: 0;
  border-left: 1px solid var(--border-strong);
}

.story-timeline li {
  position: relative;
  padding: 0 0 12px 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.doc .story-timeline li {
  color: var(--text-body);
  font-size: 1rem;
}

.story-timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.story-timeline strong {
  color: var(--text);
}

.story-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.story-card .story-caveat {
  margin: 18px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.88rem;
}

.story-caveat strong {
  color: var(--muted);
}

.maintainer-quote {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 16px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--border-strong);
  font-size: 0.95rem;
}

/* the leading emoji span, not the author tag */
.maintainer-quote > span:not(.author-tag) {
  display: none;
}

.maintainer-quote em {
  color: var(--text);
  font-style: normal;
}

.maintainer-quote .author-tag {
  color: var(--dim);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .story-card { padding: 20px 16px; }
}

/* Flow sketches on story pages (inline SVG) */
.flow {
  width: 100%;
  max-width: 550px;
  margin: 26px auto;
}

.flow svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.flow-box { fill: #131316; stroke: #3a3a43; stroke-width: 1.5; }
.flow-new { fill: rgba(74, 222, 128, 0.1); stroke: #4ade80; }
.flow-t { fill: #ececef; font: 600 15px Inter, -apple-system, sans-serif; text-anchor: middle; }
.flow-t-new { fill: #4ade80; }
.flow-s { fill: #9b9ba6; font: 400 13px Inter, -apple-system, sans-serif; text-anchor: middle; }
.flow-arrow { stroke: #818cf8; stroke-width: 2; fill: none; }
.flow-bypass { stroke: #fbbf24; stroke-width: 2; stroke-dasharray: 6 5; fill: none; }
.flow-note { fill: #fbbf24; font: 600 12px Inter, -apple-system, sans-serif; text-anchor: start; }

.flow figcaption,
.shot figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Illustration / screenshot figures on story pages */
.shot {
  width: 100%;
  max-width: 900px;
  margin: 26px auto;
  overflow: hidden;
}

.shot-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .shot img {
    width: 760px;
    max-width: none;
  }
}
