/* Terrafold website. Hand-written; `cargo xtask site` replaces the asset placeholders with hashed URLs. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/assets/fonts/Inter-Regular.5b7df5e764.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/assets/fonts/Inter-Medium.bcce249253.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/assets/fonts/Inter-SemiBold.e9a8eeb246.ttf") format("truetype"); }

:root {
  color-scheme: light dark;
  --bg: #f6f7f2;
  --bg-alt: #eceee4;
  --surface: #ffffff;
  --text: #1d2420;
  --text-dim: #4f5a53;
  --border: #d6dacd;
  --accent: #2f6b3a;
  --accent-strong: #24552d;
  --accent-text: #ffffff;
  --link: #2a6236;
  --code-bg: #e9ece2;
  --shadow: 0 1px 2px rgba(20, 30, 20, .06), 0 8px 24px rgba(20, 30, 20, .08);
  --radius: 10px;
  --max: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141917;
    --bg-alt: #1a201d;
    --surface: #1f2622;
    --text: #e6ebe6;
    --text-dim: #a5b0a8;
    --border: #313b35;
    --accent: #7cc489;
    --accent-strong: #98d6a3;
    --accent-text: #0f1a12;
    --link: #8fd19b;
    --code-bg: #26302b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
code, pre, kbd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: var(--surface); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.site-nav { display: flex; gap: 4px 18px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.site-nav a { color: var(--text-dim); text-decoration: none; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.button { display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 600; text-decoration: none; border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.button:hover { color: var(--text); border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.primary:hover { background: var(--accent-strong); color: var(--accent-text); }
.site-nav .button { padding: 6px 14px; }

/* landing */
.hero { padding-top: 56px; padding-bottom: 24px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 14px; max-width: 18ch; }
.hero .lead { font-size: 1.2rem; color: var(--text-dim); max-width: 60ch; margin: 0 0 26px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero figure { margin: 40px 0 0; }
.shot { border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; background: var(--bg-alt); }
figcaption { color: var(--text-dim); font-size: .9rem; margin-top: 10px; }
section { padding: 48px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
section h2 { font-size: 1.8rem; margin: 0 0 8px; }
section .intro { color: var(--text-dim); max-width: 65ch; margin: 0 0 28px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-dim); }
.split { display: grid; gap: 32px; grid-template-columns: 1fr 1fr; align-items: center; }
.split + .split { margin-top: 48px; }
.split h3 { font-size: 1.35rem; margin: 0 0 8px; }
.split p { color: var(--text-dim); }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } .split.reverse .text { order: -1; } }
.platforms { list-style: none; padding: 0; margin: 0; }
.platforms li { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.platforms li span { color: var(--text-dim); }
.note { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 14px 18px; }

/* plain pages (download, legal, contact, 404) */
.page { padding-top: 40px; padding-bottom: 64px; max-width: 820px; }
.page h1 { font-size: 2.2rem; margin: 0 0 12px; }
.legal-text { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: .85rem; }

/* docs */
.docs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; padding-top: 32px; padding-bottom: 64px; }
.docs-nav { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 90px); overflow-y: auto; }
.docs-nav h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin: 0 0 8px; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text-dim); text-decoration: none; }
.docs-nav a:hover { color: var(--text); background: var(--bg-alt); }
.docs-nav a[aria-current="page"] { color: var(--text); background: var(--bg-alt); font-weight: 600; }
.doc { max-width: 760px; }
.doc h1 { font-size: 2.1rem; margin-top: 0; }
.doc h2 { margin-top: 2em; padding-top: .3em; border-top: 1px solid var(--border); }
.doc h3 { margin-top: 1.6em; }
.doc :is(h2, h3, h4)[id] { scroll-margin-top: 80px; }
.doc table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; margin: 1em 0; font-size: .95rem; }
.doc th, .doc td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg-alt); }
.doc .center { text-align: center; }
.doc .right { text-align: right; }
table.downloads { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; margin: 1em 0; font-size: .95rem; }
table.downloads th, table.downloads td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
table.downloads th { background: var(--bg-alt); }
table.downloads td:nth-child(3) { white-space: nowrap; }
.doc blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--accent); color: var(--text-dim); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@media (max-width: 820px) {
  .docs { grid-template-columns: 1fr; gap: 16px; }
  .docs-nav { position: static; max-height: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
}

/* user guide (/guide/; xtask/src/guide.rs) */
.guide-nav .n, .guide-toc .n, .print-toc .n { display: inline-block; min-width: 1.6em; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.guide-nav h2 a { color: inherit; text-decoration: none; }
.guide-nav .guide-dl { margin: 14px 10px 0; font-size: .92rem; }
.guide-nav .guide-dl a { display: inline; padding: 0; }
.chapter-head { margin-bottom: 1.2em; }
.chapter-n { margin: 0 0 4px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.chapter-head h1 { margin: 0; }
.fig { margin: 1.6em 0; }
.fig img { margin: 0 auto; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-alt); }
.fig.narrow img { max-width: min(100%, 520px); }
.fig.small img { max-width: min(100%, 360px); }
.fig.diagram img { border: 0; background: none; border-radius: 0; }
.fig figcaption { text-align: left; }
.fig-n { font-weight: 600; color: var(--text); margin-right: .3em; }
table.numbered caption { caption-side: top; text-align: left; color: var(--text-dim); font-size: .9rem; padding-bottom: 6px; }
.box { margin: 1.6em 0; padding: 12px 18px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.box > :last-child { margin-bottom: 0; }
.box-label { margin: 0 0 4px; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.box-title { margin: 0 0 6px; font-weight: 600; }
.box-goals { background: var(--bg-alt); }
.box-why { border-left: 4px solid var(--accent); }
.box-try { border-left: 4px solid #b9852c; }
.box-try .box-label { color: #8a5f12; }
.box-warning { border-left: 4px solid #b0452f; }
.box-warning .box-label { color: #a03a26; }
.box-recap { background: var(--bg-alt); }
.box-project { border-left: 4px solid #3f6f9a; }
.box-project .box-label { color: #335d84; }
@media (prefers-color-scheme: dark) {
  .box-try .box-label { color: #e0b360; }
  .box-warning .box-label { color: #ec8c78; }
  .box-project .box-label { color: #8fb8de; }
}
.guide-toc { list-style: none; padding: 0; margin: 1.5em 0; }
.guide-toc li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.guide-toc li .n { font-weight: 600; padding-top: 1px; }
.guide-toc a { font-weight: 600; }
.guide-toc p { margin: 2px 0 0; color: var(--text-dim); font-size: .95rem; }
.shortcut-card { columns: 3 220px; column-gap: 24px; font-size: .92rem; }
.shortcut-card section { break-inside: avoid; margin-bottom: 14px; }
.shortcut-card h3 { margin: 0 0 4px; font-size: .95rem; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.shortcut-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; }
.shortcut-card dt { white-space: nowrap; }
.shortcut-card dd { margin: 0; }
.guide-print { max-width: 820px; margin: 0 auto; padding: 32px 20px 64px; }
.guide-print .cover { text-align: center; padding: 40px 0; }
.guide-print .cover-logo { width: 72px; height: 72px; margin: 0 auto 12px; }
.guide-print .cover-kicker { margin: 0; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.guide-print .cover h1 { font-size: 3rem; margin: 4px 0 10px; }
.guide-print .cover-sub { font-size: 1.2rem; color: var(--text-dim); max-width: 34ch; margin: 0 auto 28px; }
.guide-print .cover-img { border-radius: 8px; margin: 0 auto 24px; }
.guide-print .cover-meta { color: var(--text-dim); font-size: .9rem; }
.print-toc { list-style: none; padding: 0; columns: 2 260px; }
.print-toc li { padding: 3px 0; break-inside: avoid; }
.guide-print .chapter { margin-top: 64px; }
.guide-print .chapter h2 { margin-top: 1.8em; padding-top: .3em; border-top: 1px solid var(--border); }
.guide-print table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .92rem; }
.guide-print th, .guide-print td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; vertical-align: top; }
.guide-print th { background: var(--bg-alt); }
.print-note { color: var(--text-dim); }

@page { size: A4; margin: 18mm 17mm 20mm; }
@media print {
  :root { --bg: #fff; --bg-alt: #f1f3ec; --surface: #fff; --text: #1a1f1c; --text-dim: #4a544e; --border: #cfd4c6; --accent: #2f6b3a; --link: #24552d; --code-bg: #eef0e8; }
  body { background: #fff; font-size: 10.5pt; line-height: 1.5; }
  .site-header, .site-footer, .skip, .screen-only, .pager, .docs-nav { display: none !important; }
  .docs { display: block; padding: 0; }
  .wrap { max-width: none; padding: 0; }
  a { color: var(--link); text-decoration: none; }
  .guide-print { max-width: none; padding: 0; }
  .guide-print .cover { break-after: page; padding-top: 30mm; }
  .guide-print .cover-img { max-height: 105mm; width: auto; }
  .guide-print .contents { break-after: page; }
  .guide-print .chapter { break-before: page; margin-top: 0; }
  .chapter-head { margin-bottom: 8mm; }
  .chapter-head h1 { font-size: 24pt; }
  h2 { font-size: 15pt; break-after: avoid; }
  h3 { font-size: 12pt; break-after: avoid; }
  .guide-print .chapter h2 { border-top: 0; padding-top: 0; margin-top: 1.4em; }
  figure, .box, table, pre, .shortcut-card section { break-inside: avoid; }
  .fig img { max-height: 92mm; width: auto; max-width: 100%; }
  .fig.narrow img { max-width: 70%; }
  .fig.small img { max-width: 48%; }
  p, li { orphans: 3; widows: 3; }
  .shortcut-card { font-size: 8.4pt; columns: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2mm 6mm; align-items: start; }
  .shortcut-card section { margin: 0; }
  pre { white-space: pre-wrap; }
  /* the two appendices each fit on one page */
  .guide-print #shortcut-card, .guide-print #cheat-sheet { font-size: 8.6pt; line-height: 1.35; }
  .guide-print #shortcut-card .chapter-head, .guide-print #cheat-sheet .chapter-head { margin-bottom: 3mm; }
  .guide-print #shortcut-card h1, .guide-print #cheat-sheet h1 { font-size: 18pt; }
  .guide-print #shortcut-card h2, .guide-print #cheat-sheet h2 { font-size: 10.5pt; margin: 3mm 0 1mm; }
  .guide-print #shortcut-card p, .guide-print #cheat-sheet p { margin: 1mm 0; }
  .guide-print #shortcut-card table { font-size: 8pt; margin: 1mm 0; break-inside: auto; }
  .guide-print #shortcut-card th, .guide-print #shortcut-card td { padding: 1px 5px; }
  .guide-print #shortcut-card kbd { font-size: 7.2pt; padding: 0 .25em; line-height: 1.25; }
  .guide-print #shortcut-card .shortcut-card dl { gap: 0 8px; line-height: 1.25; }
  .guide-print #shortcut-card .shortcut-card h3 { font-size: 9.5pt; margin: 0 0 1mm; }
  .guide-print #shortcut-card td:first-child { white-space: nowrap; }
  .guide-print #cheat-sheet ol { margin: 0; padding-left: 5mm; }
  .guide-print #cheat-sheet li { margin: 0; }
  .guide-print #cheat-sheet .fig { margin: 2mm 0 0; }
}
@page :first { margin: 15mm; }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--text-dim); font-size: .92rem; }
.site-footer .wrap { display: flex; gap: 8px 24px; flex-wrap: wrap; justify-content: space-between; }
.site-footer nav { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.site-footer a { color: var(--text-dim); }
