/* Variables */
:root {
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --purple-dark: #5b21b6;
  --bg: #faf8f5;
  --bg-alt: #f3ede6;
  --text: #1c1917;
  --text-muted: #57534e;
  --border: #e7e0d8;
  --max-width: 720px;
}

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

/* Base */
html {
  font-size: 18px;
  line-height: 1.6;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p {
  margin-bottom: 1em;
}

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

a:hover {
  color: var(--purple-dark);
  text-decoration: underline;
}

/* Nav */
header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-name {
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--purple);
  text-decoration: none;
  flex-shrink: 0;
}

.site-name:hover {
  color: var(--purple-dark);
  text-decoration: none;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav ul a {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: var(--text-muted);
}

nav ul a:hover {
  color: var(--purple);
  text-decoration: none;
}

/* Main */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  flex: 1;
  width: 100%;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Page header */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  color: var(--text);
}

/* Project / note listing */
.item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.item-list li {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.item-list li:last-child {
  border-bottom: none;
}

.item-title {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.item-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: system-ui, -apple-system, sans-serif;
  margin-bottom: 0.4rem;
}

.item-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.75rem;
  background: var(--bg-alt);
  color: var(--purple-dark);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15em 0.5em;
  text-decoration: none;
}

.tag:hover {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  text-decoration: none;
}

/* Article content */
.article-body {
  margin-top: 2rem;
}

.article-body p { margin-bottom: 1em; }
.article-body h2 { margin-top: 2em; margin-bottom: 0.5em; }
.article-body h3 { margin-top: 1.5em; margin-bottom: 0.4em; }
.article-body ul, .article-body ol { padding-left: 1.5em; margin-bottom: 1em; }
.article-body li { margin-bottom: 0.25em; }
.article-body code {
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  background: var(--bg-alt);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}
.article-body pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1em;
  overflow-x: auto;
  margin-bottom: 1em;
}
.article-body pre code {
  background: none;
  padding: 0;
}

/* Tag filter bar */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
}

.tag-filter-btn {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.8rem;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.25em 0.65em;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.tag-filter-btn:hover {
  border-color: var(--purple-light);
  color: var(--purple);
}

.tag-filter-btn.active {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}

/* Project card grid */
.project-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 540px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: var(--purple-light);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.1);
}

.project-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.project-card-link:hover {
  text-decoration: none;
}

.project-card-image {
  overflow: hidden;
  background: var(--bg-alt);
}

.project-card-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s;
}

.project-card:hover .project-card-image img {
  transform: scale(1.03);
}

.project-card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--border) 100%);
}

.project-card-body {
  padding: 1rem;
}

.project-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.project-card:hover .project-card-title {
  color: var(--purple);
}

.project-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

/* Project hero image */
.project-hero {
  margin-bottom: 2rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.project-hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* Links page */
.links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.links-list a {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
}

/* Home page recent projects */
.recent-project {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
}

.recent-project:hover {
  text-decoration: none;
}

.recent-project:hover .item-title {
  color: var(--purple);
}

.recent-project-thumb {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
}

.recent-project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recent-project-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--border) 100%);
}

.recent-project-info .item-title {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Home page */
.home-intro {
  margin-bottom: 3rem;
}

.home-intro h1 {
  color: var(--purple);
  margin-bottom: 0.75rem;
}

.featured-header {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
