:root {
  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 12px;
  --radius-xl: 16px;

  --size-4-1: 4px;
  --size-4-2: 8px;
  --size-4-3: 12px;
  --size-4-4: 16px;
  --size-4-5: 20px;
  --size-4-6: 24px;

  --cursor-link: pointer;

  /* More visible panel borders */
  --panel-border: rgba(255, 255, 255, 0.22);
}

.theme-dark {
  --text-normal: #d8d8d8;
  --text-muted: #8b8b8b;
  --text-faint: #6b6b6b;
  --text-accent: #05d9e8;
  --text-on-accent: #000000;
  --text-selection: hsla(var(--interactive-accent-hsl), 0.35);

  --link-color: #ffa500;
  --link-external-color: #ffc400;
  --link-decoration: none;
  --link-decoration-hover: underline;

  --interactive-accent-hsl: 198, 63%, 57%;
  --interactive-accent: hsl(var(--interactive-accent-hsl));

  --background-primary: var(--color-base-00, #000000);
  --background-secondary: var(--color-base-20, #1e1e1e);
  --background-tertiary: var(--color-base-05, #171717b7);

  --h1-color: var(--text-normal);
  --h2-color: var(--text-normal);
  --h3-color: var(--text-normal);
  --h4-color: var(--text-normal);
  --h5-color: var(--text-normal);
  --h6-color: var(--text-normal);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

/* Subtle themed scrollbars for scrollable regions. */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--panel-border, rgba(255, 255, 255, 0.08));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, #8b8b8b);
}

/* Restore cyberpunk fonts inside the note body only. */
.note-content,
.note-content .markdown-preview-view,
.note-content .markdown-rendered,
.note-content .view-content {
  --default-font: 'OxaniumFira', 'Inter', 'Rubik', 'Segoe UI', sans-serif;
  --title-heading: 'Space Wham', 'Inter', sans-serif;
  --h1-font: 'Orbitron', 'Inter', sans-serif;
  --h2-font: 'Orbitron', 'Inter', sans-serif;
  --h3-font: 'Orbitron', 'Inter', sans-serif;
  --h4-font: 'Orbitron', 'Inter', sans-serif;
  --h5-font: 'Orbitron', 'Inter', sans-serif;
  --h6-font: 'Orbitron', 'Inter', sans-serif;
}

body.theme-dark {
  background: var(--background-primary);
  color: var(--text-normal);
  font-family: var(--default-font);
  line-height: 1.6;
}

a {
  color: var(--link-color);
  text-decoration: var(--link-decoration);
}

a:hover {
  text-decoration: var(--link-decoration-hover);
}

a.external-link {
  color: var(--link-external-color);
}

/* Site chrome -------------------------------------------------------------- */

.site-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.site-header {
  flex-shrink: 0;
  z-index: 100;
  background: var(--background-secondary);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
}

.site-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand a {
  font-family: var(--default-font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--h2-font);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.site-nav a {
  color: var(--text-muted);
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text-accent);
  border-bottom-color: var(--text-accent);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-s);
  color: var(--text-accent);
  padding: 0.4rem 0.6rem;
  font-family: var(--h2-font);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--background-tertiary);
}

.site-main {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Obsidian preview wrapper ------------------------------------------------- */

.markdown-preview-view,
.markdown-rendered {
  background: transparent;
  color: var(--text-normal);
  padding: 0;
}

/* The wrapper around actual note content */
.view-content {
  background: transparent;
}

/* Three-column blog layout ------------------------------------------------- */

.blog-three-column {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  grid-template-rows: 1fr;
  height: 100%;
  gap: 0;
}

.blog-main {
  min-width: 0;
  padding: 1.5rem 2rem;
  overflow-y: auto;
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
}

.blog-main > * {
  max-width: 85ch;
  margin-left: auto;
  margin-right: auto;
}

.blog-main > .note-meta-bar {
  max-width: 85ch;
  margin-left: auto;
  margin-right: auto;
}

.blog-sidebar,
.roadmap-panel,
.graph-panel,
.links-panel {
  overflow-y: auto;
}

.blog-sidebar {
  background: var(--background-secondary);
  overflow-y: auto;
  padding: 1rem;
}

.blog-sidebar h3 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
  font-family: var(--h2-font);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.blog-sidebar .toc {
  font-size: 0.85rem;
  line-height: 1.5;
}

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

.blog-sidebar .toc ul ul {
  padding-left: 0.9rem;
  border-left: 1px solid var(--panel-border);
  margin-top: 0.25rem;
}

.blog-sidebar .toc li {
  margin-bottom: 0.35rem;
}

.blog-sidebar .toc a {
  color: var(--text-muted);
  display: block;
  padding: 0.15rem 0;
}

.blog-sidebar .toc a:hover {
  color: var(--text-accent);
  text-decoration: none;
}

/* Right sidebar stacked panels --------------------------------------------- */

.blog-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.roadmap-panel,
.links-panel,
.graph-panel {
  flex: 1 1 50%;
  padding: 0.5rem;
  overflow-y: auto;
  border-bottom: 1px solid var(--panel-border);
}

.roadmap-panel:last-child,
.links-panel:last-child,
.graph-panel:last-child {
  border-bottom: none;
}

.roadmap-panel h3,
.links-panel h3,
.graph-panel h3 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
  font-family: var(--h2-font);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.links-list li {
  margin-bottom: 0.5rem;
}

.links-list a {
  color: var(--text-normal);
  word-break: break-word;
}

.links-list a:hover {
  color: var(--text-accent);
}

.links-list a.unresolved-link {
  color: var(--text-muted);
  font-style: italic;
}

/* Related notes (left sidebar) --------------------------------------------- */

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  border-image-source: linear-gradient(to right, transparent, var(--text-accent), transparent);

  border-image-slice: 1;
  border-image-source: linear-gradient(to right, transparent, var(--text-accent), transparent);
  border-top: 1px solid;
  border-bottom: 1px solid;

}

.related-list li {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--panel-border);
}

.related-list li:last-child {
  border-bottom: none;
}

.related-list a {
  color: var(--text-normal);
  display: block;
  margin-bottom: 0.3rem;
}

.related-list a:hover {
  color: var(--text-accent);
  text-decoration: none;
}

.related-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.related-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
}

#graph {
  width: 100%;
  height: 100%;
  min-height: 220px;
  border-radius: var(--radius-s);
  background: var(--background-primary);
}

.panel-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Note meta bar ------------------------------------------------------------ */

.note-meta-bar {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.note-meta-bar a.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--background-tertiary);
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--background-secondary);
  color: var(--text-accent);
}

.note-meta-bar a.tag:hover {
  background: var(--background-tertiary);
}

/* Blog index --------------------------------------------------------------- */

.page-header {
  margin-bottom: 1.5rem;
}

.page-header,
.global-graph-panel,
.post-list,
.pagination,
.search-page,
.tag-page,
.simple-page {
  padding: 1.5rem;
  max-width: 85ch;
  margin-left: auto;
  margin-right: auto;
}

.global-graph-panel #graph {
  height: 400px;
}

/* Blog index --------------------------------------------------------------- */

.page-header h1 {
  margin: 0 0 0.25rem;
  font-family: var(--title-heading);
  color: var(--text-accent);
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card {
  padding: 1.25rem;
  background: var(--background-secondary);
  border: 1px solid var(--background-tertiary);
  border-radius: var(--radius-m);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.post-card:hover {
  border-color: var(--text-accent);
  box-shadow: 0 0 20px hsla(var(--interactive-accent-hsl), 0.15);
}

.post-card h2 {
  margin: 0 0 0.5rem;
  font-family: var(--h2-font);
  font-size: 1.25rem;
}

.post-card h2 a {
  color: var(--text-normal);
}

.post-card h2 a:hover {
  color: var(--text-accent);
  text-decoration: none;
}

.post-card-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-card-excerpt {
  margin: 0;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  font-family: var(--h2-font);
  font-size: 0.85rem;
}

/* Search page -------------------------------------------------------------- */

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--background-primary);
  border: 1px solid var(--background-tertiary);
  border-radius: var(--radius-s);
  color: var(--text-normal);
  font-family: inherit;
  font-size: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--text-accent);
  box-shadow: 0 0 10px hsla(var(--interactive-accent-hsl), 0.25);
}

.search-button {
  padding: 0.75rem 1.25rem;
  background: var(--text-accent);
  border: none;
  border-radius: var(--radius-s);
  color: var(--text-on-accent);
  font-family: var(--h2-font);
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

.search-button:hover {
  background: var(--interactive-accent);
}

.results-count {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Note content overflow safeguards ----------------------------------------- */

.note-content img,
.note-content video,
.note-content svg,
.note-content canvas,
.markdown-preview-view img,
.markdown-preview-view video,
.markdown-preview-view svg,
.markdown-preview-view canvas {
  max-width: 100%;
  height: auto;
}

.note-content table,
.markdown-preview-view table {
  display: block;
  width: 100%;
  overflow-x: auto;
}

.note-content pre,
.markdown-preview-view pre {
  overflow-x: auto;
  white-space: pre;
  word-wrap: normal;
}

.note-content code,
.markdown-preview-view code {
  word-break: break-word;
}

/* CV / simple pages -------------------------------------------------------- */

.simple-page {
  max-width: 800px;
}

/* Responsive --------------------------------------------------------------- */

@media (max-width: 900px) {
  html,
  body {
    height: auto;
    overflow: visible;
    min-height: 100vh;
  }

  .site-wrapper {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .site-main {
    overflow-y: visible;
  }

  .blog-three-column {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
  }

  .blog-main {
    border-left: none;
    border-right: none;
    order: 1;
    padding: 1.25rem 1rem;
    overflow-y: visible;
  }

  .blog-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding: 1rem;
  }

  .blog-sidebar-left {
    order: 2;
    border-top: 1px solid var(--panel-border);
  }

  .blog-sidebar-right {
    order: 3;
    flex-direction: column;
    border-top: 1px solid var(--panel-border);
  }

  .roadmap-panel,
  .links-panel,
  .graph-panel {
    flex: 1 1 auto;
    min-height: 220px;
    border-bottom: 1px solid var(--panel-border);
    border-right: none;
  }

  .roadmap-panel:last-child,
  .links-panel:last-child,
  .graph-panel:last-child {
    border-bottom: none;
    border-right: none;
  }

  #graph {
    min-height: 220px;
  }
}

@media (max-width: 600px) {
  .site-header-inner {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--panel-border);
    margin-top: 0.5rem;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.5rem 0;
    border-bottom: none;
  }

  .site-main {
    padding: 0;
  }

  .blog-main {
    padding: 1rem;
  }

  .page-header,
  .global-graph-panel,
  .post-list,
  .pagination,
  .search-page,
  .tag-page,
  .simple-page {
    padding: 1rem;
  }

  .search-form {
    flex-direction: column;
  }

  .post-card {
    padding: 1rem;
  }
}