/* Markdown Companion — site stylesheet. One file, no build step.
   Skin: Tarnbeck brand tokens v1.0 (warm Cloud Dancer ground, product accent = reader blue).
   Source of truth for the family tokens: tarnbeck-brand repo (vendored values inline here). */

:root {
  /* Tarnbeck family ground */
  --bg: #f2f0eb;
  --surface: #fbfaf7;
  --text: #1d1f22;
  --muted: #585e66;
  --border: #dcd8cf;

  /* product accent (Markdown Companion reader blue) */
  --accent: #0969da;
  --accent-soft: #e4eefa;
  --accent-contrast: #ffffff;

  /* Tarnbeck signature (footer wordmark, small touches only) */
  --tarn: #1f5f6b;

  /* diff colors (USP section) */
  --diff-add-bg: #e3f2e3;
  --diff-add-ink: #1a5c2a;
  --diff-del-bg: #f8e3e3;
  --diff-del-ink: #8a2a2a;

  --code-bg: #ecebe5;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Code", Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 70ch;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(29, 31, 34, 0.06), 0 8px 24px rgba(29, 31, 34, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212429;
    --surface: #2a2d33;
    --text: #e9e7e2;
    --muted: #a3a9b2;
    --border: #3b3f47;
    --accent: #539bf5;
    --accent-soft: #223349;
    --accent-contrast: #10181a;
    --tarn: #5fa3af;
    --diff-add-bg: #1e3a24;
    --diff-add-ink: #7ecb8f;
    --diff-del-bg: #442828;
    --diff-del-ink: #e29a9a;
    --code-bg: #2e3138;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #212429;
  --surface: #2a2d33;
  --text: #e9e7e2;
  --muted: #a3a9b2;
  --border: #3b3f47;
  --accent: #539bf5;
  --accent-soft: #223349;
  --accent-contrast: #10181a;
  --tarn: #5fa3af;
  --diff-add-bg: #1e3a24;
  --diff-add-ink: #7ecb8f;
  --diff-del-bg: #442828;
  --diff-del-ink: #e29a9a;
  --code-bg: #2e3138;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { color-scheme: light dark; scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code, pre, .mono { font-family: var(--font-mono); }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.92em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-contrast);
  padding: 8px 14px; border-radius: 0 0 var(--radius) var(--radius); z-index: 100;
}
.skip-link:focus { left: 12px; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 650; color: var(--text); text-decoration: none; letter-spacing: 0.01em;
}

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); text-decoration: underline; }

.header-controls { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  width: 34px; height: 34px; cursor: pointer; color: var(--text); font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--muted); }
.icon-dark { display: none; }
:root[data-theme="dark"] .icon-light { display: none; }
:root[data-theme="dark"] .icon-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-light { display: none; }
  :root:not([data-theme="light"]) .icon-dark { display: inline; }
}

.nav-toggle { display: none; position: relative; }
.nav-toggle summary { list-style: none; cursor: pointer; padding: 8px; border-radius: var(--radius); }
.nav-toggle summary::-webkit-details-marker { display: none; }
.bars { display: block; width: 20px; height: 2px; background: var(--text); position: relative; }
.bars::before, .bars::after {
  content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--text);
}
.bars::before { top: -6px; }
.bars::after { top: 6px; }
.nav-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 180px; padding: 8px 0;
}
.nav-panel ul { list-style: none; margin: 0; padding: 0; }
.nav-panel a { display: block; padding: 8px 16px; color: var(--text); text-decoration: none; }
.nav-panel a:hover { background: var(--accent-soft); }

@media (max-width: 760px) {
  .site-nav { display: none; }
  .nav-toggle { display: block; }
}

@media (max-width: 760px) {
  section { padding: 44px 0; }
  .hero { padding: 24px 0 36px; }
  .final-cta { padding-bottom: 60px; }
}

@media (max-width: 480px) {
  .mock-reader { grid-template-columns: 104px minmax(0, 1fr); }
  .mock-outline { display: none; }
  .mock-doc { padding: 14px; }
}

/* ---------- hero ---------- */

.hero { padding: 40px 0 44px; }
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 48px; align-items: center;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.1rem);
  line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 18px;
}
.hero .sub { font-size: 1.12rem; color: var(--muted); margin: 0 0 26px; max-width: 46ch; }

.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; padding: 0; list-style: none; }
.hero-badges li {
  font-size: 0.82rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; background: var(--surface);
}

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: var(--radius);
  text-decoration: none; font-weight: 600; font-size: 1rem; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-secondary:hover { border-color: var(--muted); }
.cta-note { font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 36px; }
}

/* ---------- CSS product mockups (illustrative, no images) ---------- */

.mock-window {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; font-size: 0.72rem;
}
.mock-titlebar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.mock-titlebar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.mock-titlebar .addr {
  margin-left: 10px; flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; color: var(--muted);
  font-family: var(--font-mono); font-size: 0.66rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mock-reader { display: grid; grid-template-columns: 130px 1fr 110px; min-height: 300px; }
.mock-side { border-right: 1px solid var(--border); padding: 10px 0; background: var(--bg); }
.mock-side .side-title {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 0 12px 6px;
}
.mock-side .file {
  padding: 4px 12px; color: var(--muted); font-family: var(--font-mono); font-size: 0.66rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mock-side .file.active {
  color: var(--accent); background: var(--accent-soft);
  border-left: 2px solid var(--accent); padding-left: 10px;
}

.mock-doc { padding: 16px 18px; }
.mock-doc .h { height: 13px; width: 60%; border-radius: 3px; background: var(--text); opacity: 0.85; margin: 0 0 12px; }
.mock-doc .p { height: 7px; border-radius: 3px; background: var(--muted); opacity: 0.45; margin: 7px 0; }
.mock-doc .p.short { width: 72%; }
.mock-doc .p.mid { width: 88%; }
.mock-doc .task { display: flex; align-items: center; gap: 7px; margin: 9px 0; }
.mock-doc .task .box {
  width: 9px; height: 9px; border: 1.5px solid var(--muted); border-radius: 2px; flex: none;
}
.mock-doc .task .box.done { background: var(--accent); border-color: var(--accent); }
.mock-doc .task .line { height: 7px; border-radius: 3px; background: var(--muted); opacity: 0.45; flex: 1; }
.mock-doc .codeblock {
  background: var(--code-bg); border-radius: 6px; padding: 9px 11px; margin: 12px 0;
}
.mock-doc .codeblock .c { height: 6px; border-radius: 3px; margin: 5px 0; opacity: 0.7; }
.mock-doc .codeblock .c1 { width: 55%; background: var(--accent); }
.mock-doc .codeblock .c2 { width: 75%; background: var(--muted); }
.mock-doc .codeblock .c3 { width: 40%; background: var(--tarn); }

.mock-outline { border-left: 1px solid var(--border); padding: 10px 0; background: var(--bg); }
.mock-outline .side-title {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 0 12px 6px;
}
.mock-outline .o { height: 6px; border-radius: 3px; background: var(--muted); opacity: 0.4; margin: 8px 12px; }
.mock-outline .o.active { background: var(--accent); opacity: 1; }
.mock-outline .o.l2 { margin-left: 22px; }

/* diff mock */
.mock-diff .mock-toast {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 0.7rem;
}
.mock-toast .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none;
}
.mock-toast .toast-btn {
  margin-left: auto; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 5px; padding: 2px 8px; font-weight: 600;
}
.mock-diff .diffline {
  font-family: var(--font-mono); font-size: 0.68rem; padding: 3px 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.diffline.ctx { color: var(--muted); }
.diffline.del { background: var(--diff-del-bg); color: var(--diff-del-ink); }
.diffline.add { background: var(--diff-add-bg); color: var(--diff-add-ink); }
.mock-caption { font-size: 0.8rem; color: var(--muted); margin: 10px 2px 0; }

/* ---------- section scaffolding ---------- */

section { padding: 56px 0; }
section h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.01em; margin: 0 0 8px;
}
.section-lede { color: var(--muted); max-width: 62ch; margin: 0 0 34px; font-size: 1.05rem; }

.kicker {
  display: inline-block; font-size: 0.78rem; font-weight: 650; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px;
}

/* AI-era narrative */
.ai-era { border-top: 1px solid var(--border); }
.ai-era .cols {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 8px;
}
.ai-era .col h3 { margin: 0 0 8px; font-size: 1.05rem; }
.ai-era .col p { margin: 0; color: var(--muted); font-size: 0.97rem; }
@media (max-width: 820px) { .ai-era .cols { grid-template-columns: minmax(0, 1fr); } }

/* diff / USP section */
.usp { background: var(--surface); border-block: 1px solid var(--border); }
.usp .wrap {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: center;
}
.usp ul.points { margin: 18px 0 0; padding: 0; list-style: none; }
.usp ul.points li { margin: 10px 0; padding-left: 26px; position: relative; color: var(--muted); }
.usp ul.points li::before {
  content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 700;
}
@media (max-width: 900px) { .usp .wrap { grid-template-columns: minmax(0, 1fr); gap: 32px; } }

/* feature grid */
.feature-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 6px;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 20px 20px 16px;
}
.card h3 { margin: 0 0 8px; font-size: 1.02rem; display: flex; align-items: center; gap: 9px; }
.card h3 svg { flex: none; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 0.93rem; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }

/* setup steps */
.setup ol { counter-reset: step; list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.setup li {
  counter-increment: step; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.setup li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-contrast); font-weight: 700; margin-bottom: 12px;
}
.setup li strong { display: block; margin-bottom: 6px; }
.setup li span { color: var(--muted); font-size: 0.93rem; }
@media (max-width: 820px) { .setup ol { grid-template-columns: minmax(0, 1fr); } }

/* privacy strip */
.privacy-strip {
  background: var(--text); color: var(--bg); text-align: center; padding: 48px 0;
}
.privacy-strip .headline { font-size: 1.5rem; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.privacy-strip p { margin: 0 auto; max-width: 60ch; opacity: 0.85; }
.privacy-strip a { color: inherit; }

/* FAQ */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin: 10px 0; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 14px 40px 14px 18px; font-weight: 600; list-style: none; position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 500;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0; padding: 0 18px 16px; color: var(--muted); }

/* final CTA */
.final-cta { text-align: center; padding-bottom: 80px; }
.final-cta h2 { margin-bottom: 10px; }
.final-cta .section-lede { margin-left: auto; margin-right: auto; }

/* ---------- sub-pages (privacy, support, changelog) ---------- */

.page-header { padding: 56px 0 8px; }
.page-header h1 { font-size: clamp(1.9rem, 3.5vw, 2.5rem); margin: 0 0 8px; letter-spacing: -0.02em; }
.lede { color: var(--muted); font-size: 1.05rem; margin: 0; }

.content { padding: 24px 0 72px; }
.prose { max-width: var(--measure); }
.prose h2 { font-size: 1.35rem; margin: 34px 0 10px; }
.prose h3 { font-size: 1.1rem; margin: 24px 0 8px; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface); }

.changelog-entry { border-bottom: 1px solid var(--border); padding: 8px 0 18px; }
.changelog-entry .version { display: flex; align-items: baseline; gap: 14px; }
.changelog-entry h2 { margin: 16px 0 4px; }
.changelog-entry time { color: var(--muted); font-size: 0.9rem; }

/* placeholder slots (until real screenshots exist) */
.placeholder-slot {
  border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); background: var(--surface);
  aspect-ratio: 16 / 10; margin-top: 32px;
}
.placeholder-slot .dim { display: block; font-size: 0.8rem; opacity: 0.7; margin-top: 4px; }

/* ---------- footer (Tarnbeck footer contract) ---------- */

.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 34px 0; color: var(--muted); font-size: 0.92rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.site-footer p { margin: 0; }
.site-footer .tarnbeck-mark {
  color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: 0.01em;
}
.site-footer .tarnbeck-mark::after { content: "."; color: var(--tarn); font-weight: 800; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; margin: 0 0 0 auto; padding: 0; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
