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

/* Base */
:root {
  --text: #111;
  --text-secondary: #555;
  --bg: #fff;
  --border: #e0e0e0;
  --accent: #111;
  --tag-bg: #f5f5f5;
}

html {
  font-size: 17px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

img {
  max-width: 100%;
  height: auto;
}

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

h1, h2, h3 {
  letter-spacing: -0.03em;
  line-height: 1.3;
}

a:hover {
  text-decoration: underline;
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.nav-home {
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
}

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

.lang-switcher {
  position: relative;
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
}

.lang-current {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}

.lang-current:hover {
  color: var(--text);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 7rem;
  padding: 0.35rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 100;
}

.lang-dropdown.open {
  display: block;
}

.lang-option {
  display: block;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

a.lang-option:hover {
  color: var(--text);
  background: var(--tag-bg);
  text-decoration: none;
}

.lang-option.active {
  color: var(--text);
  font-weight: 500;
}

/* Homepage */
.home {
  padding: 4rem 0;
}

.home h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.intro {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.home-links {
  margin-top: 2rem;
  display: flex;
  gap: 1.5rem;
}

.home-links a {
  font-weight: 500;
}

/* Recent sections */
.recent {
  margin-top: 3rem;
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
}

.recent-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.recent-header a {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.recent-header a:hover {
  color: var(--text);
}

.recent .list-item {
  margin-bottom: 1.25rem;
}

.recent .list-item h3 {
  font-size: 1rem;
}

.recent .project-card h3 {
  font-size: 1rem;
}

/* List pages */
.list-item {
  margin-bottom: 2rem;
}

.list-item h2 {
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
}

.list-item p {
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.list-item time {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.list-item-header time {
  white-space: nowrap;
}

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

.tag {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  background: var(--tag-bg);
  border-radius: 3px;
  color: var(--text-secondary);
}

.tag:hover,
.tag.active {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
}

/* Books */
.books-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.book-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s;
}

.book-card:hover {
  border-color: var(--accent);
}

.book-card h2,
.book-card h3 {
  font-size: 1.05rem;
  margin: 0;
}

.book-author {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.book-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
}

.recent .book-card h3 {
  font-size: 1rem;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-card h2 {
  font-size: 1.05rem;
  margin: 0;
}

.project-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
}

.status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: lowercase;
}

/* Single post */
article header {
  margin-bottom: 2rem;
}

article header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

article header time {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.content {
  overflow-wrap: break-word;
}

.content h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

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

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

.content code {
  font-size: 0.9em;
  background: var(--tag-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Responsive — Tablet */
@media (max-width: 768px) {
  body {
    padding: 1.5rem 1.25rem;
  }

  nav {
    margin-bottom: 2.5rem;
  }

  .home {
    padding: 3rem 0;
  }

  .home h1 {
    font-size: 1.75rem;
  }

  article header h1 {
    font-size: 1.5rem;
  }
}

/* Responsive — Mobile */
@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 1.25rem 1rem;
  }

  nav {
    margin-bottom: 2rem;
  }

  .home {
    padding: 2rem 0;
  }

  .home h1 {
    font-size: 1.5rem;
  }

  .intro {
    font-size: 1rem;
  }

  .list-item-header {
    flex-direction: column;
    gap: 0;
  }

  .projects-grid,
  .books-grid {
    grid-template-columns: 1fr;
  }

  article header h1 {
    font-size: 1.35rem;
  }

  .content h2 {
    font-size: 1.15rem;
  }

  .tag {
    padding: 0.35rem 0.7rem;
  }

  footer {
    margin-top: 3rem;
  }
}
