/* ============================================
   NexusEdgeIT Stylesheet
   ============================================ */

/* ------------------------------------------------
   Header
   ------------------------------------------------ */
header {
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  margin: 2rem 0;
  display: flex;
}

header h1 {
  flex: auto;
  margin: 0;
}

/* ------------------------------------------------
   Clipboard Button
   ------------------------------------------------ */
.clipboard-button {
  float: right;
  color: var(--gray);
  border-color: var(--dark);
  background-color: var(--light);
  opacity: 0;
  border: 1px solid;
  border-radius: 5px;
  margin: 0.3rem;
  padding: 0.4rem;
  transition: all 0.2s;
  display: flex;
  position: absolute;
  right: 0;
}

.clipboard-button > svg {
  fill: var(--light);
  filter: contrast(0.3);
}

.clipboard-button:hover {
  cursor: pointer;
  border-color: var(--secondary);
}

.clipboard-button:focus {
  outline: 0;
}

pre:hover > .clipboard-button {
  opacity: 1;
  transition: all 0.2s;
}

/* ------------------------------------------------
   Breadcrumb
   ------------------------------------------------ */
.breadcrumb-container {
  flex-flow: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
}

.breadcrumb-element {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  display: flex;
}

.breadcrumb-element p {
  margin: 0 0 0 0.5rem;
  padding: 0;
  line-height: normal;
}

/* ------------------------------------------------
   Article & Content
   ------------------------------------------------ */
.article-title {
  margin: 2rem 0 0;
}

.content-meta {
  color: var(--gray);
  margin-top: 0;
}

.content-meta[show-comma="true"] > :not(:last-child) {
  margin-right: 8px;
}

.content-meta[show-comma="true"] > :not(:last-child):after {
  content: ",";
}

/* ------------------------------------------------
   Tags
   ------------------------------------------------ */
.tags {
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
  padding-left: 0;
  list-style: none;
  display: flex;
}

.section-li > .section > .tags {
  justify-content: flex-end;
}

.tags > li {
  white-space: nowrap;
  overflow-wrap: normal;
  margin: 0;
  display: inline-block;
}

a.internal.tag-link {
  background-color: var(--highlight);
  border-radius: 8px;
  margin: 0 0.1rem;
  padding: 0.2rem 0.4rem;
}

/* ------------------------------------------------
   Page Title & Search
   ------------------------------------------------ */
.page-title {
  margin: 0;
  font-size: 1.75rem;
}

.search {
  min-width: fit-content;
  max-width: 14rem;
}

/* Search Button */
.search > .search-button {
  background-color: var(--lightgray);
  font-family: inherit;
  font-size: inherit;
  height: 2rem;
  text-align: inherit;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  border-radius: 4px;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0;
  display: flex;
}

.search > .search-button > p {
  padding: 0 1rem;
  display: inline;
}

.search > .search-button svg {
  cursor: pointer;
  width: 18px;
  min-width: 18px;
  margin: 0 0.5rem;
}

.search > .search-button svg .search-path {
  stroke: var(--darkgray);
  stroke-width: 2px;
  transition: stroke 0.5s;
}

/* Search Container */
.search > #search-container {
  contain: layout;
  z-index: 999;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  width: 100vw;
  height: 100vh;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
}

.search > #search-container.active {
  display: inline-block;
}

.search > #search-container > #search-space {
  width: 65%;
  margin-top: 12vh;
  margin-left: auto;
  margin-right: auto;
}

@media not (min-width: 1200px) {
  .search > #search-container > #search-space {
    width: 90%;
  }
}

.search > #search-container > #search-space > * {
  background: var(--light);
  border-radius: 7px;
  width: 100%;
  margin-bottom: 2em;
  box-shadow: 0 14px 50px #1b21301f, 0 10px 30px #1b213029;
}

.search > #search-container > #search-space > input {
  box-sizing: border-box;
  font-family: var(--bodyFont);
  color: var(--dark);
  border: 1px solid var(--lightgray);
  padding: 0.5em 1em;
  font-size: 1.1em;
}

.search > #search-container > #search-space > input:focus {
  outline: none;
}

/* Search Layout */
.search > #search-container > #search-space > #search-layout {
  border: 1px solid var(--lightgray);
  box-sizing: border-box;
  flex-direction: row;
  flex: 0 0 100%;
  display: none;
}

.search > #search-container > #search-space > #search-layout.display-results {
  display: flex;
}

.search > #search-container > #search-space > #search-layout[data-preview] > #results-container {
  flex: 0 0 min(30%, 450px);
}

@media not (max-width: 800px) {
  .search > #search-container > #search-space > #search-layout[data-preview] .result-card > p.preview {
    display: none;
  }
  .search > #search-container > #search-space > #search-layout[data-preview] > div:first-child {
    border-right: 1px solid var(--lightgray);
    border-top-right-radius: unset;
    border-bottom-right-radius: unset;
  }
  .search > #search-container > #search-space > #search-layout[data-preview] > div:last-child {
    border-top-left-radius: unset;
    border-bottom-left-radius: unset;
  }
}

.search > #search-container > #search-space > #search-layout > div {
  border-radius: 5px;
  height: 63vh;
}

@media (max-width: 800px) {
  .search > #search-container > #search-space > #search-layout > #preview-container {
    display: none !important;
  }
  .search > #search-container > #search-space > #search-layout[data-preview] > #results-container {
    flex: 0 0 100%;
    width: 100%;
    height: auto;
  }
}

/* Search Highlights */
.search > #search-container > #search-space > #search-layout .highlight {
  background: color-mix(in srgb, var(--tertiary) 60%, #fff0);
  border-radius: 5px;
  scroll-margin-top: 2rem;
}

/* Preview Container */
.search > #search-container > #search-space > #search-layout > #preview-container {
  color: var(--dark);
  flex-grow: 1;
  padding: 0 2rem;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5em;
  display: block;
  overflow: hidden auto;
}

.search > #search-container > #search-space > #search-layout > #preview-container .preview-inner {
  width: min(800px, 100%);
  margin: 0 auto;
}

.search > #search-container > #search-space > #search-layout > #preview-container a[role="anchor"] {
  background-color: #0000;
}

/* Results Container */
.search > #search-container > #search-space > #search-layout > #results-container {
  overflow-y: auto;
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card {
  cursor: pointer;
  border-bottom: 1px solid var(--lightgray);
  box-sizing: border-box;
  text-transform: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  font-weight: inherit;
  outline: none;
  margin: 0;
  padding: 1em;
  transition: background 0.2s;
  display: block;
  overflow: hidden;
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card:hover,
.search > #search-container > #search-space > #search-layout > #results-container .result-card:focus,
.search > #search-container > #search-space > #search-layout > #results-container .result-card.focus {
  background: var(--lightgray);
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card > h3 {
  margin: 0;
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card > ul.tags {
  margin-top: 0.45rem;
  margin-bottom: 0;
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card > ul > li > p {
  background-color: var(--highlight);
  color: var(--secondary);
  border-radius: 8px;
  margin: 0 0.1rem;
  padding: 0.2rem 0.4rem;
  font-weight: 700;
  line-height: 1.4rem;
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card > ul > li > p.match-tag {
  color: var(--tertiary);
}

.search > #search-container > #search-space > #search-layout > #results-container .result-card > p {
  margin-bottom: 0;
}

/* ------------------------------------------------
   Dark Mode Toggle
   ------------------------------------------------ */
.darkmode {
  cursor: pointer;
  width: 20px;
  height: 20px;
  text-align: inherit;
  background: 0 0;
  border: none;
  margin: 0 10px;
  padding: 0;
  position: relative;
}

.darkmode svg {
  width: 20px;
  height: 20px;
  fill: var(--darkgray);
  transition: opacity 0.1s;
  position: absolute;
  top: calc(50% - 10px);
}

/* Dark Theme Variables */
:root[saved-theme="dark"] {
  --lightningcss-light: ;
  --lightningcss-dark: initial;
  color-scheme: dark;
}

:root[saved-theme="light"] {
  --lightningcss-light: initial;
  --lightningcss-dark: ;
  color-scheme: light;
}

/* Dark Mode Icon Toggle */
:root[saved-theme="dark"] .darkmode > #dayIcon {
  display: none;
}

:root[saved-theme="dark"] .darkmode > #nightIcon,
:root .darkmode > #dayIcon {
  display: inline;
}

:root .darkmode > #nightIcon {
  display: none;
}

/* ------------------------------------------------
   Explorer (Directory Sidebar)
   ------------------------------------------------ */
.explorer {
  flex-direction: column;
  display: flex;
  overflow-y: hidden;
}

@media not (max-width: 800px) {
  .explorer.desktop-only {
    display: flex;
  }
}

button#explorer {
  text-align: left;
  cursor: pointer;
  color: var(--dark);
  background-color: #0000;
  border: none;
  align-items: center;
  padding: 0;
  display: flex;
}

button#explorer h2 {
  margin: 0;
  font-size: 1rem;
  display: inline-block;
}

button#explorer .fold {
  opacity: 0.8;
  margin-left: 0.5rem;
  transition: transform 0.3s;
}

button#explorer.collapsed .fold {
  transform: rotate(-90deg);
}

/* Folder Styles */
.folder-outer {
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease-in-out;
  display: grid;
}

.folder-outer.open {
  grid-template-rows: 1fr;
}

.folder-outer > ul {
  overflow: hidden;
}

#explorer-content {
  visibility: visible;
  max-height: 100%;
  margin-top: 0.5rem;
  list-style: none;
  transition: max-height 0.35s, visibility linear;
  overflow: hidden auto;
}

#explorer-content.collapsed {
  visibility: hidden;
  max-height: 0;
  transition: max-height 0.35s, visibility 0s linear 0.35s;
}

#explorer-content ul {
  margin: 0.08rem 0;
  padding: 0;
  list-style: none;
  transition: max-height 0.35s, transform 0.35s, opacity 0.2s;
}

#explorer-content ul li > a {
  color: var(--dark);
  opacity: 0.75;
  pointer-events: all;
}

#explorer-content ul li {
  margin-bottom: 0.25rem;
}

#explorer-content > #explorer-ul {
  max-height: none;
}

svg {
  pointer-events: all;
}

svg > polyline {
  pointer-events: none;
}

/* Folder Container */
.folder-container {
  -webkit-user-select: none;
  user-select: none;
  flex-direction: row;
  align-items: center;
  display: flex;
}

.folder-container div > a {
  color: var(--secondary);
  font-family: var(--headerFont);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5rem;
  display: inline-block;
}

.folder-container div > a:hover {
  color: var(--tertiary);
}

.folder-container div > button {
  color: var(--dark);
  text-align: left;
  cursor: pointer;
  font-family: var(--headerFont);
  background-color: #0000;
  border: none;
  align-items: center;
  padding-left: 0;
  padding-right: 0;
  display: flex;
}

.folder-container div > button span {
  color: var(--secondary);
  pointer-events: none;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5rem;
  display: inline-block;
}

.folder-icon {
  color: var(--secondary);
  cursor: pointer;
  backface-visibility: visible;
  margin-right: 5px;
  transition: transform 0.3s;
}

li:has(> .folder-outer:not(.open)) > .folder-container > svg {
  transform: rotate(-90deg);
}

.folder-icon:hover {
  color: var(--tertiary);
}

.no-background:after {
  background: 0 0 !important;
}

#explorer-end {
  height: 4px;
  margin: 0;
}

/* ------------------------------------------------
   Table of Contents (TOC)
   ------------------------------------------------ */
.toc {
  flex-direction: column;
  display: flex;
}

.toc.desktop-only {
  max-height: 40%;
}

@media not (max-width: 800px) {
  .toc {
    display: flex;
  }
}

button#toc {
  text-align: left;
  cursor: pointer;
  color: var(--dark);
  background-color: #0000;
  border: none;
  align-items: center;
  padding: 0;
  display: flex;
}

button#toc h3 {
  margin: 0;
  font-size: 1rem;
  display: inline-block;
}

button#toc .fold {
  opacity: 0.8;
  margin-left: 0.5rem;
  transition: transform 0.3s;
}

button#toc.collapsed .fold {
  transform: rotate(-90deg);
}

#toc-content {
  visibility: visible;
  max-height: 100%;
  list-style: none;
  transition: max-height 0.35s, visibility linear;
  position: relative;
  overflow: hidden auto;
}

#toc-content.collapsed {
  visibility: hidden;
  max-height: 0;
  transition: max-height 0.35s, visibility 0s linear 0.35s;
}

#toc-content.collapsed > .overflow:after {
  opacity: 0;
}

#toc-content ul {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

#toc-content ul > li > a {
  color: var(--dark);
  opacity: 0.35;
  transition: opacity 0.5s, color 0.3s;
}

#toc-content ul > li > a.in-view {
  opacity: 0.75;
}

#toc-content > ul.overflow {
  width: 100%;
  max-height: none;
}

#toc-content .depth-0 {
  padding-left: 0;
}

#toc-content .depth-1 {
  padding-left: 1rem;
}

#toc-content .depth-2 {
  padding-left: 2rem;
}

#toc-content .depth-3 {
  padding-left: 3rem;
}

#toc-content .depth-4 {
  padding-left: 4rem;
}

#toc-content .depth-5 {
  padding-left: 5rem;
}

#toc-content .depth-6 {
  padding-left: 6rem;
}

/* ------------------------------------------------
   Graph
   ------------------------------------------------ */
.graph > h3 {
  margin: 0;
  font-size: 1rem;
}

.graph > .graph-outer {
  border: 1px solid var(--lightgray);
  box-sizing: border-box;
  border-radius: 5px;
  height: 250px;
  margin: 0.5em 0;
  position: relative;
  overflow: hidden;
}

.graph > .graph-outer > #global-graph-icon {
  cursor: pointer;
  color: var(--dark);
  opacity: 0.5;
  cursor: pointer;
  background: 0 0;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  margin: 0.3rem;
  padding: 0.2rem;
  transition: background-color 0.5s;
  position: absolute;
  top: 0;
  right: 0;
}

.graph > .graph-outer > #global-graph-icon:hover {
  background-color: var(--lightgray);
}

.graph > #global-graph-outer {
  z-index: 9999;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  width: 100vw;
  height: 100%;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
}

.graph > #global-graph-outer.active {
  display: inline-block;
}

.graph > #global-graph-outer > #global-graph-container {
  border: 1px solid var(--lightgray);
  background-color: var(--light);
  box-sizing: border-box;
  border-radius: 5px;
  width: 80vw;
  height: 80vh;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@media not (min-width: 1200px) {
  .graph > #global-graph-outer > #global-graph-container {
    width: 90%;
  }
}

/* ------------------------------------------------
   Recent Notes
   ------------------------------------------------ */
.recent-notes > h3 {
  margin: 0.5rem 0 0;
  font-size: 1rem;
}

.recent-notes > ul.recent-ul {
  margin-top: 1rem;
  padding-left: 0;
  list-style: none;
}

.recent-notes > ul.recent-ul > li {
  margin: 1rem 0;
}

.recent-notes > ul.recent-ul > li .section > .desc > h3 > a {
  background-color: #0000;
}

.recent-notes > ul.recent-ul > li .section > .meta {
  opacity: 0.6;
  margin: 0 0 0.5rem;
}

/* ------------------------------------------------
   Backlinks
   ------------------------------------------------ */
.backlinks {
  flex-direction: column;
}

.backlinks > h3 {
  margin: 0;
  font-size: 1rem;
}

.backlinks > ul {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.backlinks > ul > li > a {
  background-color: #0000;
}

.backlinks > .overflow {
  height: auto;
}

.backlinks > .overflow:after {
  display: none;
}

@media not (min-width: 1200px) {
  .backlinks > .overflow {
    height: 250px;
  }
}

/* ------------------------------------------------
   Footer
   ------------------------------------------------ */
footer {
  text-align: left;
  opacity: 0.7;
  margin-bottom: 4rem;
}

footer ul {
  flex-direction: row;
  gap: 1rem;
  margin: -1rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
}

/* ------------------------------------------------
   Section Lists
   ------------------------------------------------ */
ul.section-ul {
  margin-top: 2em;
  padding-left: 0;
  list-style: none;
}

li.section-li {
  margin-bottom: 1em;
}

li.section-li > .section {
  grid-template-columns: fit-content(8em) 3fr 1fr;
  display: grid;
}

@media (max-width: 800px) {
  li.section-li > .section > .tags {
    display: none;
  }
}

li.section-li > .section > .desc > h3 > a {
  background-color: #0000;
}

li.section-li > .section .meta {
  opacity: 0.6;
  margin: 0 1em 0 0;
}

/* Popover */
.popover .section {
  grid-template-columns: fit-content(8em) 1fr !important;
}

.popover .section > .tags {
  display: none;
}

.section h3,
.section > .tags {
  margin: 0;
}

/* ------------------------------------------------
   Popover
   ------------------------------------------------ */
@keyframes dropin {
  0% {
    opacity: 0;
    visibility: hidden;
  }
  1% {
    opacity: 0;
  }
  to {
    opacity: 1;
    visibility: visible;
  }
}

.popover {
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  padding: 1rem;
  transition: opacity 0.3s, visibility 0.3s;
  position: absolute;
  overflow: visible;
}

.popover > .popover-inner {
  width: 30rem;
  max-height: 20rem;
  font-weight: initial;
  font-style: initial;
  line-height: normal;
  font-size: initial;
  font-family: var(--bodyFont);
  border: 1px solid var(--lightgray);
  background-color: var(--light);
  white-space: normal;
  border-radius: 5px;
  padding: 0 1rem 1rem;
  position: relative;
  overflow: auto;
  box-shadow: 6px 6px 36px #00000040;
}

.popover > .popover-inner[data-content-type][data-content-type*="pdf"],
.popover > .popover-inner[data-content-type][data-content-type*="image"] {
  max-height: 100%;
  padding: 0;
}

.popover > .popover-inner[data-content-type][data-content-type*="image"] img {
  border-radius: 0;
  margin: 0;
  display: block;
}

.popover > .popover-inner[data-content-type][data-content-type*="pdf"] iframe {
  width: 100%;
}

.popover h1 {
  font-size: 1.5rem;
}

@media (max-width: 800px) {
  .popover {
    display: none !important;
  }
}

a:hover .popover,
.popover:hover {
  animation: 0.3s 0.2s forwards dropin;
}

/* ------------------------------------------------
   Code Syntax Highlighting
   ------------------------------------------------ */
code[data-theme*=" "] {
  color: var(--shiki-light);
  background-color: var(--shiki-light-bg);
}

code[data-theme*=" "] span {
  color: var(--shiki-light);
}

[saved-theme="dark"] code[data-theme*=" "] {
  color: var(--shiki-dark);
  background-color: var(--shiki-dark-bg);
}

[saved-theme="dark"] code[data-theme*=" "] span {
  color: var(--shiki-dark);
}

/* ------------------------------------------------
   Callouts
   ------------------------------------------------ */
.callout {
  border: 1px solid var(--border);
  background-color: var(--bg);
  box-sizing: border-box;
  border-radius: 5px;
  padding: 0 1rem;
  transition: max-height 0.3s;
  overflow-y: hidden;
}

.callout > .callout-content > :first-child {
  margin-top: 0;
}

.callout[data-callout] {
  --color: #448aff;
  --border: #448aff44;
  --bg: #448aff10;
  --callout-icon: var(--callout-icon-note);
}

.callout[data-callout="abstract"] {
  --color: #00b0ff;
  --border: #00b0ff44;
  --bg: #00b0ff10;
  --callout-icon: var(--callout-icon-abstract);
}

.callout[data-callout="info"],
.callout[data-callout="todo"] {
  --color: #00b8d4;
  --border: #00b8d444;
  --bg: #00b8d410;
  --callout-icon: var(--callout-icon-info);
}

.callout[data-callout="todo"] {
  --callout-icon: var(--callout-icon-todo);
}

.callout[data-callout="tip"] {
  --color: #00bfa5;
  --border: #00bfa544;
  --bg: #00bfa510;
  --callout-icon: var(--callout-icon-tip);
}

.callout[data-callout="success"] {
  --color: #09ad7a;
  --border: #09ad7144;
  --bg: #09ad7110;
  --callout-icon: var(--callout-icon-success);
}

.callout[data-callout="question"] {
  --color: #dba642;
  --border: #dba64244;
  --bg: #dba64210;
  --callout-icon: var(--callout-icon-question);
}

.callout[data-callout="warning"] {
  --color: #db8942;
  --border: #db894244;
  --bg: #db894210;
  --callout-icon: var(--callout-icon-warning);
}

.callout[data-callout="failure"],
.callout[data-callout="danger"],
.callout[data-callout="bug"] {
  --color: #db4242;
  --border: #db424244;
  --bg: #db424210;
  --callout-icon: var(--callout-icon-failure);
}

.callout[data-callout="bug"] {
  --callout-icon: var(--callout-icon-bug);
}

.callout[data-callout="danger"] {
  --callout-icon: var(--callout-icon-danger);
}

.callout[data-callout="example"] {
  --color: #7a43b5;
  --border: #7a43b544;
  --bg: #7a43b510;
  --callout-icon: var(--callout-icon-example);
}

.callout[data-callout="quote"] {
  --color: var(--secondary);
  --border: var(--lightgray);
  --callout-icon: var(--callout-icon-quote);
}

.callout.is-collapsed > .callout-title > .fold-callout-icon {
  transform: rotate(-90deg);
}

.callout-title {
  color: var(--color);
  --icon-size: 18px;
  align-items: flex-start;
  gap: 5px;
  padding: 1rem 0;
  display: flex;
}

.callout-title .fold-callout-icon {
  opacity: 0.8;
  cursor: pointer;
  transition: transform 0.15s;
}

.callout-title > .callout-title-inner > p {
  color: var(--color);
  margin: 0;
}

.callout-title .callout-icon,
.callout-title .fold-callout-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 var(--icon-size);
  background-size: var(--icon-size) var(--icon-size);
  background-position: 50%;
  background-color: var(--color);
  -webkit-mask-image: var(--callout-icon);
  mask-image: var(--callout-icon);
  -webkit-mask-size: var(--icon-size) var(--icon-size);
  mask-size: var(--icon-size) var(--icon-size);
  padding: 0.2rem 0;
  -webkit-mask-position: 50%;
  mask-position: 50%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.callout-title .callout-title-inner {
  font-weight: 600;
}

/* ------------------------------------------------
   Base HTML Styles
   ------------------------------------------------ */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  text-size-adjust: none;
  width: 100vw;
  overflow-x: hidden;
}

body,
section {
  box-sizing: border-box;
  background-color: var(--light);
  font-family: var(--bodyFont);
  color: var(--darkgray);
  margin: 0;
}

.text-highlight {
  background-color: var(--textHighlight);
  border-radius: 5px;
  padding: 0 0.1rem;
}

::selection {
  background: color-mix(in srgb, var(--tertiary) 60%, #fff0);
  color: var(--darkgray);
}

p,
ul,
text,
a,
tr,
td,
li,
ol,
ul,
.katex,
.math {
  color: var(--darkgray);
  fill: var(--darkgray);
  -webkit-hyphens: auto;
  hyphens: auto;
}

p,
ul,
text,
a,
li,
ol,
ul,
.katex,
.math {
  overflow-wrap: anywhere;
}

.math.math-display {
  text-align: center;
}

strong {
  font-weight: 600;
}

a {
  color: var(--secondary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--tertiary) !important;
}

a.internal {
  background-color: var(--highlight);
  border-radius: 5px;
  padding: 0 0.1rem;
  line-height: 1.4rem;
  text-decoration: none;
}

a.internal:has(> img) {
  background-color: #0000;
  border-radius: 0;
  padding: 0;
}

a.internal.tag-link:before {
  content: "#";
}

a.external .external-icon {
  height: 1ex;
  margin: 0 0.15em;
}

a.external .external-icon > path {
  fill: var(--dark);
}

/* ------------------------------------------------
   Responsive Display
   ------------------------------------------------ */
.desktop-only {
  display: initial;
}

@media (max-width: 800px) {
  .desktop-only {
    display: none;
  }
}

.mobile-only {
  display: none;
}

@media (max-width: 800px) {
  .mobile-only {
    display: initial;
  }
}

@media (max-width: 800px) {
  .search {
    flex-grow: 0.3;
  }
}

/* ------------------------------------------------
   Page Layout
   ------------------------------------------------ */
.page {
  max-width: 1500px;
  margin: 0 auto;
}

.page article > h1 {
  font-size: 2rem;
}

.page article li:has(> input[type="checkbox"]) {
  padding-left: 0;
  list-style-type: none;
}

.page article li:has(> input[type="checkbox"]:checked) {
  text-decoration: line-through;
  -webkit-text-decoration-color: var(--gray);
  text-decoration-color: var(--gray);
  color: var(--gray);
}

.page article li > * {
  margin-top: 0;
  margin-bottom: 0;
}

.page article p > strong {
  color: var(--dark);
}

/* Quartz Body Grid */
.page > #quartz-body {
  grid-template:
    "grid-sidebar-left grid-header grid-sidebar-right" auto
    "grid-sidebar-left grid-center grid-sidebar-right" auto
    "grid-sidebar-left grid-footer grid-sidebar-right" auto
    / 320px auto 320px;
  gap: 5px;
  display: grid;
}

@media (min-width: 800px) and (max-width: 1200px) {
  .page > #quartz-body {
    grid-template:
      "grid-sidebar-left grid-header" auto
      "grid-sidebar-left grid-center" auto
      "grid-sidebar-left grid-sidebar-right" auto
      "grid-sidebar-left grid-footer" auto
      / 320px auto;
    gap: 5px;
  }
}

@media (max-width: 800px) {
  .page > #quartz-body {
    grid-template:
      "grid-sidebar-left" auto
      "grid-header" auto
      "grid-center" auto
      "grid-sidebar-right" auto
      "grid-footer" auto
      / auto;
    gap: 5px;
  }
}

@media not (min-width: 1200px) {
  .page > #quartz-body {
    padding: 0 1rem;
  }
}

@media (max-width: 800px) {
  .page > #quartz-body {
    margin: 0 auto;
  }
}

/* Sidebar */
.page > #quartz-body .sidebar {
  box-sizing: border-box;
  gap: 2rem;
  height: 100vh;
  padding: 6rem 2rem 2rem;
  display: flex;
  position: sticky;
  top: 0;
}

.page > #quartz-body .sidebar.left {
  z-index: 1;
  flex-direction: column;
  grid-area: grid-sidebar-left;
}

@media (max-width: 800px) {
  .page > #quartz-body .sidebar.left {
    position: initial;
    height: unset;
    flex-direction: row;
    align-items: center;
    gap: 0;
    padding: 2rem 0 0;
    display: flex;
  }
}

.page > #quartz-body .sidebar.right {
  flex-direction: column;
  grid-area: grid-sidebar-right;
  margin-right: 0;
}

@media (max-width: 800px) {
  .page > #quartz-body .sidebar.right {
    margin-left: inherit;
    margin-right: inherit;
  }
}

@media not (min-width: 1200px) {
  .page > #quartz-body .sidebar.right {
    position: initial;
    height: unset;
    flex-direction: row;
    width: 100%;
    padding: 0;
  }

  .page > #quartz-body .sidebar.right > * {
    flex: 1;
  }

  .page > #quartz-body .sidebar.right > .toc {
    display: none;
  }
}

/* Page Header & Footer */
.page > #quartz-body .page-header,
.page > #quartz-body .page-footer {
  margin-top: 1rem;
}

.page > #quartz-body .page-header {
  grid-area: grid-header;
  margin: 6rem 0 0;
}

@media (max-width: 800px) {
  .page > #quartz-body .page-header {
    margin-top: 0;
    padding: 0;
  }
}

.page > #quartz-body .Center > article {
  grid-area: grid-center;
}

.page > #quartz-body footer {
  grid-area: grid-footer;
}

.page > #quartz-body .Center,
.page > #quartz-body footer {
  min-width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 800px) and (max-width: 1200px) {
  .page > #quartz-body .Center,
  .page > #quartz-body footer {
    margin-right: 0;
  }
}

@media (max-width: 800px) {
  .page > #quartz-body .Center,
  .page > #quartz-body footer {
    margin-left: 0;
    margin-right: 0;
  }
}

.page > #quartz-body footer {
  margin-left: 0;
}

/* ------------------------------------------------
   Footnotes
   ------------------------------------------------ */
.footnotes {
  border-top: 1px solid var(--lightgray);
  margin-top: 2rem;
}

/* ------------------------------------------------
   Checkboxes
   ------------------------------------------------ */
input[type="checkbox"] {
  color: var(--secondary);
  border: 1px solid var(--lightgray);
  background-color: var(--light);
  appearance: none;
  border-radius: 3px;
  width: 16px;
  height: 16px;
  margin-inline: -1.4rem 0.2rem;
  position: relative;
  transform: translateY(2px);
}

input[type="checkbox"]:checked {
  border-color: var(--secondary);
  background-color: var(--secondary);
}

input[type="checkbox"]:checked:after {
  content: "";
  border: solid var(--light);
  border-width: 0 2px 2px 0;
  width: 4px;
  height: 8px;
  display: block;
  position: absolute;
  top: 1px;
  left: 4px;
  transform: rotate(45deg);
}

/* ------------------------------------------------
   Blockquotes
   ------------------------------------------------ */
blockquote {
  border-left: 3px solid var(--secondary);
  margin: 1rem 0;
  padding-left: 1rem;
  transition: border-color 0.2s;
}

/* ------------------------------------------------
   Headings
   ------------------------------------------------ */
h1,
h2,
h3,
h4,
h5,
h6,
thead {
  font-family: var(--headerFont);
  color: var(--dark);
  font-weight: revert;
  margin-bottom: 0;
}

article > h1 > a[role="anchor"],
article > h2 > a[role="anchor"],
article > h3 > a[role="anchor"],
article > h4 > a[role="anchor"],
article > h5 > a[role="anchor"],
article > h6 > a[role="anchor"],
article > thead > a[role="anchor"] {
  color: var(--dark);
  background-color: #0000;
}

h1[id] > a[href^="#"],
h2[id] > a[href^="#"],
h3[id] > a[href^="#"],
h4[id] > a[href^="#"],
h5[id] > a[href^="#"],
h6[id] > a[href^="#"] {
  opacity: 0;
  font-family: var(--codeFont);
  -webkit-user-select: none;
  user-select: none;
  margin: 0 0.5rem;
  transition: opacity 0.2s;
  transform: translateY(-0.1rem);
}

h1[id]:hover > a,
h2[id]:hover > a,
h3[id]:hover > a,
h4[id]:hover > a,
h5[id]:hover > a,
h6[id]:hover > a {
  opacity: 1;
}

h1 {
  margin-top: 2.25rem;
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

h2 {
  margin-top: 1.9rem;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

h3 {
  margin-top: 1.62rem;
  margin-bottom: 1rem;
  font-size: 1.12rem;
}

h4,
h5,
h6 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* ------------------------------------------------
   Code Blocks
   ------------------------------------------------ */
figure[data-rehype-pretty-code-figure] {
  margin: 0;
  line-height: 1.6rem;
  position: relative;
}

figure[data-rehype-pretty-code-figure] > [data-rehype-pretty-code-title] {
  font-family: var(--codeFont);
  border: 1px solid var(--lightgray);
  width: fit-content;
  color: var(--darkgray);
  border-radius: 5px;
  margin-bottom: -0.5rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.9rem;
}

figure[data-rehype-pretty-code-figure] > pre {
  padding: 0;
}

pre {
  font-family: var(--codeFont);
  border: 1px solid var(--lightgray);
  border-radius: 5px;
  padding: 0 0.5rem;
  position: relative;
  overflow-x: auto;
}

pre:has(> code.mermaid) {
  border: none;
}

pre > code {
  counter-reset: line;
  counter-increment: line 0;
  background: 0 0;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  display: grid;
  overflow-x: auto;
}

pre > code [data-highlighted-chars] {
  background-color: var(--highlight);
  border-radius: 5px;
}

pre > code > [data-line] {
  box-sizing: border-box;
  border-left: 3px solid #0000;
  padding: 0 0.25rem;
}

pre > code > [data-line][data-highlighted-line] {
  background-color: var(--highlight);
  border-left: 3px solid var(--secondary);
}

pre > code > [data-line]:before {
  content: counter(line);
  counter-increment: line;
  text-align: right;
  color: #738a9499;
  width: 1rem;
  margin-right: 1rem;
  display: inline-block;
}

pre > code[data-line-numbers-max-digits="2"] > [data-line]:before {
  width: 2rem;
}

pre > code[data-line-numbers-max-digits="3"] > [data-line]:before {
  width: 3rem;
}

code {
  color: var(--dark);
  font-size: 0.9em;
  font-family: var(--codeFont);
  background: var(--lightgray);
  border-radius: 5px;
  padding: 0.1rem 0.2rem;
}

/* ------------------------------------------------
   Tables
   ------------------------------------------------ */
tbody,
li,
p {
  line-height: 1.6rem;
}

.table-container {
  overflow-x: auto;
}

.table-container > table {
  border-collapse: collapse;
  margin: 1rem;
  padding: 1.5rem;
}

.table-container > table th,
.table-container > table td {
  min-width: 75px;
}

.table-container > table > * {
  line-height: 2rem;
}

th {
  text-align: left;
  border-bottom: 2px solid var(--gray);
  padding: 0.4rem 0.7rem;
}

td {
  padding: 0.2rem 0.7rem;
}

tr {
  border-bottom: 1px solid var(--lightgray);
}

tr:last-child {
  border-bottom: none;
}

/* ------------------------------------------------
   Images & Media
   ------------------------------------------------ */
img {
  content-visibility: auto;
  border-radius: 5px;
  max-width: 100%;
  margin: 1rem 0;
}

p > img + em {
  display: block;
  transform: translateY(-1rem);
}

hr {
  background-color: var(--lightgray);
  border: none;
  width: 100%;
  height: 1px;
  margin: 2rem auto;
}

audio,
video {
  border-radius: 5px;
  width: 100%;
}

/* ------------------------------------------------
   Overflow & Scroll
   ------------------------------------------------ */
.spacer {
  flex: auto;
}

div:has(> .overflow) {
  max-height: 100%;
  display: flex;
  overflow-y: auto;
}

ul.overflow,
ol.overflow {
  content: "";
  clear: both;
  max-height: 100%;
  overflow-y: auto;
}

ul.overflow > li:last-of-type,
ol.overflow > li:last-of-type {
  margin-bottom: 30px;
}

.transclude ul {
  padding-left: 1rem;
}

.katex-display {
  overflow: auto hidden;
}

.external-embed.youtube,
iframe.pdf {
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  width: 100%;
  height: 100%;
}

.twitter-tweet {
  max-width: 550px;
  margin: 1rem auto !important;
}

/* Navigation Progress */
.navigation-progress {
  background: var(--secondary);
  z-index: 9999;
  width: 0;
  height: 3px;
  transition: width 0.2s;
  position: fixed;
  top: 0;
  left: 0;
}

/* ------------------------------------------------
   Scrollbar Styling
   ------------------------------------------------ */
* {
  scrollbar-width: thin;
  scrollbar-color: #5abb9a #0003;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0003;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #5abb9a, #7ecab0);
  border-radius: 10px;
  min-height: 40px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #49b28e);
}

::-webkit-scrollbar-button {
  display: none;
}

/* ------------------------------------------------
   Overflow Lists
   ------------------------------------------------ */
.overflow li {
  margin-bottom: 0.5rem;
}

.overflow li li {
  margin-bottom: 0.2rem;
}

.overflow li:last-child {
  margin-bottom: 0;
}

.folder-container .folder-content li {
  margin-bottom: 0.5rem;
}

.folder-container .folder-content li li {
  margin-bottom: 0.2rem;
}

/* ------------------------------------------------
   Right Sidebar
   ------------------------------------------------ */
.sidebar.right {
  flex-direction: column;
  gap: 2rem;
  display: flex;
  position: sticky;
  top: 0;
  height: auto !important;
}

.sidebar.right .toc {
  min-height: min-content;
  position: relative;
  overflow: visible;
  height: auto !important;
  max-height: none !important;
}

.sidebar.right div:has(> h3:contains("Recent Posts")) {
  margin-top: 2rem;
  position: relative;
}

#quartz-body .sidebar.right {
  min-height: 100vh;
  height: auto !important;
}

/* ------------------------------------------------
   CSS Variables (Light Theme)
   ------------------------------------------------ */
:root {
  --light: #faf8f8;
  --lightgray: #e5e5e5;
  --gray: #b8b8b8;
  --darkgray: #4e4e4e;
  --dark: #2b2b2b;
  --secondary: #284b63;
  --tertiary: #84a59d;
  --highlight: #268f6d26;
  --textHighlight: #fff23688;
  --headerFont: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --bodyFont: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --codeFont: "IBM Plex Mono", ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace;
}

/* ------------------------------------------------
   CSS Variables (Dark Theme)
   ------------------------------------------------ */
:root[saved-theme="dark"] {
  --light: #000;
  --lightgray: #393639;
  --gray: #646464;
  --darkgray: #d4d4d4;
  --dark: #fff;
  --secondary: #5abb9a;
  --tertiary: #84a59d;
  --highlight: #268f6d26;
  --textHighlight: #b3aa0288;
}
