/* The store: the dataset grid, the cart, and the downloads a customer holds. Built on the same
   type and palette as the rest of the site — a shop that looks like the observatory it belongs to. */

/* The store keeps the shape customers know it by: the notes about the data run the full width as
   a list, the filters stand down the left, and the grid fills the rest. */
.store-page .store-intro {
  margin-bottom: 34px;
}
.store-page .store-intro ul {
  margin: 0;
  padding-left: 1.2em;
}
.store-page .store-intro li {
  margin-bottom: 8px;
}
.cart-page .prose {
  margin-bottom: 28px;
}

.store-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.store-side {
  position: sticky;
  top: 24px;
}
.filter-groups {
  border-bottom: 1px solid var(--line);
}
.filter-group {
  border-top: 1px solid var(--line);
}
.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 0;
  border: 0;
  background: none;
  color: var(--site-text);
  font: 15px var(--font-site);
  text-align: left;
  cursor: pointer;
}
.filter-head::after {
  content: "+";
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}
.filter-head[aria-expanded="true"]::after {
  content: "\2212";
}
.filter-group ul {
  margin: 0;
  padding: 0 0 16px;
  list-style: none;
}
.filter-group[data-open="false"] ul {
  display: none;
}
.filter-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
  color: var(--muted);
  font: 14px / 1.45 var(--font-site);
  cursor: pointer;
}
.filter-option input {
  width: 15px;
  height: 15px;
  min-height: 0;
  flex: none;
  margin: 3px 0 0;
  padding: 0;
  accent-color: var(--gold);
}
.filter-option:hover {
  color: var(--gold);
}
.filter-option:has(:checked) {
  color: var(--site-text);
}
#filters-clear {
  margin-top: 18px;
}

.store-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.store-tools select {
  width: auto;
  min-width: 200px;
  min-height: 0;
  height: auto;
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--site-text);
  font: 14px var(--font-site);
}
.count {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.store-notice {
  margin: 18px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-control);
  background: var(--panel);
  font-size: 15px;
}
.store-notice[data-tone="bad"] {
  border-left-color: var(--error);
  color: var(--error);
}

/* ── The grid ─────────────────────────────────────────────────────────────── */

.dataset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 0;
}
.dataset {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  overflow: hidden;
}
.dataset .shot {
  display: block;
  aspect-ratio: 4 / 3;
  background: #000;
}
.dataset .shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dataset-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 14px 15px 18px;
}
.dataset-body h3 {
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font: 400 15px / 1.4 var(--font-site);
}
.dataset-facts {
  display: grid;
  gap: 4px;
  margin: 0;
  font-size: 12px;
}
.dataset-facts > div {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 6px;
}
.dataset-facts dt {
  color: var(--muted);
}
.dataset-facts dd {
  margin: 0;
}
.dataset-buy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: auto;
  padding-top: 4px;
}
.price {
  margin: 0;
  font: 400 16px var(--font-site);
  font-variant-numeric: tabular-nums;
}
/* What it used to cost, kept beside what it costs now: the practice sets are the point of it. */
.price .was {
  margin-right: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-decoration: line-through;
}
.dataset-empty,
.cart-empty,
.downloads-empty {
  margin-top: 32px;
  color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.button {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--site-text);
  font: 600 14px var(--font-site);
  cursor: pointer;
}
.button:hover {
  border-color: var(--gold);
  color: var(--gold);
  text-decoration: none;
}
.button.gold {
  border-color: var(--gold);
  background: var(--gold);
  color: #1b1c17;
}
.button.gold:hover {
  background: var(--softgold);
  border-color: var(--softgold);
  color: #1b1c17;
}
.button[disabled] {
  opacity: 0.6;
  cursor: default;
}
.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 14px var(--font-site);
  text-decoration: underline;
  cursor: pointer;
}
.link:hover {
  color: var(--gold);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Cart ─────────────────────────────────────────────────────────────────── */

.cart-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 15px;
}
.cart-table th {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 600 12px var(--font-site);
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.cart-table td {
  padding: 16px 14px 16px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
}
.cart-item img {
  width: 84px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
}
.cart-title {
  margin: 0;
  font-weight: 600;
}
/* What a line carries besides the product: who a gift card is for, and what it says. */
.cart-property {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.cart-warn {
  margin: 4px 0 0;
  color: var(--error);
  font-size: 13px;
}
.cart-unit,
.cart-line-total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cart-line-total .saved {
  display: block;
  color: #3ddc6b;
  font-size: 13px;
}

/* The lines on the left, the bill on the right — where a shopper looks for the total. */
.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 40px;
  align-items: start;
  margin-top: 8px;
}
.cart-remove {
  margin-top: 6px;
  font-size: 13px;
}
.cart-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}
.cart-stepper button {
  width: 32px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--site-text);
  border: 0;
  font: 16px var(--font-site);
  cursor: pointer;
}
.cart-stepper button:disabled {
  opacity: 0.35;
  cursor: default;
}
.cart-stepper span {
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cart-line-total .line-tax {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.discount label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.discount-entry {
  display: flex;
  gap: 10px;
}
.discount-entry input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg);
  color: var(--site-text);
  font: 15px var(--font-site);
}
/* Codes are printed in capitals; a ZIP code has none, and its placeholder should not shout. */
#discount-code {
  text-transform: uppercase;
}
/* Apply and Update are different words; the same width keeps the two fields beside them level. */
.totals .discount-entry .button {
  flex: 0 0 92px;
  text-align: center;
}
.codes {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.codes li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.code-on {
  color: #3ddc6b;
}
.code-off {
  color: var(--error);
}

.totals {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  text-align: left;
}
.totals h2 {
  margin: 0 0 18px;
  font-size: 18px;
  text-align: left;
}
.totals .discount + .discount {
  margin-top: 16px;
}
.total-rows {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.total-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0;
  font-variant-numeric: tabular-nums;
}
.total-row.grand {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font: 600 19px var(--font-site);
}
.checkout {
  display: block;
  margin-top: 16px;
  text-align: center;
}

/* Below this the bill would squeeze the lines into columns too narrow to read; it goes under them. */
@media (max-width: 960px) {
  .cart-layout {
    /* minmax(0, …), not 1fr: a table wider than the screen would otherwise widen the column, and
       the bill with it, past the edge. */
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}
/* On a phone the unit price goes: the line total says what matters, and four columns do not fit. */
@media (max-width: 600px) {
  .cart-table th:nth-child(2),
  .cart-table .cart-unit {
    display: none;
  }
}

/* ── Downloads ────────────────────────────────────────────────────────────── */

.downloads-signin {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}
.downloads-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}
.grant {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
}
.grant.revoked {
  opacity: 0.6;
}
.grant h3 {
  margin: 0 0 6px;
  font: 600 17px var(--font-site);
}
.grant-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
/* The digest is here so a customer can check an 800 MB download that may have been interrupted. */
.grant-hash {
  margin: 6px 0 0;
  color: var(--muted);
  font: 11px var(--font-body);
  word-break: break-all;
}
.grant-actions {
  text-align: right;
}
.grant-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.claim {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.claim h2 {
  margin: 0 0 10px;
  font: 600 19px var(--font-site);
}
.claim p {
  max-width: 70ch;
  margin: 0 0 16px;
  color: var(--site-text);
}
.claim-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.claim-form input {
  flex: 1;
  min-width: 240px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg);
  color: var(--site-text);
  font: 15px var(--font-site);
}

@media (max-width: 1120px) {
  .dataset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  /* Narrow enough that a column of filters would take the screen: they lie across the top. */
  .store-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .store-side {
    position: static;
  }
  .filter-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 28px;
  }
  .dataset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .dataset-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .store-tools select {
    min-width: 0;
  }
  .cart-item img {
    width: 60px;
  }
  .grant {
    flex-direction: column;
    align-items: flex-start;
  }
  .grant-actions {
    text-align: left;
  }
}

/* ── One dataset's own page ───────────────────────────────────────────────── */

/* The picture at the size it deserves, and beside it everything the shop knows about what is in
   the file — the questions an imager asks before buying data. */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.detail-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: #000;
}
.detail-shot-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.detail-back {
  margin: 0 0 14px;
  font-size: 14px;
}
.detail-buy h1 {
  margin: 0 0 10px;
  font: 400 28px / 1.2 var(--font-site);
  text-align: left;
}
.detail-buy .price {
  margin: 0 0 22px;
  font-size: 22px;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.detail-blurb {
  margin: 22px 0;
  color: var(--muted);
}
.detail-facts {
  display: grid;
  margin: 0;
  font-size: 14px;
}
.detail-facts > div {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.detail-facts dt {
  color: var(--muted);
}
.detail-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.detail-hash {
  margin: 16px 0 0;
  color: var(--muted);
  font: 11px var(--font-body);
  word-break: break-all;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
}
.detail-tags a {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}
.detail-tags a:hover {
  border-color: var(--gold);
  color: var(--gold);
  text-decoration: none;
}
.dataset-body h3 a {
  color: inherit;
}
.dataset-body h3 a:hover {
  color: var(--gold);
  text-decoration: none;
}

@media (max-width: 860px) {
  .detail {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .detail-facts > div {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 12px;
  }
}

/* Search and sort sit together above the grid, on the right. */
.store-tools-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.store-tools input[type="search"] {
  width: 230px;
  min-height: 0;
  height: auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--site-text);
  font: 14px var(--font-site);
}
.store-tools input[type="search"]::placeholder {
  color: var(--muted);
}
.store-tools input[type="search"]:focus-visible {
  border-color: var(--gold);
  outline: none;
}

@media (max-width: 620px) {
  .store-tools {
    flex-wrap: wrap;
  }
  .store-tools-right {
    flex: 1;
    flex-wrap: wrap;
  }
  .store-tools input[type="search"] {
    width: 100%;
  }
}
