/* Estate items — calm, warm, dignified. Mobile-first. No external deps. */

:root {
  --paper: #f5f1ea;
  --paper-soft: #faf7f1;
  --surface: #ffffff;
  --ink: #2a2620;
  --ink-soft: #4f483d;
  --muted: #8a8073;
  --line: #e8e0d3;
  --line-soft: #f0eae0;
  --sage: #5f6b54;
  --sage-dark: #4c5644;
  --clay: #a9704a;
  --gold: #9a7a3e;
  --danger: #a4503f;
  --shadow-sm: 0 1px 2px rgba(60, 50, 35, 0.06), 0 2px 8px rgba(60, 50, 35, 0.05);
  --shadow-md: 0 6px 20px rgba(60, 50, 35, 0.1);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Enforce the `hidden` attribute even where an author rule sets display
   (a class selector otherwise out-specifies the UA [hidden] rule). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  background: linear-gradient(180deg, var(--paper-soft), var(--paper));
  border-bottom: 1px solid var(--line);
  padding: 56px 0 28px;
}
.site-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  color: var(--ink);
}
.intro {
  max-width: 640px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.65;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  margin-top: 30px;
}

.filter {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}
.filter button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.filter button.active { background: var(--sage); color: #fff; }

/* ---------- admin bar ---------- */
.admin-bar {
  margin: 0 0 22px;
  padding: 12px 16px;
  background: #2f2a22;
  color: #f3ede1;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.9rem;
}
.admin-bar a { color: #ffd9a8; }
.admin-bar .tag {
  background: var(--gold);
  color: #2a2620;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- grid ---------- */
main { padding: 32px 0 64px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 26px;
}

/* Full-width section header separating Available from Claimed in "Show all". */
.group-heading {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.group-count {
  margin-left: 11px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--line-soft);
  padding: 2px 10px;
  border-radius: 999px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card-photo {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--line-soft);
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s, filter 0.2s, transform 0.3s;
}
.card:hover .card-photo img { transform: scale(1.03); }

.ribbon {
  position: absolute;
  top: 12px;
  left: 0;
  background: var(--clay);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 12px 5px 13px;
  border-radius: 0 6px 6px 0;
  box-shadow: var(--shadow-sm);
}
.multi-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(20, 17, 12, 0.62);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.is-claimed .card-photo img { opacity: 0.62; filter: saturate(0.7); }

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
}
.card-title {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}
.card-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}
/* Anchor the action to the bottom so cards line up whether or not they have a note. */
.card-action { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.claimed-by {
  font-size: 0.95rem;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.claimed-by::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clay);
  flex: none;
}
.claimed-by.mine::before { background: var(--sage); }

.by-admin-tag { font-size: 0.82rem; font-style: italic; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border: 0;
  border-radius: 9px;
  padding: 10px 18px;
  cursor: pointer;
  background: var(--sage);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--sage-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--paper-soft); }
.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 4px 2px;
}
.btn-link:hover { color: var(--danger); }
.btn-link.admin-release:hover { color: var(--danger); }

/* ---------- empty / footer ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.15rem;
  padding: 60px 0;
}
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-soft);
  padding: 30px 0 44px;
}
.site-footer p {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(22, 18, 13, 0.93);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 0;
}
.lb-img {
  max-width: min(94vw, 1300px);
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #1a1712;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.26); }
.lb-prev { left: 4px; }
.lb-next { right: 4px; }
.lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.26); }
.lb-dots { display: flex; gap: 4px; justify-content: center; margin-top: 8px; min-height: 28px; }
.lb-dot {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s;
}
.lb-dot.active::before { background: #fff; }

.lb-caption {
  color: #f3ede1;
  text-align: center;
  max-width: 640px;
  margin: 14px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lb-caption h2 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; margin: 0; }
.lb-caption p { margin: 0; color: #cfc6b6; font-size: 0.98rem; }
.lb-caption .lb-claim-row { margin-top: 8px; display: flex; align-items: center; gap: 12px; }
.lb-caption .claimed-by { color: #e9e0cf; }
.lb-caption .claimed-by.mine::before { background: #9db588; }

/* ---------- name modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(22, 18, 13, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 24px;
}
.modal-card h3 { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 6px; }
.modal-card .modal-sub { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }
.modal-card label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 6px; }
.modal-card input {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  color: var(--ink);
}
.modal-card input:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #2f2a22;
  color: #f5efe3;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
  max-width: 90vw;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--sage-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- admin add button ---------- */
.admin-action {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border: 0;
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  background: var(--gold);
  color: #2a2620;
  transition: filter 0.15s;
}
.admin-action:hover { filter: brightness(1.08); }

/* ---------- admin per-claim meta (sticker status + pickup plan) ---------- */
.admin-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-meta-row { display: flex; align-items: center; gap: 8px; }
.admin-meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}
.status-select {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 5px 26px 5px 11px;
  border-radius: 999px;
  border: 1px solid;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 9px 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b5d4e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.status-needs_sticky { background-color: #f7e1dc; border-color: #d7a294; color: #9b3a28; }
.status-stickied { background-color: #f7edc4; border-color: #d8c279; color: #846212; }
.status-removed { background-color: #e1efdb; border-color: #a3c592; color: #466b34; }
.pickup-input,
.note-input {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink);
  resize: vertical;
}
.pickup-input:focus,
.note-input:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
.pickup-input::placeholder,
.note-input::placeholder { color: var(--muted); }

/* ---------- admin editable item note (public — e.g. dimensions) ---------- */
.admin-note-edit { display: flex; flex-direction: column; gap: 5px; }

/* ---------- notify (sits in the header, left of the filter) ---------- */
.notify { flex: 1 1 320px; max-width: 520px; }
.notify-form { display: flex; gap: 10px; }
.notify-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.notify-form input:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
.notify-form .btn { white-space: nowrap; }
.notify.is-done .notify-form { display: none; }
.notify-done {
  margin: 6px 0 0;
  color: var(--sage-dark);
  font-weight: 600;
}

.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;
}

/* ---------- add-item modal ---------- */
.add-card { max-width: 460px; max-height: 90vh; overflow-y: auto; }
.add-card label { margin-top: 14px; }
.add-card label:first-of-type { margin-top: 0; }
.add-card .opt { color: var(--muted); font-weight: 400; }
.add-card textarea {
  width: 100%;
  font: inherit;
  font-size: 1.02rem;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  color: var(--ink);
  resize: vertical;
}
.add-card textarea:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
.add-card input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  cursor: pointer;
}
.add-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.add-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line-soft);
}
.add-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.add-thumb button {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 17, 12, 0.7);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.add-progress {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-header { padding: 36px 0 22px; }
  .grid { grid-template-columns: 1fr; gap: 20px; }
  .lb-img { max-height: 64vh; }
  .lb-nav { width: 44px; height: 44px; }
  .notify-form { flex-direction: column; }
  .notify-form .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
  .card:hover .card-photo img { transform: none; }
}
