@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
  --bg: rgb(255, 255, 255);
  --bg2: rgb(237, 237, 237);
  --text: #1b1b1b;
  --title: rgb(0, 105, 170);/*rgb(44, 95, 126)*/
  --brand: rgb(0, 105, 170); /*rgb(44, 95, 126)*/
  --border: rgb(254, 105, 30);
  --code-bg: rgba(87, 191, 255, 0.3);
  --td-bg: rgba(245, 245, 245, 0.25);
  --border-width: 2px;
  --sidebar-width: 300px;
  
  --font: "Inter", sans-serif;
  --weight-medium: 400;
  --weight-bold: 600;
  
  --space-xxs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-xxl: 4rem;
  
  --max-width: 56rem;
  --line-height: 1.5;
  
  /* 5-level typography scale (1rem = 15px) */
  --scale-xxs: 0.6rem;     /* 9px */
  --scale-xs: 0.8rem;     /* 12px */
  --scale-sm: 0.933rem;   /* 14px */
  --scale-base: 1rem;     /* 15px */
  --scale-lg: 1.2rem;     /* 18px */
  --scale-xl: 1.4rem;     /* 21px */
}

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

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  font-weight: var(--weight-medium);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  /* Left stripe background spanning full page height for sidebar */
  background-image: linear-gradient(
    to right,
    var(--bg2) 0,
    var(--bg2) var(--sidebar-width),
    transparent var(--sidebar-width)
  );
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-size: var(--scale-base);
}

.container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.container > div {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-xl);
}

/* Full-width container variant for left-stuck sidebar */
.container.fullwidth {
  justify-content: flex-start;
}

.container.fullwidth > div {
  max-width: none;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

/* Two-column layout with sidebar */
.layout-two-column {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  /*column-gap: var(--space-xl);*/
  column-gap: 9rem;
  align-items: start;
  width: 100%;
}

.sidebar-nav {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  position: sticky;
  top: var(--space-xl);
  padding: 0 var(--space-sm) 0 var(--space-sm);
  background: transparent; /* Background handled by body gradient */
}

.sidebar-title {
  font-size: var(--scale-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  color: var(--title);
  padding: 0.4rem 0.5rem;
  margin: 0;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Sidebar tree (folders + nested notes) */
.sidebar-folder {
  margin: 0.1rem 0;
}

.sidebar-details {
  margin: 0; /* native details/summary for simple collapse without JS */
}

.sidebar-folder-name {
  display: block;
  padding: var(--space-xxs);
  color: var(--title);
  font-size: var(--scale-sm);
  font-weight: var(--weight-bold);
  border-radius: 0.35rem;
}

.sidebar-folder-name:hover {
  background: var(--bg);
  color: var(--brand);
}

.sidebar-sublist {
  list-style: none;
  margin: 0rem 0rem 0rem 0rem;
  padding-left: 0.75rem;
  border-left: var(--border-width) solid var(--border);
}

.sidebar-subitem .sidebar-link {
  padding-left: 0.25rem;
}

.sidebar-item {
  margin: 0;
  padding: 0;
}

.sidebar-link {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 0.35rem;
  text-decoration: none;
  color: var(--text);
  font-size: var(--scale-sm);
  line-height: 1.3;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--bg);
  color: var(--brand);
}

.sidebar-item.active .sidebar-link {
  background: var(--brand);
  color: var(--bg);
}

.sidebar-collapse-all {
  display: block;
  width: calc(100% - 1rem);
  margin: 1rem 0.5rem 0.5rem 0.5rem;
  padding: var(--space-xxs) var(--space-xs);
  background: transparent;
  border: var(--border-width) solid var(--border);
  border-radius: 0.35rem;
  color: var(--text-light);
  font-size: var(--scale-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sidebar-collapse-all:hover {
  background: var(--bg);
  color: var(--brand);
  border-color: var(--brand);
}

.sidebar-collapse-all:active {
  transform: scale(0.98);
}

.main-content {
  min-width: 0;
  max-width: var(--max-width);
  /*margin: 0 auto; /* center the content column within available space */
  padding: 0 var(--space-xl);
}

@media (max-width: 960px) {
  .layout-two-column {
    grid-template-columns: 1fr;
  }
  .sidebar-nav {
    position: relative;
    top: 0;
    max-height: none;
    border-right: none;
    border-bottom: var(--border-width) solid var(--border);
    background: var(--bg2); /* visible panel on mobile */
    margin-bottom: var(--space-lg);
  }
  body {
    /* Remove left stripe on mobile */
    background-image: none;
  }
}


.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-xxl) var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-sm);
  background: var(--bg2);
}

.nav-sticky {
  position: sticky;
  background: var(--bg2);
  top: 0;
  z-index: 1002;
  width: 100%;
}

@media (max-width: 960px) {
  .nav-sticky {
    position: sticky;
    top: 0;
    z-index: 1002;
    width: 100%;
    margin-bottom: var(--space-sm);
  }
}

.nav-left a {
  text-decoration: none;
}

.logo {
  width: 32px;
  height: 32px;
  display: block;
}

/* Simplified nav after removing hamburger */
.brand {
  font-size: 1.1rem;
  font-weight: var(--weight-bold);
  color: var(--title);
  letter-spacing: 0.02em;
  display: inline-block;
  padding: 0.3rem 0.4rem;
}

.brand:hover {
  color: var(--brand);
}

.nav-right a {
  margin-left: var(--space-xs);
  text-decoration: underline;
  font-size: var(--scale-sm);
  color: var(--text);
  position: relative;
  padding: 0.3rem 0.4rem;
  border-radius: 0.35rem;
  transition: background 0.15s, color 0.15s;
}

.nav-right a:hover {
  background: var(--bg2);
  color: var(--brand);
}

/* Specific hover styles for LinkedIn link (first link) */
.nav-right a:first-child:hover {
  background: rgb(0, 105, 170);
  color: white;
}

/* Specific hover styles for GitHub link (second link) */
.nav-right a:nth-child(2):hover {
  background: black;
  color: white;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  color: var(--title);
  margin-bottom: var(--space-xs);
  line-height: 1.5;
}

h1 {
  font-size: clamp(1.2rem, 4vw, 1.4rem);
  font-weight: var(--weight-bold);
  margin: var(--space-sm) 0;
}

h2 {
  font-size: clamp(1.1rem, 3vw, 1.2rem);
  font-weight: var(--weight-bold);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: var(--weight-bold);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

h4, h5, h6 { 
  font-size: var(--scale-base); 
  font-weight: var(--weight-bold);
}

p {
  font-size: var(--scale-base); 
  margin: var(--space-xs) 0;
  color: var(--text);
  line-height: 1.7;
  font-weight: 400;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand);
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 0.2rem;
  color: var(--bg);
  background: var(--title);
  transition: background 0.2s;
  text-decoration: none;
  font-size: var(--scale-sm);
  text-align: center;
  display: inline-block;
  margin-right: var(--space-sm);
  border: none;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.btn:hover {
  background: var(--text);
  color: var(--bg);
}

.note-list-sec {
  margin-top: var(--space-xl);
}

.note-list-sec h3 {
  margin-top: 0;
}

.note-list {
  list-style: none;
}

.note-list li {
  border-bottom: var(--border-width) solid var(--border);
  padding: var(--space-xs) 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.note-list > li:first-child {
  border-top: var(--border-width) solid var(--border);
}

.note-title {
  font-size: var(--scale-base);
  font-weight: var(--weight-medium);
  color: var(--title);
}

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

.note-title a:hover {
  color: var(--brand);
}

.links-section {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.links-section h6 {
  color: var(--title);
  font-size: var(--scale-sm);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-sm);
}

.links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  list-style: none;
  margin-bottom: 0;
  padding-left: 0;
}

.links-grid li {
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid;
  color: var(--border);
}

.links-grid a {
  color: var(--text);
  text-decoration: none;
  font-size: var(--scale-sm);
  line-height: 1.5;
}

.links-grid a:hover {
  color: var(--brand);
}

@media (max-width: 520px) {
  .links-grid {
    grid-template-columns: 1fr;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  margin: 0;
  transition: color 0.3s;
}

.theme-toggle:hover {
  color: var(--brand);
}

.theme-toggle svg {
  display: block;
  width: 14px;
  height: 14px;
}

/* Markdown Support */
blockquote {
  border-left: 4px solid var(--brand);
  padding-left: var(--space-md);
  margin: var(--space-sm) 0;
  color: var(--text);
  line-height: 1.6;
  background: var(--bg2);
  padding: var(--space-md);
  border-radius: 0.25rem;
}

/* Tighter paragraph spacing inside blockquotes without affecting global <p> */
blockquote p {
  margin-bottom: 0;
}

code {
  background: var(--bg2);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  color: var(--text);
}

pre {
  background: var(--code-bg);
  padding: var(--space-md);
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: var(--space-sm) 0;
  border: var(--border-width) solid var(--border);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

hr {
  border: none;
  border-top: var(--border-width) solid var(--border);
  margin: var(--space-xl) 0;
}

ul, ol {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-lg);
}

li {
  margin-bottom: var(--space-xs);
  line-height: 1.6;
}

/* Override global li margins for sidebar items */
.sidebar-list li,
.sidebar-sublist li {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.875rem;
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: var(--border-width) solid var(--border);
}

th {
  font-weight: 600;
  color: var(--title);
  background: var(--bg2);
}

td {
  background: var(--td-bg);
  color: var(--text);
}

/* Search styles - modernized */
.search-container {
  margin-bottom: var(--space-lg);
  position: relative;
}

.search-input {
  width: 100%;
  padding: var(--space-sm);
  border: var(--border-width) solid var(--border);
  border-radius: 0.25rem;
  font-size: var(--scale-base);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.search-input:focus {
  outline: none;
  border-color: var(--brand);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 999;
  display: none;
}

.search-active .search-results {
  display: block;
  border: var(--border-width) solid var(--border);
  border-top: none;
  border-radius: 0 0 0.25rem 0.25rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-results-list-item {
  margin: 0;
}

.search-result {
  display: block;
  padding: var(--space-xs);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  border-bottom: var(--border-width) solid var(--border);
  line-height: 1.5;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover {
  background: var(--bg2);
  color: var(--brand);
}

.search-result-title {
  color: var(--title);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-sm);
  font-size: var(--scale-base);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.search-result-doc {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.search-result-doc-title {
  font-weight: var(--weight-bold);
  color: var(--title);
}

.search-result-previews {
  margin-top: var(--space-xs);
}

.search-result-preview {
  color: var(--text);
  font-size: var(--scale-sm);
  line-height: 1.4;
  margin-bottom: var(--space-xs);
  opacity: 0.8;
}

.search-result-highlight {
  background: var(--brand);
  color: var(--bg);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: var(--weight-bold);
}

.search-no-result {
  color: var(--text);
  font-style: italic;
  padding: var(--space-md);
  text-align: center;
}

/* Feed styles */
.notelist-feed {
  border-bottom: var(--border-width) solid var(--border);
  padding: var(--space-sm) 0;
  transition: background 0.3s ease;
}

.notelist-feed:hover {
  background: var(--bg2);
}

.notelist-feed a {
  text-decoration: none;
  color: inherit;
}

.notelist-feed p {
  color: var(--title);
  margin-bottom: 0;
  font-size: var(--scale-base);
  font-weight: var(--weight-medium);
}

.list-feed {
  border-bottom: var(--border-width) solid var(--border);
  padding: var(--space-sm) 0;
}

.list-feed a {
  text-decoration: none;
  color: var(--title);
  transition: color 0.3s ease;
}

.list-feed a:hover {
  color: var(--brand);
}

/* Hide/show classes for backlinks */
.hide {
  display: none;
}

.show {
  display: block;
}

/* Tooltip styles */
.tooltip {
  position: relative;
  display: inline;
}

.tooltip .right {
  width: 300px;
  padding: 0.5rem 0.75rem;
  font-size: var(--scale-xs);
  line-height: 1.3;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 150%;
  z-index: 1;
  background-color: var(--bg2);
  color: var(--text);
  border-radius: 6px;
  border: var(--border-width) solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
  text-align: left;
}

.tooltip:hover .right {
  opacity: 1;
  visibility: visible;
}

.tooltip .right .tooltip-excerpt {
  color: var(--text);
  line-height: 1.3;
  font-size: var(--scale-xs);
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.stale-link {
  color: var(--text) !important;
  opacity: 0.6;
  cursor: not-allowed;
}

.wiki-link {
  color: var(--brand);
  text-decoration: none;
  border-bottom: var(--border-width) solid transparent;
  transition: border-color 0.2s ease;
}

.wiki-link:hover {
  border-bottom-color: var(--brand);
}

.link-preview {
  background: var(--bg2);
  border: var(--border-width) solid var(--border);
  border-radius: 6px;
  padding: var(--space-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  font-size: var(--scale-sm);
  line-height: 1.4;
}

.preview-content strong {
  color: var(--title);
  display: block;
  margin-bottom: var(--space-xs);
}

.preview-content p {
  color: var(--text);
  margin: 0;
  opacity: 0.8;
  font-size: 0.875rem;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .container {
    padding-top: var(--space-sm);
  }
  
  .container > div {
    padding: 0 var(--space-md) var(--space-md);
  }
  
  .nav {
    margin-bottom: var(--space-lg);
  }
  
  h1 {
    font-size: var(--scale-lg);
  }
  
  h2 {
    font-size: var(--scale-base);
  }
  
  h3 {
    font-size: var(--scale-base);
  }
}

@media (max-width: 520px) {
  .container {
    padding-top: var(--space-sm);
  }
  
  .container > div {
    padding: 0 var(--space-sm) var(--space-sm);
  }
  
  .btn {
    display: block;
    margin-bottom: var(--space-sm);
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-md) 0;
}

p a[href^="http://"], p a[href^="https://"],
li a[href^="http://"], li a[href^="https://"] {
  position: relative;
}
p a[href^="http://"]:after, p a[href^="https://"]:after,
li a[href^="http://"]:after, li a[href^="https://"]:after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.25em;
  vertical-align: text-top;
  background: url('data:image/svg+xml;utf8,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22%23555%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M5%2019L19%205M5%205h14v14%22/%3E%3C/svg%3E') no-repeat center center;
  background-size: 1em 1em;
  opacity: 0.7;
}