/* ============================================================================
   STORES AND REVIEWS (Phase 15)
   ============================================================================
   Tokens only. No colour, font, spacing step or breakpoint is invented here:
   the store directory is part of the same shop as the catalog, and a page that
   introduces its own scale reads as somebody else's work.

   The open/closed badge is the one place worth pointing at. It carries a dot in
   a state colour *and* the words "Open now" or "Closed", because a badge whose
   only difference is green or grey says nothing to a reader who cannot tell
   those apart, and nothing at all to a screen reader.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   Directory
   --------------------------------------------------------------------------- */

.store-fulfillment {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.store-fulfillment__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.store-fulfillment__item .icon {
  flex: none;
  margin-top: 0.15em;
  color: var(--color-primary);
}

.store-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .store-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.store-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.store-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.store-card__name {
  font-size: var(--text-xl);
  line-height: 1.3;
  margin: 0;
}

.store-card__name a {
  color: inherit;
  text-decoration: none;
}

.store-card__name a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.store-card__address,
.store-card__today {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.store-card__services {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.store-card__services li {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill, 999px);
  background: var(--color-surface-sunken);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.store-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
}

.store-card__pickup {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-success);
}

.store-card__pickup .icon { flex: none; }

.store-demo {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-info-bg);
  border: var(--border-width) solid var(--color-info-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.store-demo .icon { flex: none; margin-top: 0.15em; color: var(--color-info); }

/* ---------------------------------------------------------------------------
   Open / closed
   --------------------------------------------------------------------------- */

.store-state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  font-weight: 600;
}

.store-state__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex: none;
  background: var(--color-text-subtle);
}

.store-state--open              { color: var(--color-success); }
.store-state--open .store-state__dot { background: var(--color-success); }

.store-state--closed            { color: var(--color-text-muted); }
.store-state--unknown           { color: var(--color-text-subtle); font-weight: 500; }

.store-state__until {
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ---------------------------------------------------------------------------
   Store detail
   --------------------------------------------------------------------------- */

.store-detail__head {
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}

.store-detail__grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .store-detail__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.store-panel {
  padding: var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.store-panel__title {
  font-size: var(--text-lg);
  margin: 0 0 var(--space-3);
}

.store-panel__body {
  line-height: 1.7;
  color: var(--color-text-muted);
}

.store-panel__line {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.store-panel__line .icon { flex: none; margin-top: 0.15em; color: var(--color-primary); }

.store-links {
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.store-hours {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.store-hours th,
.store-hours td {
  padding: var(--space-2) 0;
  text-align: start;
  border-bottom: var(--border-width) solid var(--color-border);
  font-weight: 400;
  color: var(--color-text-muted);
}

.store-hours td { text-align: end; }

.store-hours tr:last-child th,
.store-hours tr:last-child td { border-bottom: 0; }

.store-hours tr.is-today th,
.store-hours tr.is-today td {
  color: var(--color-text-strong);
  font-weight: 600;
}

.store-hours__today {
  margin-inline-start: var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill, 999px);
  background: var(--color-accent-subtle);
  color: var(--color-on-accent);
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.store-services {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.store-services li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.store-services .icon { flex: none; color: var(--color-success); }

/* ---------------------------------------------------------------------------
   Reviews
   --------------------------------------------------------------------------- */

.reviews__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.reviews__title {
  font-size: var(--text-2xl);
  margin: 0;
}

.reviews__summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.reviews__empty,
.reviews__closed {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.reviews__closed {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--color-border);
}

.reviews__demo {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-info-bg);
  border: var(--border-width) solid var(--color-info-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.reviews__demo .icon { flex: none; margin-top: 0.15em; color: var(--color-info); }

.reviews__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .reviews__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.review {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.review__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.review__title {
  font-family: var(--font-heading);
  font-weight: 600;
}

.review__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.review__author { font-weight: 600; }

.review__comment {
  color: var(--color-text);
  line-height: 1.65;
}

.review__badge {
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill, 999px);
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.review__badge--verified {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* Deliberately not subtle. A seeded testimonial must never be mistaken for a
   customer's, and a label nobody notices is the same as no label. */
.review__badge--demo {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: var(--border-width) solid var(--color-info-border);
}

.review__reply {
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-inline-start: 3px solid var(--color-accent);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.review__reply-label {
  font-weight: 700;
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-1);
}

/* ---------------------------------------------------------------------------
   Stars
   ---------------------------------------------------------------------------
   Decoration. The accessible name on the wrapper carries the rating, and the
   glyphs are hidden, so nobody hears "star star star" and learns nothing.
   --------------------------------------------------------------------------- */

.stars {
  display: inline-flex;
  gap: 0.05em;
  line-height: 1;
  font-size: var(--text-base);
}

.stars__star { color: var(--color-border-strong); }
.stars__star--full { color: var(--color-accent); }

/* A half star: the accent colour clipped to the left half of the glyph, with
   the muted colour showing through the rest. */
.stars__star--half {
  background: linear-gradient(90deg, var(--color-accent) 50%, var(--color-border-strong) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stars__text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Write a review (product page)
   -------------------------------------------------------------------------- */
.review-form {
  margin-top: var(--space-8);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
}
.review-form__title { margin: 0 0 var(--space-4); font-size: var(--text-xl); }
.review-form__summary { list-style: none; cursor: pointer; width: fit-content; }
.review-form__summary::-webkit-details-marker { display: none; }
.review-form[open] > .review-form__summary { margin-bottom: var(--space-4); }
.review-form:not([open]) { padding: 0; border: 0; background: none; box-shadow: none; }
.review-form__form { display: grid; gap: var(--space-4); }
.review-form__row { display: grid; gap: var(--space-4); }
@media (min-width: 720px) { .review-form__row { grid-template-columns: 1fr 1fr; } }
.review-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.review-form__sent {
  display: flex; gap: var(--space-2); align-items: center;
  margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); background: #DCF7E8; color: #065F46; font-weight: var(--weight-semibold);
}
.review-form__stars { border: 0; margin: 0; padding: 0; }

/* Five radios, right to left, so "this star and every one before it" is a sibling selector. */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { cursor: pointer; line-height: 0; }
.star-input svg { width: 2rem; height: 2rem; fill: #E5E7EB; transition: fill .12s ease, transform .12s ease; }
.star-input label:hover svg,
.star-input label:hover ~ label svg,
.star-input input:checked ~ label svg { fill: var(--color-accent, #FDC300); }
.star-input label:hover svg { transform: scale(1.12); }
.star-input input:focus-visible + label svg { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }
