/* ===== Reset & Base ===== */

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

:root {
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;

  --bg: #fafaf9;
  --bg-column: #ffffff;
  --bg-selected: #e8e6e3;
  --bg-hover: #f0efed;
  --bg-content: #ffffff;

  --border: #d6d3d1;
  --border-light: #e7e5e4;

  --text: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;

  --column-width: 260px;
  --content-min-width: 400px;
  --header-height: 48px;

  --radius: 4px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ===== Header ===== */

#header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-column);
  user-select: none;
  flex-shrink: 0;
}

.site-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.breadcrumb .sep {
  margin: 0 4px;
  color: var(--border);
}

.breadcrumb .crumb {
  color: var(--text-secondary);
  cursor: pointer;
}
.breadcrumb .crumb:hover {
  color: var(--accent);
}
.breadcrumb .crumb.current {
  color: var(--text);
}

/* ===== Miller Columns Container ===== */

#columns-container {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

/* Subtle scrollbar */
#columns-container::-webkit-scrollbar {
  height: 6px;
}
#columns-container::-webkit-scrollbar-track {
  background: var(--bg);
}
#columns-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===== Column (directory listing) ===== */

.column {
  min-width: var(--column-width);
  max-width: var(--column-width);
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--bg-column);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  animation: column-enter 0.15s ease-out;
}

@keyframes column-enter {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.column-header {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.column-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.column-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.column-list::-webkit-scrollbar {
  width: 4px;
}
.column-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== Column Item ===== */

.column-item {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.08s ease;
  position: relative;
}

.column-item:hover {
  background: var(--bg-hover);
}

.column-item.selected {
  background: var(--bg-selected);
}

.column-item.selected::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

.item-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.item-icon svg {
  width: 14px;
  height: 14px;
}

.item-label {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-chevron svg {
  width: 12px;
  height: 12px;
}

.column-item:hover .item-chevron {
  opacity: 0.8;
}

.item-description {
  display: none;
}

/* ===== Content Pane (markdown page) ===== */

.content-pane {
  min-width: var(--content-min-width);
  max-width: 640px;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-content);
  border-right: 1px solid var(--border);
  animation: column-enter 0.15s ease-out;
}

.content-pane-inner {
  padding: 32px 40px 64px;
  max-width: 640px;
}

/* ===== Markdown Content Typography ===== */

.markdown-body h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.markdown-body h2 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
}

.markdown-body h3 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text);
}

.markdown-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.markdown-body li {
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.markdown-body li strong {
  color: var(--text);
}

.markdown-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-muted);
  font-style: italic;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.markdown-body pre {
  background: #1c1917;
  color: #e7e5e4;
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 12px;
  line-height: 1.6;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 24px 0;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 6px;
  margin: 16px 0;
}

.markdown-body em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
}

.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body strong {
  font-weight: 600;
}

/* ===== Empty state ===== */

.column-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

/* ===== Loading ===== */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .column {
    min-width: 220px;
    max-width: 220px;
  }

  .content-pane {
    min-width: 300px;
  }

  .content-pane-inner {
    padding: 24px 20px 48px;
  }
}
