/* saladshare.net: one orange cover on a black table. Basteleur Bold in
   capitals, tapenade ink on carrot (6.9:1). Plain CSS, so BEM selectors are
   written out flat. */

@font-face {
  font-family: "Basteleur";
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/basteleur-bold.woff2") format("woff2");
}

:root {
  --tapenade: #0c0a09;
  --carrot: #f27610;
  --ranch: #fffcea;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--tapenade);
  color: var(--ranch);
  font: 700 1rem/1.4 "Basteleur", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

p,
h1 {
  margin: 0;
}

.hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.table {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1.25rem;
  min-height: 100svh;
  padding: 2rem 1rem;
}

/* The cover keeps the book's 3:4 proportions and fits the window either
   way round. Everything inside is sized in cqi, a percentage of the cover's
   width, so it scales like a printed page. */
.cover {
  width: min(100%, calc((100svh - 7rem) * 0.75), 40rem);
  min-width: min(100%, 18rem);
  aspect-ratio: 3 / 4;
  container-type: inline-size;
  background: var(--carrot);
  color: var(--tapenade);
}

/* Inside the container, so its cqi measure the cover rather than the window. */
.cover__page {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 7cqi 7cqi 8cqi;
}

.cover__title {
  font-size: 10.55cqi;
  font-weight: 700;
  line-height: 0.9;
  text-transform: uppercase;
  white-space: nowrap;
}

.cover__shields {
  display: flex;
  justify-content: space-between;
  margin-top: 3.5cqi;
}

.cover__shield,
.cover__face {
  display: block;
  width: 10.33cqi;
  height: auto;
  overflow: visible;
  fill: currentColor;
}

.cover__play {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.cover__oval {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
}

.cover__face image {
  image-rendering: pixelated;
}

.cover__play:hover .cover__oval,
.cover__play[aria-pressed="true"] .cover__oval {
  stroke-width: 6;
}

.cover__play:focus-visible {
  outline: 3px solid var(--tapenade);
  outline-offset: 4px;
  border-radius: 50%;
}

.cover__text {
  margin-top: auto;
  font-size: 3.55cqi;
  line-height: 1.13;
  text-align: justify;
  text-transform: uppercase;
  hyphens: manual;
}

.table__foot {
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Carrot on tapenade is 6.9:1. */
.table__foot a {
  color: var(--carrot);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.table__foot a:focus-visible {
  outline: 3px solid var(--carrot);
  outline-offset: 3px;
}

/* While the theme plays, the escutcheons take turns going hollow, left to
   right, about once a beat. Decoration only, so none of it runs under
   reduced motion: the thicker ring on the face says it's playing. */
@media (prefers-reduced-motion: no-preference) {
  .cover.is-playing .cover__shield {
    animation: hollow 2.8s steps(1, end) infinite;
  }

  .cover.is-playing .cover__shield:nth-child(2) { animation-delay: 0.35s; }
  .cover.is-playing .cover__shield:nth-child(4) { animation-delay: 1.05s; }
  .cover.is-playing .cover__shield:nth-child(5) { animation-delay: 1.4s; }
  .cover.is-playing .cover__shield:nth-child(6) { animation-delay: 1.75s; }
  .cover.is-playing .cover__shield:nth-child(7) { animation-delay: 2.1s; }
  .cover.is-playing .cover__shield:nth-child(8) { animation-delay: 2.45s; }
}

@keyframes hollow {
  0% {
    fill: transparent;
    stroke: currentColor;
    stroke-width: 3;
  }

  12.5% {
    fill: currentColor;
    stroke: none;
  }
}
