/* GeoAIGames documentation. One stylesheet, no framework.
   Palette: deep-ocean ink, map-sea blue, land green, sand highlight. */
:root {
  --bg: #f7f5ef;
  --bg2: #ffffff;
  --ink: #142231;
  --muted: #5a6877;
  --line: #e2ddd0;
  --accent: #1667b8;
  --accent2: #e3a72f;
  --good: #2f8f5b;
  --code-bg: #eef1f4;
  --sea: #d9e9f5;
  --radius: 14px;
  --sidebar: 270px;
  --top: 60px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1620;
    --bg2: #15202c;
    --ink: #e6edf3;
    --muted: #9aabbd;
    --line: #253445;
    --accent: #5aa9ff;
    --accent2: #f0b84a;
    --good: #4cc38a;
    --code-bg: #1b2836;
    --sea: #13283c;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bg2); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--top);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background:
    linear-gradient(90deg, rgba(22,103,184,.10) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(22,103,184,.10) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand small { margin-left: 6px; font-weight: 600; font-size: 12px; color: var(--bg2); background: var(--accent); padding: 2px 7px; border-radius: 999px; vertical-align: 2px; }
.logo { width: 30px; height: 30px; color: var(--accent); }
.menu-btn { display: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); padding: 9px 9px; flex-direction: column; justify-content: space-between; cursor: pointer; }
.menu-btn span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search input {
  width: 100%; height: 38px; padding: 0 36px 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: 15px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search kbd { position: absolute; right: 10px; top: 9px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; max-height: 70vh; overflow: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: 6px;
}
.search-results a { display: block; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--sea); }
.search-results b { display: block; font-size: 14px; }
.search-results small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.search-results mark { background: rgba(227,167,47,.35); color: inherit; border-radius: 3px; }
.search-results .empty { padding: 10px; color: var(--muted); font-size: 14px; }
.version-select { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.version-select select { height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 8px; font-size: 14px; }
.play { background: var(--good); color: #fff; text-decoration: none; font-weight: 600; padding: 7px 14px; border-radius: 10px; font-size: 14px; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 22px 14px 40px 18px; border-right: 1px solid var(--line); }
.sidebar ul { list-style: none; margin: 0 0 18px; padding: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 15px; }
.sidebar a:hover { background: var(--sea); }
.sidebar a[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 600; }
.nav-title { margin: 6px 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.scrim { display: none; }
main { padding: 26px clamp(18px, 4vw, 56px) 60px; min-width: 0; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { margin: 0 7px; opacity: .6; }

/* ---- article ---- */
.doc { max-width: 820px; }
.doc h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.2; margin: 6px 0 18px; letter-spacing: -.01em; }
.doc h2 { font-size: 24px; margin: 40px 0 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 19px; margin: 28px 0 8px; }
.doc h4 { font-size: 16px; margin: 22px 0 6px; }
.doc .anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor { opacity: 1; }
.doc p, .doc li { max-width: 74ch; }
.doc li { margin: 4px 0; }
.doc code { background: var(--code-bg); padding: .1em .35em; border-radius: 6px; }
.doc pre { background: var(--code-bg); padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; line-height: 1.5; }
.doc pre code { background: none; padding: 0; }
.doc blockquote { margin: 16px 0; padding: 4px 16px; border-left: 4px solid var(--accent2); background: var(--bg2); border-radius: 0 10px 10px 0; }
.table-wrap { overflow-x: auto; margin: 14px 0 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc th, .doc td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc th { background: var(--sea); font-weight: 600; }
.doc tr:last-child td { border-bottom: 0; }
.toc { margin: 0 0 24px; padding: 10px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.toc summary { cursor: pointer; font-weight: 600; }
.toc ul { margin: 8px 0 2px; padding-left: 18px; columns: 2; column-gap: 28px; }
.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 15px; }
.banner.old { background: rgba(227,167,47,.18); border: 1px solid rgba(227,167,47,.5); }
.banner.draft { background: rgba(200,60,60,.12); border: 1px solid rgba(200,60,60,.4); }
.prevnext { display: flex; justify-content: space-between; gap: 14px; max-width: 820px; margin-top: 44px; }
.prevnext a { flex: 1; display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); text-decoration: none; font-weight: 600; }
.prevnext a small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.prevnext .next { text-align: right; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: 820px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 18px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* ---- landing ---- */
.hero { padding: 26px 0 8px; max-width: 820px; }
.hero .eyebrow { color: var(--good); font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; margin: 0; }
.hero h1 { font-size: clamp(34px, 6vw, 52px); margin: 6px 0 10px; border: 0; }
.hero .lead { font-size: 19px; color: var(--muted); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 12px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 30px 0; max-width: 1000px; }
.card { display: block; padding: 16px 18px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 17px; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.machine { max-width: 820px; }
.machine h2 { border: 0; font-size: 20px; }

/* ---- small screens ---- */
@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--top); left: 0; bottom: 0; width: min(84vw, 320px); height: auto; z-index: 40;
    background: var(--bg2); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--top) 0 0 0; background: rgba(0,0,0,.35); z-index: 30; }
  .version-select span, .search kbd { display: none; }
  .toc ul { columns: 1; }
}
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand span { display: none; }
  .play { display: none; }
  .version-select select { max-width: 92px; }
  main { padding-top: 18px; }
  .doc h2 { font-size: 21px; }
  .prevnext { flex-direction: column; }
}
@media print {
  .topbar, .sidebar, .prevnext, .site-footer { display: none; }
  .layout { display: block; }
}
