/* BuddsApp — project page. Palette follows onuracar.dev; accent is BuddsApp's own green. */

:root {
  --bg: #151412;
  --surface: #1f1d1a;
  --surface-2: #26231f;
  --ink: #efe8d8;
  --muted: #9a917f;
  --faint: #5e574c;
  --line: #34302a;
  --accent: #8fbf7a;
  --accent-ink: #151412;
  --accent-soft: rgba(143, 191, 122, 0.14);
  --del: #e8846a;
  --del-soft: rgba(232, 132, 106, 0.1);
  --add: #8fbf7a;
  --add-soft: rgba(143, 191, 122, 0.1);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 1040px;
  --gutter: 24px;
  --radius: 10px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #efe9dc;
    --surface: #f8f4ea;
    --surface-2: #e9e2d2;
    --ink: #1c1a17;
    --muted: #6d665a;
    --faint: #a59c8a;
    --line: #d9d0bd;
    --accent: #3f7a34;
    --accent-ink: #f8f4ea;
    --accent-soft: rgba(63, 122, 52, 0.12);
    --del: #b5452b;
    --del-soft: rgba(181, 69, 43, 0.08);
    --add: #3f7a34;
    --add-soft: rgba(63, 122, 52, 0.09);
    color-scheme: light;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

code {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Top bar */
.top { border-bottom: 1px solid var(--line); }
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  font-family: var(--mono);
  font-size: 13px;
}
.wordmark { text-decoration: none; font-weight: 500; letter-spacing: -0.01em; }
.wordmark span { color: var(--accent); }
.top-links { display: flex; gap: 20px; }
.top-links a { text-decoration: none; color: var(--muted); }
.top-links a:hover { color: var(--ink); }

/* Hero */
.hero { padding-top: 96px; padding-bottom: 88px; }

.presence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--faint);
  background: transparent;
}

h1 {
  margin: 0;
  font-size: clamp(56px, 11vw, 120px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 36em;
  margin: 28px 0 0;
  font-size: clamp(19px, 2.2vw, 22px);
  line-height: 1.55;
  color: var(--ink);
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 48px 0 0;
  border-top: 1px solid var(--line);
}
.facts div { padding: 16px 20px 0 0; }
.facts dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
}
.facts dd { margin: 4px 0 0; font-size: 16px; line-height: 1.45; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-solid { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn-solid:hover { background: var(--ink); }
.btn-line { border: 1px solid var(--line); color: var(--ink); }
.btn-line:hover { border-color: var(--ink); }

/* Blocks */
.block { padding-top: 72px; padding-bottom: 24px; }

.block-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
h2 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.block-intro {
  max-width: 38em;
  margin: 20px 0 0;
  color: var(--muted);
}

h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 36px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}
.features p { margin: 8px 0 0; font-size: 16px; color: var(--muted); }

/* Diagram */
.diagram { margin: 40px 0 0; }
.diagram-scroll {
  overflow-x: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.diagram svg { display: block; width: 100%; min-width: 620px; height: auto; }
.diagram figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); }

.group { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 4 4; }
.group-title { font-family: var(--mono); font-size: 12px; fill: var(--muted); }
.node { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.2; }
.node-strong { stroke: var(--ink); }
.node-title { font-family: var(--serif); font-size: 17px; font-weight: 600; fill: var(--ink); }
.node-sub { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.chip { fill: var(--surface-2); stroke: var(--line); }
.chip-secret { stroke: var(--accent); }
.chip-text { font-family: var(--mono); font-size: 12px; fill: var(--ink); }
.chip-key { font-family: var(--mono); font-size: 10px; fill: var(--accent); }
.edge { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.edge-accent { stroke: var(--accent); }
.edge-dashed { stroke-dasharray: 5 4; }
.edge-label { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
.arrowhead { fill: var(--muted); }

/* Fixes */
.fixes {
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: fix;
}
.fix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 36px;
  align-items: start;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  counter-increment: fix;
}
.fix:first-child { border-top: 0; padding-top: 8px; }
.fix h3::before {
  content: counter(fix, decimal-leading-zero) " ";
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--faint);
}
.fix p { margin: 10px 0 0; font-size: 16.5px; color: var(--muted); }

pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.diff { padding: 0 0 12px; white-space: normal; }
.diff span { display: block; padding: 0 16px; white-space: pre; }
.diff .file {
  margin-bottom: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.diff .del { background: var(--del-soft); color: var(--del); }
.diff .add { background: var(--add-soft); color: var(--add); }
.diff .ctx { color: var(--muted); }

.caveat {
  max-width: 40em;
  margin: 8px 0 0;
  padding: 14px 18px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.caveat strong { font-weight: 600; }

/* Steps */
.steps {
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  max-width: 760px;
}
.steps li {
  position: relative;
  padding: 0 0 28px 44px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.steps p { margin: 0 0 10px; }
.cmd { padding: 14px 16px; white-space: pre; color: var(--ink); }

/* Footer */
.foot { margin-top: 72px; border-top: 1px solid var(--line); }
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 28px;
  padding-bottom: 40px;
  font-size: 15px;
  color: var(--muted);
}
.foot-row p { margin: 0; }
.foot-links { display: flex; gap: 20px; font-family: var(--mono); font-size: 13px; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--ink); }

/* Responsive */
@media (max-width: 860px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fix { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  body { font-size: 17px; }
  .hero { padding-top: 64px; padding-bottom: 56px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .features { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .block { padding-top: 56px; }
  .diagram-scroll { padding: 16px; }
  .top-links { gap: 14px; }
}

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