/* book of appetite — style.css */

:root {
  --text: #2a2820;
  --bg: #f7f3ec;
  --muted: #7a7060;
  --rule: #c8bfaa;
  --link: #3a2e1e;
  --max-width: 38em;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 23px;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: 'Yrsa', serif;
  font-weight: 300;
  line-height: 1.4;
  max-width: var(--max-width);
  margin: 4rem auto;
  padding: 0 1.25rem;
}

/* — typography — */

p {
  margin: 0 0 1em;
  hyphens: auto;
}

h1, h2, h3 {
  text-align: center;
}

h1 {
  font-family: 'Pinyon Script', cursive;
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1.2;
  margin: 2em 0 0.6em;
}

/* — book header — */

.book-header {
  text-align: center;
  margin-bottom: 2.5em;
}

.book-header img {
  max-width: 100%;
  height: auto;
}

h2, h3 {
  font-family: 'Lexend Exa', sans-serif;
  text-transform: uppercase;
  max-width: 20em;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

h2 {
  font-weight: 400;
  font-size: 0.76rem;
  margin-top: 2.8em;
  margin-bottom: 2.4em;
}

h3 {
  font-weight: 400;
  font-size: 0.72rem;
  margin-top: 2.4em;
  margin-bottom: 1.2em;
  color: var(--muted);
}

/* subtitle breathing room after section h1 */
h1 + h2,
h1 + h3 {
  margin-top: 0.4em;
}

/* book subtitle needs space below before body text begins */
.book-header + h3 {
  margin-bottom: 3.5em;
}

/* first h1 on page shouldn't have giant top margin */
body > h1:first-of-type,
body > p:first-child { margin-top: 0; }

/* section openers (bold p used as pseudo-headings) */
p > strong:only-child {
  display: block;
}

ol, ul {
  padding-left: 1.6em;
  margin: 0 0 1em;
}

li { margin-bottom: 0.3em; }

em { font-style: italic; }
strong { font-weight: bold; }

sup {
  font-size: 0.72em;
  line-height: 0;
  vertical-align: super;
}

/* — blockquotes (blurbs, pull quotes) — */

blockquote {
  font-family: 'Yrsa', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 1.1rem;
  text-align: center;
  max-width: 25.5em;
  margin: 4em;
  padding: 0;
  color: var(--muted);
}

blockquote p {
  margin: 0 0 0.7em;
}

/* — rules — */

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 4em 0;
}

/* — links — */

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: var(--text);
}

/* — TOC — */

.TOC {
  margin: 5em 0;
  padding: 2em 1.8em 1.6em;
  border: 1px solid var(--rule);
  font-size: 0.9rem;
  line-height: 1.5;
}

.TOC p {
  margin: 0.4em 0 1.8em;
  font-family: 'Lexend Exa', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
}

.TOC > ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.TOC > ul > li {
  margin-bottom: 0;
  padding-bottom: 0.5em;
  font-family: 'Lexend Exa', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
}

.TOC > ul > li:last-child {
  padding-bottom: 0;
}

.TOC > ul > li > ul {
  font-family: 'Yrsa', serif;
  font-size: 0.9rem;
  font-weight: 300;
  text-transform: none;
}

.TOC ul ul {
  padding-left: 1.2em;
  margin-top: 0.6em;
}

/* h3s filtered from TOC in build.js */

.TOC ul ul li {
  margin-bottom: 0.05em;
}

.TOC a {
  text-decoration: none;
  color: var(--text);
}

.TOC a:hover {
  text-decoration: underline;
  text-decoration-color: var(--rule);
}

/* — footnotes — */

.footnotes {
  margin-top: 3em;
  padding-top: 1em;
  font-size: 0.83rem;
  color: var(--muted);
}

.footnotes hr { display: none; }

.footnotes ol {
  padding-left: 1.4em;
}

.footnotes li {
  margin-bottom: 0.7em;
  line-height: 1.45;
}

.footnotes p { margin: 0; }

a.footnote,
a.reversefootnote {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
}

a.footnote:hover,
a.reversefootnote:hover {
  color: var(--text);
}

/* — page-break divs (web: invisible) — */

.page-break { display: none; }

.colophon {
  margin-top: 5em;
  font-size: 0.72rem;
  font-style: italic;
  text-align: center;
  color: var(--muted);
}

/* — mobile — */

@media (max-width: 600px) {
  html { font-size: 20px; }
  body {
    max-width: 100% !important;
    width: 100% !important;
    margin: 1.5rem 0 !important;
    padding: 0 1.25rem !important;
  }
  .TOC { padding: 0.8em 0.9em; }
}

/* — print — */

@media print {
  :root { --bg: #fff; --text: #000; }

  html { font-size: 11pt; background: white; }

  body {
    max-width: 100%;
    margin: 0;
    padding: 0;
    color: black;
  }

  .page-break { display: block; page-break-before: always; }
  .TOC a { color: black; text-decoration: none; }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }

  a[href*="gumroad"]::after { content: ""; }
}
