:root {
  --bg: #f4efe6;
  --surface: #fbf8f2;
  --ink: #2b241d;
  --muted: #6b5f52;
  --accent: #b85c38;
  --accent-dark: #924326;
  --line: #e3d9c8;
  --focus: #1f6feb;
  --shadow: 0 10px 30px rgba(43,36,29,0.08);
  --radius: 14px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

.site-header {
  padding: 28px 24px 18px;
  max-width: 1200px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 26px; font-weight: 700;
}
.brand h1 {
  margin: 0; font-family: var(--font-serif); font-size: 34px; line-height: 1;
}
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

main { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
input[type="search"], select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
  min-height: 42px;
}
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; font: inherit; min-height: 42px;
  color: var(--ink);
}
.toggle .toggle-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--line);
}
.toggle[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.toggle[aria-pressed="true"] .toggle-dot { background: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.item img {
  width: 100%; height: 200px; object-fit: cover; display: block;
}
.item-info { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.item h3 { margin: 0; font-family: var(--font-serif); font-size: 20px; }
.meta { margin: 0; color: var(--muted); font-size: 13px; }
.desc { margin: 0; font-size: 14px; color: var(--ink); }
.item button[data-testid="open-item"] {
  margin-top: auto; align-self: flex-start;
  padding: 9px 14px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; cursor: pointer; font: inherit;
}

.empty {
  text-align: center; padding: 48px 20px; background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h2 { font-family: var(--font-serif); }
.empty button {
  padding: 10px 16px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; cursor: pointer; font: inherit; margin-top: 8px;
}

dialog {
  border: none; border-radius: 18px; padding: 0;
  max-width: 720px; width: calc(100vw - 32px);
  box-shadow: 0 30px 80px rgba(43,36,29,0.25);
  background: var(--surface);
}
dialog::backdrop { background: rgba(43,36,29,0.45); }
.detail-media img {
  width: 100%; height: 260px; object-fit: cover; display: block;
  border-radius: 18px 18px 0 0;
}
.detail-body { padding: 20px 24px 24px; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.detail-body h2 { margin: 4px 0 8px; font-family: var(--font-serif); font-size: 28px; }
.detail-desc { margin: 0 0 16px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 0 0 18px; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-size: 15px; }
.close-btn {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.5); color: #fff;
  cursor: pointer; font-size: 18px; line-height: 1;
}
.save-btn {
  padding: 11px 18px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; cursor: pointer; font: inherit; font-weight: 600;
}
.save-btn[aria-pressed="true"] { background: var(--accent-dark); }

/* focus */
:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .brand h1 { font-size: 28px; }
}

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