/* Shared polish for the 2026 living-storybook experience. */
:root {
  color-scheme: light;
}

body.abz-storybook-hub {
  color-scheme: dark;
}

body.abz-storybook-experience,
body.abz-storybook-hub {
  overscroll-behavior: none;
}

body.abz-motion-paused *,
body.abz-motion-paused *::before,
body.abz-motion-paused *::after {
  animation-play-state: paused !important;
}

.abz-storybook-back {
  position: fixed;
  z-index: 80;
  left: 10px;
  top: calc(50% - 48px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  text-indent: -999px;
  border: 1px solid rgba(36, 31, 28, 0.14);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: 0 10px 30px rgba(44, 32, 22, 0.18);
  color: #2c2724;
  font: 800 13px/1 "Nunito", system-ui, sans-serif;
  text-decoration: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translateZ(0);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.abz-storybook-back::before {
  content: "←";
  text-indent: 0;
  font-size: 20px;
}

.abz-storybook-back:hover {
  color: #2c2724;
  background: #fff;
  box-shadow: 0 14px 36px rgba(44, 32, 22, 0.25);
  transform: translateY(-2px);
}

.abz-storybook-back:focus-visible {
  outline: 3px solid #8254ea;
  outline-offset: 3px;
}

.abz-story-sound {
  position: fixed;
  z-index: 80;
  left: 10px;
  top: calc(50% + 4px);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(36, 31, 28, 0.14);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: 0 10px 30px rgba(44, 32, 22, 0.16);
  color: #2c2724;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.abz-story-sound:hover {
  background: #fff;
  box-shadow: 0 14px 36px rgba(44, 32, 22, 0.22);
  transform: translateY(-2px);
}

.abz-story-sound:focus-visible {
  outline: 3px solid #8254ea;
  outline-offset: 3px;
}

@keyframes abzSceneReveal {
  from { opacity: 0; transform: scale(0.985); filter: saturate(0.86); }
  to { opacity: 1; transform: scale(1); filter: saturate(1); }
}

body.abz-storybook-experience [data-screen-label="Cover"] > div:last-child > div:first-child,
body.abz-storybook-experience [data-rsp="scene-col"] > div:nth-child(2),
body.abz-storybook-experience [data-screen-label="End of book"] > div:nth-child(2) > div:first-child {
  isolation: isolate;
  animation: abzSceneReveal 700ms cubic-bezier(.2, .75, .2, 1) both;
}

body.abz-storybook-experience [data-rsp="scene-col"] > div:nth-child(2)::after,
body.abz-storybook-experience [data-screen-label="Cover"] > div:last-child > div:first-child::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 70px rgba(255, 255, 255, 0.16);
  mix-blend-mode: soft-light;
}

/* Hub: preserve the supplied desktop art direction while making it truly responsive. */
body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav a,
body.abz-storybook-hub [data-screen-label="Storybooks Hub"] button {
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease,
    transform 180ms ease, box-shadow 180ms ease;
}

body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav > a:first-child,
body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav a {
  white-space: nowrap;
}

@media (max-width: 1320px) {
  body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav {
    gap: 18px !important;
  }

  body.abz-storybook-hub [data-hub-links="desktop"] {
    gap: 16px !important;
    margin-left: 8px !important;
    font-size: 14px !important;
  }

  body.abz-storybook-hub [data-hub-account-links] > a:not(:last-child),
  body.abz-storybook-hub [data-hub-account-links] > span {
    display: none !important;
  }
}

body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav a:focus-visible,
body.abz-storybook-hub [data-screen-label="Storybooks Hub"] button:focus-visible,
body.abz-storybook-hub [data-screen-label="Storybooks Hub"] input:focus-visible,
body.abz-storybook-hub [data-screen-label="Storybooks Hub"] select:focus-visible {
  outline: 3px solid #e86dec;
  outline-offset: 3px;
}

body.abz-storybook-hub #shelf article > a > div {
  transition: transform 600ms cubic-bezier(.2, .75, .2, 1), filter 300ms ease;
}

body.abz-storybook-hub #shelf article:hover > a > div {
  transform: scale(1.035);
  filter: saturate(1.08) contrast(1.02);
}

@media (max-width: 1120px) {
  body.abz-storybook-hub [data-hub-links="desktop"] {
    gap: 14px !important;
    margin-left: 8px !important;
  }

  body.abz-storybook-hub [data-hub-account-links] {
    gap: 12px !important;
  }

  body.abz-storybook-hub [data-hub-account-links] > a:not(:last-child),
  body.abz-storybook-hub [data-hub-account-links] > span {
    display: none !important;
  }
}

@media (max-width: 920px) {
  body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav {
    gap: 14px !important;
  }

  body.abz-storybook-hub [data-hub-links="desktop"] {
    display: none !important;
  }

  body.abz-storybook-hub [data-hub-hero-grid] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.abz-storybook-hub [data-hub-cover-stack] {
    min-height: 360px !important;
    max-width: 640px;
    width: 100%;
    margin: 8px auto 0;
  }

  body.abz-storybook-hub [data-hub-game-band] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.abz-storybook-hub [data-hub-footer-grid] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 620px) {
  body.abz-storybook-experience [data-screen-label^="Page "] > div:first-child {
    gap: 8px !important;
    padding: 8px 10px !important;
    flex-wrap: wrap;
  }

  body.abz-storybook-experience [data-screen-label^="Page "] > div:first-child > div:nth-child(2) {
    min-width: 80px;
  }

  body.abz-storybook-experience [data-screen-label^="Page "] > div:first-child > div:nth-child(3) {
    display: none !important;
  }

  body.abz-storybook-experience [data-book-spread] {
    overflow: auto !important;
    grid-template-rows: auto auto !important;
  }

  body.abz-storybook-experience [data-rsp="scene-col"] > div:nth-child(2) {
    min-height: 190px !important;
  }

  body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav {
    padding: 12px 16px !important;
  }

  body.abz-storybook-hub [data-screen-label="Storybooks Hub"] > nav > a:first-child {
    font-size: 17px !important;
  }

  body.abz-storybook-hub [data-hub-account-links] > a:last-child {
    padding: 10px 15px !important;
    font-size: 13px !important;
  }

  body.abz-storybook-hub [data-hub-hero-grid] h1 {
    font-size: clamp(42px, 15vw, 64px) !important;
  }

  body.abz-storybook-hub [data-hub-cover-stack] {
    min-height: 290px !important;
  }

  body.abz-storybook-hub [data-hub-filters] > div:first-child > label,
  body.abz-storybook-hub [data-hub-filters] > div:first-child > select {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  body.abz-storybook-hub #shelf {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.abz-storybook-hub [data-hub-footer-grid] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.abz-storybook-experience *,
  body.abz-storybook-experience *::before,
  body.abz-storybook-experience *::after,
  body.abz-storybook-hub *,
  body.abz-storybook-hub *::before,
  body.abz-storybook-hub *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
