/* TreeSimplifier website. No external fonts or scripts: nothing loads from a third party.
 *
 * Palette: warm paper and ink with one petrol accent. The strategy illustration uses
 * PioViewer's bet colours, darker for larger sizes, so it reads like a PioViewer bar.
 * Type: the Windows 11 Segoe UI Variable family, which every customer already has
 * (TreeSimplifier runs on Windows), with the usual system faces elsewhere.
 */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --band: #f2f0eb;
  --ink: #1b1f23;
  --ink-2: #464d55;
  --ink-3: #6b7178;
  --line: #e4e0d8;
  --accent: #0e6672;
  --accent-hover: #0b5560;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0f1;
  --pio-mid: #e78868;
  --pio-big: #9e4631;
  --warn: #8f5500;
  --warn-soft: #fbf1de;
  --code-bg: #f2f0eb;
  --radius: 8px;
  --radius-sm: 6px;
  --max: 1120px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1c1f23; --band: #202328; --ink: #e8eaed; --ink-2: #bcc1c7;
    --ink-3: #8e949b; --line: #2e3238; --accent: #4fb3bf; --accent-hover: #6cc3cd;
    --accent-ink: #0b1a1c; --accent-soft: #16353a;
    --warn: #e0a94a; --warn-soft: #2e2512; --code-bg: #24282d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --surface: #1c1f23; --band: #202328; --ink: #e8eaed; --ink-2: #bcc1c7;
  --ink-3: #8e949b; --line: #2e3238; --accent: #4fb3bf; --accent-hover: #6cc3cd;
  --accent-ink: #0b1a1c; --accent-soft: #16353a;
  --warn: #e0a94a; --warn-soft: #2e2512; --code-bg: #24282d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.4vw, 3.1rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 2.8vw, 1.95rem); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.15rem; font-weight: 650; }
p { margin: 0 0 1em; }
code, kbd {
  font-family: var(--mono); font-size: .86em; background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 4px; padding: .08em .35em;
  overflow-wrap: anywhere;
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-3); }
.small { font-size: .9rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.brand:hover { color: var(--ink); }
.brand img { flex: none; }
.brand .beta-tag {
  font-family: var(--font); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 2px 6px;
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--band); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 650; }
.nav .btn { margin-left: 8px; }
.menu-toggle {
  display: none; margin-left: auto; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 6px 12px; font: inherit; cursor: pointer;
}
@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column;
    align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav .btn { margin: 8px 0 0; }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650;
  font-size: .95rem; padding: 10px 18px; border-radius: var(--radius-sm); text-decoration: none;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); line-height: 1.2;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); color: var(--accent); }
.nav .btn { padding: 8px 14px; color: var(--accent-ink); }
.nav .btn:hover, .nav .btn[aria-current="page"] { background: var(--accent-hover); color: var(--accent-ink); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { padding: 64px 0 56px; border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 34em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero .fine { color: var(--ink-3); font-size: .88rem; margin-top: 16px; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; gap: 36px; } .hero { padding: 44px 0; } }

/* Strategy illustration: one decision node, as a solver would show it. */
.demo {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; font-size: .92rem;
}
.demo .demo-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--ink-3); margin-bottom: 16px; font-size: .82rem; }
.demo .node { font-family: var(--mono); color: var(--ink); }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 52px 1fr 76px; align-items: center; gap: 12px; }
.bar .label { font-family: var(--mono); font-size: .85rem; color: var(--ink-2); }
.bar .track { display: block; height: 14px; background: var(--band); border-radius: 3px; overflow: hidden; }
.bar .fill { display: block; height: 100%; }
.bar.mid .fill { background: var(--pio-mid); }
.bar.big .fill { background: var(--pio-big); }
.bar.win .label { color: var(--ink); font-weight: 700; }
.bar.cut .fill { background: transparent; border: 1px dashed var(--ink-3); }
.bar.cut .label { text-decoration: line-through; color: var(--ink-3); }
.bar .ev { font-family: var(--mono); text-align: right; font-size: .82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar.win .ev { color: var(--ink); font-weight: 700; }
.demo .demo-foot { display: flex; gap: 8px 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .8rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.swatch.mid { background: var(--pio-mid); }
.swatch.big { background: var(--pio-big); }
.swatch.cut { border: 1px dashed var(--ink-3); }

/* ── Sections ───────────────────────────────────────────────────────────── */
section { padding: 64px 0; }
section.alt { background: var(--band); }
.section-head { max-width: 44em; margin-bottom: 32px; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; }

.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card p { color: var(--ink-2); margin: 0; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { padding-left: 28px; position: relative; }
.checklist li::before {
  content: ""; position: absolute; left: 2px; top: .45em; width: 14px; height: 8px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg);
}

.callout {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 14px 16px; margin: 18px 0;
}
.callout.warn { border-color: transparent; background: var(--warn-soft); }
.callout p:last-child { margin: 0; }
.callout > strong:first-child { display: block; margin-bottom: 2px; }
.callout ul { margin: 8px 0 0; padding-left: 1.2em; }
.callout li + li { margin-top: 4px; }

details.faq { border-bottom: 1px solid var(--line); padding: 14px 0; }
details.faq:first-of-type { border-top: 1px solid var(--line); }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details.faq summary::after { content: "+"; color: var(--ink-3); font-weight: 400; font-size: 1.3rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq p { color: var(--ink-2); margin: 10px 0 0; }

/* ── Documentation layout ───────────────────────────────────────────────── */
.doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; padding: 40px 16px 80px; }
@media (max-width: 900px) { .doc { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
/* Grid items default to min-width: auto, which lets a wide table widen the whole page. */
.doc > *, .release > *, .split > *, .grid > * { min-width: 0; }
.toc { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; font-size: .93rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: block; color: var(--ink-2); text-decoration: none; padding: 5px 10px; border-radius: 4px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--ink); background: var(--band); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 900px) {
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); }
  .toc ol { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) { .toc ol { grid-template-columns: 1fr; } }
.prose { max-width: 50em; }
.prose > h1 { margin-bottom: .3em; }
.prose h2 { margin-top: 2.4em; padding-top: 1em; border-top: 1px solid var(--line); }
.prose h2:first-of-type { border-top: 0; padding-top: 0; }
.prose h3 { margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .3em 0; }

.table-wrap { overflow-x: auto; margin: 14px 0 20px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { background: var(--band); font-weight: 650; white-space: nowrap; }
td:first-child { font-weight: 600; white-space: nowrap; }
td.def { font-family: var(--mono); font-size: .84rem; white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (max-width: 620px) { th, td:first-child, td.def { white-space: normal; } th, td { padding: 8px 10px; } }

.menu-path { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); }

.figure { margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.figure figcaption { font-size: .88rem; color: var(--ink-3); margin-top: 10px; }
.flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.flow .box { flex: 1 1 140px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg); font-size: .9rem; }
.flow .box b { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 2px; }
.flow .arrow { align-self: center; color: var(--ink-3); }
@media (max-width: 620px) { .flow .arrow { transform: rotate(90deg); width: 100%; text-align: center; } }

/* Screenshots of the app. Each links to the full-size image, so no script is needed to enlarge it. */
.shot { margin: 20px 0 24px; }
.shot a { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.shot a:hover { border-color: var(--accent); }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { font-size: .88rem; color: var(--ink-3); margin-top: 8px; }
.card .shot:last-child { margin-bottom: 0; }
.shot a { cursor: zoom-in; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 12, 14, .82); }
.lightbox img { display: block; max-width: 96vw; max-height: calc(96vh - 48px); width: auto; height: auto; border-radius: var(--radius-sm); }
.lightbox-caption:empty { display: none; }
.lightbox-caption { color: #e8eaed; font-size: .9rem; margin: 10px 0 0; text-align: center; }
.lightbox-close {
  position: fixed; top: 12px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: #1b1f23; font-size: 28px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: #fff; }
.gallery { display: grid; gap: 18px; }
.gallery .shot { margin: 0; }
.gallery .main a { box-shadow: 0 12px 32px -18px rgba(0, 0, 0, .35); }

/* ── Download ───────────────────────────────────────────────────────────── */
.release { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .release { grid-template-columns: 1fr; } }
.release .card h2 { margin-bottom: .2em; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .93rem; margin: 16px 0 4px; }
.meta dt { color: var(--ink-3); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.hash { font-size: .78em; overflow-wrap: anywhere; }
.verify-head { margin-top: 22px; }
.card .hash-line { margin: 8px 0 12px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: var(--band); padding: 32px 0 40px; color: var(--ink-3); font-size: .9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

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