/* =========================================================================
   Provecho Collective — Wholesale Producer Directory (WPD) demo
   Brand tokens + shared components.
   Colors/type from the 2025 Provecho Collective Brand Guidelines.
   This is a non-production clickable mockup. No real data.
   ========================================================================= */

:root {
  /* CWPD Signature palette — Brand Guidelines (Colorado Wholesale Producer
     Directory), July 2026. Canopy is the hyperlink color on light
     backgrounds; Buttercup is the hyperlink color on dark backgrounds. */
  --periwinkle: #71779D;
  --canopy:     #4D6442;
  --bean:       #ABAF74;
  --fiddlehead: #C4C831;
  --blossom:    #EAB220;
  --buttercup:  #F5F19A;
  --buttercup-bg: #FCFAE2; /* 30% tint for backgrounds */

  /* Secondary — sparingly, for charts/graphs, buttons and labels */
  --lilac:      #EAD3E7;
  --beet:       #892678;

  /* Legacy aliases (2025 Provecho palette) kept for unmigrated rules */
  --ube:        #524959;
  --berry:      #CC2B64;
  --heirloom:   var(--beet);
  --chartreuse: var(--fiddlehead);

  /* Neutrals */
  --soil:       #221F20;  /* near-black text */
  --wheat:      var(--buttercup-bg);  /* page background per CWPD guide */
  --stonecrop:  #ACA0A8;

  /* Semantic (status) — built from the palette */
  --status-ready:    var(--canopy);
  --status-needs:    var(--fiddlehead);
  --status-notready: var(--blossom);
  --flag:            var(--berry);

  /* Surfaces */
  --paper:      #ffffff;
  --paper-soft: #fffdf6;
  --line:       #e7e0d2;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(34,31,32,.08), 0 6px 18px rgba(34,31,32,.06);
  --maxw: 1360px;
}

/* ----- Type ----- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--soil);
  background: var(--wheat);
  line-height: 1.6;
  font-size: 16px;
}

/* CWPD heading system: H1 Montserrat bold title case; H2 Montserrat light
   all caps; H3 Montserrat bold all caps; body Montserrat regular. */
h1, h2, h3, h4 {
  font-family: "Montserrat", system-ui, sans-serif;
  line-height: 1.2;
  color: var(--soil);
  margin: 0 0 .4em;
}
h1 { font-size: 2.1rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 300; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 1.05rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

p { margin: 0 0 1rem; }

a { color: var(--heirloom); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--berry); }

small, .muted { color: #6c6470; }
.eyebrow {
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; color: var(--periwinkle); margin: 0 0 .4rem;
}

/* ----- Layout ----- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 32px 0; }
.grid { display: grid; gap: 20px; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.stack > * + * { margin-top: 1rem; }

/* ----- Demo banner ----- */
.demo-banner {
  background: var(--ube);
  color: var(--lilac);
  font-size: .82rem;
  text-align: center;
  padding: 7px 16px;
  letter-spacing: .02em;
}
.demo-banner strong { color: #fff; }

/* ----- Header / nav ----- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 16px;
  min-height: 64px; flex-wrap: wrap;
}
.brand-mark {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ube); font-weight: 700;
}
.brand-mark img.sig { height: 56px; width: auto; display: block; }
.brand-mark .name { font-family: "Montserrat", sans-serif; font-size: 1.05rem; font-weight: 700; }
.brand-mark .name span { color: var(--canopy); }
.site-nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--ube); font-size: .9rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
}
.site-nav a:hover { background: var(--wheat); }
.site-nav a.active { background: var(--ube); color: #fff; }
.role-tag {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 999px; background: var(--lilac); color: var(--ube);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 11px 20px; border-radius: 999px; border: 2px solid transparent;
  text-decoration: none; transition: transform .04s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--canopy); color: #fff; }
.btn-primary:hover { background: #41562f; color:#fff; }
.btn-secondary { background: transparent; color: var(--ube); border-color: var(--ube); }
.btn-secondary:hover { background: var(--ube); color: #fff; }
.btn-berry { background: var(--berry); color: #fff; }
.btn-berry:hover { background: #b02153; color:#fff; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--heirloom); border:none; text-decoration: underline; padding: 6px 8px; }

/* ----- Cards ----- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card-soft { background: var(--paper-soft); }
.card h3 { margin-top: 0; }

.role-card { display: flex; flex-direction: column; height: 100%; }
.role-card .icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.5rem; margin-bottom: 12px;
}
.role-card .icon.admin   { background: var(--lilac); }
.role-card .icon.producer{ background: var(--bean); }
.role-card .icon.buyer   { background: #f6e3a6; }
.role-card .btn { margin-top: auto; }

/* ----- Hero ----- */
.hero {
  background:
    radial-gradient(1200px 300px at 90% -10%, rgba(113,119,157,.25), transparent 60%),
    linear-gradient(160deg, var(--wheat), #fbeedd 90%);
  border-bottom: 1px solid var(--line);
}
.hero .wrap { padding-top: 48px; padding-bottom: 48px; }
.hero h1 { max-width: 18ch; }
.hero p.lead { font-size: 1.1rem; max-width: 60ch; color: #4b4450; }

/* ----- Badges / pills ----- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .76rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--wheat); color: var(--ube); border: 1px solid var(--line);
}
.badge.verified { background: #e9f0e4; color: var(--canopy); border-color: #cfe0c4; }
.badge.cert     { background: #fff4d6; color: #8a6a00; border-color: #f0dca0; }
.badge.identity { background: var(--lilac); color: var(--ube); border-color: #ddc1da; }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .8rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; color:#fff;
}
.status::before { content:""; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.9); }
.status.ready    { background: var(--status-ready); }
.status.needs    { background: #b5860c; }
.status.notready { background: var(--status-notready); }
.status.review   { background: var(--periwinkle); }
.status.draft    { background: var(--stonecrop); }

/* ----- Flags (screener follow-up) ----- */
.flag-note {
  display: none; margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: #fdeaf0; border: 1px solid #f5c3d4; color: #8c1d42; font-size: .86rem;
}
.flag-note.show { display: block; }
.flag-note::before { content: "⚑ "; font-weight: 700; }

/* ----- Forms ----- */
.field { margin-bottom: 20px; }
.field > label.q { display: block; font-weight: 700; color: var(--ube); margin-bottom: 4px; }
.field .help { font-size: .84rem; color: #6c6470; margin: 0 0 8px; }
input[type=text], input[type=number], input[type=email], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--soil);
  padding: 10px 12px; border: 1px solid var(--stonecrop); border-radius: var(--radius-sm);
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--periwinkle); border-color: var(--periwinkle); }
textarea { min-height: 90px; resize: vertical; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.inline { flex-direction: row; flex-wrap: wrap; gap: 14px; }
.choice {
  display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer;
}
.choice:hover { border-color: var(--periwinkle); background: var(--paper-soft); }
.choice input { margin-top: 3px; width: auto; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color:#6c6470; }
.input-prefix input { padding-left: 26px; }

/* admin-only block */
.admin-only {
  border-left: 4px solid var(--periwinkle); background: #f4f5fa;
  padding: 16px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 16px 0;
}
.admin-only .eyebrow { color: var(--periwinkle); }

/* ----- Tables / queue ----- */
table.queue { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.queue th, table.queue td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: .92rem; }
table.queue th { background: var(--ube); color: var(--lilac); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
table.queue tr:last-child td { border-bottom: none; }
table.queue tr:hover td { background: var(--paper-soft); }
table.queue a { font-weight: 700; }

/* ----- Stats ----- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(2,1fr); }
@media (min-width:720px){ .stats { grid-template-columns: repeat(4,1fr); } }
.stat { background: var(--paper); border:1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-family:"Montserrat",sans-serif; font-weight:700; font-size: 2rem; color: var(--canopy); line-height:1; }
.stat .l { font-size:.8rem; color:#6c6470; margin-top:4px; }

/* ----- Filters ----- */
/* Buyer directory: single column on phones, sidebar + results on wider screens. */
.buyer-grid { gap: 28px; }
@media (min-width: 720px) { .buyer-grid { grid-template-columns: 280px 1fr; } }

/* Results: fill the available width — three-up on wide screens instead of a
   scrunched centered pair. Long card text clamps so tiles stay even. */
#results.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card-desc {
  margin: 0 0 .5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-crops {
  margin: 0 0 .7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sticky sidebar only where there's room for it. */
.filters { position: static; }
@media (min-width: 720px) { .filters { position: sticky; top: 80px; } }

/* On phones the filter panel collapses behind a "Filters" toggle; on desktop
   the summary is hidden and JS keeps the panel open (always-visible sidebar). */
.filter-collapse > summary {
  display: flex; align-items: center; cursor: pointer; list-style: none;
  font-weight: 700; color: #fff; background: var(--ube);
  padding: 10px 14px; border-radius: 999px;
}
.filter-collapse > summary::-webkit-details-marker { display: none; }
.filter-collapse > summary::after { content: "▾"; margin-left: auto; }
.filter-collapse[open] > summary::after { content: "▴"; }
@media (min-width: 720px) { .filter-collapse > summary { display: none; } }
.filter-group { border-bottom: 1px solid var(--line); padding: 14px 0; }
.filter-group:last-child { border-bottom: none; }
.filter-group h4 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing:.06em; color: var(--periwinkle); font-family:"Montserrat",sans-serif; }
.filter-group label { display:flex; align-items:center; gap:8px; font-size:.9rem; margin-bottom:5px; cursor:pointer; }

/* ----- Timeline (history) ----- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content:""; position:absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 22px 36px; }
.timeline li::before { content:""; position:absolute; left: 3px; top: 4px; width: 14px; height:14px; border-radius:50%; background: var(--periwinkle); border: 3px solid var(--wheat); }
.timeline .date { font-size: .78rem; color:#6c6470; font-weight: 700; }

/* ----- Footer ----- */
/* Canopy background; Buttercup is the CWPD hyperlink color on dark. */
.site-footer { background: var(--canopy); color: #eef0e6; margin-top: 40px; }
.site-footer .wrap { padding: 26px 20px; font-size: .85rem; }
.site-footer a { color: var(--buttercup); }
.site-footer .powered-by { opacity: .9; }

/* ----- Progress bar (screener) ----- */
.progress-wrap {
  position: sticky; top: 64px; z-index: 10;
  background: var(--wheat); border-bottom: 1px solid var(--line);
  padding: 10px 20px;
}
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--canopy); transition: width .25s ease; }

/* ----- Product picker (SCR-9) ----- */
.prod-list {
  max-height: 360px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px;
}
.prod-group + .prod-group { margin-top: 12px; }
.prod-item { font-size: .85rem; }
#prod-selected .badge { user-select: none; }

/* ----- Save-for-later toggle (buyer cards) ----- */
.save-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .76rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: #fff; color: var(--heirloom); border: 1px solid var(--line); cursor: pointer;
}
.save-btn:hover { border-color: var(--heirloom); }
.save-btn.saved { background: var(--lilac); color: var(--ube); border-color: #ddc1da; }

/* ----- Shortlist bar (buyer index) ----- */
.shortlist-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ----- Utility ----- */
.row { display:flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.tags { display:flex; gap:6px; flex-wrap: wrap; }
.divider { height:1px; background: var(--line); margin: 18px 0; border:none; }
.center { text-align: center; }
.hidden { display: none !important; }
.pill-nav { display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 18px; }
.pill-nav button {
  font: inherit; font-weight:700; cursor:pointer; padding:8px 16px; border-radius:999px;
  border:2px solid var(--ube); background:#fff; color: var(--ube);
}
.pill-nav button.active { background: var(--ube); color:#fff; }

/* ===================== Feedback widget ===================== */
#fb-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--berry); color: #fff; border: none;
  padding: 12px 18px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(34,31,32,.22);
}
#fb-fab:hover { background: #b02153; }
#fb-fab .count {
  background: #fff; color: var(--berry); border-radius: 999px;
  font-size: .72rem; padding: 1px 7px; min-width: 18px; text-align: center;
}
#fb-overlay {
  position: fixed; inset: 0; z-index: 65; background: rgba(34,31,32,.35);
  display: none;
}
#fb-overlay.show { display: block; }
#fb-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 70; width: min(380px, calc(100vw - 36px));
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(34,31,32,.28); padding: 18px; display: none;
}
#fb-panel.show { display: block; }
#fb-panel h3 { margin: 0 0 2px; }
#fb-panel .fb-sub { font-size: .82rem; color: #6c6470; margin: 0 0 12px; }
#fb-panel .fb-where {
  font-size: .78rem; background: var(--wheat); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; display: inline-block; margin-bottom: 12px; color: var(--ube);
}
#fb-panel label.q { display:block; font-weight:700; color: var(--ube); margin: 10px 0 4px; font-size: .9rem; }
#fb-panel textarea { min-height: 80px; }
#fb-panel .fb-actions { display:flex; gap:8px; align-items:center; margin-top: 12px; }
#fb-close { margin-left:auto; background:none; border:none; font-size:1.3rem; cursor:pointer; color:#6c6470; line-height:1; }
.fb-toast {
  position: fixed; right: 18px; bottom: 78px; z-index: 80;
  background: var(--canopy); color:#fff; padding: 10px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size:.88rem; opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.fb-toast.show { opacity: 1; transform: translateY(0); }
.fb-rating { display:flex; gap:8px; flex-wrap:wrap; }
.fb-rating label { flex:1; min-width: 90px; }
@media print { #fb-fab, #fb-panel, #fb-overlay { display:none !important; } }
