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

:root {
  --text: #222;
  --muted: #666;
  --border: #ddd;
  --bg: #fff;
  --sidebar-bg: #f8f8f8;
  --link: #2a5db0;
  --link-hover: #1a3d7a;
  --max-width: 960px;
  --sidebar-width: 220px;
}

html {
  font-size: 16px;
  line-height: 1.6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

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

/* ── Header / Nav ── */

header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

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

nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--muted);
  font-size: 0.9rem;
}

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

nav a.active {
  color: var(--text);
  font-weight: 500;
}

/* ── Layout ── */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 2.5rem;
  align-items: start;
}

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

/* ── Sidebar ── */

.sidebar {
  position: sticky;
  top: 1.5rem;
}

.profile-photo {
  width: 100%;
  max-width: 180px;
  border-radius: 4px;
  display: block;
  margin-bottom: 1rem;
}

.profile-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-bio {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.profile-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.profile-meta span {
  display: block;
  margin-bottom: 0.2rem;
}

.profile-links {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.profile-links a {
  font-size: 0.82rem;
  color: var(--muted);
}

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

/* ── Main content ── */

.content h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.25rem;
}

.content p {
  margin-bottom: 1rem;
}

.content ul, .content ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

.content li {
  margin-bottom: 0.25rem;
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: #f4f4f4;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.content pre {
  background: #f4f4f4;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.content strong {
  font-weight: 600;
}

.content em {
  font-style: italic;
}

.content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1rem 0;
}

/* ── CV specific ── */

.cv-section {
  margin-bottom: 0.25rem;
}

.cv-entry {
  margin-bottom: 1.25rem;
}

.cv-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.cv-entry-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.cv-entry-date {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.cv-entry-org {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.cv-entry-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.cv-download {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Blog listing ── */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

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

.post-date {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.post-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.post-excerpt {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ── Individual post ── */

.post-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ── Portfolio listing ── */

.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

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

.project-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── Publications ── */

.pub-entry {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.pub-entry:last-child {
  border-bottom: none;
}

.pub-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.pub-venue {
  font-size: 0.85rem;
  color: var(--muted);
}

.pub-links {
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

/* ── Footer ── */

footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

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