/* ===== BASE DESIGN ===== */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;600&display=swap');

:root {
  --ide-bg: #1e1e1e;
  --ide-panel: #252526;
  --ide-sidebar: #333333;
  --ide-activity: #333333;
  --ide-topbar: #3c3c3c;
  --ide-statusbar: #007acc;
  --ide-text: #cccccc;
  --ide-text-muted: #858585;
  --ide-border: #454545;
  --ide-accent: #3794ff;
  --ide-selection: #04395e;
  --ide-hover: #2a2d2e;

  --syn-keyword: #569cd6;
  --syn-string: #ce9178;
  --syn-comment: #6a9955;
  --syn-func: #dcdcaa;
  --syn-var: #9cdcfe;
  --syn-num: #b5cea8;
  --syn-key: #9cdcfe;
  --syn-operator: #d4d4d4;
  
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;

  --banner-height: 24px;
}

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

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ide-bg);
  color: var(--ide-text);
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Site Banner --- */
.site-banner {
  background: #3794ff;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  height: var(--banner-height);
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 100%;
  flex-shrink: 0;
}
.banner-text {
  display: flex;
  width: max-content;
  min-width: 100%;
  animation: ticker 40s linear infinite;
  white-space: nowrap;
}
.banner-group { flex: 0 0 auto; display: flex; align-items: center; }
.banner-text a { color: #fff; text-decoration: underline; }
@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- IDE Layout Shell --- */
.ide-window { 
  display: flex; 
  flex-direction: column; 
  height: calc(100vh - var(--banner-height)); 
  width: 100vw; 
  overflow: hidden;
}
.ide-titlebar {
  height: 30px;
  background: var(--ide-topbar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ide-text-muted);
  user-select: none;
  flex-shrink: 0;
}
.ide-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.ide-activity-bar {
  width: 48px;
  background: var(--ide-activity);
  border-right: 1px solid var(--ide-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  gap: 20px;
  flex-shrink: 0;
}
.activity-icon {
  font-size: 24px;
  color: var(--ide-text-muted);
  cursor: pointer;
  opacity: 0.5;
}
.activity-icon.active { opacity: 1; border-left: 2px solid #fff; margin-left: -2px; padding-left: 2px; }
.ide-sidebar {
  width: 250px;
  background: var(--ide-panel);
  border-right: 1px solid var(--ide-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.ide-sidebar-title {
  padding: 10px 20px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ide-text-muted);
  text-transform: uppercase;
}
.ide-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ide-bg);
}
.ide-tabs {
  height: 35px;
  background: var(--ide-panel);
  display: flex;
  flex-shrink: 0;
}
.ide-tab {
  padding: 0 20px;
  background: var(--ide-bg);
  border-top: 1px solid var(--ide-accent);
  color: var(--ide-accent);
  display: flex;
  align-items: center;
  font-size: 13px;
  font-family: var(--font-ui);
}
.ide-breadcrumb {
  height: 22px;
  background: var(--ide-bg);
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 12px;
  color: var(--ide-text-muted);
  border-bottom: 1px solid var(--ide-border);
  font-family: var(--font-ui);
  flex-shrink: 0;
}
.ide-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 40px;
}
.ide-statusbar {
  height: 22px;
  background: var(--ide-statusbar);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  color: #fff;
  font-family: var(--font-ui);
  flex-shrink: 0;
}
.status-left, .status-right { display: flex; gap: 15px; align-items: center; }
.status-item a { color: #fff; text-decoration: none; }
.status-item a:hover { text-decoration: underline; }

/* --- Sidebar Nav --- */
.ide-nav-tree { padding: 10px 0; font-family: var(--font-ui); font-size: 13px; }
.ide-folder-header { padding: 4px 20px; cursor: pointer; color: var(--ide-text); font-weight: bold; }
.ide-file-list { list-style: none; margin-top: 5px; }
.ide-file-list li a {
  display: block;
  padding: 4px 20px 4px 35px;
  color: var(--ide-text);
  text-decoration: none;
}
.ide-file-list li a:hover { background: var(--ide-hover); }
.ide-file-list li a.active { background: var(--ide-selection); color: #fff; }
.file-icon { display: inline-block; width: 16px; margin-right: 6px; text-align: center; font-size: 11px; font-weight: bold; font-family: var(--font-mono); }
.ts-icon { color: #3178c6; }
.md-icon { color: #699dfa; }
.json-icon { color: #cbcb41; }

/* --- Code View (Homepage) --- */
.ide-code-view {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}
.line { display: flex; white-space: pre-wrap; }
.indent-1 { padding-left: 2ch; }
.indent-2 { padding-left: 4ch; }
.indent-3 { padding-left: 6ch; }
.code-comment { color: var(--syn-comment); }
.code-keyword { color: var(--syn-keyword); }
.code-variable { color: var(--syn-var); }
.code-operator { color: var(--syn-operator); }
.code-key { color: var(--syn-key); }
.code-string { color: var(--syn-string); }
.code-number { color: var(--syn-num); }
.code-block-link { display: block; color: inherit; text-decoration: none; border-radius: 4px; margin: 2px 0; }
.code-block-link:hover { background: var(--ide-hover); text-decoration: none; cursor: pointer; }

/* --- Markdown View (Articles) --- */
.ide-markdown-preview {
  font-family: var(--font-ui);
  line-height: 1.6;
  max-width: 800px;
}
.ide-frontmatter {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--ide-panel);
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 30px;
  border: 1px solid var(--ide-border);
}
.article-body h1 { margin-bottom: 20px; font-size: 2.2rem; color: #fff; }
.article-body h2 { margin: 40px 0 20px; font-size: 1.5rem; color: #fff; border-bottom: 1px solid var(--ide-border); padding-bottom: 8px; }
.article-body h3 { margin: 30px 0 15px; font-size: 1.2rem; color: #fff; }
.article-body p { margin-bottom: 20px; font-size: 1.1rem; color: var(--ide-text); }
.article-body a { color: var(--ide-accent); text-decoration: underline; }
.article-body ul, .article-body ol { margin-bottom: 20px; padding-left: 30px; }
.article-body li { margin-bottom: 8px; }
.article-body blockquote { border-left: 4px solid var(--ide-accent); padding-left: 20px; margin: 20px 0; font-style: italic; color: var(--ide-text-muted); background: var(--ide-panel); padding: 15px 15px 15px 20px; border-radius: 0 4px 4px 0; }
.article-body img { max-width: 100%; border: 1px solid var(--ide-border); border-radius: 4px; margin: 20px 0; display: block; }
.article-body pre { background: #000; padding: 15px; border-radius: 6px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; border: 1px solid var(--ide-border); margin-bottom: 20px; }
.article-body code { font-family: var(--font-mono); background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
.article-body pre code { background: none; padding: 0; }

.pull-quote {
  font-size: 1.3rem;
  font-family: var(--font-ui);
  line-height: 1.4;
  margin: 30px 0;
  padding: 20px;
  border-left: 4px solid var(--syn-string);
  background: var(--ide-panel);
  color: var(--ide-text);
  border-radius: 0 4px 4px 0;
}

/* --- Archive Table as IDE Code --- */
.archive-json { margin-top: 20px; }

/* --- Reading page sorting --- */
.sort-controls { margin: 20px 0 30px; font-family: var(--font-mono); font-size: 13px; }
.sort-controls span { color: var(--syn-comment); }
.sort-controls a { color: var(--ide-accent); margin-right: 15px; text-decoration: none; display: inline-block; padding: 4px 8px; border-radius: 4px; }
.sort-controls a:hover { background: var(--ide-hover); }
.sort-controls a.active { background: var(--ide-selection); color: #fff; }
.year-heading { font-family: var(--font-mono); color: var(--syn-comment); font-size: 14px; margin: 30px 0 10px; border-bottom: 1px dashed var(--ide-border); padding-bottom: 5px; display: inline-block; }

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .ide-body { flex-direction: column; overflow-y: auto; }
  .ide-activity-bar { flex-direction: row; width: 100%; height: 48px; border-right: none; border-bottom: 1px solid var(--ide-border); padding-top: 0; justify-content: center; gap: 30px; }
  .ide-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--ide-border); max-height: 250px; overflow-y: auto; }
  .ide-content-scroll { padding: 15px; overflow: visible; }
  .ide-window { height: auto; display: block; overflow-y: auto; }
  .ide-tabs { display: none; }
  .line { flex-wrap: wrap; }
}

/* Specific component fixes for App layout */
.stack-grid, .feature-grid { display: grid; gap: 15px; grid-template-columns: 1fr; margin-bottom: 20px; }
@media (min-width: 600px) { .stack-grid, .feature-grid { grid-template-columns: 1fr 1fr; } }
.stack-card, .feature {
  display: block;
  background: var(--ide-panel);
  border: 1px solid var(--ide-border);
  padding: 20px;
  border-radius: 6px;
  color: var(--ide-text);
  font-family: var(--font-ui);
}
.stack-card:hover { border-color: var(--ide-accent); }
.stack-card-title, .feature h3 { font-size: 1.1rem; color: #fff; margin-bottom: 5px; font-weight: 600; }
.stack-card-count { font-family: var(--font-mono); font-size: 0.85rem; color: var(--syn-string); }

.post-index-row {
  display: block;
  background: var(--ide-panel);
  border: 1px solid var(--ide-border);
  padding: 15px 20px;
  margin-bottom: 10px;
  border-radius: 6px;
  color: var(--ide-text);
  font-family: var(--font-ui);
}
.post-index-row:hover { border-color: var(--ide-accent); background: var(--ide-hover); text-decoration: none; }
.post-index-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.post-index-title { font-size: 1.1rem; color: #fff; font-weight: 600; }
.post-index-date { font-family: var(--font-mono); font-size: 0.85rem; color: var(--syn-num); }
.post-index-desc { font-size: 0.95rem; color: var(--ide-text-muted); margin-bottom: 5px; }
.post-index-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--syn-comment); }
