/*
 * The Hack Farm: the site's only stylesheet. Each thing is set once.
 *
 * Based on Poole and Hyde, designed, built, and released under MIT license
 * by @mdo. Learn more at https://github.com/poole/hyde.
 *
 * The web fonts (Alice, Caudex) are loaded in layouts/partials/head.html.
 *
 * Contents
 *
 * Colours
 * Base
 * Text
 * Numbered lists
 * Code
 * Quotes, pictures, tables
 * Layout
 * Sidebar
 * Pages and posts
 * Home page
 * 404 page
 */


/*
 * Colours
 *
 * Change a colour here and it changes everywhere it is used.
 */

:root {
  --paper:      #F3F1E9;  /* page background */
  --paper-dark: #F4F1E6;  /* sidebar, code and table backgrounds */
  --line:       #D9D4C2;  /* thin rules and borders */
  --ink:        #2F3A2E;  /* body text */
  --ink-dark:   #1F2A1E;  /* headings and bold text */
  --ink-soft:   #4C5546;  /* captions, dates, small print */
  --leaf:       #3F6B3A;  /* links and list numerals */
  --leaf-dark:  #2A4A27;  /* links when hovered */
}


/*
 * Base
 */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  font-family: "Alice", serif;
  font-size: 16px;
  line-height: 1.6;
}

/*
 * Everything is sized in rem, so these set the scale of the whole page.
 * It drops back to 16px at 48em because that is where the sidebar moves
 * from the top of the page to the left and takes up width.
 */
@media (min-width: 38em) {
  html {
    font-size: 20px;
  }
}
@media (min-width: 48em) {
  html {
    font-size: 16px;
  }
}
@media (min-width: 58em) {
  html {
    font-size: 20px;
  }
}

body {
  color: var(--ink);
  background-color: var(--paper);
  -webkit-text-size-adjust: 100%;
}


/*
 * Text
 */

a {
  color: var(--leaf);
  text-decoration: none;
}
a strong {
  color: inherit;
}
a:hover,
a:focus {
  color: var(--leaf-dark);
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  margin-bottom: .5rem;
  line-height: 1.25;
  color: var(--ink-dark);
}
h1, h2, h3 {
  font-family: "Caudex", serif;
  font-weight: 400;
}
h1 {
  font-size: 2.4rem;
}
h2 {
  margin-top: 2.2rem;
  font-size: 1.5rem;
}
h3 {
  margin-top: 1.5rem;
  font-size: 1.25rem;
}
h4, h5, h6 {
  margin-top: 1rem;
  font-size: 1rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

strong {
  color: var(--ink-dark);
}

ul, ol, dl {
  margin-top: 0;
  margin-bottom: 1rem;
}
dt {
  font-weight: bold;
}
dd {
  margin-bottom: .5rem;
}

hr {
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

abbr {
  font-size: 85%;
  font-weight: bold;
  text-transform: uppercase;
}
abbr[title] {
  cursor: help;
  border-bottom: 1px dotted var(--line);
}


/*
 * Numbered lists
 *
 * Numbered lists in pages get a large green numeral. If an item starts with
 * bold text, that text becomes the item's title on its own line:
 *
 *   1. **Regenerative**
 *   Building upon agroecology and permaculture principles.
 */

.page ol,
.post ol {
  padding-left: 0;
  list-style: none;
  counter-reset: item;
}
.page ol > li,
.post ol > li {
  position: relative;
  padding-left: 3.4rem;
  margin-bottom: 1.6rem;
  counter-increment: item;
}
.page ol > li::before,
.post ol > li::before {
  content: counter(item);
  position: absolute;
  top: -.1rem;
  left: 0;
  font-family: "Caudex", serif;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--leaf);
}
.page ol > li > strong:first-child,
.page ol > li > p:first-child > strong:first-child,
.post ol > li > strong:first-child,
.post ol > li > p:first-child > strong:first-child {
  display: block;
  margin-bottom: .3rem;
  font-family: "Caudex", serif;
  font-size: 1.15rem;
  line-height: 1.3;
}


/*
 * Code
 *
 * Hugo colours highlighted code blocks itself (inline styles), so there are
 * no colour rules here.
 */

code,
pre {
  font-family: Menlo, Monaco, "Courier New", monospace;
}
code {
  padding: .25em .5em;
  font-size: 85%;
  color: #8C3B44;
  background-color: var(--paper-dark);
  border-radius: 3px;
}
pre {
  display: block;
  margin-top: 0;
  margin-bottom: 1rem;
  padding: 1rem;
  font-size: .8rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  word-wrap: break-word;
  background-color: var(--paper-dark);
}
pre code {
  padding: 0;
  font-size: 100%;
  color: inherit;
  background-color: transparent;
}
.highlight {
  margin-bottom: 1rem;
  border-radius: 4px;
}
.highlight pre {
  margin-bottom: 0;
}


/*
 * Quotes, pictures, tables
 */

blockquote {
  padding: .5rem 1rem;
  margin: .8rem 0;
  color: var(--ink-soft);
  border-left: .25rem solid var(--line);
}
blockquote p:last-child {
  margin-bottom: 0;
}
@media (min-width: 30em) {
  blockquote {
    padding-right: 5rem;
    padding-left: 1.25rem;
  }
}

img {
  display: block;
  max-width: 100%;
  margin: 0 0 1rem;
  margin-bottom: 2rem;
  border-radius: 6px;
}

table {
  margin-bottom: 1rem;
  width: 100%;
  border: 1px solid var(--line);
  border-collapse: collapse;
}
td,
th {
  padding: .25rem .5rem;
  border: 1px solid var(--line);
}
tbody tr:nth-child(odd) td,
tbody tr:nth-child(odd) th {
  background-color: var(--paper-dark);
}


/*
 * Layout
 *
 * `.content` is the main column. `max-width` is how wide the text can get.
 * From 48em up it sits to the right of the fixed sidebar, so its left margin
 * is the sidebar's width (15rem) plus some air.
 */

.content {
  max-width: calc(1024px + 2rem);  /* 1024px of text and pictures, plus the side padding */
  margin-left:  auto;
  margin-right: auto;
  padding: 2rem 1rem 4rem;
}
@media (min-width: 48em) {
  .content {
    margin-left: 17rem;
    margin-right: 1rem;
    padding-top: 3rem;
  }
}
@media (min-width: 64em) {
  .content {
    margin-left: 18rem;
    margin-right: 2rem;
    padding-top: 3.6rem;
  }
}


/*
 * Sidebar
 *
 * Logo, page links, a few facts and the funders' logos. Sits above the
 * content on small screens and is fixed to the left side from 48em up.
 */

.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  padding: 2rem 1rem;
  text-align: center;
  background-color: var(--paper-dark);
}

.sidebar-logo img {
  width: 6rem;
  margin: 0;
  border-radius: 4px;
}

/* Page links: a wrapping row on small screens, a column from 48em up */
.sidebar-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1.2rem;
}
.sidebar-nav-item {
  padding: .2rem 0;
  line-height: 1.4;
  color: #3D4638;
}
.sidebar-nav-item.active {
  color: var(--leaf);
}

.sidebar-facts {
  display: none;
  margin: 0;
  padding-top: 1.2rem;
  font-size: .75rem;
  line-height: 1.5;
  color: #5A6152;
  border-top: 1px solid var(--line);
}

.sidebar-funders {
  width: 9rem;
  margin: 0;
  border-radius: 4px;
}

@media (min-width: 48em) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 15rem;
    overflow-y: auto;
    align-items: stretch;
    gap: 1.6rem;
    padding: 2rem;
    text-align: left;
  }
  .sidebar-logo img {
    width: 7.6rem;
  }
  .sidebar-nav {
    flex-direction: column;
    gap: 0;
  }
  .sidebar-facts {
    display: block;
  }
  .sidebar-funders {
    width: 11rem;
  }
}


/*
 * Pages and posts
 *
 * Pages are wrapped in `.page`, blog posts in `.post`.
 */

.page,
.post {
  margin-bottom: 4em;
}

.page-title,
.post-title {
  margin-top: 0;
}

/* Date line below a post title */
.post-date {
  display: block;
  margin-top: -.5rem;
  margin-bottom: 1rem;
  color: var(--ink-soft);
}

/* "Related posts" list below a post */
.related {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
}
.related-posts {
  padding-left: 0;
  list-style: none;
}
.related-posts h3 {
  margin-top: 0;
}
.related-posts li small {
  font-size: 75%;
  color: var(--ink-soft);
}


/*
 * Home page
 *
 * The home page opens with a statement (its `#` heading), then a larger
 * lead paragraph. The paragraph right after a picture is that picture's
 * caption.
 */

.home h1 {
  margin-top: 0;
  margin-bottom: 1.4rem;
  font-size: 2.1rem;
  line-height: 1.22;
}
.home h1 + p {
  margin-bottom: 2.2rem;
  font-size: 1.15rem;
  line-height: 1.5;
}
.home p:has(> img) {
  margin-bottom: 0;
}
.home p:has(> img) img {
  margin-bottom: .7rem;
}
.home p:has(> img) + p {
  font-size: .85rem;
  line-height: 1.5;
  color: var(--ink-soft);
}


/*
 * 404 page
 */

.not-found {
  text-align: center;
}
.not-found h1 {
  margin: 30px 0;
  font-size: 4rem;
  line-height: 1;
  letter-spacing: -1px;
}
