:root {
  --bg: #f7f3ec;
  --ink: #1d1a16;
  --muted: #6b6258;
  --accent: #7a1f1f;
  --card: #fff;
  --line: #e5dccc;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
header {
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
header h1 { margin: 0; font-size: 2.4rem; letter-spacing: 0.5px; color: var(--accent); }
.tagline { margin: 0.4rem 0 0; color: var(--muted); font-style: italic; }

.tabs {
  display: flex; gap: 0.5rem; justify-content: center;
  padding: 1rem; border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky; top: 0; z-index: 5;
}
.tab {
  background: transparent; border: 1px solid var(--line);
  font: inherit; padding: 0.5rem 1rem; cursor: pointer;
  border-radius: 4px;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.view { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; align-items: center; }
.controls input[type=search] {
  flex: 1 1 240px; min-width: 0;
  font: inherit; padding: 0.55rem 0.75rem;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
.filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.filter {
  background: #fff; border: 1px solid var(--line);
  padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer;
  font-size: 0.9rem;
}
.filter.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  overflow: hidden; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #eee; }
.card .meta { padding: 0.6rem 0.75rem 0.8rem; }
.card .name { font-weight: bold; font-size: 1rem; margin: 0 0 0.15rem; }
.card .cat { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

dialog#modal {
  border: none; border-radius: 6px; padding: 0; max-width: 900px; width: 92vw;
  background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
dialog#modal::backdrop { background: rgba(0,0,0,0.6); }
.modal-body { padding: 1.25rem 1.5rem 1.5rem; }
.modal-body img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto 1rem; }
.modal-body h2 { margin: 0 0 0.25rem; color: var(--accent); }
.modal-body .cat { color: var(--muted); margin-bottom: 1rem; }
.modal-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1rem; }
.modal-body dt { color: var(--muted); }
.modal-body .notes { white-space: pre-wrap; }
.close {
  position: absolute; top: 0.5rem; right: 0.75rem;
  background: transparent; border: none; font-size: 1.8rem; cursor: pointer; line-height: 1;
  color: var(--muted);
}

footer { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: 0.85rem; }
