/*
 * /shells. The collection is laid out the way a shell collector keeps one: a tray of small square compartments
 * divided by hairlines, each holding one identity with its number and name underneath. A compartment is dim
 * until its shell exists, carries its price when it is for sale, and a corner of light when it is yours.
 * Colour, type and spacing come from /site/tokens.css only; the quiet tone, the rules and the focus ring are
 * the ones module.css names for the surface something is set on.
 */

/* ---------------------------------------------------------------------------------------------------------
   Mint: a real sequence, so it is numbered
   --------------------------------------------------------------------------------------------------------- */

.mint {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(15rem, 0.7fr);
  gap: var(--space-7);
  align-items: start;
}

/* A statement above the steps keeps clear of the first of them. */
.mint .notice {
  margin-bottom: var(--space-5);
}

.steps {
  display: grid;
  counter-reset: step;
}

.step {
  counter-increment: step;
  display: grid;
  grid-template-columns: var(--target) minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  padding-block: var(--space-5);
  border-top: 1px solid var(--line);
}

.step:first-child {
  border-top: 0;
  padding-top: 0;
}

/* The step's number. Still to come: a hairline ring. Done: a firm ring. Now: filled, the one that counts. */
.step::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: var(--target);
  height: var(--target);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--quiet);
}

.step[data-state='done']::before {
  border: 2px solid var(--ink);
  color: var(--ink);
}

.step[data-state='now']::before {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--field);
}

.step-body {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
  align-content: start;
  min-height: var(--target);
}

.step-body h3 {
  padding-top: calc((var(--target) - 1.3em) / 2);
  line-height: 1.3;
}

.step[data-state='later'] .step-body {
  color: var(--quiet);
}

.step-state {
  font-size: var(--text-s);
  font-weight: 500;
}

.step .button-row {
  margin-top: var(--space-2);
}

/* The terms of a mint: a ruled list, the way evidence is set everywhere on the site. Not a card. */
.terms-card {
  border-top: 2px solid currentColor;
  font-size: 1rem;
  line-height: 1.4;
}

.terms-card dl > div {
  padding: var(--space-2) 0 var(--space-3);
  border-bottom: 1px solid var(--line);
}

.terms-card dt {
  font-size: var(--text-s);
  color: var(--quiet);
}

.terms-card dd {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ---------------------------------------------------------------------------------------------------------
   The tray
   --------------------------------------------------------------------------------------------------------- */

.tray-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-4);
}

.filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter .button {
  padding-inline: var(--space-4);
  font-weight: 400;
}

.filter .button[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--field);
  font-weight: 600;
}

.tray {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.cell {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: grid;
  gap: var(--space-1);
  align-content: start;
  justify-items: start;
  margin: 0;
  padding: var(--space-3);
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--text-s);
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.cell:hover {
  background: var(--track);
}

.cell:focus-visible {
  outline-offset: -3px;
  border-radius: 0;
  z-index: 1;
}

.cell-art {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  margin-bottom: var(--space-2);
  object-fit: contain;
}

/* No picture to show: the identity's number in the picture's place, so the tray keeps its shape. */
.art-missing {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: var(--text-l);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--quiet);
}

.cell-name {
  font-weight: 600;
}

.cell-number {
  font-variant-numeric: tabular-nums;
  color: var(--quiet);
}

.cell-state {
  font-variant-numeric: tabular-nums;
  color: var(--quiet);
}

/* Not minted yet: the picture is there to be recognised, set back. The words under it say so in full. */
.cell[data-state='free'] .cell-art {
  opacity: 0.4;
}

/* For sale: the price, at full strength. */
.cell[data-state='listed'] .cell-state {
  color: var(--ink);
  font-weight: 600;
}

/* Yours: a corner of light, and the word. */
.cell[data-mine='true']::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 var(--space-5) var(--space-5) 0;
  border-color: transparent var(--light) transparent transparent;
}

.cell[data-mine='true'] .cell-state {
  color: var(--ink);
  font-weight: 500;
}

.tray-more {
  margin-top: var(--space-5);
}

.panel > h2 {
  margin-bottom: var(--space-4);
}

/* ---------------------------------------------------------------------------------------------------------
   One shell, in a sheet
   --------------------------------------------------------------------------------------------------------- */

.specimen {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.specimen-art {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  padding: var(--space-3);
  background: var(--field);
  border-radius: var(--radius);
  object-fit: contain;
}

.specimen dl {
  display: grid;
  gap: var(--space-3);
}

.specimen dt {
  font-size: var(--text-s);
  color: var(--quiet);
}

.specimen dd {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------------------------------------
   Rewards and history: rows of evidence
   --------------------------------------------------------------------------------------------------------- */

.rewards {
  display: grid;
  gap: var(--space-4);
  max-width: 44rem;
  margin-bottom: var(--space-7);
}

.rows {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;
}

.rows th,
.rows td {
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: baseline;
}

.rows th {
  font-weight: 400;
  color: var(--quiet);
}

.rows .amount {
  text-align: right;
  padding-right: 0;
  white-space: nowrap;
}

.rows tfoot td {
  border-bottom: 0;
  font-weight: 600;
}

.history {
  display: grid;
  max-width: 52rem;
}

.history li {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) max-content;
  gap: var(--space-1) var(--space-4);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-s);
  align-items: baseline;
}

.history time {
  color: var(--quiet);
}

.history .what strong {
  font-weight: 600;
}

.history .tx {
  justify-self: end;
}

@media (max-width: 800px) {
  .mint {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }
}

/* Beside the sand the page's column is narrower than the window, so the two columns close up. */
@media (min-width: 1280px) and (min-height: 560px) {
  .mint {
    gap: var(--space-6);
  }
}

@media (max-width: 700px) {
  .tray {
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
    margin-inline: calc(-1 * var(--gutter));
    border-left: 0;
  }

  .specimen {
    grid-template-columns: minmax(0, 1fr);
  }

  .specimen-art {
    max-width: 12rem;
  }

  .history li {
    grid-template-columns: minmax(0, 1fr) max-content;
  }

  .history time {
    grid-column: 1 / -1;
  }
}
