/*
 * The catalog: one block of Alga Crater as a picture with 256 links on it.
 *
 * Its own file because Propshaft's `stylesheet_link_tag :app` includes every
 * stylesheet in this directory; application.css holds what every page shares.
 *
 * The tiles have no body of their own -- they are transparent squares over the
 * orbital image -- so everything that tells a reader which parcel they are on
 * is done here: a status tint, a hover fill, and a focus outline.
 */

.catalog__header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.catalog__eyebrow {
  color: var(--ink-muted);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

.catalog__title {
  margin-bottom: 0.75rem;
}

.catalog__buying {
  margin-top: 1.25rem;
}

.catalog__price {
  margin: 0 0 0.75rem;
}

.catalog h2 {
  font-size: 1.35rem;
}

.catalog__block,
.catalog__locators,
.catalog__directory {
  margin-bottom: 3rem;
}

.catalog__block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

/* --- The legend, which is also the count ----------------------------------- */

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.status-legend__item {
  align-items: center;
  display: flex;
  font-size: 0.9rem;
  gap: 0.45rem;
}

.status-legend__swatch {
  border-radius: 2px;
  display: inline-block;
  height: 0.85rem;
  width: 0.85rem;
}

.status-legend__count {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* One declaration of each status colour, used by the swatch and the tile, so a
   legend cannot come to describe a tint the grid no longer uses. */
:root {
  /* Available is deliberately colourless. It is 247 of the 256 tiles here, and
     any hue at that coverage tints the whole block -- a green wash over Mars,
     on a page whose claim is that you are looking at the ground itself. Held
     and company held are the exceptions and carry the colour; unsold ground
     just gets a boundary. */
  --status-available-line: rgba(242, 236, 231, 0.32);
  --status-available-fill: rgba(242, 236, 231, 0.04);
  --status-held-line: rgba(226, 122, 76, 0.9);
  --status-held-fill: rgba(193, 85, 43, 0.42);
  --status-company-held-line: rgba(216, 161, 92, 0.95);
  --status-company-held-fill: rgba(216, 161, 92, 0.4);
}

.status-legend__item--available .status-legend__swatch {
  background: var(--status-available-fill);
  box-shadow: inset 0 0 0 1px var(--status-available-line);
}

.status-legend__item--held .status-legend__swatch {
  background: var(--status-held-fill);
  box-shadow: inset 0 0 0 1px var(--status-held-line);
}

/* Held and company-held are close in hue, so company-held ground is also
   hatched: the two are told apart by pattern as well as by colour. */
.status-legend__item--company-held .status-legend__swatch,
.parcel-tile--company-held {
  background-image: repeating-linear-gradient(
    45deg,
    var(--status-company-held-line) 0 1.5px,
    transparent 1.5px 5px
  );
}

.status-legend__item--company-held .status-legend__swatch {
  background-color: var(--status-company-held-fill);
  box-shadow: inset 0 0 0 1px var(--status-company-held-line);
}

/* A visible way past the grid: to the keyboard it is 256 links, and to a
   thumb each one is a sixteenth of the screen. */
.catalog__to-list {
  font-size: 0.9rem;
  font-weight: 600;
}

.catalog__filter {
  font-size: 0.95rem;
  margin: 0.75rem 0 0;
}

.catalog__filter a {
  font-weight: 600;
  margin-left: 0.4rem;
}

#directory-heading {
  scroll-margin-top: 1rem;
}

#directory-heading:focus {
  outline: none;
}

/* --- The block image and the 256 tiles over it ----------------------------- */

.block-figure {
  margin: 0;
}

.block-figure__caption,
.catalog-figure__caption,
.catalog__directory-note,
.catalog__no-imagery {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-top: 0.6rem;
}

.parcel-grid {
  position: relative;
  line-height: 0;
}

.parcel-grid__image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-raised);
}

.parcel-tile {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 1px;
  text-decoration: none;
}

.parcel-tile--available {
  background: var(--status-available-fill);
  border-color: var(--status-available-line);
}

.parcel-tile--held {
  background: var(--status-held-fill);
  border-color: var(--status-held-line);
}

.parcel-tile--company-held {
  background-color: var(--status-company-held-fill);
  border-color: var(--status-company-held-line);
}

.parcel-tile:hover {
  background: rgba(242, 236, 231, 0.28);
  border-color: var(--ink);
  z-index: 2;
}

/* Styled on :focus rather than :focus-visible on purpose. A tile has no visible
   body, so the outline is the only thing that says which parcel is selected --
   and a visitor who clicked one and then reached for the keyboard has as much
   need of that as one who tabbed in. */
.parcel-tile:focus {
  outline: 3px solid var(--sand);
  outline-offset: 1px;
  z-index: 3;
}

/* --- Locators -------------------------------------------------------------- */

.catalog__locator-pair {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 44rem) {
  .catalog__locator-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.catalog-figure {
  margin: 0;
}

.catalog-figure__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-raised);
}

/* --- The directory --------------------------------------------------------- */

.directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 0 2rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.directory__entry {
  border-bottom: 1px solid var(--border);
}

.directory__link {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem;
  color: var(--ink);
  text-decoration: none;
}

.directory__link:hover,
.directory__link:focus {
  background: var(--surface-raised);
  color: var(--sand);
}

.directory__address {
  flex: 1 1 auto;
  font-variant-numeric: tabular-nums;
}

/* Set in the case PRD R36 spells them. A status is three specific words, and
   uppercasing them makes the page say something slightly different from what
   the registry says. */
.directory__status {
  color: var(--ink-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.directory__status--held,
.directory__status--company-held {
  color: var(--sand);
}

.directory__price {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Nothing imported yet -------------------------------------------------- */

.catalog__empty {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
}

.catalog__empty p {
  margin-bottom: 0;
}

.catalog__empty code {
  background: var(--surface-raised);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
}
