:root {
  --reference-number-color: #808080;
  --references-label-color: #808080;
  --reference-text-normal-color: #808080;
  --reference-text-important-color: #101010;
  --reference-hover-background: #eaeaea;
  --reference-part-hover-background: #dadada;
  --reference-url-color: #808080;
  --reference-url-color-hover: #101010;
  --an-title-color: #101010;
  --an-subtitle-color: #202020;
  --photo-info-color: #808080;
  --author-name-color: #808080;
  --published-text-color: #808080;
  --an-notes-summary: ;
  --an-notes-contents: #202020;
  --an-notes-border: #dcdcdc;
  --an-summary-summary: ;
  --an-summary-contents: #202020;
  --an-click-to-read: #808080;
  --an-summary-border: #dcdcdc;
  --section-link-color: #808080;
  --share-color: #202020;
  --share-border: #dcdcdc;
  --feedback-color: #202020;
  --feedback-border: #dcdcdc;
  --related-analyses-label-color: #808080;
  --analysis-title-color: #a01010;
  --analysis-title-color-hover: #300000;
  --related-analyses-border: #dcdcdc;
  --contents-cell-border: #dcdcdc;
  --contents-table-border: #808080;
  --contents-hr-color: #dcdcdc;
  --blockquote-color: #202020;
  --analysis-image-size: 400px;
  /*--analysis-image-size-tablet: 700px;*/
  --analysis-image-size-small-screen: 250px;
  --max-width-main: 725px;
}

/* This class is part of the functionality of inserting references into the article */
.ref-link {
  color: var(--reference-number-color);
  text-decoration: none;
  vertical-align: super;
  font-size: 75%;
  
  &::before {
    content: "[";
  }
  
  &::after {
    content: "]";
  }
}

.an-column {
  padding-top: 1rem;
  padding-bottom: 3rem;
  display: flex;
  flex-flow: column;
  width: 100%;
  align-items: center;
}
  
#an-main {
  max-width: var(--max-width-main);
  display: flex;
  flex-flow: column;
  align-items: center;
  margin-left: 1.5rem;
  margin-right: 1.5rem;
  
  #an-breadcrumbs {
    width: 100%;
    color: var(--section-link-color);
    margin-top: 1rem;
  }
  
  #an-section-link, #an-series-link {
    text-decoration: none;
    color: var(--section-link-color);
    margin-top: 0.5rem;
    font-size: 0.85rem;
  }
  
  #an-title {
    width: 100%;
    font-size: calc(1rem + 8px);
    font-weight: bold;
    color: var(--an-title-color);
    margin-top: 1rem;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
  }
  
  #an-subtitle {
    width: 100%;
    font-size: 1rem;
    color: var(--an-subtitle-color);
    margin-top: 1rem;
  }
  
  #an-published-div {
    display: block;
    margin-top: 1rem;
    width: 100%;
    font-size: 0.85rem;
    color: var(--published-text-color);
    border-left: 1px solid var(--published-text-color);
    padding-left: 0.4rem;
    
    #an-published {
      margin-right: 1rem;
      white-space: nowrap;
    }
    
    #an-updated {
      white-space: nowrap;
    }
  }
  
  #an-authors {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    overflow-x: scroll;
    scrollbar-width: none;
    margin-top: 1rem;
    -webkit-user-select: none;  
    -moz-user-select: none;    
    -ms-user-select: none;      
    user-select: none;
    
    .and {
      color: var(--author-name-color);
      margin-right: 0.6rem;
      margin-left: 0.6rem;
    }
    
    .author-card {
      display: inline-block; 
      white-space: nowrap;
      font-size: calc(1rem - 1px);
      color: var(--author-name-color);
      
      .by {
        display: inline-block;
        margin-right: 0.4rem;
      }
      
      img {
        vertical-align: middle;
        margin-right: 4px;
        width: 32px;
        height: 32px;
        border-radius: 50%;
      }
      
      a {
        text-decoration: none;
        color: var(--author-name-color);
        font-weight: 500;
        white-space: nowrap;
      }
      
      a:hover {
        text-decoration-line: underline;
      }
    }
  }
  
  #an-share {
    font-size: calc(1rem - 1px);
    color: var(--share-color);
    text-align: right;
    padding-top: 1rem;
    padding-right: 0.5rem;
    width: 100%;
    
    #feedback-button{
      border: 1px solid var(--feedback-border);
      border-radius: 5px;
      padding: 0.3rem 0.5rem;
      text-decoration: none;
      color: var(--feedback-color);
      
      &:hover {
        background-color: var(--feedback-border);
      }
    }
    
    #share-button {
      cursor: pointer;
      border: 1px solid var(--share-border);
      border-radius: 5px;
      padding: 0.3rem 0.5rem;
      width: fit-content;
      display: inline;
      
      span {
        margin-right: 0.3rem;
      }
      
      &:hover {
        background-color: var(--share-border);
      }
    }
  }
  
  #an-photo {
    padding-top: 1.5rem;

    img {
      width: 100%;
      object-fit: cover;
      border-radius: 8px;
    }
  }
  
  #an-photo-info {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    width: 100%;
    align-items: flex-start;
    color: var(--photo-info-color);
    border-left: 1px solid var(--photo-info-color);
    padding-left: 0.4rem;
  }

  #an-notes {
    width: 100%;
    margin-top: 1rem;
    font-size: calc(1rem - 2px);
    
    summary {
      color: var(--an-notes-summary);
      cursor: pointer;
      
      .click-to-read {
        font-weight: normal;
        color: var(--an-click-to-read);
      }
    }
    
    #an-notes-contents {
      margin-top: 0.4rem;
      color: var(--an-notes-contents);
      border: 1px solid var(--an-notes-border);
      border-radius: 5px;
      padding: 0 1rem;
    }
  }
  
  #an-summary {
    width: 100%;
    margin-top: 1rem;
    font-size: calc(1rem - 2px);
    
    summary {
      color: var(--an-summary-summary);
      cursor: pointer;
      
      .click-to-read {
        font-weight: normal;
        color: var(--an-click-to-read);
      }
    }
    
    #an-summary-contents {
      margin-top: 0.4rem;
      color: var(--an-summary-contents);
      border: 1px solid var(--an-summary-border);
      border-radius: 5px;
      padding: 0 1rem;
    }
  }

  #an-contents {
    width: 100%;
    display: flex;
    flex-flow: column;
    align-items: center;
    margin-top: 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    gap: 1.5rem;
    
    img {
      margin: 0.5rem 0;
      max-width: 100%;
      border-radius: 4px;
    }
    
    pre:has(code) {
      display: block; 
      max-width: 90vw;
      width: 100%;
      overflow-x: hidden;
      padding: 0;
      margin: 0;
      font-size: 90%;
      
      &:first-line {
        line-height: 0;
      }
      
      code {
        display: block;
        width: 100%;
        overflow-x: auto;
        padding-left: 0.5em;
        padding-right: 0.5em;
        margin: 0;
      }
    }
    
    code {
      border-radius: 5px; 
      -moz-border-radius: 5px; 
      -webkit-border-radius: 5px; 
      background-color: #ececec;
      padding: 2px;
      font: 0.9rem Monaco, Consolas, monospace;
    }
    
    p, h1, h2, h3, h4, h5, h6, pre {
      width: 100%;
      padding: 0;
      margin: 0;
    }
    
    p:has(img) {
      width: unset;
            
      img[style*='float:left'], img[style*='float: left'] {
        margin-right: 0.5rem;
      }
      
      img[style*='float:right'], img[style*='float: right'] {
        margin-left: 0.5rem;
      }
    }
    
    ol, ul {
      width: 100%;
      margin-top: 0;
      margin-bottom: 0;
    }
    
    p + ul, p + ol {
      margin-top: -1rem;
    }
    
    blockquote {
      width: 100%;
      margin: 0;
      padding-left: 20px;
      color: var(--blockquote-color);
      font-style: italic;
    }
    
    a:not(.ref-link) {
      text-decoration: none;
      color: blue;
    }
    
    figure {
      width: 100%;
      margin: 0;
      padding: 0;
    }
    
    figcaption {
      font-size: calc(1rem - 1px);
      color: var(--photo-info-color);
      padding-left: 10px;
    }
    
    hr {
      border: 0;
      clear:both;
      display:block;
      width: 96%;               
      background-color: var(--contents-hr-color);
      height: 1px;
    }
    
    table {
      margin-top: 0;
      margin-bottom: 0;
      font-size: 1rem;
      border: 1px solid var(--contents-table-border);
      border-spacing: 0;
      border-radius: 4px;
      
      th {
        font-weight: 500;
        border-bottom: 1px solid var(--contents-table-border);
      }
      
      tr:not(:first-child) td {
        border-top: 1px solid var(--contents-cell-border);
      }
      
      th, td {
        padding: 10px 15px;
      }
    }
    
    li {
      line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5 {
      font-weight: bold;
    }
    
    h1 {
      font-size: calc(1rem + 8px);
    }
    
    h2 {
      font-size: calc(1rem + 6px);
    }
    
    h3 {
      font-size: calc(1rem + 4px);
    }
    
    h4 {
      font-size: calc(1rem + 2px);
    }
    
    h5 {
      font-size: 1rem;
    }

    h6 {
      font-size: 1rem;
      font-weight: 500;
    }
  }
}

#an-references {
  #references-label {
    display: block;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: calc(1rem + 2px);
    font-weight: 500;
    color: var(--references-label-color);
  }
  
  #references {
    padding-inline-start: 1.5rem;
    
    .reference-item {
      font-size: calc(1rem - 2px);
      
      &:not(:last-child) { 
        margin-bottom: 0.4rem;  
      }
      
      &:hover {
        background-color: var(--reference-hover-background);
      }
      
      .ref-author {
        color: var(--reference-text-important-color);

        &:hover {
          background-color: var(--reference-part-hover-background);
        }
      }
      
      .ref-py {
        color: var(--reference-text-normal-color);
        white-space: nowrap;
      }
      
      .ref-title {
        color: var(--reference-text-important-color);
        font-weight: 500;

        &:hover {
          background-color: var(--reference-part-hover-background);
        }
      }
      
      .ref-source {
        &:hover {
          background-color: var(--reference-part-hover-background);
        }

        .source-part-label {
          color: var(--reference-text-normal-color);
        }
        
        .source-part-content {
          color: var(--reference-text-important-color);
          font-style: italic;
        }
      }
      
      .reference-url {
        a {
          text-decoration: none;
          color: var(--reference-url-color);
        }
        
        a:hover {
          color: var(--reference-url-color-hover);
        }
      }
      
      .ref-type {
        color: var(--reference-text-normal-color);
        white-space: nowrap;
      }
      
      .loc-cit {
        font-style: italic;
        color: var(--reference-text-normal-color);
        white-space: nowrap;
      }
    } 
  }
}

#related-analyses-label {
  width: 100%;
  font-size: calc(1rem + 5px);
  color: var(--related-analyses-label-color);
  margin-top: 1.5rem;
}

.related-analyses {
  width: calc(100% - 3rem);
  max-width: var(--max-width-main);
  border-top: 1px solid var(--related-analyses-border);
  display: flex;
  flex-flow: column;
  align-items: center;
  margin-left: 1.5rem;
  margin-right: 1.5rem;
  padding-bottom: 2rem;
  gap: 1.5rem;
      
  .analysis-card {
    width: 100%;
    display: flex;
    flex-flow: row;
    padding: 0;
    margin: 0;
  
    .analysis-img {
      display: block;
      width: var(--analysis-image-size-small-screen);
      float: left;
      margin-right: 1rem;
      max-width: var(--analysis-image-size);
      aspect-ratio: 4/3;
      border-radius: 16px;
      object-fit: cover;
    }
  
    .analysis-contents {
      display: flex;
      flex-flow: column;
      
      .title-div {
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--analysis-title-color);
        font-size: calc(1rem + 3px);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2; 
        -webkit-box-orient: vertical;
        
        .analysis-title {
          text-decoration: none;
          font-weight: 500;
          color: var(--analysis-title-color);
        }
        
        .analysis-title:hover {
          color: var(--analysis-title-color-hover);
        }
      }
      
      .title-div:hover {
        color: var(--analysis-title-color-hover);
      }
      
      .analysis-description {
        width: 100%;
        font-size: 1rem;
      }
    }
  }
}

#comments-section {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;  
  width: 100%;
}

@media (min-width:1700px) {
  #an-main {
    #an-title {
      font-size: 26px;
    }
  }
}

@media (max-width: 768px) {
  #an-main {
    #an-title {
      font-size: calc(1rem + 5px);
    }
  }
  
  .related-analyses {
    .analysis-card {
      flex-flow: column;
      
      .analysis-img {
        width: 100%;
        /*max-width: var(--analysis-image-size-tablet);*/
        margin-top: 1rem;
        margin-left: auto;
        margin-right: auto;
        aspect-ratio: 16/9;
        border-radius: 8px;
      }
        
      .analysis-contents {
        flex-flow: column;
        align-items: center;
        
        .title-div {
          margin-top: 0.8rem;
        }
        
        .analysis-description {
          margin-top: 0.5rem;
        }
      }
    }
  }
}

@media screen and (max-width: 420px) {
  #an-main {
    #an-title {
      font-size: calc(1rem + 4px);
    }
  }
}

@media screen and (max-width: 360px) {
  #an-main {
    #an-title {
      font-size: calc(1rem + 2px);
    }
  }
}