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

:root {
  --text: #2d2d2d;
  --text-light: #666;
  --text-faint: #999;
  --link: #2d2d2d;
  --border: #d6cdb8;
  --bg: #f7f0e0;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---- Two-Column Layout ---- */
.layout {
  display: flex;
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
  gap: 4rem;
}

/* ---- Sidebar (Left Column) ---- */
.sidebar {
  flex-shrink: 0;
  width: 160px;
  position: sticky;
  top: 4rem;
  align-self: flex-start;
}

.name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2rem;
  line-height: 1.3;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.nav-link {
  font-size: 0.95rem;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--text);
}

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

/* ---- Main Content (Right Column) ---- */
.main {
  flex: 1;
  min-width: 0;
}

/* ---- Panels ---- */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* ---- Home / Bio ---- */
.bio p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.bio p:last-child {
  margin-bottom: 0;
}

.bio a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.15s;
}

.bio a:hover {
  text-decoration-color: var(--text);
}

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

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.15s;
}

.social-links a:hover {
  text-decoration-color: var(--text);
}

/* ---- Writing ---- */
.list-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
  margin-top: 2rem;
}

.list-heading:first-child {
  margin-top: 0;
}

.item-list {
  list-style: none;
  margin-bottom: 0.5rem;
}

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

.item-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.item-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  text-decoration: none;
  color: var(--text);
  transition: color 0.15s;
}

.item-list a:hover {
  color: var(--text-light);
}

.item-title {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

.item-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Bookshelf ---- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1.75rem 1.25rem;
}

.book {
  text-align: center;
}

.book img {
  width: 110px;
  height: 165px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s, box-shadow 0.2s;
}

.book:hover img {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.book-fallback {
  display: none;
  width: 110px;
  height: 165px;
  margin: 0 auto;
  border-radius: 3px;
  background: linear-gradient(145deg, #5a5040 0%, #3d3528 100%);
  color: #e8dcc8;
  font-size: 0.7rem;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.75rem;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.book-title {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.5rem;
  line-height: 1.3;
  color: var(--text);
}

.book-author {
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-top: 0.1rem;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .layout {
    flex-direction: column;
    padding: 2.5rem 1.25rem 4rem;
    gap: 2rem;
  }

  .sidebar {
    width: 100%;
    position: static;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }

  .name {
    margin-bottom: 0;
  }

  .nav {
    flex-direction: row;
    gap: 1.25rem;
  }

  .nav-link {
    font-size: 0.85rem;
  }

  .book-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem 0.75rem;
  }

  .book img, .book-fallback {
    width: 95px;
    height: 142px;
  }

  .item-list a {
    flex-direction: column;
    gap: 0.125rem;
  }
}
