/* =============================================================================
   public/assets/css/site.css — THE MARKETING SITE'S STYLES
   =============================================================================
   Same design tokens as VanillaSaaS Core's app.css, so the site and the
   product look like one thing. Dark mode follows the visitor's OS setting.

     1. Tokens          5. Home page (hero, features, pricing, FAQ)
     2. Dark mode       6. Docs
     3. Base            7. Prose (rendered Markdown)
     4. Shared parts    8. Blog, examples, responsive
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --on-primary: #ffffff;

  --bg: #ffffff;
  --bg-tint: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --text: #111827;
  --text-muted: #5b6475;
  --border: #e3e6ee;
  --border-strong: #cfd4df;
  --success: #15803d;

  --code-bg: #0f172a;
  --code-text: #e2e8f0;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgb(16 24 40 / 0.08), 0 8px 24px rgb(16 24 40 / 0.06);
  --focus-ring: 0 0 0 3px rgb(79 70 229 / 0.35);

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

  --wrap: 1100px;
  --wrap-narrow: 720px;

  color-scheme: light;
}

/* 2. DARK MODE ------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: rgb(129 140 248 / 0.14);
    --on-primary: #0b0d17;

    --bg: #0d1017;
    --bg-tint: #121722;
    --surface: #151a23;
    --surface-2: #1c2230;
    --text: #e7eaf0;
    --text-muted: #9aa3b5;
    --border: #262d3b;
    --border-strong: #353e50;
    --success: #4ade80;

    --code-bg: #0a0d14;
    --code-text: #d7dce6;

    --shadow: 0 0 0 1px rgb(255 255 255 / 0.04);
    --focus-ring: 0 0 0 3px rgb(129 140 248 / 0.45);

    color-scheme: dark;
  }
}

/* 3. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.12em 0.36em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
}

pre {
  margin: 0 0 1.3em;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--code-text);
  background: var(--code-bg);
  border-radius: var(--radius);
}

pre code { padding: 0; font-size: inherit; background: none; border: 0; color: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.lead { font-size: 1.2rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  padding: 0.5rem 1rem; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.skip-link:focus { top: 1rem; }

/* 4. SHARED PARTS ---------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: var(--wrap-narrow); }

.section { padding: 4rem 0; }
.section-tint { background: var(--bg-tint); border-block: 1px solid var(--border); }

.eyebrow {
  margin-bottom: 0.75rem;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary);
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
  min-height: 64px; padding-block: 0.6rem;
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), #06b6d4); }

.site-nav { display: flex; align-items: center; gap: 0.25rem 1.4rem; flex-wrap: wrap; font-size: 0.95rem; }
.site-nav a:not(.btn) { color: var(--text-muted); font-weight: 500; }
.site-nav a:not(.btn):hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0.6rem 1.2rem;
  font: inherit; font-size: 0.98rem; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; transition: background-color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-small { min-height: 34px; padding: 0.3rem 0.8rem; font-size: 0.88rem; }
.btn-block { width: 100%; }

.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

/* A screenshot in a simple browser-like frame */
.shot {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: var(--surface-2);
}

/* Footer */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--text-muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.site-footer nav { display: flex; gap: 0.4rem 1.25rem; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); }

/* Email sign-up */
.newsletter { text-align: center; }
.newsletter-form { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin: 1.5rem 0 1rem; }
.newsletter-form input {
  flex: 1 1 260px; max-width: 360px; min-height: 44px; padding: 0.55rem 0.8rem;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.newsletter-form input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }

/* 5. HOME PAGE ------------------------------------------------------------- */
.hero { padding: 4.5rem 0 4rem; background: linear-gradient(180deg, var(--bg-tint), var(--bg)); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 3rem; align-items: center; }
.hero .lead { color: var(--text-muted); }
.hero-code { display: inline-block; max-width: 100%; margin-bottom: 1.5rem; }
.hero-next { margin: 0.85rem 0 0; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.feature { padding: 1.4rem 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.feature p { margin: 0; color: var(--text-muted); font-size: 0.98rem; }

.defences { margin: 0 0 1.5rem; }
.defences dt { font-weight: 700; margin-top: 1.1rem; }
.defences dd { margin: 0.15rem 0 0; color: var(--text-muted); }

/* Pricing */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; margin: 2.5rem 0 1.5rem; align-items: stretch; }
.tier { display: flex; flex-direction: column; padding: 1.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tier-highlight { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tier h3 { margin-bottom: 0.4rem; }
.tier-price { margin: 0; font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.tier .muted { font-size: 0.95rem; }
.tier-soon {
  margin: auto 0 0; padding: 0.65rem; text-align: center; font-weight: 600; font-size: 0.95rem;
  color: var(--text-muted); background: var(--surface-2); border-radius: var(--radius-sm);
}
.tier .btn { margin-top: auto; }

.ticks { list-style: none; margin: 0.5rem 0 1.5rem; padding: 0; font-size: 0.95rem; }
.ticks li { position: relative; padding-left: 1.6rem; margin-bottom: 0.55rem; }
.ticks li::before { content: "✓"; position: absolute; left: 0; font-weight: 700; color: var(--success); }

/* FAQ: native <details>, so it works with no JavaScript */
.faq { border-bottom: 1px solid var(--border); }
.faq summary { padding: 1rem 0; font-weight: 600; cursor: pointer; }
.faq p { color: var(--text-muted); }

/* 6. DOCS ------------------------------------------------------------------ */
.docs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 3rem; padding-block: 3rem 4rem; }

.docs-nav { position: sticky; top: 88px; align-self: start; font-size: 0.95rem; }
.docs-nav-title { margin: 0 0 0.6rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; padding: 0.35rem 0.7rem; color: var(--text-muted); border-radius: var(--radius-sm); }
.docs-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.docs-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); font-weight: 600; }

.docs-body { max-width: 760px; }

.docs-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.pager-link { display: grid; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font-weight: 600; }
.pager-link:hover { border-color: var(--primary); text-decoration: none; }
.pager-next { text-align: right; }

/* 7. PROSE (rendered Markdown) -------------------------------------------- */
.prose h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 0.8em; }
.prose h2 { font-size: 1.45rem; margin-top: 2.2em; padding-top: 0.2em; }
.prose h3 { margin-top: 1.8em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4rem; }
.prose li { margin-bottom: 0.4em; }
.prose li > ul, .prose li > ol, .prose li > pre { margin-top: 0.5em; }
.prose hr { margin: 2.5rem 0; border: 0; border-top: 1px solid var(--border); }
.prose blockquote { margin: 0 0 1.2em; padding: 0.2rem 1rem; border-left: 3px solid var(--primary); color: var(--text-muted); }

/* Checklists: "- [ ]" items */
.prose li.todo { list-style: none; position: relative; margin-left: -1.4rem; padding-left: 1.9rem; }
.prose li.todo::before {
  content: ""; position: absolute; left: 0; top: 0.3em; width: 1.05rem; height: 1.05rem;
  border: 2px solid var(--border-strong); border-radius: 4px;
}
.prose li.todo.is-done::before { background: var(--success); border-color: var(--success); }

.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.prose th, .prose td { padding: 0.65rem 0.9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--surface-2); white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }

/* Copy button added to code blocks by site.js */
.code-block { position: relative; }
.copy-button {
  position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.2rem 0.55rem;
  font: inherit; font-size: 0.75rem; font-weight: 600;
  color: var(--code-text); background: rgb(255 255 255 / 0.1);
  border: 1px solid rgb(255 255 255 / 0.18); border-radius: var(--radius-sm);
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.code-block:hover .copy-button, .copy-button:focus-visible { opacity: 1; }

/* 8. BLOG, EXAMPLES, RESPONSIVE ------------------------------------------- */
.post-list { margin-top: 2.5rem; display: grid; gap: 1.25rem; }
.post-card { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.post-card h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.post-card p { margin: 0 0 0.4rem; }
.post-card p:last-child { color: var(--text-muted); margin: 0; }

.examples { display: grid; gap: 2.5rem; margin-top: 2.5rem; }
.example { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }

@media (max-width: 860px) {
  .hero { padding-top: 3rem; }
  .hero-inner, .example { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .section { padding: 3rem 0; }

  /* Docs menu moves above the page and scrolls sideways. */
  .docs { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: 1.5rem; }
  .docs-nav { position: static; }
  .docs-nav ul { display: flex; gap: 0.25rem; overflow-x: auto; padding-bottom: 0.4rem; }
  .docs-nav a { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Blueprint pages ----------------------------------------------------------- */
/* Two buying options side by side, kept narrower than the three-card row. */
.tiers-two { max-width: 760px; margin-left: auto; margin-right: auto; }
.center-block { margin: 2.5rem auto 0; }
.section-tint .shot { margin-top: 0.5rem; }
