/* Draughts AI course site. Colours and type follow new.compator.com. */
:root {
  --navy: #044e73;
  --blue: #0a97d9;
  --green: #56c02b;
  --green-dark: #3f8c1f;
  --ink: #111318;
  --ink-body: #3e414b;
  --muted: #5b5f6b;
  --surface: #fff;
  --canvas: #f7f6f2;
  --sand: #efede7;
  --border: #e7e4dc;
  --mint: #eaf6e1;
  --mint-border: #d5e7c7;
  --font: Calibri, Carlito, "Segoe UI", Candara, "Trebuchet MS", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 150px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
}
a { color: var(--navy); }
a:hover { color: var(--blue); }
img { max-width: 100%; height: auto; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 999px;
}
.skip:focus { left: 8px; z-index: 10; }

/* Footer (the header is in compator-nav.css) */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px var(--gutter);
  color: var(--muted); font-size: 15px;
}

/* Layout */
.layout { max-width: 1440px; margin: 0 auto; padding: 32px var(--gutter) 64px; }
.layout.book { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; }
.layout.home main, .layout.book main { min-width: 0; }
.layout.book main { max-width: 820px; }

.toc { position: sticky; top: 146px; align-self: start; max-height: calc(100vh - 160px); overflow: auto; font-size: 15px; }
.toc-title { font-weight: 700; margin: 0 0 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--ink-body); text-decoration: none; line-height: 1.35; }
.toc li a:hover { background: var(--sand); color: var(--ink); }

@media (max-width: 900px) {
  .layout.book { display: block; }
  .toc { position: static; max-height: none; margin-bottom: 24px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
}

/* Type */
h1, h2, h3, h4 { color: var(--ink); line-height: 1.15; letter-spacing: -0.02em; }
main h1 { font-size: clamp(1.9rem, 1.5rem + 1vw, 2.5rem); margin: 56px 0 16px; padding-top: 24px; border-top: 1px solid var(--border); }
main h2 { font-size: 1.45rem; margin: 36px 0 12px; }
main h3 { font-size: 1.15rem; margin: 28px 0 8px; }
p, li { color: var(--ink-body); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.lede { font-size: 1.2rem; color: var(--ink-body); max-width: 60ch; }

/* Book header */
.book-head { padding-bottom: 8px; }
.book-head .book-title { border: 0; padding: 0; margin: 0 0 12px; font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem); letter-spacing: -0.025em; }
.credit { color: var(--muted); font-weight: 600; margin: 0 0 16px; }
.actions { margin: 16px 0 0; }
.button, .demo-link {
  display: inline-block; background: var(--ink); color: #fff; text-decoration: none;
  font-weight: 600; padding: 10px 20px; border-radius: 999px;
}
.button:hover, .demo-link:hover { background: var(--navy); color: #fff; }

/* Code */
code { font-family: var(--mono); font-size: 0.88em; background: var(--sand); padding: 1px 5px; border-radius: 4px; }
pre {
  background: var(--ink); color: #e8eaee; border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; font-size: 14px; line-height: 1.5; margin: 16px 0 20px;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: pre; }

/* Teacher's notes, figures, tables */
.teacher-note {
  background: var(--mint); border: 1px solid var(--mint-border); border-left: 4px solid var(--green);
  border-radius: var(--radius); padding: 4px 20px; margin: 20px 0;
}
.teacher-note p { color: var(--ink); }
figure { margin: 24px 0; }
figure img, main > p > img { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
figcaption, .caption p { color: var(--muted); font-size: 15px; font-style: italic; }
table { border-collapse: collapse; width: 100%; margin: 16px 0 24px; font-size: 15px; background: var(--surface); display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--sand); }
td p, th p { margin: 0 0 6px; }

/* Home page */
.hero { background: #06070b; color: #fff; border-radius: 24px; padding: clamp(32px, 6vw, 72px); margin-bottom: 32px; }
.hero h1 { color: #fff; margin: 0 0 16px; border: 0; padding: 0; font-size: clamp(2.6rem, 1.6rem + 4vw, 4.5rem); letter-spacing: -0.025em; }
.hero .eyebrow { color: #c7cbd4; }
.hero .lede { color: #d7dae1; margin: 0; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; }
.card h2 { font-size: 1.3rem; margin: 0 0 8px; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { color: var(--navy); }
.card p { margin: 0 0 16px; }
.card-links { margin-top: auto !important; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.note { color: var(--muted); margin-top: 32px; }

/* Copy button on code listings (added by code-copy.js) */
.code-block { position: relative; margin: 16px 0 20px; }
.code-block pre { margin: 0; padding-top: 44px; }
.copy-button {
  position: absolute; top: 8px; right: 8px;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  color: #e8eaee; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22);
}
.copy-button:hover { background: rgba(255, 255, 255, 0.16); }
.copy-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.copy-button.copied { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.copy-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
