/* FONT IMPORTS */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+Pro:wght@200;400&display=swap');

/* CSS RESET */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* DECLARED VARIABLES */
:root {
    /* COLORS */
    --body-bg-color: #fffcf2;
    --body-color: #070029;
    --switch-bg-color: #d57676;
    --url-color: #0000EE;
    /* SIZES */
    --sidebar-max-width: 201px;/*250px*/
  }

/* ELEMENTS */
a {
    color: var(--body-color);
    text-decoration: none;
}

a.url {
    color: var(--url-color);
    text-decoration: none;
}

a:hover, a:focus {
    color: var(--url-color);
    cursor: pointer;
    /*opacity: 0.6;*/
    text-decoration: underline;
}

article {
    display: block;
}

body {
    background-color: var(--body-bg-color);
    color: var(--body-color);
    display: block;
    font-family: 'Source Serif Pro';
    font-size: 1.2rem;
    margin: 1rem auto;
    max-width: 2000px;
    padding: 0 20px; /* top right bottom left ; top sides bottom ; top/bottom sides ; all sides */
}

details.spoiler summary::after {
    content: var(--hidden);
    display: block;
    filter: blur(4px);
}
  
details[open] summary::after {
    display: none;
}

div {
    display: block;
}

hr {
    border-color: var(--body-color)
}

img {
    height: auto; /* Maintain aspect ratio */
    max-width: 100%; /* Responsive image */
}

main {
    display: flex;/*block*/
    flex-direction: row; /* Sidebar on the left, content on the right */
}

nav {
    /*display: block;*/
    flex: 0 0 auto; /* Sidebar doesn't grow or shrink */
}

ol {
    counter-reset: item;
    padding-left: 2rem;
    /*background-color: #e29393;*/
}

ol > li {
    counter-increment: item;
}

ol ol > li {
    display: block;
}

ol ol > li:before {
    content: counters(item, ".") " ";
    margin-left: -20px;
}
/* Level 1: Start from 0 */
.level-1 {
    /*counter-reset: level1 -1; /* Start from 0 */
    counter-reset: level1 var(--level1-start, 0);
}

.level-1 > li {
    counter-increment: level1;
    list-style-type: none;
}

.level-1 > li::before {
    content: counter(level1) ". ";
    margin-left: -20px;
}

/* Level 2 */
.level-2 {
    /*counter-reset: level2;*/
    counter-reset: level2 var(--level2-start, 0);
}

.level-2 > li {
    counter-increment: level2;
    list-style-type: none;
}

.level-2 > li::before {
    content: counter(level1) "." counter(level2) " ";
}

/* Level 3 */
.level-3 {
    counter-reset: level3;
}

.level-3 > li {
    counter-increment: level3;
    list-style-type: none;
}

.level-3 > li::before {
    content: counter(level1) "." counter(level2) "." counter(level3) " ";
}

/* Level 4 */
.level-4 {
    counter-reset: level4;
}

.level-4 > li {
    counter-increment: level4;
    list-style-type: none;
}

.level-4 > li::before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) " ";
}
/* Continue for further levels */

p {
    letter-spacing: 0.02rem;
    margin-block-start: .5em;
    margin-block-end: .5em;
    text-align: justify;
    word-spacing: 0.08rem;
}

s {
    text-decoration-thickness: 3px;
}

table {
    border-collapse: collapse;
    width: 30%;
    margin: 20px auto;
}

th, td {
    border: 1px solid #000;
    padding: 10px;
    text-align: center;
}

th {
    background-color: #f2f2f2;
}

ul {
    padding-left: 2rem;
    /*background-color: #e29393;*/
}

.aligned-text {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Aligns text vertically in case of multi-line content */
    position: relative;
}

.aligned-text::before {
    content: '';
    position: absolute;
    left: -20px; /* Adjust to position the bullet correctly */
    background: currentColor; /* Uses the current text color for the bullet */
    width: 6px; /* Adjust the size of the bullet */
    height: 6px;
    border-radius: 50%; /* Makes it round */
}

.formalProof {
    border-collapse: collapse;
    width: auto; /* Allows the table to shrink to fit its content */
    background-color: transparent; /* Ensures no unwanted background */
    border: none; /* Invisible borders */
    margin-left: 0; /* Aligns the table to the left */
    margin-right: auto; /* Prevents centering */
}

.formalProof th {
    background-color: transparent !important; /* Overrides any inherited background */
    font-weight: normal !important; /* Removes bold */
    text-align: left; /* Default alignment to override global CSS */
    white-space: nowrap; /* Prevents wrapping */
}

/* Remove borders from table cells */
.formalProof th, 
.formalProof td {
    border: none !important; /* Invisible borders */
    padding: 8px;
    white-space: nowrap; /* Ensures columns fit their content */
}

/* Column alignments for both headers and data cells */
.formalProof th:nth-child(1), 
.formalProof td:nth-child(1) { text-align: right; }   /* First column */

.formalProof th:nth-child(2), 
.formalProof td:nth-child(2) { text-align: center; }  /* Second column */

.formalProof th:nth-child(3), 
.formalProof td:nth-child(3) { text-align: left; }    /* Third column */

.formalProof th:nth-child(4), 
.formalProof td:nth-child(4) { text-align: left; }  /* Fourth column */

.formalProof th:nth-child(5), 
.formalProof td:nth-child(5) { text-align: left; }    /* Fifth column */

.image-container {
    margin-bottom: 20px; /* Space between images */
}

.image-container p {
    font-size: 16px;
    margin: 5px 0;
}

.latex-container {
    overflow-x: auto;  /* Enables horizontal scrolling */
    max-width: 100%;   /* Prevents expanding beyond parent */
    display: block;
}

.post {
    flex: 1; /* Content takes up the remaining space */
    min-width: 0;  /* Allows it to shrink if necessary --> without it, if a LaTeX line is too long, the block becomes horizontally larger and a horizontal scroll bar appears*/
    padding: 0 var(--sidebar-max-width) 1rem 1rem;
}

.sidebar {
    font-size: 1.4rem;
    min-width: 200px; /* Ensure a minimum width for longer links */
    max-width: var(--sidebar-max-width); /* Prevents it from being too wide on large screens */
    overflow-x: auto; /* Adds vertical scrollbar only if needed */
    overflow-y: hidden; /* Prevents horizontal scrollbar */
    white-space: nowrap; /* Prevents text wrapping */
    width: auto; /* Allows the sidebar to adjust its width */
    scrollbar-width: none; /* Firefox */
    /*background-color: #e29393;*/
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sidebar-links {
    align-items: flex-start; /* Aligns the links to the start */
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Adds space between links */
}

.sidebar-links a {
    font-variant: small-caps;
    font-weight: bold;
    white-space: nowrap; /* Prevents text wrapping */
}

.tables-container {
    display: flex;
    justify-content: space-around;
    gap: 20px; /* Optional: Adds space between the tables */
}

.top-title {
    font-size: 2.5rem;
    font-variant: small-caps;
    text-align: center;
}

/*tree*/
/*.tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.node {
    position: relative;
    text-align: center;
    font-size: 24px;
    margin: 20px;
}
.line {
    position: absolute;
    width: 2px;
    background: black;
}
.highlight {
    background-color: lightgreen;
    border-radius: 50%;
    padding: 5px;
}
.tree svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}*/
/*.tree {
            position: relative;
            width: 500px;
            height: 500px;
        }
.node {
    position: absolute;
    text-align: center;
    font-size: 24px;
}
 .highlight {
    background-color: lightgreen;
    border-radius: 50%;
    padding: 5px;
}
.tree svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}*/

.binary-tree{
    /*width: fit-content;*/
    display: flex;
    justify-content: center;
    /*margin: auto;*/
    /*display: inline-block; /* Keeps it within the text flow */
    /*margin: 0; /* Removes extra space */
    margin-bottom: 0; /* Remove extra spacing below */
    padding-bottom: 0; /* Ensure no extra padding */
    vertical-align: middle; /* Aligns with nearby text */
    /*width: 100%;*/
}

.binary-tree div{
    display: grid;
    gap: .5rem;  /* if you change this, update height from span::before */
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    margin-top: 1.5rem; /* regulates vertical spacing btw nodes */  /* if you change this, update height from span::before */
    position: relative;
}

.binary-tree span{
    /*border: 1px solid;
    border-radius: 50%; /* makes borders rounded */
    border: none;
    display: grid; /* centers content together with "place-items:center;" */
    grid-column: 1 / 3;
    height: 2rem;
    margin: auto auto; /* centers nodes/makes tree sym */
    place-items:center; /* centers content together with "display: grid;" */
    width: 2rem;
}

.binary-tree span::before{ /* edges */
    background: linear-gradient(to bottom right, #0000 49%, #000 0 51%, #0000 0);
    content: "";
    height: 2rem; /* = div's margin-top + gap */
    left: 50%;
    position: absolute; /* makes pos relative to div and not to span */
    top: 0;
    transform: translateY(-100%);
    width: 50%;
}

.binary-tree :nth-child(3) > span::before{ /* 3rd child = right edge */
    background: linear-gradient(to bottom left, #0000 49%, #000 0 51%, #0000 0);
    left: auto;
    right: 50%;
}

.binary-tree > div > span::before{ /* removes edge from the top of the starting node */
    content: none;
}

/*.binary-tree span:empty {
    display: none;
}

.binary-tree span:empty::before {
    content: none;
}*/

.binary-tree span:empty {
    visibility: hidden; /* Makes the empty nodes invisible but keeps their space */
    border: none; /* Hides the circular border */
}

.binary-tree span:empty::before {
    content: none; /* Removes the connecting edge */
}

.highlight-blue {
    background-color: lightblue;
    border-radius: 50%;
    padding: 5px;
}

.highlight-brown {
    background-color: peru;
    border-radius: 50%;
    padding: 5px;
}

.highlight-cyan {
    background-color: cyan;
    border-radius: 50%;
    padding: 5px;
}

.highlight-gray {
    background-color: lightgray;
    border-radius: 50%;
    padding: 5px;
}

.highlight-green {
    background-color: lightgreen;
    border-radius: 50%;
    padding: 5px;
}

.highlight-lime {
    background-color: limegreen;
    border-radius: 50%;
    padding: 5px;
}

.highlight-magenta {
    background-color: hotpink;
    border-radius: 50%;
    padding: 5px;
}

.highlight-navy {
    background-color: navy;
    border-radius: 50%;
    padding: 5px;
}

.highlight-orange {
    background-color: lightsalmon; /* Light orange shade */
    border-radius: 50%;
    padding: 5px;
}

.highlight-pink {
    background-color: lightpink;
    border-radius: 50%;
    padding: 5px;
}

.highlight-purple {
    background-color: mediumorchid;
    border-radius: 50%;
    padding: 5px;
}

.highlight-red {
    background-color: lightcoral; /* Light red shade */
    border-radius: 50%;
    padding: 5px;
}

.highlight-teal {
    background-color: teal;
    border-radius: 50%;
    padding: 5px;
}

.highlight-turquoise {
    background-color: paleturquoise; /* Light turquoise shade */
    border-radius: 50%;
    padding: 5px;
}

.highlight-violet {
    background-color: plum; /* Light violet shade */
    border-radius: 50%;
    padding: 5px;
}

/* orders --> not sure it's useful */
.binary-tree.inorder div,
.binary-tree.preorder div,
.binary-tree.postorder div{
    display: flex;
    gap: 0;
    margin: 0;
}

.binary-tree.inorder span::before,
.binary-tree.preorder div span::before,
.binary-tree.postorder div span::before{
    content: none;
}

.binary-tree.preorder :nth-child(1) { order: 1; } /* value */
.binary-tree.preorder :nth-child(2) { order: 2; } /* left side */
.binary-tree.preorder :nth-child(3) { order: 3; } /* right side */

.binary-tree.inorder :nth-child(1) { order: 2; } /* value */
.binary-tree.inorder :nth-child(2) { order: 1; } /* left side */
.binary-tree.inorder :nth-child(3) { order: 3; } /* right side */

.binary-tree.postorder :nth-child(1) { order: 3; } /* value */
.binary-tree.postorder :nth-child(2) { order: 1; } /* left side */
.binary-tree.postorder :nth-child(3) { order: 2; } /* right side */

.binary-tree.invert{
    transform: scaleX(-1);
}

.subscript {
    font-size: 0.7em; /* Make the subscript smaller */
}

#contact-box {
    align-items: center;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
