:root {
  --bg: #f6f2ea;
  --card: #fffdf8;
  --ink: #23201c;
  --muted: #6b6459;
  --line: #ddd5c6;
  --accent: #7d3b2e;
  --accent-soft: #b8785f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- masthead ---------- */

.masthead {
  background: linear-gradient(180deg, #efe7d8, var(--bg));
  border-bottom: 1px solid var(--line);
  padding: 56px 0 40px;
}

.kicker {
  margin: 0 0 10px;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: system-ui, sans-serif;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -.01em;
}

.lede {
  margin: 14px 0 0;
  max-width: 56ch;
  font-size: 1.08rem;
  color: var(--muted);
}

/* ---------- notice ---------- */

.notice {
  margin: 28px 0 0;
  padding: 14px 18px;
  background: #fdf6e3;
  border: 1px solid #e8dcbd;
  border-left: 3px solid var(--accent-soft);
  border-radius: 4px;
  font-size: .9rem;
  color: #5c5346;
  font-family: system-ui, sans-serif;
  line-height: 1.55;
}

.notice code {
  background: #f0e7d2;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .85em;
}

/* ---------- controls ---------- */

.controls { margin: 32px 0 8px; }

#q {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
}

#q:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

select, #reset {
  padding: 9px 12px;
  font: inherit;
  font-size: .9rem;
  font-family: system-ui, sans-serif;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
}

#reset { color: var(--accent); }
#reset:hover { background: #f1e8d8; }

.count {
  margin: 14px 0 0;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

/* ---------- grid ---------- */

.grid {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
  display: flex;
  flex-direction: column;
}

.card:hover, .card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px -12px rgba(60, 45, 30, .35);
  outline: none;
}

.card figure {
  margin: 0;
  background: #f2ebdd;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.card figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-body { padding: 16px 18px 18px; }

.card h3 {
  margin: 0 0 6px;
  font-size: 1.04rem;
  font-weight: 500;
  line-height: 1.35;
}

.card .meta {
  margin: 0;
  font-size: .84rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

.tag {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 9px;
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-family: system-ui, sans-serif;
  color: var(--accent);
  background: #f4e9db;
  border-radius: 99px;
}

.empty { margin: 40px 0; text-align: center; color: var(--muted); }

/* ---------- essay ---------- */

.essay {
  margin: 72px 0 0;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  max-width: 68ch;
}

.essay h2 { font-size: 1.7rem; font-weight: 500; margin: 0 0 4px; }
.essay h3 { font-size: 1.05rem; font-weight: 600; margin: 32px 0 0; color: var(--accent); }
.essay p { margin: 10px 0 0; }

/* ---------- footer ---------- */

.foot {
  margin-top: 72px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  font-size: .84rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

.foot p { margin: 0; }

/* ---------- detail sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(35, 30, 24, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.sheet[hidden] { display: none; }

.sheet-inner {
  position: relative;
  background: var(--card);
  border-radius: 6px;
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}

.sheet-close:hover { color: var(--accent); }

.sheet h2 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 500; }
.sheet .sheet-sub { margin: 0 0 20px; color: var(--muted); font-family: system-ui, sans-serif; font-size: .9rem; }
.sheet .sheet-img {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  background: #f2ebdd;
  margin: 0 0 22px;
  border-radius: 4px;
}

.sheet p.desc { margin: 0 0 20px; }

.prov {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
}

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

.specs { margin: 0; font-size: .92rem; }
.specs div { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.specs dt { flex: 0 0 34%; color: var(--muted); font-family: system-ui, sans-serif; font-size: .86rem; }
.specs dd { margin: 0; flex: 1; }

@media (max-width: 560px) {
  .masthead { padding: 40px 0 30px; }
  .sheet-inner { padding: 24px 20px; }
  .specs div { flex-direction: column; gap: 2px; }
}
