/* ============================================================
   CodeFlow marketing site — "Ink & Paper"
   Same brand tokens as the app (src/renderer/src/App.css).
   No framework, no build step.
   ============================================================ */

/* ---------- Self-hosted fonts ---------- */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/space-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/space-mono-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/space-mono-latin-700-normal.woff2') format('woff2');
}

/* ---------- Tokens (light default, dark via media query) ---------- */
:root {
  --font-ui: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, Menlo, monospace;

  --shell: #f6f5f1;
  --panel: #ffffff;
  --ink: #151412;
  --ink-soft: #454239;
  --muted: #6d6a61; /* app's #7a776e darkened slightly for AA on cream */
  --hair: #e7e5de;
  --hair-strong: #d6d4cc;
  --hover: #f1f0ea;
  --active: #e9e7e0;
  --accent: #c93a22;
  --accent-hover: #ad3018;
  --accent-ink: #c93a22;   /* accent used as text/link color */
  --accent-soft: rgba(201, 58, 34, 0.07);
  --hero: #171614;         /* dark pill / dark band */
  --hero-ink: #edece6;
  --hero-muted: #a5a29a;
  --wave: #e8563c;
  --header-bg: rgba(246, 245, 241, 0.92);
  --shadow: 0 14px 36px rgba(21, 20, 18, 0.16);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --shell: #161513;
    --panel: #1e1d1a;
    --ink: #edece6;
    --ink-soft: #c9c6bc;
    --muted: #8f8c82;
    --hair: rgba(255, 255, 255, 0.09);
    --hair-strong: rgba(255, 255, 255, 0.18);
    --hover: rgba(255, 255, 255, 0.04);
    --active: rgba(255, 255, 255, 0.08);
    --accent: #c93a22;
    --accent-hover: #b13320;
    --accent-ink: #e8563c; /* lighter crimson for AA text on dark shell */
    --accent-soft: rgba(232, 86, 60, 0.14);
    --hero: #111009;
    --hero-ink: #edece6;
    --hero-muted: #a5a29a;
    --header-bg: rgba(22, 21, 19, 0.92);
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  }
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  background: var(--shell);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 2px;
}

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

[id] {
  scroll-margin-top: 84px;
}

.container {
  width: min(1080px, 100% - 48px);
  margin-inline: auto;
}
.container.narrow {
  width: min(760px, 100% - 48px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  background: var(--ink);
  color: var(--shell);
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
}

/* ---------- Typography ---------- */
h1,
h2,
h3 {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 1.2rem + 4.5vw, 4rem);
}
h2 {
  font-size: clamp(1.45rem, 1.05rem + 2vw, 2.15rem);
}
h3 {
  font-size: 1.02rem;
}

p {
  margin: 0 0 1em;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--panel);
  border: 1px solid var(--hair-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.12em 0.5em;
  white-space: nowrap;
}
.kbd-plus {
  color: var(--muted);
  padding: 0 0.15em;
  font-family: var(--font-mono);
  font-weight: 400;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 14px;
}

.section-lede {
  color: var(--ink-soft);
  max-width: 56ch;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-ghost {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--hair-strong);
}
.btn-ghost:hover {
  background: var(--hover);
  border-color: var(--muted);
}
.btn-small {
  padding: 8px 18px;
  font-size: 0.88rem;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-logo {
  border-radius: 7px;
}
.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav-link {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}
.nav-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--accent);
}
.ext {
  font-size: 0.75em;
  margin-left: 3px;
  color: var(--muted);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}
.nav-toggle-bars {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  position: relative;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  position: absolute;
  left: 0;
}
.nav-toggle-bars::before {
  top: -6px;
}
.nav-toggle-bars::after {
  top: 6px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 88px;
  border-bottom: 1px solid var(--hair);
}
.hero-inner {
  text-align: center;
}
.hero h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-ink);
}
.hero-sub {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 44ch;
  margin: 18px auto 22px;
}
.badge-row {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 34px;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}
.cta-note {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 auto;
}

/* ---------- Flow Bar pill ---------- */
.flowbar-stage {
  margin-top: 64px;
}
.flowbar {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: var(--hero);
  color: var(--hero-ink);
  border-radius: 999px;
  padding: 15px 30px;
  box-shadow: var(--shadow);
}
.flowbar-waves {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
}
.flowbar-waves i {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: var(--wave);
  animation: cfwave 1.1s ease-in-out infinite;
  transform-origin: center;
}
.flowbar-waves i:nth-child(1) { height: 10px; animation-delay: 0s; }
.flowbar-waves i:nth-child(2) { height: 18px; animation-delay: 0.14s; }
.flowbar-waves i:nth-child(3) { height: 26px; animation-delay: 0.28s; }
.flowbar-waves i:nth-child(4) { height: 16px; animation-delay: 0.42s; }
.flowbar-waves i:nth-child(5) { height: 9px;  animation-delay: 0.56s; }
.flowbar-label {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.flowbar-caption {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin: 14px 0 0;
}

@keyframes cfwave {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

/* ---------- Sections ---------- */
.section {
  padding: 88px 0;
  border-bottom: 1px solid var(--hair);
}

/* ---------- How it works ---------- */
.steps {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  counter-reset: step;
}
.step {
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 28px 26px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-ink);
  border: 1px solid var(--hair-strong);
  margin-bottom: 16px;
}
.step h3 {
  margin-bottom: 8px;
}
.step p {
  color: var(--ink-soft);
  font-size: 0.94rem;
  margin: 0;
}

/* ---------- Feature grid ---------- */
.grid {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 26px 24px;
}
.card h3 {
  margin-bottom: 8px;
}
.card p {
  color: var(--ink-soft);
  font-size: 0.94rem;
  margin: 0;
}

/* ---------- Privacy (dark band) ---------- */
.section-dark {
  background: var(--hero);
  color: var(--hero-ink);
  border-bottom: none;
}
.section-dark .kicker {
  color: var(--wave);
}
.section-dark a {
  color: var(--wave);
}
.privacy-list {
  list-style: none;
  margin: 28px 0 36px;
  padding: 0;
  display: grid;
  gap: 16px;
}
.privacy-list li {
  padding-left: 26px;
  position: relative;
  color: var(--hero-muted);
}
.privacy-list li strong {
  color: var(--hero-ink);
}
.privacy-list li::before {
  content: '~';
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--wave);
}
.privacy-pull {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1rem + 1vw, 1.5rem);
  font-weight: 700;
  margin: 0;
}

/* ---------- Comparison table ---------- */
.table-wrap {
  margin-top: 36px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 780px;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 14px 16px;
  border-top: 1px solid var(--hair);
}
thead th {
  border-top: none;
  border-bottom: 1px solid var(--hair-strong);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: nowrap;
}
thead th a {
  color: var(--ink);
  text-decoration-color: var(--hair-strong);
}
thead th a:hover {
  text-decoration-color: var(--accent);
}
tbody th[scope='row'] {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}
td {
  color: var(--ink-soft);
}
.col-codeflow {
  background: var(--accent-soft);
}
thead .col-codeflow {
  color: var(--accent-ink);
}
td.col-codeflow {
  color: var(--ink);
  font-weight: 600;
}
.table-note {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin: 14px 2px 0;
}

/* ---------- Prose (why free) ---------- */
.prose p {
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.prose strong {
  color: var(--ink);
}

/* ---------- Support ---------- */
#support .cta-row {
  justify-content: flex-start;
  margin: 26px 0 18px;
}
.support-note {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0;
}

/* ---------- FAQ ---------- */
.faq-list {
  margin-top: 24px;
  border-top: 1px solid var(--hair);
}
details {
  border-bottom: 1px solid var(--hair);
}
summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 2px;
  font-weight: 600;
  font-size: 1.02rem;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: '+'; /* fallback for browsers without alt-text syntax */
  content: '+' / ''; /* empty alt text hides the glyph from screen readers */
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--muted);
  flex: none;
}
details[open] summary::after {
  content: '\2212'; /* minus sign; fallback for browsers without alt-text syntax */
  content: '\2212' / '';
}
summary:hover {
  color: var(--accent-ink);
}
details p {
  margin: 0 0 20px;
  padding-right: 36px;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 44px 0 52px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}
.footer-links {
  display: flex;
  gap: 22px;
}
.footer-links a {
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.footer-links a:hover {
  color: var(--accent-ink);
}
.footer-legal {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0;
  flex-basis: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 899px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 719px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-menu {
    display: none;
  }
  body.nav-open .nav-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--shell);
    border-bottom: 1px solid var(--hair);
    padding: 10px 24px 20px;
    box-shadow: var(--shadow);
  }
  body.nav-open .nav-menu .nav-link {
    padding: 10px 0;
    width: 100%;
  }
  body.nav-open .nav-menu .btn {
    margin-top: 10px;
  }
  .hero {
    padding: 64px 0 60px;
  }
  .section {
    padding: 60px 0;
  }
  .cta-row .btn {
    width: 100%;
  }
  .flowbar-stage {
    margin-top: 44px;
  }
  details p {
    padding-right: 0;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
