/* MandiUpdate — public styles.
   Mobile-first, white background with an agricultural green accent.
   No external fonts or CDNs: everything is served from this origin. */

:root {
  --green-900: #10391f;
  --green-700: #1a6b34;
  --green-500: #2e9e4f;
  --green-100: #e8f5ec;
  --green-050: #f4faf6;
  --ink:       #16241b;
  --muted:     #5c6b60;
  --line:      #d7e5da;
  --white:     #ffffff;
  --radius:    10px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}

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

.site-header { background: var(--green-900); color: var(--white); padding: 14px 0; }
.header-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.brand { color: var(--white); font-size: 1.35rem; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: #9fe0b4; }
.tagline { margin: 0; color: #cfe8d7; font-size: 0.9rem; }

.hero { padding: 28px 0 8px; }
.hero h1 { margin: 0 0 6px; font-size: 1.8rem; color: var(--green-900); }
.hero .sub { margin: 0; color: var(--muted); }

.card {
  background: var(--green-050);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0;
}
.card h2 { margin: 0 0 10px; font-size: 1.15rem; color: var(--green-700); }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }

a { color: var(--green-700); }
.muted { color: var(--muted); font-size: 0.92rem; }
.disclaimer { color: var(--muted); font-size: 0.88rem; border-top: 1px solid var(--line); padding-top: 10px; }

/* Price tables scroll sideways on small screens instead of squashing. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.prices { width: 100%; border-collapse: collapse; min-width: 560px; background: var(--white); }
table.prices th, table.prices td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }

@media (max-width: 520px) {
  table.prices { min-width: 500px; font-size: 0.9rem; }
  table.prices th, table.prices td { padding: 8px 9px; }
}
table.prices th { background: var(--green-100); color: var(--green-900); font-weight: 600; }
table.prices td.num { text-align: right; font-variant-numeric: tabular-nums; }

.site-footer { margin-top: 32px; padding: 18px 0; background: var(--green-900); color: #cfe8d7; }
.site-footer a { color: #9fe0b4; }

@media (min-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
}

/* ---------------------------------------------------------------- navigation */
.mainnav { display: flex; flex-wrap: wrap; gap: 14px; width: 100%; margin-top: 8px; }
.mainnav a { color: #cfe8d7; text-decoration: none; font-size: 0.95rem; padding: 3px 0; border-bottom: 2px solid transparent; }
.mainnav a:hover { color: var(--white); border-bottom-color: #9fe0b4; }

/* Sticky search: the primary action on mobile (brief §30). */
.searchbar { position: sticky; top: 0; z-index: 20; background: var(--green-100); border-bottom: 1px solid var(--line); padding: 10px 0; }
.searchbar form { display: flex; gap: 8px; position: relative; }
.searchbar input[type=search] {
  flex: 1; min-width: 0; padding: 12px 14px; font: inherit; border: 1px solid var(--line);
  border-radius: 8px; background: var(--white); color: var(--ink);
}
.searchbar input[type=search]:focus { outline: 2px solid var(--green-500); border-color: var(--green-700); }
.searchbar button { padding: 12px 18px; border: 0; border-radius: 8px; background: var(--green-700); color: var(--white); font: inherit; font-weight: 600; cursor: pointer; }
.searchbar button:hover { background: var(--green-900); }

.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--white);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 57, 31, 0.12);
  overflow: hidden; z-index: 30;
}
.suggestions a { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.suggestions a:last-child { border-bottom: 0; }
.suggestions a:hover, .suggestions a.is-active { background: var(--green-050); }
.suggestions .s-context { color: var(--muted); font-size: 0.85rem; }

/* --------------------------------------------------------------- breadcrumbs */
.breadcrumbs { padding: 10px 16px; font-size: 0.88rem; color: var(--muted); }
.breadcrumbs a { color: var(--green-700); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 6px; color: var(--line); }

/* -------------------------------------------------------------------- blocks */
h1 { font-size: 1.6rem; color: var(--green-900); margin: 20px 0 6px; line-height: 1.3; }
h2 { font-size: 1.2rem; color: var(--green-700); margin: 26px 0 10px; }
section { margin-bottom: 6px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-head .more { font-size: 0.9rem; white-space: nowrap; }
.updated { color: var(--muted); font-size: 0.92rem; margin: 0 0 14px; }
.empty { background: var(--green-050); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; color: var(--muted); }
.backlink { margin: 24px 0; }
.table-note { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }
.lead { font-size: 1.05rem; }

/* --------------------------------------------------------------------- chips */
.quick-filters, .chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.chip {
  display: inline-flex; flex-direction: column; padding: 9px 14px; background: var(--green-100);
  color: var(--green-900); border-radius: 999px; text-decoration: none; font-size: 0.94rem; font-weight: 600;
}
.chip:hover { background: var(--green-500); color: var(--white); }
.chip .sub { font-weight: 400; font-size: 0.75rem; opacity: 0.75; }
.chip-more { background: var(--white); border: 1px solid var(--line); }

/* ------------------------------------------------------------------- tables */
/* On a narrow screen the price columns scroll sideways, so the first column is
   pinned — without it a reader loses track of which mandi/crop a price belongs
   to as soon as they scroll (brief §30). */
table.prices th:first-child, table.prices td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--white); box-shadow: 1px 0 0 var(--line);
}
table.prices thead th:first-child { background: var(--green-100); }
table.prices tbody tr:nth-child(even) td:first-child { background: var(--green-050); }

table.prices td .sub { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }
table.prices td.strong { font-weight: 700; color: var(--green-900); }
table.prices tbody tr:nth-child(even) { background: var(--green-050); }
table.prices a { text-decoration: none; font-weight: 600; }
table.prices a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- price summary */
.price-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 18px; }
.price-card { background: var(--green-050); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.price-card .label { display: block; color: var(--muted); font-size: 0.82rem; }
.price-card .value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--green-900); font-variant-numeric: tabular-nums; }
.price-card .sub { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.trend-up .value { color: #14713a; }
.trend-down .value { color: #b3261e; }
.trend-flat .value, .trend-unknown .value { color: var(--muted); }

/* ---------------------------------------------------------------- range nav */
.range-nav { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.9rem; }
.range-nav a { text-decoration: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
.range-nav a:hover { background: var(--green-100); }
.range-nav strong { padding: 4px 10px; border-radius: 999px; background: var(--green-700); color: var(--white); font-weight: 600; }

/* ------------------------------------------------------------------- lists */
.link-grid { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.link-grid li { background: var(--green-050); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.link-grid a { text-decoration: none; font-weight: 600; }
.link-grid .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.date-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.date-list li { background: var(--green-050); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; }
.date-list .sub { color: var(--muted); font-size: 0.8rem; }
.results { list-style: none; padding: 0; }
.results li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.results a { font-weight: 600; text-decoration: none; font-size: 1.05rem; }
.results .badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--green-100); color: var(--green-900); font-size: 0.75rem; }
.results .sub { display: block; color: var(--muted); font-size: 0.85rem; }

/* -------------------------------------------------------------- pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 18px 0; font-size: 0.92rem; }
.pagination a { text-decoration: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; }
.pagination a:hover { background: var(--green-100); }
.pagination .page-info { color: var(--muted); }
.pagination .per-page { margin-left: auto; color: var(--muted); }
.pagination .per-page a { padding: 4px 8px; }

/* ------------------------------------------------------------------- footer */
.foot-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; padding: 8px 0 4px; }
.foot-cols h3 { font-size: 0.95rem; margin: 0 0 6px; color: var(--white); }
.foot-cols ul { list-style: none; padding: 0; margin: 0; }
.foot-cols li { margin-bottom: 4px; }
.foot-cols p { margin: 0; font-size: 0.9rem; }
.foot-note { border-top: 1px solid rgba(255,255,255,0.15); margin-top: 14px; padding-top: 12px; font-size: 0.85rem; }

/* ---------------------------------------------------------------- ad slots */
.ad-slot { margin: 18px 0; min-height: 90px; display: flex; align-items: center; justify-content: center; }

@media (min-width: 768px) {
  h1 { font-size: 2rem; }
  .price-summary { grid-template-columns: repeat(4, 1fr); }
  .link-grid { grid-template-columns: repeat(4, 1fr); }
  .foot-cols { grid-template-columns: repeat(4, 1fr); }
  .header-inner { align-items: center; }
  .mainnav { width: auto; margin: 0 0 0 auto; }
}

/* ------------------------------------------------------------ price chart */
.chart-wrap { margin: 0 0 14px; }
.chart-wrap figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.price-chart {
  width: 100%; height: auto; display: block;
  background: var(--green-050); border: 1px solid var(--line); border-radius: var(--radius);
}
.price-chart .chart-grid { stroke: var(--line); stroke-width: 1; }
.price-chart .chart-area { fill: rgba(46, 158, 79, 0.14); stroke: none; }
.price-chart .chart-line { fill: none; stroke: var(--green-700); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.price-chart .chart-point { fill: var(--green-900); }
.price-chart .chart-axis-label { fill: var(--muted); font-size: 12px; font-family: system-ui, sans-serif; }


/* ---------------------------------------------------------------- filters */
.filters { background: var(--green-050); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 18px; }
.filters form { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: end; }
.filters label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.filters select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--white); color: var(--ink); }
.filters .filter-actions { display: flex; gap: 8px; }
.filters button { padding: 11px 18px; border: 0; border-radius: 8px; background: var(--green-700); color: var(--white); font: inherit; font-weight: 600; cursor: pointer; }
.filters .reset { padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); text-decoration: none; text-align: center; }
.filters .active-note { margin: 10px 0 0; color: var(--muted); font-size: 0.88rem; }

@media (min-width: 768px) { .filters form { grid-template-columns: 1fr 1fr auto; } }
