:root {
  --text-face: "effra", sans-serif;
  --display-face: "angie-sans", "Georgia", serif;
  --bg-color: rgba(255,255,255,1.0);
  --text-color: rgba(0,0,0,0.85);
  --link-color: #07CFAB;
  --accent-color: #07CFAB;
  --smallest: 16px;
  --smaller: 18px;
  --regular: 20px;
  --larger: 24px;
  --largest: 40px;
  --lh: 30px;
  --dl: calc(var(--lh) * 2);
  --hl: calc(var(--lh) / 2);
  --lighter: rgba(0,0,0,0.65);
  --lightest: rgba(0,0,0,0.35);
  --faint: rgba(124,124,124,0.2);
  --fainter: rgba(124,124,124,0.1);
  --faintest: rgba(124,124,124,0.05);
  --darker: rgba(0,0,0,1.0);
}

/* ====================================
   Start
=======================================*/

html {
  background: var(--bg-color);
  color: var(--text-color);
  font: var(--regular)/var(--lh) var(--text-face);
  scroll-behavior: smooth;
}

header, main > section, aside, footer {
  padding: var(--lh);
}

header, footer {
  letter-spacing: 0.02em;
}

header {
  font-size: var(--smaller);
  background: var(--accent-color);
}

header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
}

header a {
  color: var(--bg-color);
}

header a:not(.logo) {
  margin-left: 0.9em;
}

header a.logo {
  flex: 1 1 7em;
}

header span.about {
  display: none;
  flex: 1 1 10rem;
}

header a:hover, header a.active, header a.logo {
  color: var(--darker);
}

footer {
  text-align: center;
  color: var(--lightest);
  font-size: var(--smaller);
}

footer a {
  text-decoration: none;
}

footer a:not(:first-of-type)::before {
  content: " · ";
}

footer a:hover::before {
  color: var(--lightest);
}

footer span {
  color: var(--text-color);
  margin-right: 0.85rem;
}

/* ====================================
   Typography
=======================================*/

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.002em;
  word-spacing: 0.04em;
}

h1, h2, header, footer, input[type=submit], a.button {
  font-family: var(--display-face);
  font-weight: 400;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  letter-spacing: normal;
  word-spacing: normal;
}

h1, h2, ul, ol {
  margin-bottom: var(--lh);
}

h1, h2, section > h3 {
  color: var(--darker);
}

h1 {
  font-size: var(--largest);
  line-height: calc(var(--lh) * 1.5);
}

h1 strong {
  font-weight: 600;
}

h2 {
  font-size: var(--larger);
}

p a, time a {
  color: var(--link-color);
}

.main-body img {
  display: block;
  margin: 0 auto;
}

.main-body h2 {
  margin: var(--dl) 0 var(--lh);
}

p {
  margin-bottom: var(--lh);
}

section > h3, p strong {
  font-weight: 500;
}

blockquote, .main-nav {
  margin: calc(var(--lh) * 1.5) 0;
}

blockquote {
  padding-left: calc(var(--lh) - 4px);
  border-left: 4px solid var(--faint);
}

hr {
  border: 0;
  border-bottom: 1px solid var(--faint);
  width: 10rem;
  margin: calc(var(--lh) * 2 - 1px) auto var(--dl);
}

figcaption, img + em {
  color: var(--lighter);
  display: block;
  font-size: var(--smallest);
  margin: calc(var(--lh) / 3) 0 calc(var(--lh) * 2/3);
  text-align: center;
}

figure {
  margin: 0;
  text-align: center;
}

.main-body figure {
  margin-bottom: 0 0 var(--dl);
}

p + figure {
  margin-top: var(--dl);
}

article figure img {
  display: block;
  margin: 0 auto var(--hl);
}

sup {
  line-height: var(--hl);
}

.sc {
  font-size: 0.9em;
}

/* ====================================
   Layout
=======================================*/

.main-header {
  background: var(--faintest);
  background-size: cover;
  padding: calc(var(--lh) * 3) 10vw calc(var(--lh) * 3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.main-header h1, h2, p {
  width: 100%;
}

.main-header h1 {
  margin: calc(var(--lh) / 2) 0;
}

.main-header h2 {
  font-family: var(--text-face);
  font-size: var(--smallest);
  letter-spacing: 0.2em;
  margin: 0;
  order: -1;
  text-transform: uppercase;
  color: inherit;
}

.main-header h2 span {
  color: var(--faint);
  margin: 0 0.5em;
}

.main-header h2 em {
  font-style: normal;
}

.main-header p {
  font-size: var(--smaller);
  line-height: calc(var(--lh) * 5/6);
  color: var(--lighter);
  margin-top: 3px;
  margin-bottom: 2px;
  max-width: 48em;
}

.main-header figure {
  margin-bottom: 0;
}

.main-header figure img {
  max-height: 900px;
}

.main-header figcaption, .home-book figcaption {
  margin-bottom: 0;
}

/* ====================================
   Homepage
=======================================*/

.home section h2 {
  margin: calc(var(--lh) * 1/3) 0 calc(var(--lh) * 2/3);
}

.home-about {
  text-align: left;
}

.home-about h1 br {
  display: none;
}

.home-about a {
  color: var(--link-color);
}

.home-about p {
  margin: var(--hl) 0;
}

.home-book {
  background: var(--fainter);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(80vh - calc(var(--lh) * 3));
}

.home-book img {
  height: 45vh;
}

.home-podcast {
  /* background: var(--text-color);
  color: var(--bg-color); */
  object-fit: scale-down;
}

.home-podcast img {
  float: right;
  max-height: calc(var(--lh) * 5);
  margin-left: var(--lh);
  margin-bottom: var(--lh);
}

.home-sunday form input {
  margin-right: 0;
}

/* ====================================
   Essay Pages
=======================================*/

.essays .main-body > p:last-of-type::after {
  margin-left: 0.1em;
  content: "⬙";
  font-size: 1.1em;
  line-height: 1.0rem;
}


/* ====================================
   Post Previews
=======================================*/

.post-preview {
  padding: var(--lh) 0;
  position: relative;
  border-bottom: 1px solid var(--faint);
}

.post-preview:first-of-type {
  border-top: 1px solid var(--faint);
}

.post-preview a {
  color: var(--regular);
}

.post-preview a h3 {
  display: block;
  margin: 0;
  padding-right: 6em;
}

.post-preview a:hover h3 {
  color: var(--link-color);
}

.post-preview time, .post-preview h4 {
  color: var(--lightest);
  font-size: var(--smaller);
  position: absolute;
  right: 0;
  top: var(--lh);
}

/* .post-preview time::before {
  content: " · ";
} */

.post-preview p {
  color: var(--lighter);
  margin-bottom: 0;
}

article.podcast img {
  float: right;
  max-height: calc(var(--lh) * 5);
  margin-left: var(--lh);
}

/* ====================================
   Single Post Pages
=======================================*/

.main-nav a {
  color: var(--link-color);
}

.main-nav time {
  display: block;
  color: var(--lightest);
  font-size: var(--smaller);
}

main aside {
  color: var(--lighter);
  font-size: var(--smaller);
  line-height: 25px;
}

main aside section {
  margin-bottom: var(--dl);
}

main aside {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  grid-column-gap: var(--lh);
}

main aside h2 {
  color: var(--text-color);
  font-size: var(--smallest);
  letter-spacing: 0.05em;
  margin-bottom: var(--hl);
  text-transform: uppercase;
}

main aside nav {
  display: flex;
  flex-direction: column;
}

main aside nav a.active{
  color: var(--text-color) !important;
  font-weight: bold;
}

main aside p {
  margin-bottom: 0;
}

p.small {
  font-size: var(--smallest);
  line-height: 21px;
}

/* ====================================
   Form Inputs
=======================================*/

form .form-fields {
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: -7px -7px;
}

form input, a.button {
  line-height: normal;
  padding: var(--hl) 1rem;
  display: inline-block;
  -webkit-appearance: none;
  border-radius: 0;
}

form input {
  margin: 7px;
  background: var(--bg-color);
}

form input:focus {
  color: var(--text-color);
}

form input:-webkit-autofill::first-line {
  font-size: var(--regular) !important;
  font-family: var(--text-face) !important;
}

form input#bd-email {
  border: 1px solid var(--faint);
  flex: 1 1 calc(70% - 14px);
}

form input[type=submit], a.button {
  background: var(--text-color);
  color: var(--bg-color);
  border: 1px solid transparent;
  border-radius: 5px;
}

form input[type=submit] {
  flex: 1 1 auto;
  cursor: pointer;
}

form input[type=submit]:hover, a.button:hover {
  background: var(--link-color);
}

form input[type=submit]::-moz-focus-inner {
  border: 0;
}

p + .form-fields, p + form {
  margin-top: var(--lh);
}

/* ====================================
   Embeds
=======================================*/

iframe {
  margin-bottom: var(--lh);
}

/* YouTube */

.video-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  margin: var(--lh) 0;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Soundcloud */

iframe.dark {
  display: none;
}

iframe.light {
  display: block;
}

/* ====================================
   School Visits
=======================================*/

dl#school-visits {
  margin: var(--dl) 0;
}

dl#school-visits dt {
  display: inline;
  font-style: italic;
}

dl#school-visits dt em {
  font-style: normal;
}

dd.visit-length {
  font-size: var(--smaller);
  color: var(--lighter);
  display: inline;
}

dd.visit-description {
  margin-bottom: var(--lh);
}

/* ====================================
   Membership
=======================================*/

.main-body ul, .main-body ol {
	padding-left: var(--lh);
}

.main-body ul li::before, .main-body ol li::before {
  width: var(--lh);
  margin-left: calc(var(--lh) * -1);
  content: '–';
  float: left;
}

.main-body ol li {
  counter-increment: count;
}

.main-body ol li::before{
  content: counter(count) ".";
}

dl#plans {
	display: flex;
	justify-content: space-between;
  flex-wrap: wrap;
  margin: var(--lh) -10px;
}

dt, dd{
	padding: 0;
	margin: 0;
}

dl#plans a {
	text-align: center;
	text-decoration: none;
	flex: 3 1 10rem;
	background: var(--fainter);
  margin: 10px;
	padding: 28px 14px;
}

dl#plans a:hover {
	background: rgba(124,124,124,0.05);
}

dd.plan-pricing {
	font-size: var(--larger);
	font-weight: bold;
	margin: var(--hl) 0;
}

dd.plan-description {
	font-size: var(--smaller);
	color: var(--lighter);
	line-height: 21px;
}

body.membership .main-body p.small {
	color: var(--lighter);
  text-align: center;
  margin-top: -21px;
}

/* ====================================
   Talk Layout
=======================================*/

body.talk .slide {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--fainter);
  height: calc(var(--lh) * 20);
  margin: calc(var(--lh) * 3) 0;
  max-width: none;
  padding: 0 var(--lh);
  text-align: center;
}

body.talk .title-slide {
  background: #222 url("/assets/images/enchanted-rose/rose1.jpg") no-repeat center center;
  background-size: cover;
  color: #fff;
  min-height: calc(90vh - calc(var(--lh) * 3));
}

body.talk figure {
  max-width: 60rem;
  margin: calc(var(--lh) * 3) auto;
}

body.talk .gallery {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

body.talk .gallery a {
  display: block;
  margin: 14px;
}

body.talk .gallery img {
  max-height: calc(var(--lh) * 12);
  border: 1px solid var(--faint);
}

body.talk .slide blockquote {
  font-size: var(--larger);
  line-height: 1.5;
  padding: 0;
  border: 0;
}

body.talk .slide cite {
  text-align: center;
  font-size: var(--smaller);
}

.footnotes h3{
  margin: calc(var(--lh) * 1.5) 0 var(--hl);
}

.footnotes ol {
  font-size: var(--smallest);
  line-height: 1.5;
}

.footnotes ol li p {
  margin-bottom: var(--hl);
}

/* ====================================
   Announcement
=======================================*/

#site-announcement {
  background: var(--text-color);
  color: var(--bg-color);
  text-align: center;
  padding: 10px 20px 9px;
  font-size: var(--smaller);
  line-height: 21px;
}

#site-announcement a:hover {
  color: inherit;
}

/* ====================================
   Media Queries
=======================================*/

/* Mobile */

@media (max-width: 600px) {
  :root {
    --smaller: 16px;
    --regular: 18px;
    --larger: 24px;
    --largest: 32px;
    --lh: 24px;
  }

  .home-about {
    padding: calc(var(--lh) * 2) 10vw;
  }

  .main-header p {
    line-height: var(--lh);
  }
}

@media (min-width: 780px) {
  header, footer {
    font-size: var(--smaller);
  }

  main {
    display: grid;
    grid-template-columns: 1fr repeat(8, 60px) 1fr;
    grid-column-gap: var(--lh);
  }

  .main-header {
    grid-column: 1 / span 10;
    padding: calc(var(--lh) * 4) 10vw;
    margin-bottom: var(--lh);
  }

  .main-body, .posts-list, aside {
    grid-column: 2 / span 8;
  }

  .main-header form {
    width: 680px;
  }

  aside {
    display: flex;
    flex-wrap: wrap;
  }

  aside .toc {
    order: -1;
  }
  
  .home-about {
    grid-column: 1 / span 10;
    grid-row: 1 / 2;
    border-bottom: 1px solid var(--faint);
    margin-bottom: 0;
  }

  .home-about > * {
    width: 660px !important;
  }

  .home-about h1 br {
    display: unset;
  }
  
  .home-book, .home-podcast {
    grid-column: 1 / span 5;
    margin-right: calc(var(--hl) * -1);
  }

  .home-book {
    grid-row: 2 / 4;
    background: var(--fainter);
  }

  .home-podcast {
    grid-row: 4 / 5;
  }

  .home-sunday, .home-posts {
    grid-column: 6 / span 5;
  }

  .home-posts {
    grid-row: 3 / 5;
  }

  .home-podcast, .home-newsletter {
    font-size: var(--smaller);
  }

  .home-podcast img {
    max-height: calc(var(--lh) * 4);
  }

  .home footer {
    border-top: 1px solid var(--faint);
  }

  main aside .listen {
    grid-column: 2 / 3;
  }
  
  main aside .toc {
    grid-row: 1 / span 2;
  }

  .archive .post-preview:first-of-type {
    /* border-top: 0; */
  }
}

@media (min-width: 1260px) {

  main {
    grid-template-columns: 1fr repeat(12, 56px) 1fr;
    padding: 0;
  }

  .home-about, .home-book {
    margin-bottom: var(--lh);
  }

  .main-header {
    grid-column: 1 / 15;
  }

  aside {
    grid-column: 10 / span 4;
    align-self: start;
  }
  
  aside .toc {
    order: 2;
  }
  
  aside.sticky {
    position: sticky;
    top: 52px;
    margin-bottom: 11rem;
  }

  .essays .main-body, .page .main-body, .talk .main-body, .posts-list, .notes .main-body {
    grid-column-start: 4;
  }

  footer {
    border-top: 0 !important;
    margin-top: var(--dl);
  }

  .home-book {
    grid-column: 1 / span 5;
    grid-row: 1 / 2;
    margin-right: calc(var(--lh) * -1);
    background: var(--faintest);
    border-bottom: 1px solid var(--faint);
  }

  .home-book figure {
    margin-left: 5vw;
  }

  .home-about {
    grid-column: 6 / span 9;
  }

  .home-posts {
    grid-column: 2 / span 7;
    grid-row: 2 / 5;
  }

  .home-podcast {
    margin-right: 0;
    grid-row: 2 / 3;
    background: transparent;
    color: inherit;
  }

  .home-sunday {
    grid-row: 3 / 4;
  }

  .home-podcast, .home-sunday {
    grid-column: 9 / span 5;
    font-size: var(--smaller);
    line-height: 25px;
  }

  main aside .listen {
    grid-column: unset;
  }
  
  main aside .toc {
    grid-row: unset;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0D0125;
    --text-color: rgba(255,255,255,0.8);
    --darker: rgba(255,255,255,1.0);
    --lighter: rgba(255,255,255,0.7);
    --lightest: rgba(255,255,255,0.4);
  }

  body, header {
    background: var(--bg-color);
  }

  header a {
    color: var(--text-color);
  }

  header a:hover, .home-about a, header a.active, header a.logo {
    color: var(--link-color);
  }

  iframe.dark {
    display: block;
  }

  iframe.light {
    display: none;
  }

  .home-podcast, form input {
    background: var(--faint);
  }

  .home-podcast {
    color: inherit;
  }

  .home-podcast h2 {
    color: var(--darker);
  }

  form input[type="submit"], a.button {
    background: var(--link-color);
    color: var(--darker);
  }
}