/* assets/css/grantscouts.css
   Clean rewrite (deduped + consistent):
   - mobile-first grid form
   - Clear button never wraps/squeezes
   - consistent cards/pills/buttons
*/

/* ---------- Layout ---------- */
.gs-wrapper{
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ---------- Hero ---------- */
.gs-hero{
  text-align: center;
  margin-bottom: 1rem;
}

.gs-title{
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 0.35rem;
  font-weight: 800;
}

.gs-lede{
  margin: 0 0 0.35rem;
  opacity: 0.9;
}

.gs-trust{
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.75;
  font-style: italic;
}




.gs-pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}
.gs-pager__info{
  font-size: 0.95rem;
  opacity: 0.85;
  text-align:center;
  flex: 1;
}




/* ---------- Form ---------- */
.gs-form{
  display: grid;
  grid-template-columns: 1fr; /* mobile: stacked */
  gap: 0.9rem;
  align-items: end;
  margin-bottom: 1rem;
}

/* Let grid children shrink properly */
.gs-field{ min-width: 0; }

.gs-field label{
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

/* Screen-reader only label */
.gs-label--sr{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.gs-field select,
.gs-field input{
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  background: #fff;
}

/* Keyword input row + Clear button (if used) */
.gs-input-row{
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.gs-input-row input[type="search"],
.gs-input-row input[type="text"]{
  flex: 1 1 auto;
  min-width: 180px;
}

/* Actions row (optional) */
.gs-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Optional helpers */
.gs-field--btn{ min-width: 0; }
.gs-field--grow{ min-width: 240px; }

/* Desktop layout */
@media (min-width: 820px){
  .gs-form{
    /* State | Keyword | Clear(auto) | Sort | Search(auto) */
    grid-template-columns:
      minmax(200px, 1fr)
      minmax(260px, 1.4fr)
      auto
      minmax(180px, 1fr)
      auto;
    gap: 0.9rem 1rem;
    align-items: end;
  }

  .gs-actions{ grid-column: 1 / -1; }

  /* Give button columns a safe minimum */
  .gs-field--btn{ min-width: 110px; }
}

/* ---------- Status ---------- */
.gs-status{
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.35;
}
.gs-status--loading{ opacity: 0.85; }
.gs-status--error{ color: #b00020; }
.gs-status--empty{ color: #555; }

/* ---------- Results grid ---------- */
.gs-results{
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
@media (min-width: 768px){
  .gs-results{ grid-template-columns: 1fr 1fr; }
}



/* ---------- Results count / info line ---------- */
.gs-results-info{
  display: inline-block;
  margin: 0.25rem 0 0.9rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #e6e6e6;
  background: #fafafa;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0.95;
}





/* ---------- Cards ---------- */
.gs-card{
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.gs-card__title{
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.gs-card__agency{
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.35rem;
}

.gs-card__summary{
  font-size: 0.92rem;
  color: #222;
  margin: 0 0 0.6rem;
  line-height: 1.35;
}

/* Summary expand/collapse (used by JS) */
.gs-card__summary.is-expanded{
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* Toggle button under summary */
.gs-summary-toggle{
  align-self: flex-start;
  margin: -0.25rem 0 0.65rem;
  padding: 0;
  border: 0;
  background: none;
  color: #111;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.gs-summary-toggle:hover{ opacity: 0.85; }

/* ---------- Meta pills ---------- */
.gs-card__meta{
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.gs-pill{
  font-size: 0.75rem;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  border: 1px solid #d0d0d0;
  background: #fafafa;
  color: #222;
  white-space: nowrap;
}

/* Specific pill styles (used by JS) */
.gs-pill--amount{
  font-weight: 600;
  background: #f7f7ff;
  border-color: #cfcfff;
}
.gs-pill--deadline{
  font-weight: 600;
  background: #fff7f0;
  border-color: #ffd3b5;
}
.gs-pill--state{
  background: #f3fbf7;
  border-color: #bfe7d2;
}
.gs-pill--category{
  background: #f6f6f6;
  border-color: #dcdcdc;
}
.gs-pill--muted{
  opacity: 0.72;
  font-weight: 500;
  background: #fbfbfb;
  border-color: #e2e2e2;
}

/* ---------- Card actions ---------- */
.gs-card__actions{
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.gs-button{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  cursor: pointer;

  white-space: nowrap;
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease;
}

/* ✅ Touch feedback */
.gs-button:active{ transform: translateY(1px); }

/* ✅ Only apply hover styles on devices with real hover (desktop mouse/trackpad) */
@media (hover: hover) and (pointer: fine) {
  .gs-button:hover{ opacity: 0.92; }
}

/* Small */
.gs-button--small{
  display: inline-flex;
  font-size: 0.85rem;
  padding: 0.42rem 0.78rem;
  text-decoration: none;
}

/* Ghost */
.gs-button--ghost{
  background: #fff;
  color: #111;
  border: 1px solid #d6d6d6;
}

/* ✅ Touch devices won’t get “stuck hover” anymore */
@media (hover: hover) and (pointer: fine) {
  .gs-button--ghost:hover{ background: #f5f5f5; }
}

.gs-button--ghost:disabled{
  opacity: 0.55;
  cursor: not-allowed;
}

/* --- Clear button: theme-proof, never wrap / never squeeze --- */
.gs-field--btn{ min-width: 120px; } /* prevents narrow grid cell */
#gs-clear{
  white-space: nowrap;
  word-break: keep-all;
  min-width: 120px;
  width: auto;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Also safe if Clear is next to keyword in flex row */
.gs-input-row #gs-clear,
.gs-input-row .gs-button{
  flex: 0 0 auto;
}

/* Desktop: ensure Clear column has a real minimum */
@media (min-width: 820px){
  .gs-form{
    grid-template-columns:
      minmax(200px, 1fr)
      minmax(260px, 1.4fr)
      minmax(120px, max-content)
      minmax(180px, 1fr)
      auto;
  }
}

/* ---------- Accessibility: focus states ---------- */
.gs-field select:focus,
.gs-field input:focus,
.gs-button:focus,
.gs-button--small:focus,
.gs-summary-toggle:focus{
  outline: 2px solid rgba(0,0,0,0.25);
  outline-offset: 2px;
}

/* Tiny screens */
@media (max-width: 360px){
  .gs-input-row{
    flex-direction: column;
    align-items: stretch;
  }
  .gs-input-row .gs-button{
    width: 100%;
  }
}


/* ---------- Mobile sticky search action ---------- */
@media (max-width: 640px){
  .gs-actions{
    position: sticky;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(6px);
    padding: 0.6rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid #eee;
    z-index: 20;
  }

  .gs-actions .gs-button{
    width: 100%;
  }
}


