/* Tutto in Computer Modern (KaTeX_Main è il Computer Modern di LaTeX): sembra un documento compilato con pdflatex. */
:root {
  --ink: #111;
  --muted: #666;
  --line: #ddd;
  --paper: #fffefb;
  --side: #f6f4ee;
  --accent: #8b1a1a;
  --cm: "KaTeX_Main", "Latin Modern Roman", "Computer Modern Serif", "CMU Serif", Georgia, serif;
  --cm-tt: "KaTeX_Typewriter", "CMU Typewriter Text", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--cm); font-size: 19px; line-height: 1.45;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- indice a sinistra */
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side); border-right: 1px solid var(--line); padding: 26px 18px 40px;
}
.brand { display: block; color: var(--ink); font-size: 26px; line-height: 1.05; font-variant: small-caps; letter-spacing: .02em; margin-bottom: 18px; }
.brand span { font-style: italic; font-variant: normal; color: var(--accent); }
.brand:hover { text-decoration: none; }
#search {
  width: 100%; font: inherit; font-size: 16px; padding: 7px 10px; border: 1px solid #cfcac0; border-radius: 4px;
  background: #fff; margin-bottom: 16px;
}
#search:focus { outline: none; border-color: var(--accent); }
.toc-sec { margin: 14px 0 4px; }
.toc-sec > button {
  all: unset; cursor: pointer; display: flex; align-items: baseline; gap: 8px; width: 100%;
  font-size: 15px; font-weight: bold; text-transform: uppercase; letter-spacing: .06em; color: #333;
}
.toc-sec > button .n { color: var(--accent); }
.toc-sec > button .chev { margin-left: auto; color: var(--muted); font-weight: normal; transition: transform .15s; }
.toc-sec.closed > button .chev { transform: rotate(-90deg); }
.toc-sec .course { font-size: 13.5px; color: var(--muted); font-style: italic; margin: 1px 0 4px 0; }
.toc-sec ol { list-style: none; margin: 4px 0 0; padding: 0; }
.toc-sec.closed ol { display: none; }
.toc-sec li a { display: grid; grid-template-columns: 34px 1fr; padding: 3px 6px; border-radius: 3px; color: var(--ink); font-size: 16.5px; line-height: 1.3; }
.toc-sec li a .n { color: var(--muted); font-size: 15px; }
.toc-sec li a:hover { background: #ebe7dc; text-decoration: none; }
.toc-sec li a.on { background: var(--ink); color: #fff; }
.toc-sec li a.on .n { color: #ccc; }
.hits { list-style: none; padding: 0; margin: 0; }
.hits li a { display: block; padding: 5px 6px; color: var(--ink); font-size: 16px; border-radius: 3px; }
.hits li a:hover { background: #ebe7dc; text-decoration: none; }
.hits li a small { display: block; color: var(--muted); font-size: 13.5px; font-style: italic; }
.menu { display: none; }

/* ---------------------------------------------------------------- pagina */
.page { padding: 56px clamp(20px, 6vw, 80px) 120px; max-width: 900px; width: 100%; }
.page h1 { font-size: 34px; font-weight: normal; margin: 0 0 4px; line-height: 1.15; }
.page .crumb { color: var(--muted); font-style: italic; font-size: 16px; margin-bottom: 26px; }
.page h2 { font-size: 23px; font-weight: bold; margin: 40px 0 10px; line-height: 1.25; }
.page h2 .n { margin-right: 14px; }
.page h3 { font-size: 19px; font-weight: bold; font-style: italic; margin: 22px 0 6px; }
.page p { margin: 0 0 12px; text-align: justify; hyphens: auto; }
.page ul, .page ol { margin: 0 0 14px; padding-left: 26px; }
.page li { margin: 4px 0; text-align: justify; hyphens: auto; }
.page li::marker { color: #444; }
.page strong { font-weight: bold; }
.page em { font-style: italic; }
.page code { font-family: var(--cm-tt); font-size: .92em; }
.page hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.page blockquote {
  margin: 14px 0; padding: 10px 16px; border: 1px solid #cfcac0; background: #fbf9f3;
}
.page blockquote p:last-child { margin-bottom: 0; }
.page blockquote strong:first-child { font-variant: small-caps; letter-spacing: .03em; }
.page table { border-collapse: collapse; margin: 10px auto 18px; font-size: 17px; }
.page th, .page td { padding: 5px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.page thead th { border-bottom: 1.5px solid var(--ink); border-top: 1.5px solid var(--ink); }
.page tbody tr:last-child td { border-bottom: 1.5px solid var(--ink); }
.page .katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.page .katex { font-size: 1.04em; }

/* figure: SVG prodotti da LaTeX */
.page figure { margin: 18px auto 22px; text-align: center; }
.page figure img { max-width: 100%; height: auto; display: inline-block; }
.page figcaption { font-size: 16.5px; margin-top: 6px; color: #333; }
.page figcaption b { font-weight: bold; }

.home-sec { margin: 26px 0 8px; }
.home-sec h2 { margin: 0 0 2px; }
.home-sec p.course { color: var(--muted); font-style: italic; margin: 0 0 8px; }
.home-sec ol { columns: 2; column-gap: 32px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 17px; }
.pager a span { display: block; color: var(--muted); font-size: 14px; font-style: italic; }

@media (max-width: 860px) {
  body { grid-template-columns: minmax(0, 1fr); font-size: 18px; }
  .side { position: fixed; z-index: 20; left: 0; top: 0; width: min(320px, 86vw); transform: translateX(-102%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0, 0, 0, .12); }
  body.nav-open .side { transform: none; }
  .menu {
    display: block; position: fixed; z-index: 10; top: 10px; left: 10px; font: inherit; font-size: 16px;
    background: var(--paper); border: 1px solid #cfcac0; border-radius: 4px; padding: 5px 12px; cursor: pointer;
  }
  .page { padding-top: 64px; }
  .page h1 { font-size: 29px; }
  .home-sec ol { columns: 1; }
}
