/* Fonts and the dc tokens are in shared/dc-base.css. This file adds the
   vitrines: a pixel icon behind glass and a museum label below. */

:root {
  /* Behind the glass. In dark mode a little lighter than nightblue,
     because the pixel outlines are nightblue. Same as the pet stage in
     Repo-Tamagotchi. */
  --stage: var(--surface-muted);
  --shine: rgba(255, 255, 255, 0.55);
  --plinth: var(--gray);
  --note: #8a6408;
  --note-bg: #fbf3dc;
  --hungry: #c0392b;
  /* A soft light in the top right corner of the page. */
  --glow: var(--lime-ultra-light);

  /* Chip colors for the state of an exhibit. Ocean and lime are too light
     for text on a light background, so the text is darker. */
  --chip-draft-bg: var(--purple-ultra-light);
  --chip-draft-ink: var(--purple);
  --chip-demo-bg: var(--ocean-light);
  --chip-demo-ink: #145d68;
  --chip-live-bg: var(--lime-light);
  --chip-live-ink: var(--nightblue);

  /* Pixel colors for the icons in exhibit.json. */
  --px-o: var(--nightblue);
  --px-l: var(--lime);
  --px-c: var(--ocean);
  --px-p: var(--purple);
  --px-r: #ff8fab;
  --px-e: #c0392b;
  --px-m: var(--middle-gray);
}

:root[data-theme="dark"] {
  --stage: #0d3346;
  --shine: rgba(255, 255, 255, 0.08);
  --plinth: #2b3f4b;
  --note: #e3b85a;
  --note-bg: rgba(212, 160, 60, 0.12);
  --hungry: #e8705e;
  --glow: rgba(75, 190, 207, 0.1);
  --chip-draft-bg: rgba(105, 61, 208, 0.25);
  --chip-draft-ink: var(--purple-light);
  --chip-demo-bg: rgba(75, 190, 207, 0.16);
  --chip-demo-ink: var(--ocean-light);
  --chip-live-bg: rgba(188, 207, 0, 0.18);
  --chip-live-ink: var(--lime-light);
  --px-e: #e8705e;
  --px-m: var(--dark-gray);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1200px 700px at 85% -10%, var(--glow), transparent),
    var(--page);
  color: var(--ink);
  font-family: var(--font-sans), sans-serif;
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.top,
.hall {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.top {
  position: relative;
  padding-top: var(--space-7);
}

/* The logo file already has 25% free space around the mark. */
.logo {
  position: absolute;
  top: var(--space-6);
  right: var(--space-2);
  width: 72px;
}

h1 {
  margin: 0 72px var(--space-3) 0;
  font-size: 44px;
  line-height: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  hyphens: manual;
}

.lead {
  max-width: 600px;
  margin: 0 0 var(--space-7);
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 28px;
}

/* "start", so an open label makes only its own vitrine longer and not
   the whole row. */
.hall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
  gap: var(--space-5);
  padding-bottom: var(--space-7);
}

.vitrine {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-high);
  transition:
    transform var(--motion-exit) var(--ease-exit),
    box-shadow var(--motion-exit) var(--ease-exit);
  /* gallery.js sets a longer delay on each vitrine, so they arrive one
     after the other. */
  --arrive-delay: 0ms;
  /* "backwards" and not "both": with "both" the end state of the
     animation stays and blocks the hover transform below. */
  animation: arrive 380ms var(--ease-enter) var(--arrive-delay) backwards;
}

.vitrine:hover,
.vitrine:focus-within {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  transition-duration: var(--motion-enter);
  transition-timing-function: var(--ease-enter);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Two diagonal stripes of light, so the stage looks like it is behind
   glass. */
.glass {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 4 / 3;
  /* Plinth bottom (24px) plus its height (10px). */
  padding-bottom: 34px;
  background:
    linear-gradient(120deg, transparent 0 18%, var(--shine) 18% 26%,
      transparent 26% 31%, var(--shine) 31% 33%, transparent 33%),
    var(--stage);
}

/* The plinth the exhibit stands on. */
.glass::after {
  content: "";
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  width: 128px;
  height: 10px;
  margin-left: -64px;
  border-radius: var(--radius-sm);
  background: var(--plinth);
}

.icon {
  position: relative;
  z-index: 1;
  width: 108px;
  height: auto;
}

/* On hover the exhibit hops by one of its own pixels (108px / 12). Two
   frames and no easing, like an old sprite. */
.vitrine:hover .icon {
  animation: hop 700ms steps(1, end) infinite;
}

@keyframes hop {
  50% {
    transform: translateY(-9px);
  }
}

.px-o { fill: var(--px-o); }
.px-l { fill: var(--px-l); }
.px-c { fill: var(--px-c); }
.px-p { fill: var(--px-p); }
.px-r { fill: var(--px-r); }
.px-e { fill: var(--px-e); }
.px-m { fill: var(--px-m); }

.badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--hungry);
  color: var(--white);
  font-size: 14px;
  line-height: 24px;
  font-weight: 600;
}

.label {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-4) var(--space-5) var(--space-4);
}

.inv {
  margin: 0 0 var(--space-1);
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.title {
  margin: 0 0 var(--space-2);
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.title a {
  color: inherit;
  text-decoration: none;
}

/* The whole vitrine is one link, with one stop for the keyboard. */
.title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: var(--radius-lg);
}

.title a:focus-visible {
  outline: none;
}

.title a:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* Room for three lines, so closed vitrines in one row end at the same
   height. */
.summary {
  min-height: 72px;
  margin: 0 0 var(--space-4);
  color: var(--ink-muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: 13px;
  line-height: 20px;
}

.chip {
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.chip--draft { background: var(--chip-draft-bg); color: var(--chip-draft-ink); }
.chip--demo { background: var(--chip-demo-bg); color: var(--chip-demo-ink); }
.chip--live { background: var(--chip-live-bg); color: var(--chip-live-ink); }
.chip--warn { background: var(--note-bg); color: var(--note); }

.fed {
  color: var(--ink-muted);
}

/* The label sits above the link of the vitrine. Without the z-index a
   click on "Schildchen lesen" opens the exhibit. */
.schild {
  position: relative;
  z-index: 3;
  margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-4));
  border-top: 1px solid var(--border);
}

.schild summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color var(--motion-exit) var(--ease-exit);
}

.schild summary::-webkit-details-marker {
  display: none;
}

.schild summary:hover {
  color: var(--ink);
  transition-duration: var(--motion-enter);
}

.schild summary:focus-visible {
  outline-offset: -2px;
}

/* A small arrow that turns down when the label is open. */
.schild summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--motion-enter) var(--ease-enter);
}

.schild[open] summary::before {
  transform: rotate(45deg);
}

.schild-body {
  padding: 0 var(--space-5) var(--space-4);
}

.schild[open] .schild-body {
  animation: unfold var(--motion-enter) var(--ease-enter);
}

@keyframes unfold {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* One grid for all rows, so the values start in one column and the
   terms take only the space of the longest term. */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px var(--space-3);
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.facts div {
  display: contents;
}

.facts dt {
  color: var(--ink-muted);
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

.note {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--note-bg);
  color: var(--note);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

/* A ring and not a border, so a hungry vitrine has the same size as the
   others. */
.is-hungry,
.is-hungry:hover {
  box-shadow: 0 0 0 2px var(--hungry), var(--shadow-high);
}

.vitrine--empty {
  align-self: stretch;
  border: 1px dashed var(--border);
  background: transparent;
  box-shadow: none;
}

.vitrine--empty:hover {
  transform: none;
  box-shadow: none;
}

.vitrine--empty .glass {
  background: transparent;
}

.vitrine--empty .glass::after {
  background: var(--border);
}

.vitrine--empty .title,
.vitrine--empty .summary {
  color: var(--ink-muted);
}

.empty {
  grid-column: 1 / -1;
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  .vitrine,
  .vitrine:hover .icon,
  .schild[open] .schild-body {
    animation: none;
  }

  .vitrine {
    transition: none;
  }

  .vitrine:hover,
  .vitrine:focus-within {
    transform: none;
  }
}

@media (max-width: 480px) {
  .top {
    padding-top: var(--space-6);
  }

  .logo {
    top: var(--space-4);
    width: 56px;
  }

  h1 {
    font-size: 32px;
    line-height: 36px;
    margin-right: 56px;
  }

  .lead {
    margin-bottom: var(--space-6);
  }

  .summary {
    min-height: 0;
  }
}
