/* "Brugt er godt" — warm, restrained Danish-design look.
   Palette: cream paper, warm ink, clay/terracotta accent, dusty sage. */

:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #2c2723;
  --ink-soft: #6b6259;
  --line: #e4dccd;
  --clay: #b45f3c;
  --clay-dark: #9a4e30;
  --sage: #7f8c6c;
  --sage-soft: #eef0e6;
  --gold: #c9a24b;
  --shadow: 0 6px 20px rgba(52, 42, 30, .08);
  --shadow-lg: 0 18px 50px rgba(52, 42, 30, .18);
  --radius: 16px;
  --maxw: 1120px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--clay-dark); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 241, 231, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .mark { width: 34px; height: 34px; flex: 0 0 auto; color: var(--clay); }
.brand .word { font-family: var(--serif); font-weight: 600; font-size: 1.42rem; letter-spacing: .2px; }
.brand .word em { font-style: italic; color: var(--clay); }
.topbar .admin-link {
  font-size: .82rem; color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px;
  background: var(--card);
}
.topbar .admin-link:hover { border-color: var(--clay); color: var(--clay-dark); }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto; padding: 30px 18px 8px;
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: center;
}
.hero h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 4.6vw, 2.9rem);
  line-height: 1.08; margin: 0 0 10px;
}
.hero h1 em { font-style: italic; color: var(--clay); }
.hero p { margin: 0; color: var(--ink-soft); font-size: 1.02rem; max-width: 46ch; }
.hero-art { display: flex; gap: 14px; justify-content: center; color: var(--sage); }
.hero-art svg { width: 74px; height: 100px; opacity: .9; }
.hero-art svg:nth-child(2) { color: var(--clay); align-self: flex-end; }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding-top: 22px; }
  .hero-art { justify-content: flex-start; }
  .hero-art svg { width: 56px; height: 78px; }
}

/* ---------- Controls (search + filters) ---------- */
.controls {
  max-width: var(--maxw); margin: 18px auto 6px; padding: 0 18px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.search {
  flex: 1 1 240px; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px; box-shadow: var(--shadow);
}
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 1rem; color: var(--ink); }
.search svg { width: 18px; height: 18px; color: var(--ink-soft); flex: 0 0 auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px; font-size: .9rem; white-space: nowrap;
}
.chip.active { background: var(--clay); border-color: var(--clay); color: #fff; }

/* ---------- Grid ---------- */
.grid {
  max-width: var(--maxw); margin: 16px auto 120px; padding: 0 18px;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .thumb {
  aspect-ratio: 4 / 3; background: var(--sage-soft) center/cover no-repeat;
  cursor: pointer; position: relative; display: flex; align-items: center; justify-content: center;
}
.card .thumb .ph { color: var(--sage); width: 46px; height: 46px; opacity: .55; }
.card .badge {
  position: absolute; top: 10px; left: 10px; font-size: .72rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; letter-spacing: .3px; text-transform: uppercase;
}
.badge.reserved { background: var(--gold); color: #3a2c07; }
.badge.sold { background: #6d635a; color: #fff; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-family: var(--serif); font-weight: 600; font-size: 1.06rem; cursor: pointer; }
.card .cat { font-size: .78rem; color: var(--sage); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.card .price { font-weight: 700; font-size: 1.1rem; margin-top: 2px; }
.card .price .byd { color: var(--sage); font-weight: 600; font-size: .95rem; }
.card .row { margin-top: auto; padding-top: 10px; }
.btn-add {
  width: 100%; border: 1px solid var(--clay); color: var(--clay-dark); background: transparent;
  padding: 9px; border-radius: 10px; font-weight: 600; font-size: .92rem;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-add:hover { background: var(--clay); color: #fff; }
.btn-add.in { background: var(--sage); border-color: var(--sage); color: #fff; }
.card.sold .btn-add { display: none; }

/* ---------- Empty / loading ---------- */
.state { max-width: var(--maxw); margin: 40px auto; padding: 0 18px; text-align: center; color: var(--ink-soft); }
.state svg { width: 60px; height: 60px; color: var(--sage); opacity: .6; margin-bottom: 10px; }

/* ---------- Offer bar (fixed bottom) ---------- */
.offerbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  transform: translateY(120%); transition: transform .22s ease;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; pointer-events: none;
}
.offerbar.show { transform: translateY(0); }
.offerbar-inner {
  pointer-events: auto; width: 100%; max-width: 520px;
  background: var(--ink); color: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
}
.offerbar-inner .count { font-weight: 600; }
.offerbar-inner .count b { color: var(--gold); }
.offerbar-inner button {
  background: var(--clay); color: #fff; border: 0; padding: 10px 16px; border-radius: 10px; font-weight: 700;
}
.offerbar-inner button:hover { background: var(--clay-dark); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 60; background: rgba(30, 24, 18, .55);
  display: none; align-items: flex-end; justify-content: center; padding: 0;
}
.modal-back.show { display: flex; }
.modal {
  background: var(--paper); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 20px; }
  .modal { border-radius: 20px; }
}
.modal-head {
  position: sticky; top: 0; background: var(--paper); padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; z-index: 2;
}
.modal-head h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0; }
.modal-close { border: 0; background: var(--card); border: 1px solid var(--line); width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; color: var(--ink-soft); }
.modal-body { padding: 18px; }

/* item detail */
.gallery { border-radius: 12px; overflow: hidden; background: var(--sage-soft); }
.gallery .main { aspect-ratio: 4/3; background: var(--sage-soft) center/cover no-repeat; display:flex;align-items:center;justify-content:center; }
.gallery .main .ph { width: 64px; height: 64px; color: var(--sage); opacity: .5; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumbs img { width: 60px; height: 46px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.thumbs img.sel { border-color: var(--clay); }
.detail-price { font-size: 1.5rem; font-weight: 700; margin: 14px 0 4px; }
.detail-cat { color: var(--sage); font-weight: 600; text-transform: uppercase; font-size: .8rem; letter-spacing: .5px; }
.detail-desc { white-space: pre-wrap; color: #3f3831; margin: 12px 0 18px; }
.contact-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.contact-row a, .contact-row button {
  text-decoration: none; text-align: center; border-radius: 12px; padding: 12px 6px; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.contact-row .c-email { background: var(--clay); color: #fff; border-color: var(--clay); }
.contact-row .c-phone { background: var(--sage); color: #fff; border-color: var(--sage); }
.contact-row .c-mp { background: #5a78ff; color: #fff; border-color: #5a78ff; }
.contact-row svg { width: 20px; height: 20px; }
@media (max-width: 420px) { .contact-row { grid-template-columns: 1fr; } .contact-row a, .contact-row button { flex-direction: row; justify-content: center; } }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); font-size: 1rem; color: var(--ink); font-family: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
.btn-primary {
  width: 100%; background: var(--clay); color: #fff; border: 0; padding: 14px; border-radius: 12px;
  font-weight: 700; font-size: 1.02rem;
}
.btn-primary:hover { background: var(--clay-dark); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { width:100%; background: transparent; border: 1px solid var(--line); color: var(--ink-soft); padding: 11px; border-radius: 10px; font-weight: 600; margin-top: 8px; }

/* offer item list */
.offer-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.offer-item .oi-thumb { width: 54px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--sage-soft); flex: 0 0 auto; }
.offer-item .oi-title { font-weight: 600; flex: 1; font-size: .95rem; }
.offer-item .oi-price { color: var(--ink-soft); font-size: .9rem; }
.offer-item .oi-rm { border: 0; background: transparent; color: var(--clay); font-size: 1.3rem; line-height: 1; padding: 0 6px; }
.offer-sum { display: flex; justify-content: space-between; padding: 10px 2px 4px; font-weight: 600; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 90;
  opacity: 0; transition: all .25s ease; pointer-events: none; font-weight: 600; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { text-align: center; color: var(--ink-soft); font-size: .85rem; padding: 20px; }
footer a { color: var(--clay-dark); }
.hidden { display: none !important; }
