:root {
  --bg: #fbfaf7;
  --text: #2b2a26;
  --muted: #6b6a63;
  --accent: #3f6b3f;
  --accent-light: #e8efe4;
  --border: #ddd8cc;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.site-header {
  background: var(--accent);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.site-header h1 a {
  color: #fff;
  text-decoration: none;
}

.site-header nav a {
  color: #eef4ea;
  text-decoration: none;
  margin-left: 1.25rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.site-header nav a:first-child { margin-left: 0; }

.site-header nav a.active,
.site-header nav a:hover {
  border-bottom-color: #fff;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h1, h2, h3, h4 {
  color: #23331f;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; margin-top: 2.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.15rem; margin-top: 1.75rem; }

a { color: var(--accent); }

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

blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0 2rem;
  font-size: 0.92rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
  vertical-align: top;
  text-align: left;
}

th {
  background: var(--accent-light);
}

code {
  background: var(--accent-light);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

li.todo {
  list-style: none;
  margin-left: -1.4rem;
}

li.todo.done {
  color: var(--muted);
  text-decoration: line-through;
}

/* Photo galleries (diary entries) */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.gallery figcaption {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.2rem;
}

.thumb-link {
  text-decoration: none;
  color: inherit;
  cursor: zoom-in;
}

/* Lightbox (click-through photo viewer) */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-caption {
  color: #fff;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.4rem 0.9rem;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: #ccc;
}

.lightbox-close {
  top: 0.5rem;
  right: 0.5rem;
}

.lightbox-prev {
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Inline thumbnails inside inventory tables */
.thumb-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.thumb-inline {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem;
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.book-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.book-card h2 {
  margin-top: 0;
  margin-bottom: 0.2rem;
  font-size: 1.15rem;
}

.book-card h2 a {
  text-decoration: none;
}

.book-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

.book-card.queued {
  opacity: 0.75;
}

.book-card.queued h2 {
  color: var(--muted);
}
