/* ==========================================================================
   Rambler Disc Golf — the store
   The store page and the disc pages. Loaded on those pages only.

   Kept out of style.css so that file stays byte-identical to the static site.
   Every colour, size and space here comes from the tokens in style.css;
   nothing new is introduced.

   Sections: 1 Filter bar · 2 Disc grid & card · 3 Flight numbers
             4 Disc page · 5 Pagination & empty states · 6 Responsive
   ========================================================================== */

/* The four flight numbers always wear the same four pastels, so they read as
   a key you learn once: speed, glide, turn, fade. */
.f-speed { --f: var(--mint); }
.f-glide { --f: var(--sky); }
.f-turn  { --f: var(--lilac); }
.f-fade  { --f: var(--peach); }

/* 1 ── Filter bar ------------------------------------------------------- */
.store-head { margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem); }

.store-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
  padding-block: var(--sp-2);
  border-block: 1px solid var(--line);
}

.store-types ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.chip:hover { color: var(--paper); border-color: var(--paper); }
.chip[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.chip-count {
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  opacity: .72;
}

.store-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* A select with the site's own chevron. The arrow is a mask so it takes a
   token colour rather than a hex baked into an SVG. */
.select { position: relative; display: inline-block; }
.select select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.5rem 2.2rem 0.5rem 0.95rem;
  background: var(--ink-900);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--paper);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.select select:hover { border-color: var(--paper); }
.select select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.select::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  pointer-events: none;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M5 9l7 7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M5 9l7 7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
}

.store-count {
  margin-block: var(--sp-3);
  font-size: var(--step--1);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* 2 ── Disc grid & card ------------------------------------------------- */
.disc-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: clamp(1rem, 2.4vw, 1.75rem);
}
.disc-grid > li { display: flex; }

.disc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}
.section-raised .disc-card { background: var(--surface-2); }
.disc-card:hover,
.disc-card:focus-within {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.disc-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.section-raised .disc-card-media { background: var(--ink-600); }
.disc-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.disc-card-media .ph {
  height: 100%;
  border: 0;
  border-radius: 0;
}
.disc-card-media .ph-label { font-size: 0.86rem; }
.is-sold-out .disc-card-media img { opacity: .5; filter: grayscale(.5); }

.disc-card-tag {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  background: color-mix(in srgb, var(--ink-900) 80%, transparent);
  color: var(--paper);
}

.disc-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  padding: 0.95rem 1.05rem 1.05rem;
}

.disc-card-kicker {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.disc-card-title {
  font-size: var(--step-1);
  line-height: 1.2;
}
.disc-card-title a {
  color: inherit;
  text-decoration: none;
}
/* The whole card is the link's hit area. */
.disc-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.disc-card-title a:focus-visible { outline: none; }
.disc-card:has(a:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.disc-card-spec { font-size: 0.86rem; color: var(--muted); }

.disc-card-foot {
  margin-top: auto;
  padding-top: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.price {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}
.price-was {
  color: var(--faint);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
.disc-card-price { line-height: 1.2; }
.disc-card-price .price { font-size: 1.08rem; }

/* 3 ── Flight numbers ---------------------------------------------------- */
/* Compact, on a card: 12 | 5 | −1 | 3 */
.flight-line {
  display: flex;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.flight-line > span { color: var(--f); padding-inline: 0.45rem; }
.flight-line > span:first-child { padding-left: 0; }
.flight-line > span + span { border-left: 1px solid var(--line-strong); }

/* Full panel, on a disc page */
.flight {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: var(--sp-4);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.flight > div {
  background: var(--surface);
  padding: 0.95rem 0.5rem 1rem;
  text-align: center;
  box-shadow: inset 0 3px 0 var(--f);
}
.flight dt {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.flight dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1.1;
  color: var(--f);
  font-variant-numeric: tabular-nums;
}

/* 4 ── Disc page --------------------------------------------------------- */
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  font-size: var(--step--1);
  color: var(--faint);
}
.crumbs li + li::before { content: "/"; margin-right: 0.4rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--paper); }
.crumbs [aria-current] { color: var(--paper); }

.disc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.disc-photo {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.disc-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.disc-photo .ph { height: 100%; border: 0; border-radius: 0; }

.disc-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
  list-style: none;
  padding: 0;
}
.disc-thumbs a {
  display: block;
  width: 76px;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color .16s ease;
}
.disc-thumbs a:hover { border-color: var(--line-strong); }
.disc-thumbs a[aria-current="true"] { border-color: var(--accent); }
.disc-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.disc-info h1 { font-size: var(--step-5); }
.disc-spec { margin-top: 0.65rem; color: var(--muted); font-size: var(--step-1); }

.disc-price {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: var(--sp-3);
}
.disc-price .price { font-size: var(--step-3); }
.disc-price .status { letter-spacing: 0.06em; }

.disc-tax {
  margin-top: 0.35rem;
  font-size: var(--step--1);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.disc-stock-note {
  margin-top: 0.75rem;
  font-size: 0.98rem;
  color: var(--muted);
}

.disc-buy { margin-top: var(--sp-4); }
p.disc-buy { font-size: 0.98rem; }

.disc-desc {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.more-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.more-head h2 { font-size: var(--step-3); }

/* 5 ── Pagination & empty states ---------------------------------------- */
.pagination { margin-top: var(--sp-5); }
.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 2.6rem;
  height: 2.6rem;
  padding-inline: 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color .16s ease, border-color .16s ease;
}
a.page-numbers:hover { color: var(--paper); border-color: var(--paper); }
.page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.page-numbers.dots { border-color: transparent; }

.store-empty {
  margin-top: var(--sp-3);
  padding: clamp(2rem, 6vw, 3.5rem) var(--sp-3);
  text-align: center;
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius);
  color: var(--muted);
}

/* 6 ── Responsive -------------------------------------------------------- */
@media (max-width: 860px) {
  .disc-layout { grid-template-columns: 1fr; }
  .disc-media { max-width: 560px; }
}

@media (max-width: 720px) {
  /* Two across on a phone, as shoppers expect. */
  .disc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .disc-card-body { padding: 0.75rem 0.8rem 0.85rem; }
  .disc-card-title { font-size: 1.05rem; }
  .flight-line { font-size: 0.82rem; }
  .flight-line > span { padding-inline: 0.32rem; }
  .flight dd { font-size: var(--step-2); }
  .store-bar { align-items: stretch; }
  /* One swipeable row of types rather than three wrapped rows. It scrolls
     inside the page gutter, so the page itself never scrolls sideways. */
  .store-types {
    width: auto;
    margin-inline: calc(-1 * clamp(1.15rem, 4vw, 2.5rem));
    overflow-x: auto;
    scrollbar-width: none;
  }
  .store-types::-webkit-scrollbar { display: none; }
  .store-types ul {
    flex-wrap: nowrap;
    padding-inline: clamp(1.15rem, 4vw, 2.5rem);
  }
}

@media (max-width: 360px) {
  .disc-grid { grid-template-columns: 1fr; }
}
