/* ------------------------------------------------------------------ *
 * KaPaPi — shared design system
 *
 * One stylesheet for the brand page and every product page under it, so
 * the products read as a family rather than as four separate sites.
 * Each product keeps one accent colour of its own; everything else is shared.
 * ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Ink and paper. Warm off-white, cool near-black — never pure #000/#fff. */
  --ink:        #14181d;
  --ink-soft:   #454d57;
  --ink-muted:  #6b7480;
  --paper:      #fbfbfa;
  --paper-sunk: #f4f4f2;
  --line:       #e3e3e0;

  /* Brand accent: the amber from the product marks. Warm, human, used sparingly. */
  --accent:     #d98218;
  --accent-ink: #8a5210;

  /* Product accents */
  --cleanpaste: #0f7b8a;
  --sortdoc:    #1f5fb8;

  --radius: 12px;
  --measure: 34rem;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #eceae6;
    --ink-soft:   #b3b0aa;
    --ink-muted:  #8a877f;
    --paper:      #101216;
    --paper-sunk: #171a1f;
    --line:       #282b31;
    --accent:     #e9a44a;
    --accent-ink: #f0bd77;
    --cleanpaste: #4fc3d1;
    --sortdoc:    #7aa9f0;
  }
}

* { box-sizing: border-box; }

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

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

.wrap {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap-narrow { max-width: 42rem; }

a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

/* ---------------- the mark ---------------- */

/* Three bars for the three syllables — ka pa pi. Scales to a favicon. */
.mark { display: inline-flex; align-items: flex-end; gap: 4px; height: 1em; }
.mark span {
  display: block;
  width: 0.2em;
  border-radius: 999px;
  background: currentColor;
}
.mark span:nth-child(1) { height: 0.58em; }
.mark span:nth-child(2) { height: 1em; }
.mark span:nth-child(3) { height: 0.38em; background: var(--accent); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 20, "WONK" 1;
  letter-spacing: -0.015em;
  text-decoration: none;
}

/* ---------------- site chrome ---------------- */

.site-head {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-head .wordmark { font-size: 1.2rem; }
.site-nav { display: flex; gap: 1.5rem; font-size: 0.94rem; color: var(--ink-soft); }
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--ink); }

.site-foot {
  margin-top: 6rem;
  padding: 2.5rem 0 4rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink-muted);
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: baseline; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }
.site-foot .spacer { flex: 1; }

/* ---------------- type ---------------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 20, "WONK" 1;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 1.9rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.12rem; letter-spacing: -0.01em; }

p { margin: 0 0 1.1rem; }
p.lead {
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 34rem;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 1rem;
}

section { padding: 4.5rem 0; }
section + section { border-top: 1px solid var(--line); }

.hero { padding: clamp(4rem, 12vw, 8rem) 0 clamp(3.5rem, 8vw, 6rem); }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-sunk);
  padding: 0.12em 0.38em;
  border-radius: 5px;
}

/* ---------------- product cards ---------------- */

.products { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }

.product {
  --tint: var(--accent);
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.product:hover { border-color: var(--tint); transform: translateY(-2px); }
.product.cleanpaste { --tint: var(--cleanpaste); }
.product.sortdoc { --tint: var(--sortdoc); }

.product .icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--tint);
  display: grid; place-items: center;
  margin-bottom: 1.1rem;
}
.product .icon i {
  display: block; background: #fff; border-radius: 2px; height: 3px;
}
.product .icon .bars { display: grid; gap: 3px; width: 20px; }

.product h3 { margin-bottom: 0.35rem; }
.product .what { color: var(--ink-soft); font-size: 0.97rem; margin: 0 0 1.1rem; flex: 1; }
.product .go { font-size: 0.9rem; font-weight: 600; color: var(--tint); }
.product .tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.5rem;
  margin-left: 0.5rem; vertical-align: 0.15em;
}

/* ---------------- principles ---------------- */

.principles { display: grid; gap: 2rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.principle h3 { margin-bottom: 0.4rem; }
.principle p { color: var(--ink-soft); font-size: 0.97rem; margin: 0; }
.principle .n {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent);
  display: block; margin-bottom: 0.6rem;
}

/* ---------------- prose pages (privacy, terms, support) ---------------- */

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.75rem; }
.prose h3 { margin-top: 1.75rem; margin-bottom: 0.35rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin: 0.3rem 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.6rem 0.7rem; text-align: left; vertical-align: top; }
.prose th { font-weight: 600; background: var(--paper-sunk); }

.note {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  padding: 0.9rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}
.note p:last-child { margin-bottom: 0; }

/* ---------------- demo block ---------------- */

.demo { display: grid; gap: 0.9rem; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 1.75rem 0; }
.demo pre {
  margin: 0; padding: 1rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-sunk);
  font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.7;
  overflow-x: auto; white-space: pre-wrap;
}
.demo .arrow { color: var(--ink-muted); font-size: 1.1rem; }
@media (max-width: 34rem) {
  .demo { grid-template-columns: 1fr; }
  .demo .arrow { transform: rotate(90deg); justify-self: center; }
}

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