@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4efe6;
  --bg-2: #ebe3d6;
  --ink: #1f1a14;
  --muted: #5a5044;
  --accent: #b84a2e;
  --accent-2: #2e5a4f;
  --line: #d9cfbe;
  --card: #fbf7f0;
  --shadow: 0 8px 24px rgba(31,26,20,.08);
  --radius: 14px;
  --focus: #1f1a14;
}

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

.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 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7f2e9, var(--bg));
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 1rem; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: "DM Serif Display", serif; font-size: 1.4rem;
}
.brand-title {
  font-family: "DM Serif Display", serif;
  margin: 0; font-size: 1.6rem; line-height: 1.1;
}
.brand-sub { margin: 0; color: var(--muted); font-size: .85rem; }
.site-nav { display: flex; gap: .5rem; }
.nav-chip {
  border: 1px solid var(--line); background: var(--card);
  padding: .4rem .9rem; border-radius: 999px; cursor: pointer;
  font: inherit; color: var(--ink);
}
.nav-chip:hover { background: var(--bg-2); }

.layout { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.intro h2 {
  font-family: "DM Serif Display", serif;
  font-size: 2.4rem; margin: 0 0 .5rem; line-height: 1.1;
}
.intro p { color: var(--muted); max-width: 60ch; margin: 0 0 2rem; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: end;
  padding: 1.25rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 2rem;
}
.field { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 220px; }
.field-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.field input, .field select {
  padding: .7rem .9rem; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.toggle {
  padding: .7rem 1.1rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); cursor: pointer;
  font: inherit; color: var(--ink); white-space: nowrap;
}
.toggle[aria-pressed="true"] { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }

.list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem;
  display: flex; flex-direction: column; gap: .75rem;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.item:hover { transform: translateY(-2px); }
.item-meta {
  display: flex; flex-wrap: wrap; gap: .4rem .8rem;
  font-size: .8rem; color: var(--muted); font-family: "IBM Plex Mono", monospace;
}
.pill {
  display: inline-block; padding: .15rem .55rem;
  background: var(--bg-2); border-radius: 999px; font-size: .75rem;
}
.item-title {
  font-family: "DM Serif Display", serif;
  font-size: 1.35rem; margin: 0; line-height: 1.2;
}
.item-summary { margin: 0; color: var(--muted); }
.item-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price { font-weight: 600; }
.open-item {
  padding: .55rem 1rem; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; cursor: pointer; font: inherit;
}
.open-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty-state button {
  margin-top: 1rem; padding: .6rem 1.2rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font: inherit;
}

.detail-dialog {
  border: none; padding: 0; border-radius: 18px;
  max-width: 640px; width: calc(100vw - 2rem);
  background: var(--card); box-shadow: 0 24px 60px rgba(31,26,20,.25);
}
.detail-dialog::backdrop { background: rgba(31,26,20,.45); }
.detail {
  padding: 1.75rem; display: flex; flex-direction: column; gap: 1rem;
}
.detail-title {
  font-family: "DM Serif Display", serif; font-size: 1.9rem;
  margin: 0; line-height: 1.15;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: .4rem .8rem; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: .8rem; }
.detail-body { margin: 0; white-space: pre-line; }
.detail-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: .5rem; }
.save-item {
  padding: .6rem 1.2rem; border: 1px solid var(--accent-2);
  border-radius: 10px; background: var(--accent-2); color: #fff;
  cursor: pointer; font: inherit;
}
.save-item[aria-pressed="false"] { background: var(--card); color: var(--accent-2); }
.close-detail {
  padding: .6rem 1.2rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); cursor: pointer; font: inherit;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .item { transition: none; }
  .item:hover { transform: none; }
}

@media (max-width: 600px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .intro h2 { font-size: 1.9rem; }
  .layout { padding: 1.25rem 1rem 3rem; }
}
