/* The zoomed views of the notebooks: the card, the arrows beside it, and how they move (js/shared/zoom.js) */

/* the card in the middle, an arrow on each side of it; on a phone the arrows sit under the card */
.zoom {
  /* above the site bar (30), so a tall card is never hidden under it and the bar dims with the page */
  z-index: 35;
  grid-template-columns: auto minmax(0, 40rem) auto;
  column-gap: 22px;
  row-gap: 16px;
  justify-content: center;
  align-content: center;
}
/* every card has one frame, a word's or a kana's: as wide, with what it is (N5 and the topic, or Hiragana) in a
   tinted band along the top */
.zoom > .zcard {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0 0 22px;
  gap: 14px;
  border-radius: 18px;
  border-color: transparent;
  box-shadow:
    0 2px 6px rgba(10, 16, 14, 0.08),
    0 24px 60px -12px rgba(10, 16, 14, 0.35);
}
.zoom .zbar {
  margin: 0;
  padding: 12px 18px;
  gap: 10px;
  justify-content: flex-start;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 18%, var(--rule));
}
.zoom .zbar .tag {
  display: inline-block;
  font: 600 0.92rem/1.25 var(--f-body);
  letter-spacing: 0;
  text-transform: none;
}
.zoom .zbar .tag::first-letter {
  text-transform: uppercase;
}
.zoom .zcard:not(.wzc) > :not(.zbar) {
  padding-inline: 22px;
}
.zoom .zfig {
  grid-template-columns: minmax(0, 15rem);
}
.zoom > .znav {
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0 0 3px;
  border: 1px solid color-mix(in srgb, var(--surface) 60%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: 0 8px 24px -8px rgba(10, 16, 14, 0.45);
  cursor: pointer;
  transition:
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 0.22s,
    box-shadow 0.22s;
}
.zoom > .zprev {
  grid-column: 1;
}
.zoom > .znext {
  grid-column: 3;
}
@media (hover: hover) {
  .zoom > .znav:hover {
    transform: scale(1.08);
    background: var(--surface);
    box-shadow: 0 12px 28px -8px rgba(10, 16, 14, 0.5);
  }
}
.zoom > .znav:active,
.zoom > .znav.pressing {
  transform: scale(0.92);
  transition-duration: 0.08s;
}
@media (max-width: 520px) {
  .zoom {
    grid-template-columns: 1fr 1fr;
  }
  .zoom > .zcard {
    grid-column: 1 / -1;
    padding-bottom: 18px;
    gap: 12px;
    /* room left for the arrows under the card */
    max-height: calc(100vh - 32px - 3.25rem - 16px);
    max-height: calc(100dvh - 32px - 3.25rem - 16px);
  }
  .zoom > .znav {
    grid-row: 2;
  }
  .zoom > .zprev {
    grid-column: 1;
    justify-self: end;
  }
  .zoom > .znext {
    grid-column: 2;
    justify-self: start;
  }
}

/* opening: the arrows come in just after the card */
.zoom.in > .znav {
  animation: znavin 0.36s 0.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes znavin {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
}

/* closing: the card shrinks back into its tile while the backdrop and the arrows fade */
.zoom.out {
  animation: zfadeout 0.19s ease-in forwards;
  pointer-events: none;
}
.zoom.out .zcard {
  animation: zout 0.19s cubic-bezier(0.5, 0, 0.75, 0) forwards;
}
.zoom.out > .znav {
  opacity: 0;
  transition: opacity 0.12s;
}
@keyframes zfadeout {
  to {
    background: rgba(10, 16, 14, 0);
  }
}
@keyframes zout {
  to {
    transform: translate(var(--dx), var(--dy)) scale(0.16);
    opacity: 0;
  }
}

/* stepping: zoom.js slides the cards; the one leaving is a copy that only moves */
.zghost {
  pointer-events: none;
}

/* a sideways swipe on the card is for stepping, not for the page */
.zoom .zcard {
  touch-action: pan-y;
}
/* on a touch screen the card is swiped, so the round arrows beside it are hidden (as the ‹ › buttons of an opened
   kanji are on a phone); they stay for screen readers and the keyboard, and a mouse keeps them */
@media (pointer: coarse) {
  .zoom > .znav {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zoom.out,
  .zoom.out .zcard,
  .zoom.in > .znav {
    animation: none;
  }
  .zoom > .znav {
    transition: none;
  }
}
