/* Rose Pine Theme */
:root {
  /* Rose Pine Base */
  --rp-base: #191724;
  --rp-surface: #1f1d2e;
  --rp-overlay: #26233a;
  --rp-muted: #6e6a86;
  --rp-subtle: #908caa;
  --rp-text: #e0def4;

  /* Rose Pine Accent */
  --rp-love: #eb6f92;
  --rp-gold: #f6c177;
  --rp-rose: #ebbcba;
  --rp-pine: #31748f;
  --rp-foam: #9ccfd8;
  --rp-iris: #c4a7e7;

  /* Rose Pine Highlights */
  --rp-highlight-low: #21202e;
  --rp-highlight-med: #403d52;
  --rp-highlight-high: #524f67;
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace;
  background: var(--rp-base);
  color: var(--rp-text);
  line-height: 1.7;
  min-height: 100vh;
}

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.header {
  background: var(--rp-surface);
  border-bottom: 1px solid var(--rp-overlay);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--rp-rose);
  text-decoration: none;
}

.site-title:hover {
  color: var(--rp-love);
}

.site-icon {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
}

/* Navigation */
nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  color: var(--rp-subtle);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

nav a:hover {
  color: var(--rp-foam);
}

/* Search */
.search-container {
  position: relative;
}

#search {
  background: var(--rp-overlay);
  border: 1px solid var(--rp-highlight-med);
  color: var(--rp-text);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  width: 180px;
  transition: all 0.2s;
}

#search:focus {
  outline: none;
  border-color: var(--rp-pine);
  width: 220px;
}

#search::placeholder {
  color: var(--rp-muted);
}

.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--rp-surface);
  border: 1px solid var(--rp-overlay);
  border-radius: 4px;
  margin-top: 0.5rem;
  width: 300px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-results.active {
  display: block;
}

.search-result {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rp-overlay);
}

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

.search-result a {
  color: var(--rp-text);
  text-decoration: none;
  display: block;
}

.search-result a:hover {
  color: var(--rp-foam);
}

.search-result-title {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.search-result-date {
  font-size: 0.8rem;
  color: var(--rp-muted);
}

/* Main Content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  font-weight: bold;
  line-height: 1.3;
}

h1 {
  font-size: 1.75rem;
  color: var(--rp-rose);
  margin-top: 0;
}

h2 {
  font-size: 1.4rem;
  color: var(--rp-iris);
}

h3 {
  font-size: 1.2rem;
  color: var(--rp-foam);
}

h4, h5, h6 {
  font-size: 1rem;
  color: var(--rp-pine);
}

p {
  margin-bottom: 1rem;
}

/* Links */
a {
  color: var(--rp-foam);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--rp-rose);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

ul > li::marker {
  color: var(--rp-gold);
}

ol > li::marker {
  color: var(--rp-iris);
}

/* Bold and Italic */
strong, b {
  color: var(--rp-gold);
  font-weight: bold;
}

em, i {
  color: var(--rp-rose);
  font-style: italic;
}

/* Code - Inline */
code {
  background: var(--rp-overlay);
  color: var(--rp-gold);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Code - Blocks */
pre {
  background: var(--rp-surface);
  border: 1px solid var(--rp-overlay);
  border-left: 3px solid var(--rp-iris);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

pre code {
  background: none;
  color: var(--rp-text);
  padding: 0;
  font-size: 0.9rem;
}

/* Blockquote */
blockquote {
  border-left: 3px solid var(--rp-iris);
  margin: 1rem 0;
  padding-left: 1rem;
  color: var(--rp-subtle);
  font-style: italic;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px !important;
  margin: 1rem 0;
  border: 2px solid var(--rp-gold) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  transition: border-width 0.2s ease, transform 0.2s ease;
}

img:hover {
  border-width: 4px !important;
  transform: scale(1.02);
}

/* Horizontal Rule */
hr {
  border: none;
  border-top: 1px solid var(--rp-overlay);
  margin: 2rem 0;
}

/* Blog Post List */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rp-overlay);
}

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

.post-list-title {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.post-list-title a {
  color: var(--rp-text);
}

.post-list-title a:hover {
  color: var(--rp-foam);
}

.post-list-meta {
  font-size: 0.85rem;
  color: var(--rp-muted);
}

.post-list-description {
  margin-top: 0.5rem;
  color: var(--rp-subtle);
}

/* Post Header */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rp-overlay);
}

.post-meta {
  font-size: 0.9rem;
  color: var(--rp-muted);
  margin-top: 0.5rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tag {
  background: var(--rp-overlay);
  color: var(--rp-iris);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* Footer */
.footer {
  background: var(--rp-surface);
  border-top: 1px solid var(--rp-overlay);
  padding: 1.5rem 0;
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--rp-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--rp-base);
}

::-webkit-scrollbar-thumb {
  background: var(--rp-highlight-med);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--rp-highlight-high);
}

/* Syntax Highlighting - Rose Pine */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--rp-muted);
  font-style: italic;
}

.token.punctuation {
  color: var(--rp-subtle);
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
  color: var(--rp-gold);
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin {
  color: var(--rp-foam);
}

.token.operator,
.token.entity,
.token.url,
.token.variable {
  color: var(--rp-rose);
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: var(--rp-iris);
}

.token.function,
.token.class-name {
  color: var(--rp-love);
}

.token.regex,
.token.important {
  color: var(--rp-gold);
}

.token.inserted {
  color: var(--rp-foam);
}

.token.deleted {
  color: var(--rp-love);
}

/* Responsive */
@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    gap: 1rem;
  }

  nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  #search {
    width: 100%;
  }

  #search:focus {
    width: 100%;
  }

  .search-results {
    width: 100%;
    left: 0;
    right: 0;
  }
}

/* Entity Display / Home */
.entity-display {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.entity-display pre {
  background: var(--rp-surface);
  border: 1px solid var(--rp-overlay);
  border-left: 3px solid var(--rp-iris);
  max-width: 400px;
}

/* Node Content */
.node-content {
  margin-top: 1.5rem;
}

.node-content pre {
  margin: 1rem 0;
}

/* YAML highlighting in content */
.language-yaml .token.key {
  color: var(--rp-foam);
}

.language-yaml .token.value {
  color: var(--rp-gold);
}

/* Click-to-copy slug header */
.copy-url {
  cursor: pointer;
  transition: color 0.2s;
}

.copy-url:hover {
  color: var(--rp-foam);
}

.copy-url.copied {
  color: var(--rp-pine);
}

/* Edges navigation */
.edges {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rp-overlay);
}

.edge-group {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.edge-dir {
  color: var(--rp-muted);
  font-size: 0.85rem;
  min-width: 80px;
}

.edge-pair {
  display: inline-flex;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--rp-highlight-med);
}

.edge-link {
  background: var(--rp-overlay);
  color: var(--rp-foam);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s;
}

.edge-link:hover {
  background: var(--rp-highlight-med);
  color: var(--rp-text);
  text-decoration: none;
}

.edge-copy {
  background: var(--rp-highlight-low);
  border: none;
  border-left: 1px solid var(--rp-highlight-med);
  color: var(--rp-muted);
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.edge-copy:hover {
  background: var(--rp-highlight-med);
  color: var(--rp-text);
}

.edge-copy.copied {
  background: var(--rp-pine);
  color: var(--rp-base);
}

/* A-Z Picker */
.alpha-picker {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.alpha-picker::-webkit-scrollbar {
  display: none;
}

.alpha-tile {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--rp-overlay);
  border: 1px solid var(--rp-highlight-med);
  border-radius: 6px;
  color: var(--rp-foam);
  font-size: 1.1rem;
  font-weight: bold;
  text-decoration: none;
  transition: all 0.2s;
}

.alpha-tile:hover {
  background: var(--rp-highlight-med);
  color: var(--rp-text);
  text-decoration: none;
}

.alpha-tile.active {
  background: var(--rp-pine);
  border-color: var(--rp-pine);
  color: var(--rp-base);
}

.alpha-tile.disabled {
  color: var(--rp-muted);
  opacity: 0.4;
  cursor: default;
}

.alpha-group {
  margin-bottom: 2rem;
}

.alpha-header {
  font-size: 1.5rem;
  color: var(--rp-iris);
  border-bottom: 1px solid var(--rp-overlay);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.post-list.compact li {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Reading List Navigation */
.reading-list-nav {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--rp-surface);
  border: 1px solid var(--rp-overlay);
  border-radius: 8px;
}

.rl-header {
  font-size: 1.1rem;
  color: var(--rp-gold);
  margin-bottom: 1rem;
}

.rl-progress {
  color: var(--rp-muted);
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

.rl-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.rl-exit {
  font-size: 0.85rem;
  color: var(--rp-muted);
}

.rl-exit a {
  color: var(--rp-subtle);
}

/* Reading List Page */
.reading-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: reading-item;
}

.reading-list li {
  counter-increment: reading-item;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reading-list li::before {
  content: counter(reading-item);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  background: var(--rp-overlay);
  border-radius: 50%;
  color: var(--rp-iris);
  font-size: 0.85rem;
  font-weight: bold;
}

.rl-start {
  margin: 1.5rem 0;
}

.rl-start-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--rp-pine);
  color: var(--rp-base);
  border-radius: 6px;
  font-weight: bold;
  text-decoration: none;
  transition: all 0.2s;
}

.rl-start-btn:hover {
  background: var(--rp-foam);
  color: var(--rp-base);
  text-decoration: none;
}

/* Mermaid Diagram Styling - Rose Pine overrides */
.mermaid {
  background: var(--rp-surface);
  border: 1px solid var(--rp-overlay);
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.mermaid .node text,
.mermaid .label text,
.mermaid .mindmap-node text {
  font-weight: 400 !important;
  fill: var(--rp-text) !important;
}

/* Force override of inline styles that create light backgrounds */
.mermaid rect[style*="fill:#fff"],
.mermaid rect[style*="fill:#f3e"],
.mermaid rect[style*="fill:#f0f"],
.mermaid rect[style*="fill:#fef"],
.mermaid polygon[style*="fill:#fff"],
.mermaid polygon[style*="fill:#f3e"],
.mermaid polygon[style*="fill:#f0f"],
.mermaid polygon[style*="fill:#fef"] {
  fill: var(--rp-surface) !important;
}

/* Force all mermaid node backgrounds to be dark */
.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node circle,
.mermaid .node ellipse {
  fill: var(--rp-surface) !important;
  stroke: var(--rp-foam) !important;
}

/* Force all text in mermaid to be light */
.mermaid .nodeLabel,
.mermaid .node text,
.mermaid text {
  fill: var(--rp-text) !important;
  color: var(--rp-text) !important;
}

/* Sequence diagram specific fixes */
.mermaid .actor {
  fill: var(--rp-surface) !important;
  stroke: var(--rp-foam) !important;
}

.mermaid .actor-box {
  fill: var(--rp-surface) !important;
  stroke: var(--rp-foam) !important;
}

.mermaid .note {
  fill: var(--rp-overlay) !important;
  stroke: var(--rp-foam) !important;
}

/* Fix highlighted sections in sequence diagrams */
.mermaid rect[fill*="rgb(191, 223, 255)"],
.mermaid rect[style*="rgb(191, 223, 255)"],
.mermaid rect[fill*="#bfdffe"],
.mermaid rect[style*="#bfdffe"],
.mermaid .section0,
.mermaid .section1,
.mermaid .section2 {
  fill: var(--rp-overlay) !important;
}

/* Force sequence diagram highlighted areas to be dark */
.mermaid g[class*="rect"] rect {
  fill: var(--rp-overlay) !important;
}

/* Force all sequence diagram text to be light */
.mermaid .messageText,
.mermaid .labelText,
.mermaid .loopText,
.mermaid .noteText {
  fill: var(--rp-text) !important;
  font-weight: 400 !important;
}

/* Flowchart edge labels */
.mermaid .edgeLabel {
  background: var(--rp-surface) !important;
  color: var(--rp-text) !important;
}

.mermaid .edgeLabel rect {
  fill: var(--rp-surface) !important;
}

/* Cluster/subgraph styling */
.mermaid .cluster rect {
  fill: var(--rp-base) !important;
  stroke: var(--rp-highlight-med) !important;
}

.mermaid .cluster text {
  fill: var(--rp-iris) !important;
}
