:root {
  --bg: #f4efe7;
  --surface: #fbf8f2;
  --ink: #2b241d;
  --muted: #6b5f52;
  --accent: #8a4b2f;
  --accent-2: #3f5a4a;
  --border: #d9cfbf;
  --focus: #1f4b8f;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(43,36,29,.08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.site-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: .9rem; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 1.4rem; font-weight: 700;
}
.brand-name { margin: 0; font-size: 1.9rem; letter-spacing: .02em; }
.brand-tag { margin: 0; color: var(--muted); font-size: .95rem; }

.main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: .75rem;
  align-items: end;
  margin-bottom: 1rem;
}
@media (max-width: 700px) {
  .toolbar { grid-template-columns: 1fr; }
}

.search-wrap, .filter-wrap { display: flex; flex-direction: column; gap: .35rem; }
label { font-size: .85rem; color: var(--muted); }

input[type="search"], select {
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  touch-action: manipulation;
}
input[type="search"]:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.toggle {
  padding: .65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  white-space: nowrap;
}
.toggle[aria-pressed="true"] {
  background: var(--accent-2); color: #fff; border-color: var(--accent-2);
}

.results-count { color: var(--muted); font-size: .9rem; margin: .25rem 0 1rem; }

.list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
@media (max-width: 500px) {
  .list { grid-template-columns: 1fr; }
}

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.item img {
  width: 100%; height: 200px; object-fit: cover; display: block;
}
.item-body { padding: 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.item-title { margin: 0; font-size: 1.25rem; }
.item-meta { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
.item-desc { color: var(--ink); font-size: .95rem; }
.item-actions { margin-top: auto; padding-top: .5rem; }

.open-item {
  width: 100%;
  padding: .6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}
.open-item:hover { background: var(--accent); color: #fff; }

.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--muted);
}
.empty-state button {
  margin-top: 1rem; padding: .6rem 1.2rem; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; min-height: 44px;
}

/* dialog */
.detail-dialog {
  border: none; padding: 0; background: transparent;
  max-width: 90vw; width: 720px;
}
.detail-dialog::backdrop {
  background: rgba(43,36,29,.45);
}
.detail {
  background: var(--surface);
  border-radius: 18px;
  padding: 1.25rem;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(43,36,29,.25);
}
.detail[hidden] { display: none; }
.detail img { width: 100%; height: 260px; object-fit: cover; border-radius: 12px; display: block; }
.detail h2 { margin: .5rem 0 .25rem; font-size: 1.6rem; }
.detail .meta { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.detail .body { font-size: 1.05rem; }
.detail .actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.save-item, .close-detail {
  padding: .65rem 1.1rem; border-radius: 10px; cursor: pointer; min-height: 44px;
  touch-action: manipulation;
}
.save-item { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.save-item[aria-pressed="true"] { background: var(--accent-2); border-color: var(--accent-2); }
.close-detail { background: #fff; color: var(--ink); border: 1px solid var(--border); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 420px) {
  .detail-dialog { width: 96vw; }
}
