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

:root {
  --color-accent: #FF9900;
  --color-accent-hover: #e68a00;
  --color-text: #1a1a1a;
  --color-text-muted: #555;
  --color-bg: #fafafa;
  --color-surface: #fff;
  --color-border: #e0e0e0;
  --color-code-bg: #f0f0f0;
  --color-pre-bg: #1a1a1a;
  --color-pre-text: #f0f0f0;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 760px;
  --spacing: 2rem;
}

[data-theme="dark"] {
  --color-text: #e0e0e0;
  --color-text-muted: #a0a0a0;
  --color-bg: #121212;
  --color-surface: #1a1a1a;
  --color-border: #333;
  --color-code-bg: #2a2a2a;
  --color-pre-bg: #0d0d0d;
  --color-pre-text: #e0e0e0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, color 0.3s;
}

/* === Layout === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

main.container {
  flex: 1;
  padding-top: 3rem;
  padding-bottom: 4rem;
}

/* === Header & Nav === */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.nav-brand:hover {
  color: var(--color-accent);
}

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

.nav-links a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
}

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

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.2s;
}

/* === Theme Toggle === */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

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

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* === Typography === */
h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 700;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

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

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

/* === Hero (Homepage) === */
.hero {
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.5rem;
}

.hero .tagline {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.hero .intro {
  font-size: 1rem;
  max-width: 600px;
}

/* === Page header === */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent);
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header .subtitle {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin-bottom: 0;
}

/* === Talks list === */
.talks-year {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.25rem;
}

.talk-item {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--color-border);
}

.talk-item:hover {
  border-left-color: var(--color-accent);
}

.talk-event {
  font-weight: 600;
  font-size: 0.95rem;
}

.talk-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.talk-title {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
}

/* === Blog list === */
.post-list {
  list-style: none;
}

.post-item {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

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

.post-item h2 {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}

.post-item h2 a {
  color: var(--color-text);
}

.post-item h2 a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.post-excerpt {
  font-size: 0.95rem;
}

/* === Blog single === */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  margin-bottom: 0.5rem;
}

.post-content {
  line-height: 1.8;
}

.post-content h2 {
  margin-top: 2rem;
}

.post-content ul, .post-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content code {
  background: var(--color-code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
}

.post-content pre {
  background: var(--color-pre-bg);
  color: var(--color-pre-text);
  padding: 1.2rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

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

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

.post-tags {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.post-tags span {
  display: inline-block;
  background: var(--color-code-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  color: var(--color-text-muted);
}

.post-tags a {
  text-decoration: none;
}

.post-tags a:hover span {
  color: var(--color-accent);
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* === Responsive === */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 0.75rem;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  main.container {
    padding-top: 2rem;
    padding-bottom: 3rem;
  }
}
