/* /rare/{slug}/download/: the furni's asset pack as one card in the
   room idiom. A stage the width of the card: a wall strip with the
   classname plate, the category chip, the file count and the Download
   button, over the rare's own iso floor (lib/rare_page.php stage markup)
   with the furni at its home zoom and its name on a plaque at the foot.
   Then one shelf per render state: wall plate, file count, and every PNG
   standing on the floor with its filename on a plaque and its kind, size
   and direction on hover. API and manifest share the last row. Plates
   and the hover tip are dark in both themes, like the site header. */

.rare-dl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rare-dl-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.rare-dl-tools .btn {
  height: 2rem;
  min-height: 0;
  padding-block: 0;
  white-space: nowrap;
}

.rare-dl-room {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding: 0.9rem;
}

.rare-dl-stage-room,
.rare-dl-shelf {
  --rare-dl-line: color-mix(in srgb, var(--fg) 14%, transparent);
  position: relative;
  min-width: 0;
  border-radius: 6px;
  border: 1px solid var(--control-border);
  background-color: var(--stage-floor);
  background-image:
    linear-gradient(26.57deg, transparent 49.4%, var(--rare-dl-line) 49.4% 50.6%, transparent 50.6%),
    linear-gradient(-26.57deg, transparent 49.4%, var(--rare-dl-line) 49.4% 50.6%, transparent 50.6%);
  background-size: 32px 16px, 32px 16px;
  overflow: hidden;
}

.rare-dl-wall,
.rare-dl-shelf-wall {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0 0.6rem;
  background: color-mix(in srgb, var(--fg) 7%, var(--control-bg));
  border-bottom: 2px solid rgba(0, 0, 0, 0.28);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
}

.rare-dl-wall {
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  min-height: 40px;
  padding-block: 0.3rem;
}

.rare-dl-shelf-wall {
  justify-content: space-between;
  height: 24px;
}

.rare-dl-plate {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 1 auto;
  height: 17px;
  min-width: 0;
  margin: 0;
  padding: 0 0.5rem;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #1e242c;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  color: #e8eef4;
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-font-smoothing: none;
}

.rare-dl-plate--code {
  text-transform: none;
  letter-spacing: 0.03em;
}

.rare-dl-chip {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--control-border);
  background: var(--content-box-bg);
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  -webkit-font-smoothing: none;
}

.rare-dl-wall-count {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.66rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-font-smoothing: none;
}

.rare-dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 1.8rem;
  padding-inline: 0.75rem;
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 0.72rem;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.rare-dl-btn-icon {
  flex: 0 0 auto;
}

/* The floor holds the shared rare stage, pinned to fill it, with the
   name plaque over its foot. */
.rare-dl-floor {
  position: relative;
  height: 16rem;
}

.rare-dl-stage.rare-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  min-height: 0;
  height: auto;
  padding: 0.35rem 0.35rem 2.4rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
  touch-action: auto;
}

.rare-dl-stage .rare-stage-frame {
  min-height: 100%;
  height: 100%;
}

.rare-dl-stage .rare-stage-stack,
.rare-dl-stage .rare-stage-image {
  cursor: default;
  pointer-events: none;
  touch-action: auto;
}

.rare-dl-name {
  position: absolute;
  left: 50%;
  bottom: 0.8rem;
  z-index: 2;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: 0.15rem 0.8rem;
  border-radius: 3px;
  border: 1px solid var(--control-border);
  background: var(--content-box-bg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  color: var(--fg);
  font-size: 1.15rem;
  line-height: 1.3;
  text-align: center;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.rare-dl-more {
  flex: 0 0 auto;
  font-size: 0.62rem;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  -webkit-font-smoothing: none;
}

/* Shelves: the PNGs as stands. */
.rare-dl-shelf-floor {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.4rem 0;
  margin: 0;
  padding: 0.6rem 0.3rem 0.5rem;
  list-style: none;
}

.rare-dl-stand {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.rare-dl-asset {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
}

.rare-dl-asset:hover,
.rare-dl-asset:focus-visible {
  text-decoration: none;
}

.rare-dl-asset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.rare-dl-thumb {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
}

.rare-dl-thumb img {
  width: auto;
  height: auto;
  max-width: 52px;
  max-height: 52px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.3));
}

.rare-dl-thumb--shadow img {
  opacity: 0.85;
}

.rare-dl-asset:hover .rare-dl-thumb img,
.rare-dl-asset:focus-visible .rare-dl-thumb img {
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.3)) drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 90%, transparent));
}

.rare-dl-plaque {
  max-width: 100%;
  margin-top: -2px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--control-border);
  background: var(--content-box-bg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  font-size: 0.58rem;
  line-height: 1.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-font-smoothing: none;
}

.rare-dl-tip {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: #1e242c;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 0.62rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.rare-dl-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: #1e242c;
  border-bottom: 0;
}

.rare-dl-stand:first-child .rare-dl-tip {
  left: 0;
  transform: none;
}

.rare-dl-stand:first-child .rare-dl-tip::after {
  left: 18px;
}

.rare-dl-stand:last-child .rare-dl-tip {
  left: auto;
  right: 0;
  transform: none;
}

.rare-dl-stand:last-child .rare-dl-tip::after {
  left: auto;
  right: 13px;
}

.rare-dl-asset:hover .rare-dl-tip,
.rare-dl-asset:focus-visible .rare-dl-tip {
  opacity: 1;
  visibility: visible;
}

/* API and manifest. */
.rare-dl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
}

.rare-dl-section {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.rare-dl-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.rare-dl-section-title {
  margin: 0;
  font-size: 0.86rem;
  color: var(--fg);
}

.rare-dl-api-docs {
  font-size: 0.72rem;
  text-decoration: none;
}

.rare-dl-api-docs:hover {
  color: var(--fg);
  text-decoration: none;
}

.rare-dl-api-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.28rem 0.4rem;
  margin: 0;
}

.rare-dl-api-facts > div {
  min-width: 0;
  padding: 0.22rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--content-box-border);
  background: var(--inset-bg);
}

.rare-dl-api-facts dt {
  margin: 0;
  font-size: 0.58rem;
  color: var(--muted);
  line-height: 1.2;
}

.rare-dl-api-facts dd {
  margin: 0.08rem 0 0;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.rare-dl-api-facts code {
  font-size: 0.64rem;
}

.rare-dl-api-lookups {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.22rem;
}

.rare-dl-api-lookups li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.22rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--content-box-border);
  background: var(--inset-bg);
}

.rare-dl-api-verb {
  flex: 0 0 auto;
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  color: var(--success);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.rare-dl-api-path {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.62rem;
}

.rare-dl-api-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.rare-dl-api-copy,
.rare-dl-api-actions a {
  font-size: 0.62rem;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.rare-dl-api-copy:hover,
.rare-dl-api-actions a:hover {
  color: var(--fg);
}

.rare-dl-manifest-details {
  margin: 0;
  min-width: 0;
  border-radius: 6px;
  border: 1px solid var(--content-box-border);
  background: var(--inset-bg);
}

.rare-dl-manifest-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: var(--fg);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  user-select: none;
}

.rare-dl-manifest-details > summary::-webkit-details-marker {
  display: none;
}

.rare-dl-manifest-details > summary::after {
  content: '+';
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
}

.rare-dl-manifest-details[open] > summary::after {
  content: '–';
}

.rare-dl-manifest {
  margin: 0;
  padding: 0.4rem 0.5rem 0.5rem;
  border-top: 1px solid var(--content-box-border);
  background: transparent;
  box-shadow: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  line-height: 1.3;
  color: var(--fg);
  overflow: auto;
  max-height: 12rem;
  white-space: pre;
}

.rare-dl-empty {
  margin: 0;
}

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

  .rare-dl-shelf-floor {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rare-dl-floor {
    height: 13rem;
  }

  .rare-dl-name {
    font-size: 1rem;
  }
}

@media (max-width: 519px) {
  .rare-dl-room {
    padding: 0.6rem;
  }

  .rare-dl-wall-count {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rare-dl-tip {
    transition: none;
  }
}
