/* You may freely reuse this code for any purpose */

@page {
  size: letter landscape;
  margin: 20mm;
  padding: 5mm 0;
  border-top: thin solid black;
  border-bottom: thin solid black;
  @top-left {
    font-size: 10pt;
    vertical-align: bottom;
    margin: 0.3em 0;
  }
  @top-right {
    font-size: 10pt;
    vertical-align: bottom;
    margin: 0.3em 0;
  }
  @bottom-left {
    font-size: 10pt;
    vertical-align: top;
    margin: 0.3em 0;
  }
  @bottom-right {
    font-size: 10pt;
    vertical-align: top;
    margin: 0.3em 0;
  }
}

/* assign values to header/footer strings */

title { string-set: title content() }
h2, h3 { string-set: headers content() }
div.head h2 { string-set: w3crec content() }

/* place headers/footers on left/right pages */

@page :left {
  @top-left { content: string(w3crec) }
  @top-right { content: string(title) }
  @bottom-left { content: counter(page) }
  @bottom-right { content: string(headers) }
}

@page :right {
  @top-right { content: string(w3crec) }
  @top-left { content: string(title) }
  @bottom-right { content: counter(page) }
  @bottom-left { content: string(headers, first) }
}

/* avoid marginalia on first page */

@page :first {
  border-top: none;
  border-bottom: none;
  @top-right { content: normal }
  @top-left { content: normal }
  @bottom-left { content: normal }
  @bottom-right { content: normal }
}

/* general statements */

body { font: 10pt serif; padding: 0 }
h1, h2, h3, h4, h5, h6, dt { page-break-after: avoid }
* { text-decoration: none }
img { max-width: 100% }

/* add leader/page numbers to existing TOC */

ul.toc, ul.toc li  {
  font-weight: normal;
  margin-left: 0;
}

ul.toc ul.toc {
  font-weight: normal;
  margin-left: 2em;
}

ul.toc a::after {
  content: leader('.') target-counter(attr(href), page);
}

/* document specific code */

.principlelab, .constraintlab, .propertylab, .practicelab, .storylab { 
  padding: 0.3em 1em;
  display: block;
  margin: 0;
}

.boxedtext p { margin-top: 0 }
.boxedtext { page-break-inside: avoid }