/* #region common */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  /* box-sizing: border-box; */
}

/** Defaults of defaults */
:root {

  --color-bg-table-header: var(--color-bg-elevated);
  --color-bg-table-row-even: var(--color-bg);
}

:root[data-colors="white"]
{


  /* background colors */
  --color-bg: rgb(249, 249, 245);
  --color-bg-elevated: rgb(242, 242, 236);
  --color-bg-hoover: rgb(232, 232, 226);

  --color-bg-topbar: var(--color-bg);
  --color-bg-body: var(--color-bg);
  --color-bg-article: var(--color-bg);
  --color-bg-code: var(--color-bg-elevated);
  /* --color-bg-code: white; */
  --color-bg-blockquote: var(--color-bg-elevated);
  --color-bg-input: var(--color-bg);
  --color-bg-menu-pane: var(--color-bg-elevated);
  --color-bg-outline: var(--color-bg-elevated);

  

  /* Font colors */
  --color-text: rgb(22, 20, 15);
  --color-text-muted: rgb(100, 100, 100);
  --color-txt-heading: var(--color-text);
  --color-txt-article: var(--color-text);
  --color-txt-topbar-title: var(--color-txt-heading);
  --color-txt-input: var(--color-text);
  --color-txt-left-tree: var(--color-text);
  --color-txt-left-tree-folder: var(--color-text);


  /* Borders colors */
  /* --color-border: var(--color-bg-elevated);
  --color-border-stronger: var(--color-bg-hoover);
  --color-border-strongest: orange; */

  /* --color-border: black;
  --color-border-stronger: blue;
  --color-border-strongest: red; */


  --color-border: rgb(200, 200, 200);
  /* --color-border-stronger: rgb(100, 100, 100); */
  --color-border-stronger: var(--color-border);
  --color-border-strongest: black;

}


:root[data-colors="yc"]
{


  /* background colors */
  --color-bg: rgb(245, 245, 238);
  /* --color-bg: red; */
  --color-bg-elevated: rgb(249, 249, 244);            
  --color-bg-hoover: rgb(255, 255, 253);          

  --color-bg-topbar: var(--color-bg);
  --color-bg-body: var(--color-bg);
  --color-bg-article: var(--color-bg);
  --color-bg-code: var(--color-bg-elevated);
  /* --color-bg-code: white; */
  --color-bg-blockquote: var(--color-bg-elevated);
  --color-bg-input: var(--color-bg);
  --color-bg-menu-pane: var(--color-bg-elevated);
  --color-bg-outline: white;
  --color-bg-table-header: var(--color-bg-elevated);
  --color-bg-table-row-even: var(--color-bg-elevated);

  

  /* Font colors */
  --color-text: rgb(22, 20, 15);
  --color-text-muted: rgb(100, 100, 100);
  --color-txt-heading: var(--color-text);
  --color-txt-article: var(--color-text);
  --color-txt-topbar-title: var(--color-txt-heading);
  --color-txt-input: var(--color-text);
  --color-txt-left-tree: var(--color-text);
  --color-txt-left-tree-folder: var(--color-text);


  /* Borders colors */
  /* --color-border: var(--color-bg-elevated);
  --color-border-stronger: var(--color-bg-hoover);
  --color-border-strongest: orange; */

  /* --color-border: black;
  --color-border-stronger: blue;
  --color-border-strongest: red; */


  --color-border: rgb(200, 200, 200);
  /* --color-border-stronger: rgb(100, 100, 100); */
  --color-border-stronger: var(--color-border);
  --color-border-strongest: black;

}




:root:not([data-colors]),
:root[data-colors=""],
:root[data-colors="dark"],
:root[data-colors="github-docs"]
{
  /* background colors */
  --color-bg: #0d1117;
  --color-bg-elevated: #161b22;
  --color-bg-hoover: #21262d;

  --color-bg-topbar: var(--color-bg);
  --color-bg-body: var(--color-bg);
  --color-bg-article: var(--color-bg);
  --color-bg-code: var(--color-bg-elevated);
  --color-bg-blockquote: var(--color-bg-elevated);
  --color-bg-input: var(--color-bg-elevated);
  --color-bg-menu-pane: var(--color-bg-elevated);
  --color-bg-outline: var(--color-bg);
  /* --color-bg-table-header: var(--color-bg-elevated);
  --color-bg-table-row-even: var(--color-bg-elevated); */

  /* Font colors */
  --color-text: #e6edf3;
  --color-text-muted: #8b949e;
  --color-txt-heading: var(--color-text);
  --color-txt-article: var(--color-text);
  --color-txt-heading: var(--color-txt-heading);
  --color-txt-topbar-title: var(--color-txt-heading);
  --color-txt-input: var(--color-text);
  --color-txt-left-tree: var(--color-text);
  --color-txt-left-tree-folder: var(--color-text);

  /* Borders colors */
  --color-border: rgb(44, 50, 57);
  /* --color-border: red; */
  --color-border-stronger: rgb(52, 59, 68);
  /* --color-border-stronger: blue; */
  --color-border-strongest: #6e7681;
}


/* Typography */
:root {
  --font-family-body: "Source Serif 4", system-ui, sans-serif;
  --font-family-menu: Outfit, sans-serif;
  --font-family-topbar-title: var(--font-family-menu);
  --font-family-top-menu: var(--font-family-menu);
  --font-family-left-menu: var(--font-family-menu);
  --font-family-outline: var(--font-family-menu);
  --font-family-code: 'Courier New', Courier, monospace;
  --font-size-code: 13px;
  --font-size-topbar-title: 24px;
  --font-weight-topbar-title: bold;
}




/* Borders */
:root {
  --border-input-search: 2px solid var(--color-border);
  --border-input-filter: 1px solid var(--color-border);
  --border-code: 1px solid var(--color-border-stronger);
  --border-radius-code: 5px;
  --border-blockquote: 1px solid var(--color-border-strongest);
  --border-radius-blockquote: 10px;
  --border-left-tree: 1px solid var(--color-border-stronger);
  --border-pane-separator: 0px solid var(--color-border);
  --border-radius-pane-separator: 0px;
  --color-border-bottom-bar: 0px solid var(--color-border);
  --border-article-heading: 1px solid var(--color-border-stronger);

}


:root {
    /** Center lerf/right margin */
  --margin-topbar: 1%;
  --margin-main-lr: 10px;
  --margin-main-tb: 5px;

}




.hidden {
  display: none !important;
}

.no-pointer-events {
  /* block focus gain on input */
  pointer-events: none; 
}

/* #endregion */


/* #region layout top */


body {
  display: flex;
  flex-direction: column;

  height: 100vh;
  /* min-width: 600px; */
  overflow: hidden;
  /* overflow-x: auto; */
  padding: 0px 2%;

  max-width: 1600px;
  margin: 0 auto;

  font-family: var(--font-family-body);
  font-size: 16px;

  background-color: var(--color-bg-body);
  color: var(--color-text);
  /* animation: page-fade-in .1s ease-out; */
}

@keyframes page-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}


.hljs {
  background-color: var(--color-bg-code);
}

.topbar {
  font-size: 18px;
  font-weight: bold;
  margin-left: var(--margin-topbar);
  margin-right: var(--margin-topbar);

  background-color: var(--color-bg-topbar);

  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1px;

  display: flex;
  align-items: center;
  padding: 15px 20px 10px 20px;

}

.topbar-menu {
  padding: 0;
}


/* Main layout below the top bar 
* The default flex-direction is row, so its children will be laid out horizontally (left → right).
*/
.main-layout {
  display: flex;
  flex: 1;
  /* Grow to fill available space in the parent flex container (the body). Since body uses flex-direction: column, .main-layout will expand vertically between top-bar and bottom-bar */
  min-height: 0;
  /* prevents overflow issues when nested flexboxes have children that might stretch in some browsers */
  position: relative;
  /* Set a positioning context for any absolutely positioned children inside it. */
  margin-left: var(--margin-main-lr);
  margin-right: var(--margin-main-lr);
  margin-top: var(--margin-main-tb);
  margin-bottom: var(--margin-main-tb);


}





.content {
  flex: 1;
  padding: 50px;
  padding-top: 30px;
  overflow-y: auto;
  /* height: 100%; */

  background-color: var(--color-bg-article);
  color: var(--color-txt-article);
  animation: page-fade-in .8s ease-out;
}

.right-sidebar {
  width: 15%;
  margin-top: 80px;
  margin-left: 40px;
  margin-right: 40px;
  
}

@media (max-width: 799px) {
  .right-sidebar {
    display: none;
  }
}




.bottombar {
  text-align: center;
  margin-left: var(--margin-topbar);
  margin-right: var(--margin-topbar);
  padding: 5px 10px 4px 10px;

  font-size: 10px;
  font-weight: normal;

  border-top: var(--color-border-bottom-bar);
  margin-top: 1px;
}

.bottombar a {
  color: var(--color-text);
}






.left-sidebar {
  border-radius: var(--border-radius-pane-separator);
  border-right: var(--border-pane-separator);
}


.right-sidebar {
  border-radius: var(--border-radius-pane-separator);
  border-left: var(--border-pane-separator)
  
}



.topbar-left {
  flex: 0 0 auto;
  white-space: nowrap;

  display: flex;
  align-items: center;
  gap: 10px;
}




.topbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.input-top-search {
  width: clamp(200px, 30vw, 350px);
  padding: 3px 80px;
  /* min-width: 300px; */
  /* min-width: 130%;  */
}




@media (max-width: 799px) {
  .input-top-search {
    display: none;
  }
}



.topbar-right {
  position: absolute;
  right: 20px;
}




/* .topbar-icon {
  filter: invert(1);
} */

.topbar-icon img {
  width: 28px;
  height: 28px;
}

.topbar-settings img:hover {
  filter: invert(1);
}


.topbar-title {
  font-family: var(--font-family-topbar-title);
  font-size: var(--font-size-topbar-title);
  font-weight: var(--font-weight-topbar-title);
  
  color: var(--color-txt-topbar-title);
}

.input-top-search {
  border-radius: 20px;
  border: var(--border-input-search);
  background-color: var(--color-bg-input);
  color: var(--color-txt-input);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Center placeholder text */
.input-top-search::placeholder {
  text-align: center;
}

/* #endregion */


/* #region Left sidebar */

.left-sidebar {
  /* Remove duplicate min-width, set width and max-width */
  width: 20%;
  min-width: 200px;
  display: flex;
  /* flex: 1; */
  flex-direction: column;
  padding-top: 60px;
  padding-right: 15px;
  padding-left: 15px;
  padding-bottom: 15px;
  box-sizing: border-box;
  font-family: var(--font-family-left-menu);
}

@media (max-width: 500px) {
  .left-sidebar {
    display: none;
  }
}


.left-sidebar-scroll-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding-top: 5px;
  visibility: hidden;
}

.left-sidebar-scroll-pane.ready {
  visibility: visible;
}

.left-sidebar a {
  color: var(--color-txt-left-tree);
  text-decoration: none;
  padding: 2px;
  display: block;
  border-radius: 6px;
}


.left-sidebar li {
  padding-top: 1px;
}

.left-sidebar a {
  padding-left: 20px;
  font-size: 15px;
}

.left-sidebar a.active {
  background-color: var(--color-bg-hoover);
  font-weight: bold;
}

.left-sidebar a:hover {
  background-color: var(--color-bg-hoover);
}


/* --- Tree menu styles --- */
.left-sidebar ul.tree-root {
  padding-top: 10px;
}

.left-sidebar ul.tree-root,
.left-sidebar ul.tree-root ul {
  list-style: none;
  white-space: nowrap;
}

:root[data-left-menu-wrap] .left-sidebar ul.tree-root,
:root[data-left-menu-wrap] .left-sidebar ul.tree-root ul {
  white-space: normal;
}

.left-sidebar ul.tree-root>li {
  margin-left: 0;
}



.left-sidebar ul.tree-root ul {
  margin-left: 20px;
  border-left: var(--border-left-tree);
}

.tree-folder-btn {
  background: none;
  border: none;
  color: var(--color-txt-left-tree-folder);
  /* font-weight: bold; */
  cursor: pointer;
  padding: 1px 0 1px 18px;
  text-align: left;
  width: 100%;
  position: relative;
  font-size: 15px;
  outline: none;
  transition: background 0.2s;
}

/* Default: arrow on the left via ::before */
.tree-folder-btn:before {
  content: ">";
  display: inline-block;
  margin-right: 6px;
  font-size: 16px;
  font-weight: 300;
  transition: transform .5s;
}

.tree-folder-btn.open::before { transform: rotate(90deg); }

/* Option: arrow on the right via ::after */
:root[data-tree-btn-right] .tree-folder-btn:before {
  content: none;
}

:root[data-tree-btn-right] .tree-folder-btn:after {
  content: ">";
  position: absolute;
  right: 8px;
  font-size: 16px;
  font-weight: 300;
  transition: transform .5s;
}

:root[data-tree-btn-right] .tree-folder-btn.open::after { transform: rotate(90deg); }


.tree-folder-btn:hover {
  background: var(--color-bg-hoover);
  border-radius: 8px;
}

.left-sidebar ul.tree-root ul {
  display: none;
}

.left-sidebar ul.tree-root ul.open {
  display: block;
}

.left-sidebar ul.tree-root ul > li {
  min-height: 0;
  overflow: hidden;
}



.tree-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-right: 8px;
}

#tree-filter-input {
  margin-left: 8px;
  margin-bottom: 0;
  padding: 2px;
  padding-left: 6px;
  border-radius: 4px;
  border: var(--border-input-filter);
  background: var(--color-bg-input);
  color: var(--color-txt-input);
  width: 100%;
  min-width: 0;
  max-width: 250px;
  flex: 1 1 auto;
  outline: none;
}

#collapse-all-tree-btn,
#expand-all-tree-btn {
  
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid #555;
  border-radius: 1px;
  font-size: 14px;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-bottom: 0;
  cursor: pointer;
  /* transition: background 0.2s, border-color 0.2s; */
  display: flex;
  align-items: center;
  justify-content: center;
}

#collapse-all-tree-btn:hover,
#expand-all-tree-btn:hover {
  background: var(--color-bg-hoover);
  /* border-color: red; */
}

/* #endregion */


/* #region right sidebar */

.right-sidebar header {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  font-family: var(--font-family-outline);
}

.outline {
  font-family: var(--font-family-outline);
  background-color: var(--color-bg-outline);
  font-size: 15px;
  padding-bottom: 10px;
  border-radius: 5px;
  animation: outline-grow .6s ease-out;
  transform-origin: top left;
}

@keyframes outline-grow {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.outline ol {
  margin-left: .5rem;
  /* indent each nested list */
  list-style-position: outside;
}

.outline li {
  list-style-type: none;
  line-height: 1.4;
  padding-top: 5px;
}

.outline a {
  display: block;
  color: var(--color-text);
  text-decoration: none;

  /* ... for long line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outline a:hover {
  font-weight: bold;
}

.outline a.active {
  font-weight: bold;
  border-left: 2px solid var(--color-text);
  padding-left: 4px;
}


/* #endregion */


/* #region topmenu */
.topmenu {
  display: flex;
  gap: 20px;
  position: relative;
  margin-left: 20px;
  margin-right: 20px;
  /* padding-top: 7px; */
}

/* Center topmenu in topbar2 when data-menu-center is set */
:root[data-menu-center] #topbar2 {
  justify-content: center;
}

.topmenu-item {
  position: relative;
}

.topmenu-label {
  cursor: pointer;
  padding: 6px 1px;
  border-radius: 8px;
  transition: background 0.2s;
  font-weight: 200;
  font-size: 14px;
  font-family: var(--font-family-top-menu);
  display: inline-block;
  color: var(--color-text);
  text-decoration: none;
}

.topmenu-label:hover,
.topmenu-item:hover>.topmenu-label {
  background: var(--color-bg-hoover);
}

.topmenu-label.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.topmenu-dropdown a.active {
  /* font-weight: bold; */
  text-decoration: underline;
  text-underline-offset: 4px;
}

.topmenu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--color-bg-menu-pane);
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  padding: 8px 0;
  z-index: 200;
  flex-direction: column;
}

.topmenu-item:hover>.topmenu-dropdown {
  display: flex;
}

.topmenu-dropdown a,
.topmenu-submenu-label {
  display: block;
  color: var(--color-text);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.topmenu-dropdown a:hover,
.topmenu-submenu-label:hover {
  background: var(--color-bg-hoover);
}

.topmenu-separator {
  border: none;
  border-top: 1px solid #8e8e8e;
  margin: 6px 15px;
}

.topmenu-submenu-parent {
  position: relative;
}

.topmenu-submenu-label {
  position: relative;
  padding-right: 28px;
}

.topmenu-submenu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  min-width: 200px;
  background: var(--color-bg-menu-pane);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  padding: 8px 0;
  z-index: 210;
}

.topmenu-submenu-parent:hover>.topmenu-submenu,
.topmenu-submenu-label:focus+.topmenu-submenu {
  display: flex;
  flex-direction: column;
}

.topmenu-submenu a {
  padding: 8px 20px;
  font-size: 15px;
}

/* #endregion */


/* #region popup overlay */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  /* background: rgba(34, 34, 34, 0.7); */
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease, visibility .3s;
}

.popup-overlay.hidden {
  display: block !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Blur specific elements when popup is open */
.main-layout,
#topbar2 {
  transition: filter 0.3s ease;
}

body.popup-open .main-layout,
body.popup-open #topbar2 {
  filter: blur(4px);
  transition: filter 3s ease;
}

/* Popup Modal */
.popup-modal {
  position: fixed;
  top: 110px;
  left: 50%;
  transform: translateX(-50%) scale(1);
  width: 600px;
  height: 600px;
  background: var(--color-bg);
  color: var(--color-txt-article);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease, transform .3s ease, visibility .3s;
}

.popup-modal.hidden {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) scale(0.95);
  pointer-events: none;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 10px 16px;
}

.popup-title {
  margin-left: 8px;
  font-size: 18px;
  font-weight: bold;
  color: var(--color-txt-heading);
}

.popup-close {
  background: none;
  border: none;
  color: var(--color-txt-heading);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 50%;
  transition: background 0.2s;
}

.popup-close:hover {
  background: var(--color-bg-hoover);
}

.popup-separator {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0 15px 8px 15px;
}

.popup-content {
  flex: 1;
  padding: 10px 46px;
  overflow-x: auto;
}

.popup-content a {
  color: #6590cc;
  font-size: 17px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.popup-content .lineNumber {
  font-family: var(--font-family-code);
  font-size: 13px;
  font-weight: 600;
  padding: 1px 10px 1px 4px;
  border-radius: 4px;
}

.popup-confirm {
  margin: 0 16px 16px 16px;
  padding: 6px 0;
  border: none;
  border-radius: 10px;
  background: #555;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.popup-confirm:hover {
  background: #676767;
}

/* #endregion */

h1, h2, h3, h4, h5, h6, header {

  color: var(--color-txt-heading);
}


/* #region article */

article {
  max-width: 750px;
  margin: 0 auto;
  line-height: 1.6;
  font-size: 16px;
  font-family: var(--font-family-article);
}

/* article * {
  margin-bottom: 20px
} */


article > p, hr {
  margin-bottom: 15px
}


article h1 {
  padding-top: 10px;
  padding-bottom: 5px;

  margin-top: 40px;
  margin-bottom: 30px;
  font-size: 32px;
}

article h2 {
  margin-top: 40px;
  margin-bottom: 20px;
}

article h3 {
  margin-top: 10px;
  margin-bottom: 10px;
}

article h1:first-child,
article h2:first-child
{
  margin-top: 0px;
}

article h1,
h2 {
  border-bottom: var(--border-article-heading);
}

article ol,
article ul {
  margin-left: 30px;
  margin-bottom: 20px;
}

article pre code {
  background-color: var(--color-bg-code);
  color: var(--color-txt-code);
  border-radius: var(--border-radius-code);
  border: var(--border-code);
  font-size: var(--font-size-code);
  line-height: 2;
  font-family: var(--font-family-code);
  display: block;
  /* width: 85%; */
  padding: 20px;
  margin-left: 10px;
  margin-bottom: 20px;
  margin-top: 20px;
  white-space: pre-wrap;
  /* allow line breaks */
  word-break: break-word;
}

article h1 + pre code,
article h2 + pre code {
  margin-top: 40px;
}

article p > code {
  background-color: var(--color-bg-code);
  font-size: 12px;
}

article blockquote {
  padding: 20px;
  margin: 30px 10px;
  border: var(--border-blockquote);
  background-color: var(--color-bg-blockquote);
  border-radius: var(--border-radius-blockquote);
}

article a:visited {
  color: #6590cc;
  font-weight: bold;
}

article a:link {
  color: #6590cc;
  font-weight: bold;
}

article img {
  /* skip missing alt text for missing imgs for now */
  font-size: 0;
  max-width: 100%;
  height: auto;
}

article p > img,
article > img {
  /* center image */
  display: block;
  margin-left: auto;
  margin-right: auto;
}

article table {
  /* center table */
  margin-left: auto; 
  margin-right: auto;

  border-collapse: collapse; /* merge touching borders into one shared border (single line instead of two) */

  margin-top: 40px;
  margin-bottom: 30px;
}

table td,
table th {
  border: 1px solid;
  padding: 10px; 
}

table th {
  border-width: 2px;
  background-color: var(--color-bg-table-header);
}

tbody tr:nth-child(even) {
  background-color: var(--color-bg-table-row-even);
}



