/* Karpathy-inspired minimal blog theme */

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

body {
  font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #333;
  background: #fdfdfd;
}

.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 30px;
}

a {
  color: #2a7ae2;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  border-top: 5px solid #333;
  border-bottom: 1px solid #e8e8e8;
  min-height: 56px;
  background-color: #fdfdfd;
}

.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.site-title {
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -1px;
  color: #333;
}

.site-title:hover {
  text-decoration: none;
}

.site-nav .trigger {
  display: flex;
  gap: 20px;
}

.page-link {
  color: #727272;
  font-size: 15px;
}

/* Content */
.page-content {
  padding: 30px 0;
  min-height: calc(100vh - 200px);
}

/* Post list (homepage) */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  margin-bottom: 30px;
}

.post-list h2 {
  font-size: 24px;
  margin: 0;
  font-weight: 400;
}

.post-meta {
  font-size: 14px;
  color: #828282;
}

.post-link {
  color: #333;
}

.post-link:hover {
  color: #2a7ae2;
  text-decoration: none;
}

/* Post page */
.post-header h1 {
  font-size: 36px;
  letter-spacing: -1px;
  line-height: 1.2;
  font-weight: 400;
  margin-bottom: 5px;
}

.post-header .meta {
  font-size: 15px;
  color: #828282;
  margin-bottom: 30px;
}

.post-content {
  margin-top: 20px;
}

.post-content h2 {
  font-size: 26px;
  margin-top: 40px;
  margin-bottom: 15px;
  font-weight: 400;
}

.post-content h3 {
  font-size: 20px;
  margin-top: 30px;
  margin-bottom: 10px;
}

.post-content p {
  margin-bottom: 15px;
}

.post-content ul, .post-content ol {
  margin-bottom: 15px;
  padding-left: 30px;
}

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

.post-content img {
  max-width: 100%;
  display: block;
  margin: 20px auto;
}

.post-content blockquote {
  border-left: 4px solid #e8e8e8;
  padding-left: 20px;
  color: #606060;
  font-style: italic;
  margin: 20px 0;
}

.post-content code {
  background: #f6f6f6;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 14px;
}

.post-content pre {
  background: #f6f6f6;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.post-content pre code {
  padding: 0;
  background: none;
  font-size: 13px;
  line-height: 1.5;
}

/* Image captions */
.imgcap {
  text-align: center;
  margin: 20px 0;
}

.imgcap img {
  margin: 0 auto;
}

.imgcap p {
  font-size: 14px;
  color: #828282;
  margin-top: 5px;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e8e8e8;
  padding: 20px 0;
}

.site-footer p {
  font-size: 14px;
  color: #828282;
  text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
  .wrap {
    padding: 0 15px;
  }

  .post-header h1 {
    font-size: 28px;
  }

  .site-title {
    font-size: 22px;
  }

  .cards { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .stats { flex-wrap: wrap; }
}

/* Portfolio card styles (about page) */

.site-subtitle {
  font-size: 14px;
  color: #828282;
  margin-top: 2px;
}

a.stat {
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

a.stat:hover {
  text-decoration: none;
  transform: translateY(-3px);
}

.stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px 0;
  padding: 20px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  color: #2a7ae2;
}

.stat-label {
  font-size: 13px;
  color: #828282;
  margin-top: 5px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 30px 0;
}

.card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 24px;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.card h2 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 10px;
}

.card p {
  font-size: 14px;
  color: #555;
  margin-bottom: 15px;
}

.card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 15px 0;
}

.card-features li {
  font-size: 13px;
  color: #666;
  padding: 3px 0;
}

.card-features li::before {
  content: "•";
  color: #2a7ae2;
  margin-right: 8px;
}

.card-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  text-decoration: none;
}

.btn:not(.btn-secondary) {
  background: #2a7ae2;
  color: #fff;
}

.btn:not(.btn-secondary):hover {
  background: #1a6ad4;
}

.btn-secondary {
  background: #f6f6f6;
  color: #333;
  border: 1px solid #e8e8e8;
}

.btn-secondary:hover {
  background: #eee;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.feature {
  text-align: center;
  padding: 20px;
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.feature h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.feature p {
  font-size: 13px;
  color: #666;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #f6f6f6;
  border: 1px solid #e8e8e8;
  border-radius: 5px;
  color: #333;
  font-size: 14px;
  transition: all 0.2s;
}

.social-link:hover {
  background: #eee;
  text-decoration: none;
}

/* ========================================
   Dark Mode
   ======================================== */

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid #e8e8e8;
  border-radius: 5px;
  padding: 6px 10px;
  cursor: pointer;
  color: #727272;
  font-size: 14px;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: #f6f6f6;
  color: #333;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --bg-secondary: #16213e;
  --text: #e0e0e0;
  --text-secondary: #a0a0b0;
  --border: #2a2a4a;
  --link: #5da4f0;
  --code-bg: #16213e;
  --card-bg: #16213e;
  --header-border: #5da4f0;
}

[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] a {
  color: var(--link);
}

[data-theme="dark"] .site-header {
  background-color: var(--bg);
  border-top-color: var(--header-border);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .site-title {
  color: var(--text);
}

[data-theme="dark"] .site-subtitle,
[data-theme="dark"] .page-link,
[data-theme="dark"] .post-meta,
[data-theme="dark"] .meta {
  color: var(--text-secondary);
}

[data-theme="dark"] .post-link {
  color: var(--text);
}

[data-theme="dark"] .post-link:hover {
  color: var(--link);
}

[data-theme="dark"] .post-content code {
  background: var(--code-bg);
}

[data-theme="dark"] .post-content pre {
  background: var(--code-bg);
}

[data-theme="dark"] .post-content blockquote {
  border-left-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] .site-footer {
  border-top-color: var(--border);
}

[data-theme="dark"] .site-footer p {
  color: var(--text-secondary);
}

[data-theme="dark"] .theme-toggle {
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] .theme-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* Dark mode: About page components */
[data-theme="dark"] .card {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .card h2 {
  color: var(--text);
}

[data-theme="dark"] .card p,
[data-theme="dark"] .card-features li {
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--bg-secondary);
}

[data-theme="dark"] .stat-value {
  color: var(--link);
}

[data-theme="dark"] .stat-label,
[data-theme="dark"] .feature p {
  color: var(--text-secondary);
}

[data-theme="dark"] .feature h3 {
  color: var(--text);
}

[data-theme="dark"] .social-link {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .social-link:hover {
  background: var(--border);
}

/* ========================================
   Search Overlay
   ======================================== */

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

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

.search-container {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e8e8;
  gap: 12px;
}

.search-input-wrap i {
  color: #828282;
  font-size: 16px;
}

.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: #333;
}

.search-input-wrap kbd {
  font-family: inherit;
  font-size: 12px;
  padding: 2px 6px;
  background: #f6f6f6;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  color: #828282;
}

.search-results {
  overflow-y: auto;
  padding: 8px;
}

.search-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  color: #333;
  text-decoration: none;
  transition: background 0.15s;
}

.search-result:hover {
  background: #f6f6f6;
  text-decoration: none;
}

.search-result-title {
  font-size: 15px;
  font-weight: 500;
}

.search-result-date {
  font-size: 13px;
  color: #828282;
  white-space: nowrap;
  margin-left: 16px;
}

.search-no-results {
  padding: 20px;
  text-align: center;
  color: #828282;
  font-size: 14px;
}

/* Dark mode: Search */
[data-theme="dark"] .search-container {
  background: var(--bg-secondary);
}

[data-theme="dark"] .search-input-wrap {
  border-bottom-color: var(--border);
}

[data-theme="dark"] .search-input-wrap input {
  color: var(--text);
}

[data-theme="dark"] .search-input-wrap kbd {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] .search-result {
  color: var(--text);
}

[data-theme="dark"] .search-result:hover {
  background: var(--bg);
}

[data-theme="dark"] .search-result-date {
  color: var(--text-secondary);
}

/* ========================================
   Tags
   ======================================== */

.tag-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 40px;
}

.tag-list li a {
  display: inline-block;
  padding: 6px 14px;
  background: #f6f6f6;
  border: 1px solid #e8e8e8;
  border-radius: 20px;
  font-size: 14px;
  color: #333;
  transition: all 0.2s;
}

.tag-list li a:hover {
  background: #2a7ae2;
  color: #fff;
  border-color: #2a7ae2;
  text-decoration: none;
}

.tag-section {
  margin-bottom: 40px;
}

.tag-section h2 {
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8e8e8;
}

.post-tags {
  display: inline-flex;
  gap: 6px;
  margin-left: 8px;
}

.post-tag {
  font-size: 12px;
  padding: 2px 8px;
  background: #f0f4ff;
  color: #2a7ae2;
  border-radius: 12px;
}

[data-theme="dark"] .tag-list li a {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .tag-list li a:hover {
  background: var(--link);
  color: #fff;
  border-color: var(--link);
}

[data-theme="dark"] .tag-section h2 {
  border-bottom-color: var(--border);
}

[data-theme="dark"] .post-tag {
  background: var(--bg-secondary);
  color: var(--link);
}
