/* MacWright-inspired Minimal Stylesheet */

/* CSS Custom Properties for Light Theme (default) */
:root {
  --bg-color: #fff;
  --text-color: #000;
  --text-secondary: #666;
  --text-tertiary: #333;
  --border-color: #ccc;
  --border-light: #eee;
  --link-color: #000;
}

/* Dark Theme Variables */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #999;
    --text-tertiary: #ccc;
    --border-color: #444;
    --border-light: #333;
    --link-color: #e0e0e0;
  }
}

/* Manual Light Mode Class (explicit override) */
.light-mode {
  --bg-color: #fff;
  --text-color: #000;
  --text-secondary: #666;
  --text-tertiary: #333;
  --border-color: #ccc;
  --border-light: #eee;
  --link-color: #000;
}

/* Manual Dark Mode Class */
.dark-mode {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --text-secondary: #999;
  --text-tertiary: #ccc;
  --border-color: #444;
  --border-light: #333;
  --link-color: #e0e0e0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  padding: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Container for sidebar + main content */
.container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  gap: 60px;
}

/* Sidebar (desktop) */
.sidebar {
  flex: 0 0 200px;
  min-width: 200px;
}

.sidebar-header {
  display: block;
}

.site-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
  text-decoration: none;
}

.dark-mode-toggle-mobile {
  display: none !important;
}

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

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 12px;
}

.sidebar-nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 16px;
}

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

.sidebar-nav li.active a {
  font-weight: bold;
}

.sidebar-nav li.active a::after {
  content: ' •';
  margin-left: 4px;
}

/* Main content area */
.main-content {
  flex: 1;
  min-width: 0;
  padding-top: 0;
}

.main-content > h1:first-child {
  margin-top: 0;
}

h1 {
  font-size: 24px;
  margin-top: 0;
  margin-bottom: 0px;
  font-weight: normal;
}

h2 {
  font-size: 20px;
  margin-top: 30px;
  margin-bottom: 15px;
  font-weight: normal;
}

h3 {
  font-size: 18px;
  margin-top: 25px;
  margin-bottom: 12px;
  font-weight: normal;
}

p {
  margin-bottom: 15px;
}

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

a:visited {
  color: var(--link-color);
}

a:hover {
  color: var(--link-color);
}

/* Dark mode toggle in sidebar */
.sidebar-nav .dark-mode-toggle-item {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: list-item;
}

.dark-mode-toggle-button {
  background: none;
  border: none;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dark-mode-toggle-button:hover {
  color: var(--text-color);
  text-decoration: underline;
}

.dark-mode-icon svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.dark-mode-icon-mobile svg {
  width: 20px;
  height: 20px;
}

/* Ensure SVGs render correctly */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

svg path {
  stroke: currentColor;
}

/* Sidebar nav is visible, old nav styles removed */
.sidebar nav {
  display: block;
}

footer {
  margin-top: 50px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text-color);
}

.blog-list {
  list-style: none;
  margin: 20px 0;
}

.blog-list li {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.blog-list h2 {
  margin-top: 0;
  margin-bottom: 5px;
}

.blog-list h2 a {
  text-decoration: none;
}

.blog-list .date {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 10px;
}

.read-more {
  margin-top: 10px;
}

.read-more a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-color);
}

.read-more a:hover {
  text-decoration: underline;
}

.read-more .arrow-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.projects-list {
  list-style: none;
  margin: 20px 0;
}

.projects-list li {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-light);
}

.projects-list h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.projects-list p {
  margin-bottom: 5px;
}

.post-content ul {
  margin: 15px 0;
  padding-left: 30px;
}

.post-content ul li {
  margin-bottom: 8px;
}

.post-content h2 {
  margin-top: 30px;
}

.post-content h3 {
  margin-top: 25px;
}

.date {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 15px;
}

/* Reading list styles - MacWright style */
.reading-list {
  list-style: none;
  margin: 20px 0;
  padding: 0;
}

.reading-list li {
  padding-bottom: 12px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-color);
}

.book-title {
  font-size: 18px;
  text-decoration: none;
  font-weight: bold;
  margin-bottom: 2px;
  line-height: 1.4;
}

.book-author {
  font-size: 16px;
  margin-bottom: 2px;
  line-height: 1.4;
}

.read-date {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-family: monospace;
  line-height: 1.4;
}

.rating {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 0;
  line-height: 1.4;
}

.book-thoughts {
  color: var(--text-tertiary);
  margin-top: 0px;
  font-size: 14px;
  line-height: 1.6;
}

.book-thoughts p {
  margin-bottom: 8px;
}

/* Desktop: Horizontal layout for reading list */
@media (min-width: 769px) {
  .reading-list li {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr auto;
    column-gap: 20px;
    row-gap: 8px;
    align-items: start;
    margin-bottom: 12px;
  }

  .reading-list li:has(.book-thoughts) {
    grid-template-rows: auto auto;
  }

  .book-title {
    margin-bottom: 0;
  }

  .book-author {
    margin-bottom: 0;
  }

  .read-date {
    margin-bottom: 0;
  }

  .rating {
    text-align: right;
    margin-bottom: 0;
  }

  .book-thoughts {
    grid-column: 1 / -1;
  }
}

/* Mobile: Sidebar becomes header */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 20px 15px;
    gap: 15px;
  }

  .sidebar {
    flex: none;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    margin-bottom: 10px;
  }

  .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
  }

  .site-title {
    margin-bottom: 0;
  }

  .dark-mode-toggle-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 4px;
  }

  .dark-mode-toggle-mobile .dark-mode-text {
    display: none;
  }

  .dark-mode-toggle-mobile:hover {
    text-decoration: none;
  }

  .dark-mode-toggle-item {
    display: none !important;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
  }

  .sidebar-nav li {
    margin-bottom: 0;
  }

  body {
    font-size: 15px;
  }

  h1 {
    font-size: 22px;
  }

  .main-content > h1:first-child {
    display: none;
  }

  h2 {
    font-size: 18px;
  }

  h3 {
    font-size: 16px;
  }
}
