:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #1a1a1a;
  --border: #e5e5e0;
  --max-width: 640px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
}

/* Dark theme: applied via data-theme="dark" (set by JS based on saved
   preference or system preference) */
[data-theme="dark"] {
  --bg: #111111;
  --fg: #ededed;
  --muted: #9a9a9a;
  --accent: #ededed;
  --border: #2a2a2a;
}

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.15s ease;
}

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

/* Nav */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.75rem 1.5rem;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

.nav-logo {
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

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

.nav-links a:hover {
  color: var(--fg);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.theme-toggle-icon {
  font-size: 0.95rem;
}

/* Container */
.container {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Hero */
.hero {
  padding: 3rem 0 4rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.tagline {
  color: var(--muted);
  font-size: 1.05rem;
}

/* Sections */
.section {
  padding: 2.25rem 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: lowercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

/* About prose */
.prose {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.65;
  margin-bottom: 1rem;
}

.prose a.inline {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Work list */
.work-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.work-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
}

.work-name {
  font-weight: 500;
  font-size: 1rem;
}

.work-desc {
  color: var(--muted);
  font-size: 0.95rem;
}

.work-item:hover .work-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Books two-column layout */
.books-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.books-col-title {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: lowercase;
  color: var(--muted);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

/* Book list */
.book-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.book-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
}

.book-cover {
  flex-shrink: 0;
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--border);
  transition: opacity 0.15s ease;
}

.book-item:hover .book-cover {
  opacity: 0.85;
}

.book-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-top: 0.1rem;
}

.book-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
}

.book-author {
  color: var(--muted);
  font-size: 0.9rem;
}

.book-item:hover .book-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Content list */
.content-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.content-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
}

.content-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.content-name {
  font-weight: 500;
  font-size: 1rem;
}

.content-desc {
  color: var(--muted);
  font-size: 0.95rem;
}

.content-item:hover .content-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Links */
.links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.links a {
  text-decoration: none;
  font-size: 1rem;
}

.links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Footer */
.footer {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Mobile */
@media (max-width: 480px) {
  html {
    font-size: 16px;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .nav {
    padding: 1.25rem 1.25rem;
  }
  .container {
    padding: 1.5rem 1.25rem 3rem;
  }
  .books-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}
