:root {
  --green: #2d6a4f;
  --green-light: #40916c;
  --green-pale: #b7e4c7;
  --bg: #fefae0;
  --surface: #fff;
  --text: #1b1b1b;
  --text-secondary: #555;
  --border: #d4a373;
  --border-light: #e8d5b7;
  --muted: #4a5228;
  --red: #ae2012;
  --orange: #bc6c25;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Nav */

body > nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 0;
  border-bottom: 2px solid var(--green);
  margin-bottom: 2.5rem;
}

body > nav a {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s;
}

body > nav a:first-child {
  font-size: 1.3rem;
  margin-right: auto;
  letter-spacing: -0.01em;
}

body > nav a:hover { color: var(--green-light); }

/* Typography */

main { min-height: 60vh; }

h1 {
  color: var(--green);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

h2 {
  color: var(--green-light);
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

main > p { color: var(--text-secondary); }

a { color: var(--green); transition: color 0.15s; }
a:hover { color: var(--green-light); }

section { margin: 2.5rem 0; }

/* Hero */

.hero {
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.hero h1 { font-size: 2rem; }

.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 32rem;
  margin: 0 auto;
}

/* Location label */

.location-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 1rem;
}

/* Product grid */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, transform 0.15s;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.product-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.product-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--green);
  margin-right: auto;
}

.product-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-fruit { background: #fde68a; color: #92400e; }
.badge-legume { background: var(--green-pale); color: var(--green); }
.badge-season { background: #dbeafe; color: #1e40af; }

.product-card-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.price-main {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.price-main small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.price-range {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.product-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.trend { font-weight: 600; }
.trend-down { color: var(--green); }
.trend-up { color: var(--orange); }
.trend-stable { color: var(--text-secondary); }

.market-count { color: var(--text-secondary); }

/* Product detail */

.product-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.detail-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.15rem 0;
}

.detail-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Table */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 0.65rem 0.85rem;
  text-align: left;
}

th {
  background: var(--green);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(45, 106, 79, 0.04); }

/* Articles */

article {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

article img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

article h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

article p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

time {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* FAQ */

details {
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--green);
  list-style: none;
}

summary::before {
  content: '+';
  display: inline-block;
  width: 1.25rem;
  font-weight: 700;
  color: var(--green-light);
}

details[open] summary::before { content: '\2212'; }

details[open] summary { margin-bottom: 0.5rem; }

details p { color: var(--text-secondary); font-size: 0.9rem; }

/* Footer */

footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 2px solid var(--green);
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Location picker (SSR shell) */

.location-picker {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.location-picker label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 0.25rem;
}

.location-picker small {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-style: italic;
}

.location-picker input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
}

.location-picker input:focus {
  outline: none;
  border-color: var(--green);
}

.location-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
  background: var(--green-pale);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--green);
}

.location-bar button {
  appearance: none;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--green);
  cursor: pointer;
  text-decoration: underline;
}

/* Price checker (SSR shell) */

.price-checker {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.price-checker input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.price-checker > div:first-child input {
  width: 100%;
}

.price-checker input:focus {
  outline: none;
  border-color: var(--green);
}

.price-checker strong {
  display: block;
  font-size: 1.1rem;
  color: var(--green);
  margin-top: 1rem;
}

.price-checker label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
}

.price-checker .verdict {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  background: var(--bg);
  font-size: 1.1rem;
  font-weight: 700;
}

/* Market select (SSR shell) */

.market-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  margin-bottom: 0.25rem;
}

.market-select strong {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.market-select select {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  min-width: 12rem;
}

/* Dropdown suggestions (SSR fallback for clientEntry css() styles) */

.location-picker ul, .price-checker ul {
  list-style: none;
  margin-top: 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.location-picker li + li, .price-checker li + li {
  border-top: 1px solid var(--border-light);
}

.location-picker li button, .price-checker li button {
  width: 100%;
  display: flex;
  padding: 0.65rem 1rem;
  border: none;
  background: var(--surface);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s;
}

.location-picker li button:hover, .price-checker li button:hover {
  background: var(--bg);
}

.location-picker li button {
  flex-direction: column;
  gap: 0.1rem;
  text-align: left;
}

.location-picker li button span { font-size: 0.95rem; font-weight: 600; }
.location-picker li button small { font-size: 0.8rem; color: var(--text-secondary); }

.price-checker li button {
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text);
}

/* Filters (server-rendered category pills) */

.filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  border-bottom: none;
  margin-bottom: 0.25rem;
}

.filters strong {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.filters a {
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filters a:hover {
  border-color: var(--green-light);
  color: var(--green);
}

.filters a[aria-current="page"] {
  background: var(--green);
  color: white;
  border-color: var(--green);
  font-weight: 600;
}

/* Pagination */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

.pagination a {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.pagination a:hover {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.pagination .disabled {
  color: var(--border);
  font-size: 0.85rem;
}

/* Breadcrumb */

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  list-style: none;
  gap: 0.25rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.breadcrumb li {
  padding: 0;
  margin: 0;
  line-height: 1.4;
}

.breadcrumb li:not(:last-child)::after {
  content: '›';
  margin-left: 0.25rem;
  color: var(--text-secondary);
}

.breadcrumb a,
.breadcrumb span {
  font-size: 0.85rem;
  font-weight: 600;
}

.breadcrumb a {
  color: var(--green);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb span[aria-current] {
  color: var(--text);
}

/* Market search */

.market-search {
  position: relative;
  margin: 1rem 0;
}

.market-search input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
}

.market-search input:focus {
  outline: none;
  border-color: var(--green);
}

.market-search-results {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-top: 0.25rem;
  overflow: hidden;
}

.market-search-results li + li {
  border-top: 1px solid var(--border-light);
}

.market-search-results a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
}

.market-search-results a span { font-weight: 600; font-size: 0.95rem; }
.market-search-results a small { font-size: 0.8rem; color: var(--text-secondary); }

.market-search-results a:hover,
.market-search-results a.selected {
  background: var(--bg);
}

.market-search-empty {
  display: block;
  padding: 0.65rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Market grid */

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.market-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, transform 0.15s;
}

.market-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.market-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--green);
}

.market-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Market detail */

.market-location {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.market-map {
  width: 100%;
  height: 350px;
  border-radius: var(--radius);
  margin: 1rem 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.market-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.market-osm-attribution {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Consent banner */

.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border-top: 2px solid var(--green);
  padding: 1rem 1.5rem;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.consent-banner p {
  flex: 1;
  min-width: 200px;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
}

.consent-buttons {
  display: flex;
  gap: 0.5rem;
}

.consent-accept,
.consent-refuse {
  appearance: none;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.consent-accept {
  background: var(--green);
  color: #fff;
}

.consent-accept:hover { background: var(--green-light); }

.consent-refuse {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.consent-refuse:hover { background: var(--bg); }

#manage-cookies {
  appearance: none;
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Responsive */

@media (max-width: 600px) {
  body { padding: 0 1rem; }
  .hero h1 { font-size: 1.5rem; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }
  .product-grid { grid-template-columns: 1fr; }
  .product-detail { grid-template-columns: 1fr; }
  table { font-size: 0.8rem; }
  th, td { padding: 0.4rem 0.5rem; }
  body > nav { gap: 1rem; }
  body > nav a:first-child { font-size: 1.1rem; }
  footer { flex-direction: column; }
}
