/* GaiaBasic — site styles */
:root {
  --bg: #f7f5ef;
  --bg-alt: #efece2;
  --surface: #ffffff;
  --ink: #1d2320;
  --ink-soft: #4a524d;
  --muted: #6c746f;
  --line: #dcd8cb;
  --accent: #2f6b4f;
  --accent-ink: #ffffff;
  --accent-soft: #e2eee7;
  --link: #24593f;
  --code-bg: #1b201d;
  --code-ink: #e6eae5;
  /* element palette (from the author's diagrams) */
  --el-idea: #e2b93b;
  --el-matter: #8e9590;
  --el-exp: #e07a3a;
  --el-identity: #23407a;
  --el-op: #6fb2d9;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 8px 24px rgba(20, 30, 25, .06);
  --radius: 14px;
  --maxw: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --bg-alt: #161b18; --surface: #1b211e; --ink: #e8ece8; --ink-soft: #bfc7c1;
    --muted: #8f9892; --line: #2c3530; --accent: #6cc093; --accent-ink: #0d130f; --accent-soft: #1d2e25;
    --link: #8dd3ad; --code-bg: #0b0e0c; --code-ink: #e6eae5; --el-identity: #6f8fd6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --bg-alt: #161b18; --surface: #1b211e; --ink: #e8ece8; --ink-soft: #bfc7c1;
  --muted: #8f9892; --line: #2c3530; --accent: #6cc093; --accent-ink: #0d130f; --accent-soft: #1d2e25;
  --link: #8dd3ad; --code-bg: #0b0e0c; --code-ink: #e6eae5; --el-identity: #6f8fd6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: "Fraunces", Georgia, serif; line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
code, pre { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
:not(pre) > code { background: var(--accent-soft); padding: .1em .35em; border-radius: 5px; font-size: .9em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink-soft); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--bg-alt); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; width: 38px; height: 38px; display: inline-grid; place-items: center; cursor: pointer; }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav .icon-btn { align-self: flex-start; margin-top: 6px; }
}

/* sections */
section { padding: 72px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 600; color: var(--accent); margin-bottom: .6em; }
.lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 46em; }
.section-head { max-width: 760px; margin-bottom: 36px; }

/* hero */
.hero { padding: 80px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 em { font-style: italic; color: var(--accent); }
.badge { display: inline-flex; gap: 8px; align-items: center; font-size: .82rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); margin-bottom: 18px; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--el-exp); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:hover { filter: brightness(1.05); text-decoration: none; }

/* cards & grids */
.grid { display: grid; gap: 20px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card .tag { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
a.card { color: inherit; text-decoration: none; display: block; transition: transform .15s ease; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.step-num { font-family: "Fraunces", Georgia, serif; font-size: 2rem; color: var(--accent); line-height: 1; margin-bottom: 10px; }

/* element chips */
.chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.chip::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--c, var(--accent)); flex: none; }
.el-idea { --c: var(--el-idea); } .el-matter { --c: var(--el-matter); } .el-exp { --c: var(--el-exp); }
.el-identity { --c: var(--el-identity); } .el-op { --c: var(--el-op); }
.card.el { border-top: 5px solid var(--c); }

/* code */
pre { background: var(--code-bg); color: var(--code-ink); padding: 20px 22px; border-radius: var(--radius); overflow-x: auto; font-size: .88rem; line-height: 1.6; margin: 0 0 1.2em; border: 1px solid #000; }
pre .k { color: #f2a65a; } pre .s { color: #a9d98b; } pre .c { color: #7d8a82; font-style: italic; }
pre .n { color: #8fc6ff; } pre .f { color: #f5d778; }
.code-label { font-size: .8rem; color: var(--muted); margin: -4px 0 8px; font-family: "JetBrains Mono", monospace; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.4em; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-alt); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

/* notes */
.note { border-left: 4px solid var(--el-exp); background: var(--surface); padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 0 0 1.4em; color: var(--ink-soft); }
.note strong { color: var(--ink); }

/* docs layout */
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-top: 48px; padding-bottom: 80px; }
.toc { position: sticky; top: 88px; align-self: start; font-size: .92rem; }
.toc a { display: block; padding: 5px 0; color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.toc .toc-title { font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.doc h2 { margin-top: 1.8em; padding-top: .4em; border-top: 1px solid var(--line); }
.doc h2:first-of-type { margin-top: 0; border-top: 0; }
.doc h3 { margin-top: 1.4em; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin-bottom: .35em; }
@media (max-width: 900px) { .doc-layout { grid-template-columns: 1fr; gap: 16px; } .toc { position: static; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--surface); } }

.page-hero { padding: 64px 0 36px; border-bottom: 1px solid var(--line); }

/* example blocks */
.example { padding: 36px 0; border-top: 1px solid var(--line); }
.example:first-child { border-top: 0; }
.example .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* diagram */
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.diagram text { font-family: "Inter", sans-serif; fill: var(--ink); }
.diagram .sub { fill: var(--muted); font-size: 11px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-footer a { color: var(--ink-soft); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* project pages */
.page-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.page-hero .eyebrow a { color: inherit; text-decoration: none; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.pager a.next { text-align: right; }
@media (max-width: 620px) { .pager { grid-template-columns: 1fr; } .pager a.next { text-align: left; } }
.factsheet { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 20px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.factsheet div { padding: 12px 16px; border-right: 1px solid var(--line); min-width: 0; }
.factsheet div:last-child { border-right: 0; }
.factsheet dt { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.factsheet dd { margin: 2px 0 0; font-size: .95rem; overflow-wrap: anywhere; }
@media (max-width: 760px) { .factsheet { grid-template-columns: 1fr 1fr; } .factsheet div:nth-child(2) { border-right: 0; } .factsheet div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
a.pill { text-decoration: none; } a.pill:hover { background: var(--accent); color: var(--accent-ink); }

/* language switch */
.nav a.lang-switch { font-weight: 600; font-size: .82rem; letter-spacing: .06em; border: 1px solid var(--line); padding: 7px 10px; margin-left: 4px; }
@media (max-width: 860px) { .nav a.lang-switch { align-self: flex-start; margin: 6px 0 0; } }
