/* nostr-kinds.letsbalance.life: one stylesheet, no external fonts, mobile first (360 px and up). */
:root {
  --bg: #fbfaf6;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --text: #1c2126;
  --muted: #4d5660;
  --line: #d9d5c8;
  --accent: #0a6666;          /* on --bg: contrast 6.4 */
  --accent-strong: #064545;
  --accent-soft: #dff1ef;
  --layer1: #0a6666;          /* directory infrastructure */
  --layer1-soft: #dff1ef;
  --layer2: #8a4b08;          /* balanced wallets / circles */
  --layer2-soft: #fbead2;
  --future: #5b5f8f;
  --future-soft: #eceefa;
  --warn-bg: #fff3d3;
  --warn-text: #5a4200;
  --warn-line: #e0bd5a;
  --ok: #17663a;
  --code-bg: #eeece4;
  --focus: #b13a00;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161a; --surface: #1a2026; --surface-2: #232b32; --text: #e8ebee; --muted: #aab3bb; --line: #36404a;
    --accent: #66cdcd; --accent-strong: #9be3e3; --accent-soft: #14393a; --layer1: #66cdcd; --layer1-soft: #14393a;
    --layer2: #f0b46a; --layer2-soft: #3a2a14; --future: #a9aef0; --future-soft: #25284a;
    --warn-bg: #3a2f10; --warn-text: #ffe3a0; --warn-line: #7a6320; --ok: #6fd69a; --code-bg: #232b32; --focus: #ffb27a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161a; --surface: #1a2026; --surface-2: #232b32; --text: #e8ebee; --muted: #aab3bb; --line: #36404a;
  --accent: #66cdcd; --accent-strong: #9be3e3; --accent-soft: #14393a; --layer1: #66cdcd; --layer1-soft: #14393a;
  --layer2: #f0b46a; --layer2-soft: #3a2a14; --future: #a9aef0; --future-soft: #25284a;
  --warn-bg: #3a2f10; --warn-text: #ffe3a0; --warn-line: #7a6320; --ok: #6fd69a; --code-bg: #232b32; --focus: #ffb27a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--text); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
img, svg { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.prose-wrap { max-width: 820px; }

/* ---- header and navigation ---- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.02rem; line-height: 1.2; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.nav-wide { display: none; }
.nav-wide ul, .nav-narrow ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.nav-wide a, .nav-narrow a { text-decoration: none; color: var(--text); padding: 6px 2px; display: inline-block; }
.nav-wide a[aria-current="page"], .nav-narrow a[aria-current="page"] { color: var(--accent); font-weight: 700; text-decoration: underline; }
.nav-narrow { width: 100%; }
.nav-narrow summary { cursor: pointer; font-weight: 600; padding: 8px 0; list-style: none; }
.nav-narrow summary::-webkit-details-marker { display: none; }
.nav-narrow summary::after { content: " \25BE"; }
.nav-narrow ul { flex-direction: column; padding: 4px 0 8px; }
.theme { font: inherit; font-size: .85rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
@media (min-width: 960px) {
  .nav-wide { display: block; }
  .nav-narrow { display: none; }
  .site-header .wrap { flex-wrap: nowrap; }
}

/* ---- draft banner ---- */
.draft-bar { background: var(--warn-bg); color: var(--warn-text); border-bottom: 1px solid var(--warn-line); font-size: .9rem; }
.draft-bar .wrap { padding-top: 6px; padding-bottom: 6px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); vertical-align: middle; }
.badge.built { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.badge.future { background: var(--future-soft); color: var(--future); border-color: var(--future); }
.badge.l1 { background: var(--layer1-soft); color: var(--layer1); border-color: var(--layer1); }
.badge.l2 { background: var(--layer2-soft); color: var(--layer2); border-color: var(--layer2); }

/* ---- typography ---- */
main { padding: 20px 0 48px; }
h1 { font-size: 1.85rem; line-height: 1.2; margin: .5rem 0 .6rem; }
h2 { font-size: 1.38rem; line-height: 1.25; margin: 2.2rem 0 .6rem; padding-top: .4rem; }
h3 { font-size: 1.12rem; line-height: 1.3; margin: 1.6rem 0 .4rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
h2[id], h3[id], h4[id] { scroll-margin-top: 12px; }
.anchor { margin-left: .35rem; text-decoration: none; opacity: .0; font-size: .85em; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: .8; }
p, ul, ol { margin: .7rem 0; }
li { margin: .25rem 0; }
.lead { font-size: 1.12rem; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--code-bg); padding: .08em .35em; border-radius: 4px; font-size: .88em; overflow-wrap: anywhere; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: .84rem; line-height: 1.5; border: 1px solid var(--line); max-width: 100%; }
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
blockquote { margin: 1rem 0; padding: .1rem 1rem; border-left: 4px solid var(--accent); background: var(--surface); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); max-width: 100%; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: .9rem; overflow-wrap: normal; word-break: normal; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); overflow-wrap: break-word; min-width: 6rem; }
th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td code, th code { white-space: nowrap; }
table.wide td, table.wide th { min-width: 9rem; }

/* ---- boxes ---- */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 1rem 0; }
.box h2, .box h3 { margin-top: .2rem; }
.status { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); border-radius: 10px; padding: 12px 16px; margin: 1.2rem 0; }
.status h2 { margin: 0 0 .3rem; font-size: 1.1rem; padding: 0; color: inherit; }
.status ul { margin: .3rem 0; padding-left: 1.2rem; }
.status a { color: inherit; }
.note { border-left: 4px solid var(--accent); padding: .2rem .9rem; background: var(--surface); margin: 1rem 0; }
.warn { border-left: 4px solid var(--layer2); padding: .2rem .9rem; background: var(--layer2-soft); margin: 1rem 0; color: var(--text); }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 1rem 0; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.card h3 { margin-top: .2rem; }
.card.l1 { border-top: 5px solid var(--layer1); }
.card.l2 { border-top: 5px solid var(--layer2); }
.card.future { border-top: 5px dashed var(--future); }
.links-list { list-style: none; padding: 0; }
.links-list li { margin: .5rem 0; }
.links-list strong { display: block; }

/* ---- diagrams (inline SVG, drawn 360 units wide so text stays readable on phones) ---- */
figure.diagram { margin: 1.2rem 0; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
figure.diagram svg { display: block; width: 100%; max-width: 560px; margin: 0 auto; height: auto; }
figure.diagram figcaption { font-size: .88rem; color: var(--muted); text-align: center; padding: 4px 8px 2px; }
svg text { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; fill: var(--text); }
svg .t-muted { fill: var(--muted); }
svg .t-l1 { fill: var(--layer1); font-weight: 700; }
svg .t-l2 { fill: var(--layer2); font-weight: 700; }
svg .t-future { fill: var(--future); font-weight: 700; }
svg .b-base { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
svg .b-l1 { fill: var(--layer1-soft); stroke: var(--layer1); stroke-width: 2; }
svg .b-l2 { fill: var(--layer2-soft); stroke: var(--layer2); stroke-width: 2; }
svg .b-future { fill: var(--future-soft); stroke: var(--future); stroke-width: 2; stroke-dasharray: 6 4; }
svg .b-key { fill: var(--warn-bg); stroke: var(--warn-line); stroke-width: 2; }
svg .ln { stroke: var(--muted); stroke-width: 2; fill: none; }
svg .ln-key { stroke: var(--layer2); stroke-width: 3; fill: none; }
svg .arrow-fill { fill: var(--muted); }
svg .zone-gentle { fill: var(--layer1-soft); }
svg .zone-strong { fill: var(--layer2-soft); }
svg .zone-spend { fill: var(--future-soft); }
.two-layers { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .two-layers { grid-template-columns: 1fr 1fr; } }
.two-layers figure.diagram { margin: 0; }

/* ---- table of contents and page layout ---- */
.with-toc { display: block; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; margin: 1rem 0; font-size: .92rem; }
.toc summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.toc ol, .toc ul { list-style: none; padding-left: 0; margin: .2rem 0 .6rem; }
.toc ul ul, .toc ol ol { padding-left: 1rem; }
.toc a { text-decoration: none; display: inline-block; padding: 2px 0; }
@media (min-width: 1100px) {
  .with-toc { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 32px; align-items: start; }
  .with-toc .toc { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow: auto; margin-top: 0; }
  .toc summary { pointer-events: none; }
}
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 2rem; font-size: .95rem; }

/* ---- kinds page ---- */
.kind { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 12px; margin: 1.2rem 0; }
.kind dl { display: grid; grid-template-columns: 1fr; gap: 2px 14px; margin: .6rem 0; }
.kind dt { font-weight: 700; margin-top: .5rem; }
.kind dd { margin: 0; }
@media (min-width: 720px) { .kind dl { grid-template-columns: 11rem 1fr; } .kind dt { margin-top: 0; } }
details.example { margin: .8rem 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; background: var(--bg); }
details.example summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details > summary { cursor: pointer; }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--muted); padding: 18px 0 30px; }
.site-footer p { margin: .35rem 0; }
.site-footer a { color: var(--accent); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .site-header, .nav-narrow, .theme, .toc { display: none; } body { background: #fff; color: #000; } }
