/*The phrase "monitor" is going to refer to the section in the middle of the screen with all the interactables. Effectively everything contained within the "screen-split" element. On mobile, this is effectively the entire site.*/

html, body{
  margin:0;
  height: 100dvh;
  max-height: 100dvh;
}

body{
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.layout{
  display: grid;
  grid-template-columns: 1fr 968px 120px 1fr; /*ngl 968 isn't always ideal but it's kinda a funny number to me. 120px to offset the entire monitor so the main content is centred on the screen. It's basically 840px + 128px of sidebar to line up with the square logo and a 128px header.*/
  grid-template-rows: 16px 1fr 16px;
  height: 100dvh;
}
.screen-split{
  
  box-shadow: 0px 0px 5px 5px rgba(15, 15, 15, 0.4); 
  border: solid 4px var(--dark);
  border-radius: 16px 16px 16px 16px;
  overflow: hidden; /*Rounded corners on the monitor frame means the contents would overflow, so this cuts them out*/
}

.scroll-container{
  display: grid;
  grid-template-rows: 128px 1fr; /*To have a consistent logo size, this is mandatory. As buttons and so on are a fixed size, could potentially play about with scaling the logo as the screen shrinks to keep priority on the written content size*/   
  height: 100%;
  overflow: auto;

  background-color: var(--lighttransparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header{
  display: grid;
  grid-template-columns: 128px 1fr; /*Logo, piano buttons*/  
  background-color: var(--dark);
}

.header-interactables-container{ /*exists to allow the buttons and nav breadcrumbs to move as a single unit*/
  overflow-x: auto;
  display: grid;
  grid-template-rows: 30px 98px; /*Breadcrumb nav, piano buttons */
}

.breadcrumbs{
  font-family: 'Mecha-Private';
  display: flex;
  align-self: start; /*Centres the text in its container vertically*/
  padding: 1px 4px 3px;
  margin-left: 8px;
  font-size: large;
  color: var(--light);
  background-color: var(--tertiary);    
  white-space: nowrap; /*Forces text to extend on narrower screen sizes*/
}

.breadcrumbs-text{
  margin-top: 3px;
}

.header-button-holder{  
  display: flex;
  align-items: flex-end;
}

.button-div{
  margin-left: 8px;
  margin-right: 0px;
}

.button-text{
  background-color: var(--light);
  writing-mode:vertical-rl;
  padding: 10px;
  margin-left: 8px;
  margin-right: 0px;
  margin-bottom: 3px;
  transform: rotate(180deg);
  text-align: left;
  height: 75px;
  
  font-family: 'Mecha-Private';
  color: var(--dark);
}

.content-container{
  display: grid;
  grid-template-columns: 128px 1fr;
  height: 100%;
}

.sidebar{   
  display: flex;
  flex-wrap: wrap; /*Without this, the images get scaled absurdly large for some reason*/
  justify-content: center;
  align-content: flex-start;
  text-align: center;
  background-color: var(--tertiary);
  grid-row: 1;
  grid-column: 1;  
  padding-bottom: 99px;
}

.sidebar-image{
  margin: 16px 16px 0px;
}

.sidebar-image a{
  display: flex; /*Without this the scale of the image is changed, giving the same effect as padding. So links need to be purposely set to display with flex */
  border: 3px solid;
}

.content-cover{
  background-color: none;        
  border-left: solid;
  border-width: 8px;
  border-color: var(--contrast_tertiary);  
  grid-row: 1;
  grid-column: 2;
  overflow-x: hidden;

  display: flex;
  flex-direction: column;
}

.content-text{  
  padding: 16px;
  padding-top:0px;
  line-height: 150%;
  font-size: 18px;
  font-family: 'Atkinson Hyperlegible Next-Private';
  white-space: wrap;
}
/*
.content-text a{  
  color: var(--contrast_tertiary);
}

.content-text a:visited{
  color: var(--tertiary);
}*/

.content-text img{
  display: block;
  margin-inline: auto;
  max-height: 1080px;
  max-width: min(600px, 100%);
}

.content-text p:has(> a > img){
  display: flex;
  justify-content: center;
  position: relative; 
}

.content-text p:has(> a > img) a {
  position: relative;
  max-width: min(600px, 100%);
  border: solid 3px;
  margin-bottom: 16px;
}

.content-text a:has(> img)::after {
  content: attr(href);
  position: absolute;

  top: 100%;   /* place BELOW the image */
  right: -3px;
  color: var(--dark);
  font-size: 10px;
  padding: 0px 3px 0px 3px;
  border-radius: 0 0 3px 3px;
  border-top: none;
  margin-top: 3px;

  background-color: var(--tertiary_transparent);

  white-space: nowrap;
  max-width: min(100%, 300px);
  overflow: hidden;
  text-overflow: ellipsis;

}

.content-text p:has(> a > img) img {
  margin: 0;
}

.content-text h1{
  padding-top:16px;
}

.content-text h1, .content-text h2, .content-text h3{
  margin-top: 0px !important;
  margin-bottom: 0px !important;
  font-family: 'Mecha-Private' !important;
  line-height: normal;
}

.content-text blockquote{
  background-color: var(--tertiary);
  padding: 8px;
  margin-right: 0px;
  font-size:14px;
  white-space: normal;
  overflow-x: auto;
  min-width: calc(100% - 40px);
  border-left:var(--contrast_tertiary) solid 6px;
}

.content-text table{
  margin: auto;
  border-spacing: 0px;
  /*float: left;*/
}

tr:nth-child(even) td {
  background-color: var(--tertiary_transparent);
}

th:first-of-type {
  border-top-left-radius: 10px;
}
th:last-of-type {
  border-top-right-radius: 10px;
}
tr:last-of-type td:first-of-type {
  border-bottom-left-radius: 10px;
}
tr:last-of-type td:last-of-type {
  border-bottom-right-radius: 10px;
}

.content-text td:first-of-type{
  border: solid;
  
  border-top:none;
  border-right: none;  
}
.content-text td:last-of-type {
  border: solid;
  
  border-top:none;
  border-left: solid grey 1px;   
}

.content-text th:first-of-type{
  border: solid;
  
  border-right: none;  
}
.content-text th:last-of-type {
  border: solid;
   
  border-left: solid grey 1px;  
}

.content-text th{
  background-color: var(--tertiary);
}

.content-text th, .content-text td{
  padding: 4px;
  border: none; 
  border-top: solid;
  border-bottom: solid;
  
}
.content-text td{
  border-top:none;
  
  border-left: solid grey 1px; 
}

.content-text th{  
  border-left: solid grey 1px; 
}



.content-text blockquote hr{
  border:var(--contrast_tertiary) solid;
  width:calc(100% - 8px);
  margin-left: -8px;
}

.content-text code{
  font-size:small;
}

.content-text blockquote code{
  white-space: pre;
  font-size: small;
  overflow-x: auto;
  padding-right: 16px;
  max-width: 100%;
  display: block;
}

@media (max-width: 1105px){
  body{
    overflow: none;
  }

  .layout{
    grid-template-columns: 1fr min(840px,97vw) 1fr;
  }

  .screen-split{
    
  border-radius: 4px 26px 4px 26px;    
  }

  .content-container{          
    display: grid;
    grid-template-rows: 1fr min-content;
    grid-template-columns: 1fr;
    
    overflow-y: auto;
  }
  
  .sidebar{          
    width: 100%;
    grid-row: 2;
    grid-column: 1;
    padding-bottom: 0px;
  }

  .sidebar-image{
    margin: 16px 16px 16px;
  }

  .content-cover{
    padding-bottom: 0px;
    border-bottom: solid;  
    border-width: 8px;
    border-color: var(--contrast_tertiary);   
    box-sizing: border-box;   
    min-height: 595px;
    grid-row: 1;
    grid-column: 1;
  }

  .content-text{
    font-size: 14px;
  }
}