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

:root {
  /* Colors */
  --bg: #f5f2eb;
  --fg: #1a1a1a;
  --muted: #7D4E57;
  --border: #c8c2b4;
  --accent: #727d71;
  
  /* Typography */
  --serif: 'IBM Plex Serif', Georgia, serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --text-base: 15px;
  --text-sm: 0.9rem;
  --text-xs: 0.72rem;
  
  /* Spacing */
  --space-xs: 0.3rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.4rem;
  --space-xl: 1.8rem;
  --space-2xl: 2rem;
  --space-3xl: 2.5rem;
  
  /* Layout */
  --sidebar-w: 250px;
  --content-max-w: 840px;
  --atoms-max-w: 550px;
  --mosaic-col-w: 150px;
  
  /* Timing */
  --trans-fast: 0.15s;
  --trans-smooth: 0.2s;
}

[data-theme="dark"] {
  --bg: #151510;
  --fg: #ddd8cc;
  --muted: #888;
  --border: #2e2e26;
  --accent: #7aad7a;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: var(--text-base);
  line-height: 1.6;
  transition: background var(--trans-smooth), color var(--trans-smooth);
}

/* ── Images ── */
img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  padding: var(--space-md) 0;
}

/* ── Layout ── */
.container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2xl) 0;
}

.main-content > * {
  max-width: var(--content-max-w);
  margin: 0 auto;
  padding: 0 var(--space-2xl);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  overflow-y: auto;
  padding: var(--space-2xl) var(--space-lg);
  border-left: 2px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
}

/* ── Sidebar ── */
.site-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-xl);
  color: var(--accent);
}

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

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

.sidebar-nav ul li {
  margin-bottom: var(--space-sm);
}

.sidebar-nav ul li a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color var(--trans-fast);
}

.sidebar-nav ul li a:hover {
  color: var(--accent);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-xs);
  color: var(--muted);
  background: none;
  border: none;
  transition: color var(--trans-fast);
}

.theme-toggle:hover { 
  color: var(--accent); 
}

/* ── Content blocks ── */
.content-block {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--border);
}

.content-block:last-child {
  border-bottom: none;
}

.content-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.content-header h1,
.content-header h2,
.content-header h3 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

.content-header h1 {
  font-size: 1.8rem;
}

.content-header h2 {
  font-size: 1.4rem;
}

.content-header h3 {
  font-size: 1.2rem;
}

.content-date {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.content-body {
  font-size: var(--text-sm);
}

.content-body p {
  margin-bottom: var(--space-md);
}

.content-body a {
  color: var(--accent);
  text-decoration: underline;
  transition: color var(--trans-fast);
}

.content-body a:hover {
  color: var(--fg);
}

.content-body img {
  margin: var(--space-lg) 0;
}

.content-body h2 {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: var(--space-2xl) 0 var(--space-md);
}

.content-body h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: var(--space-lg) 0 var(--space-sm);
}

/* ── Post ── */
.post {
  display: block;
}

.post-header {
  display: block;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.post-header h2 {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.post-date {
  font-family: var(--mono);
  font-size: var(--text-base);
  color: var(--muted);
}

.post-content {
  font-size: var(--text-base);
}

.post-content p {
  margin-bottom: var(--space-sm);
  line-height: 1.7;
}

.post-content h2 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.post-content h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.post-content ul,
.post-content ol {
  margin-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

.post-content li {
  margin-bottom: var(--space-xs);
  line-height: 1.6;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--muted);
  font-style: italic;
}

.post-content code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--border);
  padding: 0.2em 0.4em;
  border-radius: 2px;
}

.post-content pre {
  background: var(--border);
  padding: var(--space-md);
  border-radius: 2px;
  overflow-x: auto;
  margin: var(--space-md) 0;
}

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

.post-content img {
  max-width: 100%;
  height: auto;
  margin: var(--space-sm) 0;
  border-radius: 2px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  transition: color var(--trans-fast);
}

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

/* ── Home page ── */
.home h1 {
  font-family: var(--serif);
  color: var(--accent);
  text-align: center;
  font-size: 5rem;
  font-weight: 600;
  margin-bottom: var(--space-2xl);
}

.section-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: var(--space-lg);
}

.posts-list,
.project-posts-list {
  list-style: none;
}

.post-item {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-right: 2px solid var(--border);
  border-left: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.post-item:first-child {
  border-top: 2px solid var(--border);
}
.post-item:last-child {
  border-bottom: 2px solid var(--border);
}

.post-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
}

.post-preview-title {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--trans-fast);
}

.post-preview-title:hover {
  color: var(--accent);
}

.post-preview-content {
  font-size: var(--text-base);
  color: var(--fg);
  margin: var(--space-md);
}

.post-preview-content img {
  margin: var(--space-md) 0;
}

.post-preview-content a {
  color: var(--accent);
}

.read-more {
  font-family: var(--mono);
  font-size: var(--text-base);
  color: var(--accent);
  padding-top: 1rem;
  text-decoration: none;
  transition: text-decoration var(--trans-fast);
}

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

/* ── Project pages ── */
.project-intro {
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.project-feed,
.project-map {
  margin-bottom: var(--space-3xl);
}

.project-posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.project-posts-list li {
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

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

.project-posts-list li a {
  color: var(--fg);
  font-size: var(--text-base);
  transition: color var(--trans-fast);
}

.project-posts-list li a:hover {
  color: var(--accent);
}

/* ── Atoms ── */
.atoms-intro h1{
  color: var(--accent);
}

.atoms-feed {
  max-width: var(--atoms-max-w);
  margin: 0 auto;
  padding: var(--space-lg);
}

.atom {
  padding: var(--space-md);
  background: var(--border);
  border: 1px solid var(--accent);
  border-radius: 5px;
  transform: translateX(var(--offset-x, 0)) translateY(var(--offset-y, 0));
}

.atom-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.atom-date {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.atom-content {
  font-size: var(--text-base);
  line-height: 1.6;
}

.atom-content a {
  color: var(--accent);
  text-decoration: underline;
  transition: color var(--trans-fast);
}

.atom-content a:hover {
  color: var(--fg);
}

/* ── Mosaic ── */
.mosaic-grid {
  column-count: 4;
  column-width: clamp(150px, 20vw, 200px);
  column-gap: 8px;
  margin-bottom: 2rem;
}

.mosaic-item {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  cursor: pointer;
  background: var(--border);
  margin-bottom: 8px;
  break-inside: avoid;
  display: block;
}

.mosaic-image {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.2s;
}
/* ── Overlay ── */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  padding: 20px;
  overflow: auto;
}

.overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.overlay-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin-bottom: 20px;
}

.overlay-text {
  color: var(--fg);
  background: var(--bg);
  padding: 20px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.overlay-title {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.overlay-description {
  font-size: var(--text-sm);
  line-height: 1.6;
}

.close-overlay {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans-smooth);
}

.close-overlay:hover {
  background: rgba(255,255,255,0.4);
}

/* ── Scrollbar ── */
.main-content::-webkit-scrollbar {
  width: 5px;
}

.main-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}