:root {
  --color-bg: #fbf8f3;
  --color-surface: #ffffff;
  --color-ink: #1f2a1f;
  --color-ink-soft: #4d5a4d;
  --color-muted: #7d8a7d;
  --color-line: #e4dfd4;
  --color-leaf: #3a6b3a;
  --color-leaf-dark: #234a23;
  --color-bark: #6b4f2b;
  --color-bloom: #c84f6a;
  --color-potted: #8a5a2b;
  --color-both: #2b6b8a;
  --shadow-sm: 0 1px 2px rgba(31, 42, 31, 0.06);
  --shadow-md: 0 6px 18px rgba(31, 42, 31, 0.08);
  --radius: 10px;
  --radius-lg: 16px;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --font-sans: 'Oswald', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-leaf-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.muted { color: var(--color-muted); }
.small { font-size: 0.85rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-leaf);
  margin: 0 0 8px;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; color: var(--color-ink); margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
h3 { font-size: 1.2rem; font-weight: 600; }

.lede { font-size: 1.1rem; color: var(--color-ink-soft);  }

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 12px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-leaf);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.brand-text strong { display: block; font-family: var(--font-serif); font-size: 1.15rem; }
.brand-text em { display: block; font-style: normal; font-size: 0.78rem; color: var(--color-muted); }

.primary-nav { display: flex; align-items: center; gap: 20px; }
.primary-nav a {
  color: var(--color-ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  height: 32px;
}
.primary-nav a:hover { color: var(--color-leaf-dark); text-decoration: none; }
.primary-nav .nav-admin {
  padding: 0 14px;
  border-radius: 999px;
  background: var(--color-leaf);
  color: #fff;
}
.primary-nav .nav-admin:hover { background: var(--color-leaf-dark); color: #fff; }

.search-bar {
  padding-bottom: 16px;
}
.search-bar form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-bar input[type="search"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-bg);
  font: inherit;
}
.search-bar input[type="search"]:focus { outline: 2px solid var(--color-leaf); outline-offset: 1px; }
.search-bar select {
  padding: 10px 14px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-bg);
  font: inherit;
}

/* In-content search bar (search page) */
.search-bar-block {
  margin: 0 0 20px;
}
.search-bar-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.search-input-wrap {
  flex: 1 1 240px;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--color-muted);
  pointer-events: none;
}
.search-input {
  flex: 1;
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-bg);
  font: inherit;
  font-size: 0.95rem;
  color: var(--color-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input::placeholder { color: var(--color-muted); }
.search-input:hover { border-color: #c8c0a8; }
.search-input:focus {
  outline: none;
  border-color: var(--color-leaf);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(58, 107, 58, 0.15);
}
.search-input:focus + .search-input-icon,
.search-bar-form:focus-within .search-input-icon { color: var(--color-leaf); }
.search-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 9px 32px 9px 14px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background-color: var(--color-bg);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%234d5a4d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 8l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--color-ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-select:hover { border-color: #c8c0a8; }
.search-select:focus {
  outline: none;
  border-color: var(--color-leaf);
  box-shadow: 0 0 0 3px rgba(58, 107, 58, 0.15);
}

/* Loading state (set by the debounce JS while a submission is pending) */
.listing-controls.is-loading,
.search-bar-form.is-loading {
  position: relative;
  opacity: 0.85;
}
.listing-controls.is-loading::after,
.search-bar-form.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 18px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid var(--color-line);
  border-top-color: var(--color-leaf);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Main */
.site-main { min-height: 60vh; }
.section { padding: 48px 0; }
.section-title { margin-bottom: 24px; }
.page-header { margin-bottom: 32px; }

.breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-leaf-dark); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #2d5a2d 0%, #3a6b3a 60%, #6b8a3a 100%);
  color: #fff;
  padding: 80px 0 96px;
}
.hero .eyebrow { color: rgba(255, 255, 255, 0.8); }
.hero h1 { color: #fff; }
.hero .lede { color: rgba(255, 255, 255, 0.92); }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.hero-compact {
  padding: 36px 0 40px;
}
.hero-compact h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin-bottom: 6px; }
.hero-compact .eyebrow { margin-bottom: 4px; }
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #fff; color: var(--color-leaf-dark); }
.btn-primary:hover { background: #f3eedf; }
.btn-ghost { border-color: rgba(255, 255, 255, 0.6); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.category-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  color: var(--color-ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.category-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-leaf);
}
.category-name { font-family: var(--font-serif); font-size: 1.2rem; }
.category-count { font-size: 0.85rem; color: var(--color-muted); }

/* Related variety grid (on detail pages) */
.variety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.related-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-card-link {
  display: block;
  padding: 18px;
  color: var(--color-ink);
}
.related-card-link:hover { text-decoration: none; }
.related-card-cat { margin: 0 0 4px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-leaf); font-weight: 600; }
.related-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.related-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* Variety list (cards) */
.variety-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 860px) {
  .variety-list { grid-template-columns: 1fr 1fr; align-items: stretch; }
}
.variety-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
  overflow: hidden;
}
.variety-card:hover {
  border-color: var(--color-leaf);
  box-shadow: var(--shadow-sm);
}
.variety-card-img-link {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-bg);
}
.variety-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.variety-card:hover .variety-card-img { transform: scale(1.03); }
.variety-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 16px 18px;
}
.variety-card-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.variety-card-cat { margin: 2px 0 6px; }
.variety-card-desc {
  margin: 6px 0 0;
  color: var(--color-ink-soft);
  font-size: 0.95rem;
  flex: 1 1 auto;
}

/* Inline facts inside the description body */
.variety-card-facts-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}
.variety-card-facts-inline span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--color-ink-soft);
}
.variety-card-facts-inline em {
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-leaf);
}

.empty-state {
  padding: 32px;
  text-align: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-line);
  border-radius: var(--radius);
}
.result-count { margin: 12px 4px 0; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  flex-wrap: wrap;
}
.filter-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-surface);
  font: inherit;
}
.filter-bar input[type="search"]:focus { outline: 2px solid var(--color-leaf); outline-offset: 1px; }
.filter-bar select {
  padding: 10px 14px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-surface);
  font: inherit;
}

/* Category blocks (catalog index) */
.category-block {
  margin: 36px 0;
  padding: 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
}
.category-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-line);
}
.category-block-header h2 { margin: 0; }

/* Variety detail */
.variety-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  align-items: start;
}
.variety-header { grid-column: 1 / -1; }
.variety-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.variety-hero-img {
  grid-column: 1 / -1;
  margin: 0 0 8px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg);
}
.variety-detail-img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}
.variety-body .lede { font-size: 1.05rem; }
.variety-facts {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 140px;
}
.variety-facts h3 { margin-top: 0; }
.variety-facts dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 16px; }
.variety-facts dl > div { margin: 0; }
.variety-facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); font-weight: 600; margin: 0; }
.variety-facts dd { margin: 0; }

/* Chips and badges */
.chip {
  display: inline-block;
  padding: 4px 10px;
  background: #efe8d6;
  color: var(--color-bark);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.chip-sm { padding: 2px 8px; font-size: 0.72rem; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-sm { padding: 2px 7px; font-size: 0.68rem; }
.badge-potted { background: var(--color-potted); color: #fff; }
.badge-bareroot { background: var(--color-leaf); color: #fff; }
.badge-both { background: var(--color-both); color: #fff; }

/* Info strip */
.info-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-card { padding: 24px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); }
.info-card h3 { margin-top: 0; }

/* Footer */
.site-footer {
  margin-top: 64px;
  padding: 40px 0;
  background: #1f2a1f;
  color: #d8d2c2;
}
.site-footer p { margin: 4px 0; }
.site-footer .muted { color: #8a9389; }
.site-footer strong { color: #fff; }

/* HTMX loading indicator */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* Responsive */
@media (max-width: 860px) {
  .variety-detail { grid-template-columns: 1fr; }
  .variety-facts { position: static; }
  .info-strip { grid-template-columns: 1fr; }
  .primary-nav { gap: 12px; }
  .primary-nav a { font-size: 0.85rem; }
  .header-inner { flex-wrap: wrap; }
  .listing-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 12px;
  }
  .listing-controls-inputs { justify-content: space-between; }
  .result-summary {
    border-right: none;
    border-bottom: 1px solid var(--color-line);
    padding-right: 0;
    padding-bottom: 10px;
    text-align: center;
  }
  .listing-search { flex: 1 1 100%; min-width: 0; }
  .search-bar-form input[type="search"] { flex: 1 1 200px; }
}
@media (max-width: 560px) {
  .hero { padding: 56px 0 64px; }
  .hero-compact { padding: 24px 0 28px; }
  .pagination { gap: 2px; }
  .page-link { padding: 6px 10px; font-size: 0.85rem; }
  .listing-sort-label { display: none; }
}

/* Listing controls (single integrated toolbar) */
.listing-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px 8px 18px;
  margin-bottom: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.listing-controls-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}
.result-summary {
  margin: 0;
  padding-right: 16px;
  border-right: 1px solid var(--color-line);
  white-space: nowrap;
  color: var(--color-muted);
}
.result-summary strong { color: var(--color-ink); font-weight: 600; }

/* Search input with leading icon */
.listing-search {
  flex: 1 1 260px;
  min-width: 180px;
  padding: 8px 14px 8px 36px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%237d8a7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='9' r='6'/><path d='M17 17l-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 16px 16px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--color-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.listing-search::placeholder { color: var(--color-muted); }
.listing-search:hover { border-color: #c8c0a8; }
.listing-search:focus {
  outline: none;
  border-color: var(--color-leaf);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(58, 107, 58, 0.15);
}

/* Custom-styled selects with chevron */
.listing-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 8px 32px 8px 14px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%234d5a4d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 8l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--color-ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.listing-select:hover {
  border-color: #c8c0a8;
  background-color: #fff;
}
.listing-select:focus {
  outline: none;
  border-color: var(--color-leaf);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(58, 107, 58, 0.15);
}

/* Sort label, paired with the sort select */
.listing-sort-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  font-weight: 600;
  margin-left: 6px;
  padding-right: 2px;
  pointer-events: none;
}
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }


/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.page-link {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.page-link:hover {
  background: var(--color-bg);
  border-color: var(--color-leaf);
  text-decoration: none;
}
.page-link.current {
  background: var(--color-leaf);
  border-color: var(--color-leaf);
  color: #fff;
}
.page-link.disabled {
  color: var(--color-muted);
  background: transparent;
  cursor: not-allowed;
}
.page-ellipsis {
  padding: 8px 6px;
  color: var(--color-muted);
}
