
/* Sample style sheet for boom!, the book microformat              */
/* written  by Hakon Wium Lie and Bert Bos, November 2005          */
/* You may reuse this style sheet for any purpose without any fees */

/* Adapted to format my stuff $Revision: 1.10 $ */

html { 
  margin: 0;
  font: 9pt "Nimbus Roman No9 L", "Times New Roman", serif;
  text-align: justified;
}

body { 
	margin-top: 0px;
	padding-top: 0px;
}

h1, h2, h3, h4, h5, h6 { 
  font-family: Ariel, Helvetica, sans-serif;
  page-break-after: avoid;
} 

h1 { 
  padding: 2em 0 2em 0;
  margin: 0;
  margin-top: 8cm;
  font-size: 2.4em;
  font-weight: bold;
  border-bottom: thin solid black;
  page-break-before: always;
}

h2 { 
  font-size: 2em;
  margin-top: 4cm;
  font-weight: bold;
  border-bottom: thin solid black;
  page-break-before: always;
}

h3 { 
  font-size: 1em;
  font-weight: bold;
}

hr
{ 
  margin-top: 1.5em;
  margin-bottom: 1em;
  border-bottom: 0.1pt solid black;
  color: white;
  border-color: silver;
  background-color: silver;
  border-width: 0.1pt;
  
  height: 0.1pt;
}


/* override normal quote-mark-generating behaviour because I'm handling that by 
 * inserting entities */
q:before {
  content: none;
}

/* override normal quote-mark-generating behaviour because I'm handling that by 
 * inserting entities */
q.std:after {
  content: none;
}

/* override normal quote-mark-generating behaviour because I'm handling that by 
 * inserting entities */
q.withcontinuation:after {
  content: none;
}

blockquote {
	font-style: italic;
}

p { 
  margin: 0;
  margin-bottom: 0.6em;
  text-align: justify;
  text-indent: 1em;
}
/* p + p { text-indent: 1.3em } */
p.sidenote + p, p.caption, p.art { text-indent: 0 }

address p.author {
  margin-top: 2em;
  text-indent: 0;
  text-align: right;
}

pre {  margin: 1em 1.3em; }

a { text-decoration: none; color: black }

/* cross-references */

a.pageref::after { content: " on page " target-counter(attr(href), page); }
a.chapref::before { content: " Chapter " target-counter(attr(href), chapter) ", "; }
a.figref { content: " Figure " target-counter(attr(href), figure); }
a.tableref { content: " Table " target-counter(attr(href), figure); }


/* editors' notes */
.editnote {
  font-family: cursive;
  color: blue;
  background-color: yellow;
  float: left;
  clear: left;
  margin: 0.25em 0.25em 1em -10mm;
  padding: 0.5em 2em;
  width: 30%;
  font-size: 0.66em;
  font-style: normal;
  text-indent: 0;
  text-align: left;
  page-break-inside: avoid;
 }


/* sidenotes */

.sidenote, .boxout {
  float: left;
  clear: left;
  margin: 0 0 1em -41%;
  width: 37%;
  font-size: 0.9em;
  font-style: normal;
  text-indent: 0;
  text-align: right;
  page-break-inside: avoid;
}

.boxout {
  background-color: silver;
}

.boxin {
  margin: 0.5em 2em 0.5em 2em;
  padding: 0 1em 0 1em;
  border-top: thin solid black;
  border-bottom: thin solid black;
  font-size: 110%;
  font-style: italic;
}



/* sidebars */

div.sidebar {
  float: top-next;
  margin: 1.2em 0 1.2em 0;
  border: thin solid;
  background: #CCC;
  padding: 0.5em 1em;
  page-break-inside: avoid;
/*  column-count: 2; // not supported by kindle */
/*  column-gap: 1.5em; // not supported by kindle */
}

div.sidebar h2 {
  margin-top: 0;
}

/* figures and tables*/

div.figure {
  margin: 1em 0;
/*  counter-increment: figure; // not supported by kindle */
}

div.figure .caption, div.table .caption {
  float: left;
  clear: left;
  width: 37%;
  text-align: right;
  font-size: 0.9em;
  margin: 0 0 1.2em -40%;
}

div.figure .caption::before {
  content: "Figure " counter(figure) ": ";
  font-weight: bold;
}

div.table .caption::before {
  content: "Table " counter(table) ": ";
  font-weight: bold;
}

div.table {
  margin: 1em 0;
/*  counter-increment: table; // not supported by kindle */
}

div.table th {
  text-align: left;
}

table th, table td {
  text-align: left;
  padding-right: 1em;
}

table.lined td, table.lined th {
  border-top: none;
  border-bottom: thin dotted;
  padding-top: 0.2em;
  padding-bottom: 0.2em;
}



/* define default page and names pages: cover, blank, frontmatter */

@media: page
{
  font-size: 9pt;
}

@page {
  size: 110mm 172mm;
  

  @footnotes {
    border-top: thin solid black;
    padding-top: 0.3em;
    margin-top: 0.6em;
    margin-left: 30%;
  }
}

@page :left
{ 
  margin: 20mm 20mm 20mm 10mm;

  @top-left {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: string(title-header, first);;
    vertical-align: bottom;
    padding-bottom: 2em;
    font-variant: small-caps;
  }

  @bottom-left {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: counter(page);
    padding-top: 2em;
    vertical-align: top;
  }
}

@page :right
{  
  margin: 20mm 10mm 20mm 20mm;

  @top-right {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: string(chapter-header);
    vertical-align: bottom;
    padding-bottom: 1em;
    font-variant: small-caps;
  }

  @bottom-right {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: counter(page);
    padding-top: 1em;
    vertical-align: top;
  }
}


@page frontmatter :left {
  @top-left {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: string(title);
    vertical-align: bottom;
    padding-bottom: 2em;
  }

  @bottom-left {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: counter(page, lower-roman);
    padding-top: 2em;
    vertical-align: top;
  }
}

@page cover { margin: 0; }

@page frontmatter :right {
  @top-right {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: string(header, first); 
    vertical-align: bottom;
    padding-bottom: 2em; 
  }

  @bottom-right {
    font: 8pt "Nimbus Roman No9 L", "Times New Roman", serif;
    content: counter(page, lower-roman);
    text-align: right;
    vertical-align: top;
    padding-top: 2em;
  }
}

@page blank :left {
  @top-left { content: normal }
  @bottom-left { content: normal }
}

@page blank :right {
  @top-right { content: normal }
  @bottom-right { content: normal }
}

/* footnotes */

.footnote {
  display: none;                   /* default rule */

  display: prince-footnote;        /* prince-specific rules */
  position: footnote;
  footnote-style-position: inside;

/*  counter-increment: footnote; // not supported by kindle */
  margin-left: 1.4em;
  font-size: 90%;
  line-height: 1.4;
}

.footnote::footnote-call {
  vertical-align: super;
  font-size: 80%;
}

.footnote::footnote-marker {
  vertical-align: super;
  color: green;
  padding-right: 0.4em;
}


/*
   A book consists of different types of sections. We propose to use
   DIV elements with these class names:

    frontcover
    halftitlepage: contains the title of the book
    titlepage: contains the title of the book, name of author(s) and publisher
    imprint: left page with copyright, publisher, library printing information
    dedication: right page with short dedication
    foreword: written by someone other than the author(s)
    toc: table of contents
    preface: preface, including acknowledgements
    chapter: each chapter is given its own DIV element
    references: contains list of references
    appendix: each appendix is given its own 
    bibliography
    glossary
    index
    colophon: describes how the book was produced
    backcover

   A book will use several of the types listed above, but few books
   will use all of them.
*/

/* which section uses which named page */

div.innerfront, div.halftitlepage, div.titlepage, div.imprint, div.dedication { page: blank }
div.foreword, div.toc, div.preface { page: frontmatter } 


/* page breaks */

div.frontcover, div.halftitlepage, div.titlepage { page-break-before: always; }
div.imprint, div.blankpage { page-break-before: always; }
div.dedication, div.foreword, div.toc, div.preface, div.chapter, div.reference, 
div.appendix, div.bibliography, div.glossary, div.index, div.colophon { 
  page-break-before: always ;
}
div.backcover { page-break-before: left }

/* the front cover; this code is probably not very reusable by other books */

div.frontcover { page: cover; }

div.frontcover img {
/*  position: absolute; // not supported by kindle */
  width: 110mm; height: 172mm;
  left: 0; top: 0;
  z-index: -1;
}

div.frontcover h1 {
/*    position: absolute; // not supported by kindle */
  left: 2cm; top: 1cm;
  color: white;
  font-size: 44pt;
  font-weight: normal;
}

div.frontcover h2 {
/*    position: absolute; // not supported by kindle */
  right: 0; top: 5cm;
  color: black;
  background: white;
  font-size: 16pt;
  font-weight: normal;
  padding: 0.2em 5em 0.2em 1em;
  letter-spacing: 0.15em;
}

div.frontcover h3 {
/*    position: absolute; // not supported by kindle */
  left: 2cm; top: 7cm;
  color: white;
  font-size: 24pt;
  font-weight: normal;
}

div.frontcover p {
/*    position: absolute; // not supported by kindle */
  left: 2cm; bottom: 1.5cm;
  font-size: 24pt;
  color: black;
  font-weight: bold;
  text-transform: uppercase;
}


/* titlepage, halftitlepage */

div.titlepage h1, div.halftitlepage h1 { margin-bottom: 2em; }
div.titlepage h2, div.halftitlepage h2 { font-size: 1.2em; margin-bottom: 3em; }
div.titlepage h3, div.halftitlepage h3 { font-size: 1em; margin-bottom: 3em; }
div.titlepage p, div.halftitlepage p { 
  font-size: 1.4em;
  font-weight: bold;
  margin: 0; padding: 0;
}

/* in addition to Hakon Lie's suggestions I propose that a chapter is
 * divided into one or more subdivisions called scenes */

div.scene
{
  padding-top: 0.6em; 
  padding-bottom: 1em;
}

div.scene::after { 
     display: block; 
     content: ""; 
     border-top: solid black thin 
 } 
 

/* TOC */

ul.toc, ul.toc ul { 
  list-style-type: none;
  margin: 0; padding: 0;
  text-transform: lowercase;
}
ul.toc ul {
  margin-left: 1em;
  font-weight: normal;
}
ul.toc > li { 
  font-weight: bold;
  margin-bottom: 0.5em;
}
ul.toc a::after {
  content: leader('.') target-counter(attr(href), page);
  font-style: normal;
}
ul.toc > li.frontmatter a::after {
  content: leader('.') target-counter(attr(href), page, lower-roman);
  font-style: normal;
}
ul.toc > li.endmatter a::after {
  content: leader('.') target-counter(attr(href), page);
  font-style: normal;
}
ul.toc > li.chapter::before {
  content: "Chapter " counter(toc-chapter, decimal);
  display: block;
  margin: 1em 0 0.1em -2.5cm;
  font-weight: normal;
/*  counter-increment: toc-chapter; // not supported by kindle */
  page-break-after: avoid;
}

/* chapter numbers */

div.chapter { 
/* counter-increment: chapter;  // not supported by kindle */
}

h1::before {
  white-space: pre;
  margin-left: -2.5cm;
  font-size: 50%;
  content: "\B0  \B0  \B0  \B0  \B0 \A";  /* ornaments */
}

/* div.chapter h1::before { content: "Chapter " counter(chapter) " \A"; } */

div.titlepage {
	margin: 0px;
	padding: 0px;
}

div.frontcover h1::before, div.titlepage h1::before, div.halftitlepage h1::before {
  content: normal;                  /* that is, none */
}

title { string-set: title-header content();}
h2 { string-set: chapter-header content(); }

/* index */

ul.index { 
  list-style-type: none;
  margin: 0; padding: 0;
/*  column-count: 2; // not supported by kindle */
/*  column-gap: 1em; // not supported by kindle */
}

ul.index a::after { content: ", " target-counter(attr(href), page); }


span.element, span.attribute {
  text-transform: uppercase;
  font-weight: bold;
  font-size: 80%;
}
span.property { font-weight: bold }
code, span.css, span.value, span.declaration {
  font: 90% "Lucida Console", "Lucida Sans Typewriter", monospace;
}


@media screen, handheld {
  html { margin: 1em; font: 100% "Nimbus Roman No9 L", "Times New Roman", serif }
  h1 { margin-bottom: 0.5em }
  div.frontcover, div.halftitlepage, div.titlepage, div.imprint, 
  div.dedication, div.foreword, div.toc, div.index { /* display: none  */}
}
