:root {
  --font-family: monospace;
  --font-color: black;
  --bg-color: white;
  
  --link-color: #333399;
  --link-color-transparent: rgba(51, 51, 153, 0.25);
  --link-hover: #FF9933;
  --link-hover-transparent: rgba(255, 153, 51, 0.25);
  --link-active: #CC0000;
  --link-active-transparent: rgba(204, 0, 0, 0.25);
  
  --grayscale-1: #222;
  --grayscale-2: #444;
  --grayscale-3: #666;
  --grayscale-x: #777;
  
  --container-width: 80ch;
  --container-padding: 1ch;
  
  --header-filler-height: 10rem;
  --header-filler-color: lavender;
  
  --border-color: #CCCCCC;
  
  --hr-width: 25ch;
}

html {
  font-family: var(--font-family);
  font-size: 100%;
  background-color: var(--bg-color);
  color: var(--font-color);
}

blockquote {
  padding-inline-start: 8ch;
  
  blockquote {
    padding-inline-start: 4ch;
    
    blockquote {
      padding-inline-start: 2ch;
    }
  }
  
  h1 + & {
    padding-inline-start: max(8ch, calc(100% - var(--container-width) * .75));
  }
}

h1 {
  font-size: 2rem;
  line-height: 2.5rem;
  margin-bottom: 3.5rem;
  
  p + & {
    margin-top: 3.5rem;
  }
}

h2 {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1.75rem;
  margin: 3.5rem 0 1.75rem;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.5rem;
  color: var(--grayscale-1);
  font-weight: bold;
  margin: 3.5rem 0 1.75rem;
  
  h2 + & {
    margin-top: 1.75rem;
  }
}

p, li {
  white-space: preserve-spaces;
  
  &:has(br), .index & {
    white-space: unset;
  }
}

ul {
  line-height: 1.75rem;
  padding-inline-start: 2ch;
  white-space: unset;
  
  li {
    margin: 0.75rem 0;
    list-style: square outside;
    
    &::marker {
      color: var(--grayscale-1);
    }
    
    &:has(ul, ol) {
      white-space: unset;
    }
  }
}

ol {
  line-height: 1.75rem;
  padding-inline-start: 4ch;
  white-space: unset;
  
  &:has(li:nth-child(10)) {
    padding-inline-start: 5ch;
  }
  
  &:has(li:nth-child(100)) {
    padding-inline-start: 6ch;
  }
  
  &:has(li:nth-child(1000)) {
    padding-inline-start: 7ch;
  }
  
  li {
    margin: 0.75rem 0;
    list-style-type: decimal;
    
    &:has(ul, ol) {
      white-space: unset;
    }
  }
}

.index-entry {
  display: flex;
  gap: 2ch;
}
.index-entry-segment {
  display: flex;
  flex-direction: column;

  .publication-date {
    height: unset;
  }

  &.publication-date {
    white-space: nowrap;
  }
}

ul + ul, ol + ul, ol + ol, ul + ol {
  margin-top: 1.75rem;
}

section + section {
  margin-top: 3.5rem;
}

p {
  margin: 1.75rem 0;
  line-height: 1.75rem;
}

hr {
  border: solid var(--border-color);
  border-width: 0 0 1px;
  max-width: var(--hr-width);
  margin: 3.5rem 0;
}

a {
  color: var(--link-color); 
  text-decoration: underline;
  transition: color 125ms ease, text-decoration-color 125ms ease;
  
  &:hover {
    color: var(--link-hover);
    /*text-decoration-color: var(--link-hover-transparent);*/
  }
  &:active {
    color: var(--link-active);
    /*text-decoration-color: var(--link-active-transparent);*/
  }
  
  section & {
    &[href*="http://"], &[href*="https://"] {
      text-decoration-color: var(--link-color-transparent);
  
      &:hover {
        text-decoration-color: var(--link-hover-transparent);
      }
      &:active {
        text-decoration-color: var(--link-active-transparent);
      }
    }
  }
}

img {
  max-width: 100%;
}

strong, b {
  font-weight: bold;
  text-decoration: double underline var(--grayscale-3);
}

em, i {
  font-style: italic;
  color: var(--grayscale-1);
}

code {
  h1 &, h2 &, p &, li &{
    background-color: #eee;
    border-radius: 3px;
    padding: 1px 5px;
  }
}

pre {
  border: 1px dashed var(--border-color);
  border-radius: calc(var(--container-padding) / 2);
  padding: calc(2 * var(--container-padding) - 1px);
  margin: 1.75rem 0;
  line-height: 1.5rem;
  overflow: scroll;
}

.container {
  max-width: var(--container-width);
  margin: auto;
  padding: var(--container-padding);
}

.header {
  margin-bottom: 1.75rem;
  
  nav {
    line-height: 1.75rem;
    margin-bottom: 1.75rem;
  }
  
  &:after {
    content: "";
    display: block;
    background-color: var(--header-filler-color);
    height: var(--header-filler-height);
  }
}

.publication-date {
  color: var(--grayscale-x);
  line-height: 1.75rem;
  height: 1.75rem;
}

.bottom-nav {
  border-top: 1px solid var(--border-color);
  margin-top: 110vh;
  padding-top: 1.75rem;
  line-height: 1rem;
}

.page-footer {
  max-width: var(--container-width);
  margin: auto;
  padding: var(--container-padding);
}

.zola-anchor {
  color: var(--grayscale-x);
  text-decoration: none;
  margin-left: 1ch;
  
  h1 & {
    display: none;
  }
}
