:root {
  --background-color: #ffffff;
  --text-color: #1a1a1a;
  --border-color: #e0e0e0;
  --muted-color: #888;
  --accent-color: #c0392b;
  --accent-bg: #fdf2f0;
  --content-width: 100%;
  --content-padding: 40px;
  --navbar-height: 60px;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

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

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: 240px;
  height: calc(100vh - var(--navbar-height));
  background: var(--background-color);
  border-right: 1px solid var(--border-color);
  padding: 0;
  overflow-y: auto;
  z-index: 5;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1em 0;
}

.sidebar-link {
  display: block;
  padding: 0.6em 1.2em;
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.15s ease;
}

.sidebar-link:hover {
  background: #f5f5f5;
}

.sidebar-section {
  border-bottom: 1px solid var(--border-color);
}

.sidebar-sublink {
  display: block;
  padding: 0.35em 1.2em 0.35em 2.2em;
  font-size: 0.78em;
  color: #555;
  text-decoration: none;
  transition: background 0.15s ease;
}

.sidebar-sublink:hover {
  background: #f5f5f5;
  color: var(--text-color);
}

.sidebar-active {
  background: var(--accent-bg);
  color: var(--accent-color);
  font-weight: 600;
}

/* Collapsible sidebar sections */
details.sidebar-section {
  border-bottom: 1px solid var(--border-color);
}

details.sidebar-section > summary {
  cursor: pointer;
  list-style: none;
}

details.sidebar-section > summary::-webkit-details-marker {
  display: none;
}

details.sidebar-section > summary::after {
  content: '›';
  float: right;
  margin-right: 1.2em;
  transition: transform 0.15s ease;
}

details.sidebar-section[open] > summary::after {
  transform: rotate(90deg);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  padding: 0 var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-color);
  z-index: 10;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1em;
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border-color);
  font-size: 1em;
  cursor: pointer;
  color: var(--text-color);
  padding: 0.3em 0.6em;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.sidebar-toggle:hover {
  border-color: var(--text-color);
}

.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar-collapsed .navbar {
  left: 0;
}

.navbar-name {
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

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

/* Dashboard */
.dashboard-container {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(var(--navbar-height) + 2em) var(--content-padding) 4em;
  margin-left: 240px;
}

.dashboard-title {
  font-size: 2.2em;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1.5em 0;
}

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  margin: 0;
}

.card {
  display: block;
  border: 1px solid var(--border-color);
  padding: 1.5em;
  transition: border-color 0.2s ease;
  text-decoration: none;
  color: var(--text-color);
}

.card:hover {
  border-color: var(--text-color);
}

.card-label {
  font-size: 0.7em;
  color: var(--muted-color);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.6em;
}

.card h2 {
  font-size: 1.1em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.8em 0;
}

.card p {
  font-size: 0.95em;
  line-height: 1.7;
  margin: 0;
  color: #444;
}

/* Status badge */
.status-badge {
  display: inline-block;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  border: 1px solid currentColor;
  margin-left: 0.6em;
  vertical-align: middle;
}

.status-live { color: #2e7d32; }
.status-blocked { color: #b71c1c; }
.status-progress { color: #e65100; }
.status-draft { color: #888; }

/* Search */
.search-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  justify-content: center;
  padding-top: 15vh;
}

.search-overlay.open {
  display: flex;
}

.search-modal {
  width: 500px;
  max-width: 90vw;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

#search-input {
  width: 100%;
  padding: 1em 1.2em;
  border: none;
  border-bottom: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.95em;
  outline: none;
  background: var(--background-color);
  color: var(--text-color);
}

.search-results {
  overflow-y: auto;
  max-height: 50vh;
}

.search-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7em 1.2em;
  text-decoration: none;
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.1s;
}

.search-result:hover {
  background: #f5f5f5;
}

.search-result-title {
  font-size: 0.9em;
}

.search-result-section {
  font-size: 0.7em;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Single page */
.post-nav {
  margin-bottom: 2em;
}

.post-nav a {
  font-size: 0.85em;
  color: var(--muted-color);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.post-nav a:hover {
  color: var(--text-color);
}

.post-content h1 {
  font-size: 1.6em;
  margin: 0 0 1.5em 0;
}

.post-content h2 {
  font-size: 1.2em;
  margin: 2em 0 0.8em 0;
}

.post-content h3 {
  font-size: 1em;
  margin: 1.5em 0 0.6em 0;
}

.post-content p {
  line-height: 1.7;
  margin: 0 0 1em 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.9em;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border-color);
  padding: 0.5em 0.8em;
  text-align: left;
}

.post-content th {
  font-weight: 700;
  background: #fafafa;
}

.post-content blockquote {
  border-left: 3px solid var(--border-color);
  margin: 1.5em 0;
  padding: 0.5em 1em;
  color: #555;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content a:hover {
  color: var(--muted-color);
}

.post-content ul,
.post-content ol {
  padding-left: 1.5em;
  line-height: 1.7;
}

.post-content pre {
  background: #f5f5f5;
  padding: 0.8em 1em;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 0.9em;
  margin: 1em 0;
}

.post-content code {
  background: #f5f5f5;
  padding: 0.1em 0.3em;
  border-radius: 2px;
  font-size: 0.9em;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.section-list {
  list-style: none;
  padding: 0;
  margin: 1.5em 0;
}

.section-list li {
  border-bottom: 1px solid var(--border-color);
}

.section-list li a {
  display: block;
  padding: 0.8em 0;
  font-size: 0.95em;
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

.section-list li a:hover {
  color: var(--muted-color);
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 3em 0;
}

@media only screen and (max-width: 600px) {
  .dashboard-container {
    margin-left: 0;
  }

  .dashboard-title {
    font-size: 1.6em;
  }
}
