/* ==========================================================================
   notes.css: COMP5001 weekly notes (HTML -> A4 PDF with python3 build.py N)
   Same look as the ACCF5002 seminar sheets: Figtree body, Playfair Display
   headings, deep-purple header band, green rule under each section heading.
   ========================================================================== */
:root {
  --deep: #291647; --bright: #C68EFD; --green: #D4EF70; --ink: #6F8A1E;
  --grey: #56565A; --light: #E6EBEB; --mute: #8C8C97;
  --code-ink: #6B2FB3; --code-bg: #F4F1F8;
  --lilac: rgba(198, 142, 253, 0.13); --lime: rgba(212, 239, 112, 0.28);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Figtree, system-ui, sans-serif; color: var(--deep); background: #fff; line-height: 1.55; font-size: 17px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
a { color: var(--ink); }

/* ---- Header ---------------------------------------------------------------- */
header { background: var(--deep); color: #fff; padding: 26px 0 22px; }
header .kicker { color: var(--bright); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; }
header h1 { font-family: "Playfair Display", Georgia, serif; font-size: 42px; margin: 4px 0 6px; line-height: 1.1; }
header .sub { margin: 0; color: var(--green); font-weight: 600; }
header .links { margin: 12px 0 0; font-size: 14.5px; color: var(--light); }
header .links a { color: var(--light); }
.credit { color: var(--grey); font-size: 13px; margin: 10px 0 0; }

main { padding: 12px 0 40px; }

/* ---- Headings ---------------------------------------------------------------- */
h2 { font-family: "Playfair Display", Georgia, serif; font-size: 27px; margin: 36px 0 6px; line-height: 1.2; }
h2::after { content: ""; display: block; width: 56px; height: 4px; background: var(--green); margin-top: 8px; }
h2 .num { color: var(--code-ink); margin-right: 0.3em; }
h3 { font-size: 18.5px; margin: 24px 0 6px; }
p { margin: 8px 0; }
ul, ol { margin: 8px 0; padding-left: 1.4em; }
li { margin: 4px 0; }
strong { font-weight: 800; }

/* ---- Inline code and code blocks (same colours as the slides) --------------- */
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.86em; color: var(--code-ink); font-weight: 700; background: var(--code-bg); border: 1px solid #E7D2FE; border-radius: 4px; padding: 0.02em 0.3em; }
.box code, table code { background: #fff; }
pre.code, .pseudo { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; line-height: 1.55; background: var(--code-bg); border-left: 4px solid var(--bright); border-radius: 6px; padding: 10px 14px; margin: 10px 0; white-space: pre; overflow-x: auto; }
pre.code .c { color: var(--grey); font-style: italic; }
pre.code .k, .pseudo b { color: var(--deep); font-weight: 800; }
.pseudo .fn { color: var(--code-ink); font-weight: 700; }
.pseudo .new { background: rgba(212, 239, 112, 0.7); border-radius: 3px; }

/* ---- Boxes ---------------------------------------------------------------------- */
.box { border-left: 5px solid var(--deep); border-radius: 6px; padding: 12px 16px; margin: 14px 0; }
.box h4 { margin: 0 0 6px; font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.box p:first-of-type { margin-top: 0; }
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }
.box.aims { background: var(--lilac); }
.box.definition { background: var(--lilac); }
.box.example { background: var(--lime); border-left-color: var(--ink); }
.box.example h4 { color: #4E6514; }
.box.keyidea { background: var(--deep); color: #fff; border-left-color: var(--green); }
.box.keyidea h4 { color: var(--green); }
.box.keyidea strong { color: #fff; }
.box.code { background: #F7F7F9; border-left-color: var(--bright); }
.box.code h4 { color: var(--code-ink); }

dl.terms { margin: 4px 0 0; }
dl.terms dt { font-weight: 800; margin-top: 8px; }
dl.terms dd { margin: 2px 0 0 0; }
dl.terms dd .eg { color: var(--grey); font-style: italic; }

/* ---- Figures ---------------------------------------------------------------------- */
figure { margin: 14px 0; text-align: center; }
figure svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
figcaption, .tcap { color: var(--grey); font-size: 14px; margin-top: 6px; text-align: left; }
figcaption b, .tcap b { color: var(--deep); }
/* X and O in the tic-tac-toe text, in the same colours as the board figures */
.ttt-x, .ttt-o { font-weight: 800; }
.ttt-x { color: var(--code-ink); }
.ttt-o { color: var(--ink); }
.figs { display: grid; gap: 10px 18px; margin: 14px 0; align-items: start; }
.figs.two { grid-template-columns: 1fr 1fr; }
.figs.three { grid-template-columns: 1fr 1fr 1fr; }
.figs figure { margin: 0; }
svg.maze-snap { border-radius: 4px; box-shadow: 0 1px 6px rgba(41, 22, 71, 0.18); }
.w60 svg { max-width: 60%; }
.w70 svg { max-width: 70%; }
.w40 svg { max-width: 40%; }
.w50 svg { max-width: 50%; }
.legend { color: var(--grey); font-size: 13.5px; text-align: center; margin: 4px 0 10px; }
.legend span { display: inline-block; margin: 0 8px; }
.legend i { display: inline-block; width: 13px; height: 13px; border-radius: 2px; vertical-align: -2px; margin-right: 4px; }
.legend i.dash { border: 2px dashed #6B2FB3; }

/* ---- Tables ------------------------------------------------------------------------ */
.tw { overflow-x: auto; margin: 10px 0; }
table.xt { border-collapse: collapse; font-size: 15px; width: 100%; }
table.xt th { background: var(--deep); color: #fff; font-weight: 700; text-align: left; padding: 6px 10px; }
table.xt td { padding: 5px 10px; border-bottom: 1px solid var(--light); vertical-align: top; }
table.xt tbody tr:nth-child(even) td { background: #F7F7F9; }
table.xt td.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
table.xt tr.goal td { background: rgba(212, 239, 112, 0.55) !important; font-weight: 800; }
table.xt tr.best td { background: rgba(212, 239, 112, 0.45) !important; font-weight: 700; }
table.xt.narrow { width: auto; }

/* ---- Contents, questions, answers -------------------------------------------------- */
ol.toc { columns: 2; column-gap: 28px; font-size: 15.5px; padding-left: 1.6em; margin: 12px 0 0; }
ol.toc li { margin: 2px 0; break-inside: avoid; }
ol.toc a { color: var(--deep); text-decoration: none; }
/* cross-references (Section, Figure, Table): numbered and linked by build.py */
a.ref { color: inherit; text-decoration: none; }
ol.toc a:hover, a.ref:hover { text-decoration: underline; }
ol.qs, .answers ol { padding-left: 2em; }
ol.qs > li { margin: 10px 0; }
ol.qs > li::marker { font-weight: 800; color: var(--code-ink); }
.answers { border-top: 2px solid var(--light); margin-top: 30px; }
.answers ol > li { margin: 8px 0; }

.pros { list-style: none; padding-left: 1.4em; }
.pros li { position: relative; }
.pros li::before { position: absolute; left: -1.3em; font-weight: 800; }
.pros li.yes::before { content: "\2713"; color: #5E7A12; }
.pros li.no::before { content: "\2717"; color: #D1350F; }

footer { color: var(--grey); font-size: 13.5px; border-top: 1px solid var(--light); padding-top: 12px; margin-top: 36px; }

/* ---- Search-cost notation: h (heuristic), g (cost so far), f = g + h ----------------
   Always <var class="nh">h</var>, <var class="ng">g(n)</var>, <var class="nf">f</var>, as in the slides. */
var.nh, var.ng, var.nf { font-family: Figtree, system-ui, sans-serif; font-style: italic; font-weight: 800; white-space: nowrap; }
var.nh { color: #6B2FB3; }
var.ng { color: #4E6514; }
var.nf { color: var(--deep); }
.box.keyidea var.nh { color: var(--bright); }
.box.keyidea var.ng { color: var(--green); }
.box.keyidea var.nf { color: #fff; }
.pseudo var.nh, .pseudo var.ng, .pseudo var.nf { font-family: inherit; }

/* ---- Week 3: true / false, facts, action cards ------------------------------------- */
.tf-t { color: var(--ink); font-weight: 800; }
.tf-f { color: #D1350F; font-weight: 800; }
.tf-n { color: var(--grey); font-style: italic; }
svg g.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
ul.facts { list-style: none; padding-left: 0.4em; }
ul.facts li { margin: 5px 0; }
ul.facts .arrow { color: var(--grey); font-weight: 700; margin: 0 0.35em; }
table.xt.card td:first-child { font-weight: 800; white-space: nowrap; width: 1%; }
table.xt.card tr.add td { background: rgba(212, 239, 112, 0.38) !important; }
table.xt.card tr.del td { background: rgba(236, 60, 18, 0.08) !important; }
table.xt td.c, table.xt th.c { text-align: center; }
.legend i.corner { width: auto; height: auto; padding: 0 3px; border: 1px solid #C6C6CC; background: #fff; font-style: normal; font-size: 11px; font-weight: 700; color: var(--grey); }

@media (max-width: 620px) {
  body { font-size: 16px; }
  .figs.two, .figs.three { grid-template-columns: 1fr; }
  ol.toc { columns: 1; }
  .w60 svg, .w70 svg, .w50 svg, .w40 svg { max-width: 100%; }
}

/* ---- Print: A4, page numbers in the footer ------------------------------------------ */
@page {
  size: A4;
  margin: 15mm 15mm 17mm;
  @bottom-left { content: "COMP5001 Artificial Intelligence"; font-family: Figtree, sans-serif; font-size: 8pt; color: #8C8C97; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font-family: Figtree, sans-serif; font-size: 8pt; color: #8C8C97; }
}
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 10.5pt; }
  header { padding: 16px 0 14px; }
  header h1 { font-size: 30pt; }
  .wrap { max-width: none; padding: 0; }
  h2 { font-size: 18pt; margin-top: 22px; break-after: avoid; }
  h3, h4, figcaption { break-after: avoid; }
  .tcap { break-before: avoid; }
  .box, figure, .figs, table, pre.code, .pseudo, dl.terms > div, .tw { break-inside: avoid; }
  .box.definition.long { break-inside: auto; }
  ol.qs > li, .answers li { break-inside: avoid; }
  pre.code, .pseudo { font-size: 8.8pt; }
  table.xt { font-size: 9.5pt; }
  figcaption, .tcap { font-size: 9pt; }
  .legend { font-size: 8.5pt; }
  a { color: inherit; text-decoration: none; }
  .pagebreak { break-before: page; }
}

/* ---- Week 3: truth tables and model checking ----------------------------------------- */
table.xt.tt th, table.xt.tt td { text-align: center; }
table.xt.tt td.why { text-align: left; color: var(--grey); }
table.xt.tt tr.out td:not(.why) { opacity: 0.45; text-decoration: line-through; text-decoration-color: #EC3C12; }
table.xt.tt tr.out td.why { color: #D1350F; }
table.xt.tt tr.goal td.why { color: var(--ink); }
