/**
 * @file
 * Where to Buy store locator. Brand palette matches the Almanaco theme:
 *   brick red #ad2a24 / hover #8b221e, ink #181616, muted #595974,
 *   border #dedad3, garden green #7e9460, kids tan #e2d6bb.
 */

.wtb-form {
  /* Fixed, responsive column: full width up to the cap, so it doesn't reflow
     when the (wide) results replace the narrow search pane. */
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding-top: 1.5rem;
  padding-bottom: 4rem;
  color: #181616;
}

/* --- Intro ---------------------------------------------------------------- */
.wtb-intro {
  margin-bottom: 2rem;
}

.wtb-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ad2a24;
}

.wtb-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.15;
  color: #595974;
}

.wtb-title__brand {
  color: #181616;
  font-style: italic;
  text-decoration: none;
}

.wtb-lede {
  max-width: 42ch;
  margin: 0;
  color: #595974;
}

/* --- Search card ---------------------------------------------------------- */
.wtb-card-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: start;
  max-width: 380px;
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  border: 1px solid #dedad3;
  background: #fff;
}

/* Let the label / input / description flow into the card grid. */
.wtb-card-search .form-item {
  display: contents;
}

.wtb-card-search .form-item__label,
.wtb-card-search label {
  grid-column: 1 / -1;
  grid-row: 1;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #595974;
}

.wtb-card-search input[type="text"] {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #dedad3;
  border-radius: 0;
}

.wtb-card-search .form-item__description,
.wtb-card-search .description {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  font-size: 0.75rem;
  color: #595974;
}

.wtb-card-search .form-actions {
  grid-column: 2;
  grid-row: 2;
  align-self: stretch;
  margin: 0;
}

.wtb-card-search .form-actions .button,
.wtb-card-search .form-actions input[type="submit"] {
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #ad2a24;
  border: 1px solid #ad2a24;
  border-radius: 0;
  cursor: pointer;
}

.wtb-card-search .form-actions .button:hover,
.wtb-card-search .form-actions input[type="submit"]:hover {
  background: #8b221e;
  border-color: #8b221e;
}

/* --- Results header + toolbar --------------------------------------------- */
.wtb-results__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dedad3;
}

.wtb-results__title {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  color: #181616;
}

.wtb-results__count {
  flex: none;
  font-size: 0.85rem;
  color: #595974;
}

.wtb-results__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}

.wtb-sortby {
  padding: 0.35rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #595974;
  background: #f2efe9;
}

.wtb-sort {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  color: #181616;
  background: #fff;
  border: 1px solid #dedad3;
  border-radius: 0;
}

/* --- Card grid ------------------------------------------------------------ */
.wtb-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.wtb-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #dedad3;
}

.wtb-card[hidden] {
  display: none;
}

.wtb-card--featured {
  position: relative;
  grid-column: 1 / -1;
  /* Uniform padding (Harshad); the absolute Nearest tab clears the name via
     the name's own top margin, so no extra top padding is needed. */
  border-left: 4px solid #ad2a24;
  overflow: hidden;
}

.wtb-card__name {
  margin: 0.4rem 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #181616;
}

.wtb-card__addr {
  margin: 0;
  font-size: 0.9rem;
  color: #595974;
}

/* --- Badges --------------------------------------------------------------- */
.wtb-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.wtb-badge {
  padding: 0.44rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  border-radius: 5px;
}

.wtb-badge--almanac {
  color: #ad2a24;
  background: #fbf1f0;
  border: 1px solid #ad2a24;
}

.wtb-badge--garden {
  color: #7e9460;
  background: #f3f6ef;
  border: 1px solid #7e9460;
}

.wtb-badge--kids {
  color: #a67c2e;
  background: #fbf6e9;
  border: 1px solid #a67c2e;
}

/* Sits as a tab hanging off the top-left of the featured card. */
.wtb-badge--nearest {
  position: absolute;
  top: 0;
  left: 1.5rem;
  padding: 0.44rem 0.94rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  border-radius: 0 0 5px 5px;
  color: #fff;
  background: #8b221e;
}

/* --- Card meta (distance + directions) ------------------------------------ */
.wtb-card__meta {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  text-align: right;
  /* Vertical divider between the store details and the meta column. */
  padding-left: 1.5rem;
  border-left: 1px solid #dedad3;
}

.wtb-card__dist {
  margin: 0;
  font-size: 0.8rem;
  color: #595974;
}

.wtb-card__dist strong {
  font-size: 1.5rem;
  color: #181616;
}

.wtb-card__dir {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ad2a24;
  text-decoration: none;
}

.wtb-card__dir:hover {
  text-decoration: underline;
}

.wtb-card__dir svg {
  width: 0.85em;
  height: 0.85em;
  fill: currentColor;
}

/* --- Footer note + load more ---------------------------------------------- */
.wtb-note {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: #595974;
}

.wtb-more {
  margin-top: 1rem;
  text-align: center;
}

.wtb-more__status {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: #595974;
}

.wtb-progress {
  max-width: 420px;
  height: 4px;
  margin: 0 auto 0.75rem;
  background: #e9e5dc;
}

.wtb-progress__bar {
  display: block;
  height: 100%;
  background: #ad2a24;
  transition: width 0.3s ease;
}

.wtb-more__btn {
  padding: 0.6rem 1.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ad2a24;
  background: transparent;
  border: 1px solid #ad2a24;
  border-radius: 0;
  cursor: pointer;
}

.wtb-more__btn:hover {
  color: #fff;
  background: #ad2a24;
}

.wtb-empty {
  padding: 1rem 0;
  color: #595974;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 640px) {
  .wtb-grid {
    grid-template-columns: 1fr;
  }

  .wtb-card--featured {
    grid-column: auto;
  }

  /* Stack the meta below the details; the divider becomes horizontal. */
  .wtb-card {
    flex-direction: column;
    align-items: stretch;
  }

  .wtb-card__meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-left: 0;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-left: 0;
    border-top: 1px solid #dedad3;
    text-align: left;
  }
}
