:root {
  color-scheme: light;
  font-family: ui-rounded, system-ui, sans-serif;
  color: #402e24;
  background: #fbf4e8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

main {
  width: min(100%, 37rem);
  min-height: 100svh;
  margin-inline: auto;
  padding: clamp(1rem, 5vw, 1.75rem);
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}

button {
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.control {
  min-height: 3rem;
  padding: .55rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid #dac9b4;
  border-radius: 2rem;
  background: #fffaf2;
  font-weight: 650;
}

.mute { margin-inline-start: auto; }
.mute[aria-pressed="true"] { background: #594535; color: #fffaf2; }
.speaker::before { content: "◖))"; font-weight: 800; }
.mute[aria-pressed="true"] .speaker::before { content: "◖×"; }
:focus-visible { outline: 3px solid #80432f; outline-offset: 4px; }

#picker-view, .animal { margin-block: auto; padding-block: 1.25rem; }

.page-title {
  margin: 0 0 .55em;
  text-align: center;
  font-size: clamp(2rem, 10vw, 3.75rem);
}

.picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.7rem, 3vw, 1rem);
}

.picker button, .picture {
  overflow: hidden;
  border-radius: clamp(1.1rem, 6vw, 2.1rem);
  background: #f2dfc5;
}

.picker button {
  padding: 0;
  border: 2px solid #fffaf2;
  box-shadow: 0 3px 0 #d9c4ac, 0 8px 20px #69422214;
}

.picker button:active { box-shadow: 0 1px 0 #d9c4ac; }
img { display: block; width: 100%; height: auto; }

.animal { text-align: center; }
.picture {
  position: relative;
  width: min(100%, 63svh);
  margin-inline: auto;
  border: 3px solid #fffaf2;
  box-shadow: 0 10px 28px #6942221f;
}

h1 {
  margin: .35em 0 0;
  font: 700 clamp(3.3rem, 15vw, 6rem)/1 Georgia, serif;
  letter-spacing: -.045em;
}

@media (max-height: 500px) and (orientation: landscape) {
  main { padding-block: .75rem; }
  #picker-view, .animal { padding-block: .6rem; }
  .picker { width: min(100%, 54svh); margin-inline: auto; }
  .page-title { font-size: 2rem; }
  .picture { width: min(100%, 50svh); }
  h1 { font-size: 2.6rem; }
}

/* Feather the head layer into the original art so the neck and scenery stay put. */
.head-layer {
  display: none;
  position: absolute;
  inset: 0;
  mask-image: radial-gradient(
    ellipse var(--head-width) var(--head-height) at var(--head-x) var(--head-y),
    #000 80%, transparent 100%
  );
}

.picture[data-animal="dog"]   { --head-x: 54%; --head-y: 29%; --head-width: 34%; --head-height: 29%; }
.picture[data-animal="cat"]   { --head-x: 53%; --head-y: 24%; --head-width: 33%; --head-height: 30%; }
.picture[data-animal="cow"]   { --head-x: 68%; --head-y: 24%; --head-width: 34%; --head-height: 33%; }
.picture[data-animal="horse"] { --head-x: 67%; --head-y: 26%; --head-width: 31%; --head-height: 30%; }

@media (prefers-reduced-motion: no-preference) {
  .picture.moving .head-layer { display: block; }
  .picture.moving .head-layer img {
    transform-origin: var(--head-x) calc(var(--head-y) + 15%);
    animation: lift-head 820ms ease-in-out;
  }
}

@keyframes lift-head {
  42% { transform: translateY(-1.8%) rotate(-9deg); }
}

.credits-link { text-align: center; margin-top: .7rem; font-size: .85rem; }
.credits-link a { color: inherit; }
