:root {
  /* Palette pulled from the logo */
  --bg: #d9dcf8;            /* periwinkle */
  --field: #f5f6fd;
  --surface: #ffffff;
  --text: #1c2a44;
  --muted: #4c5a6e;
  --accent: #022278;        /* logo navy */
  --accent-soft: #e2eadb;   /* pale pine */
  --green: #4e6e30;
  --sky: #a9bfd3;
  --border: #cfd3ef;
  --danger: #b8434f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(2, 34, 120, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

main { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--accent); text-decoration: none; }
.brand img { display: block; }
.nav-link { color: var(--accent); text-decoration: none; font-weight: 700; }

.hero { text-align: center; padding: 8px 0 32px; }
.hero h1 { margin: 0; line-height: 0; }
.hero-logo { width: min(420px, 90vw); height: auto; }
.hero .tagline { margin: 16px 0 2px; font-size: 1.2rem; font-weight: 700; color: var(--green); }
.hero p { margin: 0; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 300px));
  justify-content: center;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity 0.2s;
  /* Column layout so the price can sit at the bottom, aligned across a row. */
  display: flex;
  flex-direction: column;
}
.card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--accent-soft); }
.card-body { padding: 12px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card-body p { margin: 0; color: var(--muted); font-size: 0.95rem; white-space: pre-line; }

/* --- Admin --- */
h2 small { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

.upload-form {
  display: grid;
  gap: 12px;
  max-width: 520px;
  padding: 20px;
  margin-bottom: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.upload-form h2 { margin: 0; }
.upload-form label { display: grid; gap: 4px; font-weight: 700; font-size: 0.9rem; }
input, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
}

button {
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.danger { background: transparent; color: var(--danger); padding: 6px 10px; }

/* Round icon buttons on admin cards */
.icon { display: block; }
button.icon-button {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
button.icon-button:hover, button.icon-button:focus-visible { background: var(--accent-soft); color: var(--accent); }
button.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.toggle.on { color: var(--green); }
button.toggle.off { background: #eceef5; color: var(--muted); }
button.icon-button.danger { color: var(--danger); }
button.icon-button.danger:hover, button.icon-button.danger:focus-visible { background: #f9e4e6; color: var(--danger); }
button.htmx-request { opacity: 0.6; cursor: progress; }

.card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.card-tools { gap: 4px; }
.card-tools .danger { margin-left: auto; }
.admin-grid { justify-content: start; }
.drag-handle { cursor: grab; color: var(--muted); padding: 8px 4px; margin-right: 4px; user-select: none; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.card:has(.toggle.off) img,
.card:has(.toggle.off) .card-body { opacity: 0.4; }
.sortable-ghost { opacity: 0.3; outline: 2px dashed var(--accent); }

.flash {
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #f9e4e6;
  color: var(--danger);
  font-weight: 700;
}

.login-form { margin: 48px auto; }
.login-form h1 { margin: 0; font-size: 1.4rem; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav form { margin: 0; }
button.link-button { background: none; color: var(--muted); padding: 0; font-weight: 700; }

/* --- Price --- */
.card-body .price { margin-top: auto; padding-top: 10px; color: var(--accent); font-weight: 800; font-size: 1.05rem; }
.upload-form label small { font-weight: 400; color: var(--muted); }
.price-input { display: flex; align-items: center; gap: 6px; }
.price-input input { width: 100%; }
.price-field { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; font-weight: 700; font-size: 0.9rem; }
.price-field .price-input input { width: 7.5em; padding: 5px 8px; }
.saved-note { color: var(--green); font-weight: 700; animation: fade-out 2s forwards 1s; }
@keyframes fade-out { to { opacity: 0; } }

/* --- Edit form (replaces a card in place) --- */
button.secondary { background: var(--accent-soft); color: var(--accent); }
.card-edit { outline: 2px solid var(--accent); }
.card-edit .edit-thumb { aspect-ratio: 2 / 1; }
.card-edit .card-body { gap: 10px; }
.card-edit label { display: grid; gap: 4px; font-weight: 700; font-size: 0.9rem; }
.card-edit label small { font-weight: 400; color: var(--muted); }
.card-edit input, .card-edit textarea { font-weight: 400; min-width: 0; width: 100%; }
.card-edit input[type=file] { font-size: 0.85rem; }
.edit-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
