/*
  models.css - styles specific to the 3D viewer.

  Layout, rail, toolbar, register line and card grid all come from
  ../shared/theme.css, which is what makes this page read as the same site as
  the drawing archive. The one identity change is the accent: patina, the
  colour the bronze in this collection has gone.
*/

:root {
  --accent-light: #2c5f5b;
  --accent-dark: #6fb3a9;
}

/* --- model plate ------------------------------------------------------- */

/*
  Ten Sketchfab embeds are ten WebGL contexts. Nothing loads until asked: the
  card holds a still until it is picked, then swaps itself for the real embed.
*/
.plate {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  background: var(--sheet-sunk);
  border: none;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  cursor: pointer;
}

.plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/*shown while the thumbnail is being fetched, and kept if it never arrives*/
.plate__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0 7px,
      color-mix(in srgb, var(--rule) 45%, transparent) 7px 8px
    ),
    var(--sheet-sunk);
}

.plate__fallback span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.plate__cue {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--step) * 1.25);
  padding: calc(var(--step) * 1.25);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color var(--speed), background-color var(--speed);
}

.plate:hover .plate__cue {
  color: var(--accent);
}

.plate__cue svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.plate.is-loading .plate__cue {
  color: var(--accent);
}

/*the embed, once the card has been picked*/
.embed {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: none;
  border-bottom: 1px solid var(--rule);
  display: block;
  background: var(--sheet-sunk);
}

/*Sketchfab asks that the model and author stay credited on the page*/
.card__credit {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}

.card__credit a {
  color: var(--ink-soft);
  text-decoration: none;
}

.card__credit a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.card__note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/*3D cards carry a viewer, so they want more width than a drawing tile*/
.grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

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