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

:root {
  --bg: #ffffff;
  --sidebar-bg: #f7f7f7;
  --border: #e4e4e4;
  --text: #1a1a1a;
  --text-muted: #666666;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --accent: #2563eb;
  --sidebar-w: 220px;
  --content-max: 700px;
  --font-sans:
    "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono:
    "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, "Courier New",
    monospace;
  --radius: 4px;
  --transition: 0.15s ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* =========================================================
   Layout – two-column: sidebar | content
   ========================================================= */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  max-width: 960px;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 2rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.75rem;
  line-height: 1.2;
}

.sidebar-name a {
  color: var(--text);
  text-decoration: none;
}

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

.sidebar nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar nav ul li a {
  display: block;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
  transition:
    color var(--transition),
    background var(--transition);
}

.sidebar nav ul li a:hover,
.sidebar nav ul li a.active {
  color: var(--text);
  background: var(--border);
}

.sidebar nav ul li a.active {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Main content ---- */
.main-content {
  flex: 1;
  padding: 1.75rem 2.5rem;
  max-width: var(--content-max);
}

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

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

/* =========================================================
   Mobile nav bar (hidden on desktop)
   ========================================================= */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.mobile-header .site-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Mobile drawer */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
}

.mobile-nav.open {
  display: block;
}

.mobile-nav-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 240px;
  height: 100%;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 2rem 1.25rem;
  overflow-y: auto;
}

.mobile-nav-inner .site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: 1.5rem;
}

.mobile-nav-inner ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.mobile-nav-inner ul li a {
  display: block;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
  transition:
    color var(--transition),
    background var(--transition);
}

.mobile-nav-inner ul li a:hover {
  color: var(--text);
  background: var(--border);
}

.nav-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

/* =========================================================
   Typography
   ========================================================= */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.9rem;
  margin-bottom: 1rem;
  margin-top: 2.5rem;
}

h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  margin-top: 2.5rem;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

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

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

strong {
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #f0f0f0;
  padding: 0.15em 0.35em;
  border-radius: var(--radius);
}

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

/* =========================================================
   Welcome / Bio section
   ========================================================= */
.bio {
  margin-top: 0;
}

.bio p {
  font-size: 1.025rem;
  color: var(--text);
  max-width: 640px;
}

/* =========================================================
   Featured Articles list
   ========================================================= */
.article-list {
  list-style: none;
  margin-bottom: 1rem;
}

.article-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.article-list li:first-child {
  border-top: 1px solid var(--border);
}

.article-list li a {
  font-size: 0.975rem;
  color: var(--link);
  flex: 1;
}

.article-list li a:hover {
  text-decoration: underline;
}

.article-list li .date {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =========================================================
   Talks list
   ========================================================= */
.talks-list {
  list-style: none;
  margin-bottom: 1rem;
}

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

.talks-list li:first-child {
  border-top: 1px solid var(--border);
}

.talk-title a {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--link);
}

.talk-title a:hover {
  text-decoration: underline;
}

.talk-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.talk-meta .event {
  font-style: italic;
}

.talk-meta .collab {
  color: var(--text-muted);
}

.talk-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1em 0.4em;
  border-radius: 2px;
  background: #dbeafe;
  color: #1e40af;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* =========================================================
   "All → " footer links
   ========================================================= */
.see-all {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.5rem;
}

.see-all:hover {
  text-decoration: underline;
}

/* =========================================================
   Blog page – article cards
   ========================================================= */
.posts-list {
  list-style: none;
}

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

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

.post-item .post-title a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.post-item .post-title a:hover {
  color: var(--link);
  text-decoration: underline;
}

.post-item .post-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.post-item .post-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* =========================================================
   Page header / hero (talks, blog pages)
   ========================================================= */
.page-header {
  margin-bottom: 0.25rem;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  padding: 2rem 2.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

/* =========================================================
   Responsive – Tablet / Mobile
   ========================================================= */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .site-wrapper {
    flex-direction: column;
  }

  .main-content {
    padding: 1.75rem 1.25rem;
    max-width: 100%;
  }

  h1 {
    font-size: 1.55rem;
  }
  h2 {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 1.25rem 1rem;
  }

  h1 {
    font-size: 1.35rem;
  }
}
