/* The whole Rome book as a story movie, played page by page (src/pages/story-movie.mjs,
   assets/js/story-movie.js, 2026-11-10): a copy of the two-page preview's styles (story2.css, left as
   it is) with the page dots swapped for the page number and a thin line for the whole movie. */
/* the words' round, friendly letters (picked 2026-11-10 to look more fun for children) */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500..700&display=swap');

.page-sb2 { overflow: hidden; background: var(--paper); overscroll-behavior: none; }
.page-sb2 main { display: block; }
.sb2 {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  container-type: size;
  overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 45%, #fff) 0%, var(--tint) 75%);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sb2 .sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sb2__room { position: absolute; inset: 0; overflow: hidden; }
.sb2__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; }

/* the cover, before the story starts */
.sb2__start {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.85), transparent 60%), radial-gradient(90% 70% at 50% 100%, color-mix(in srgb, var(--tint) 70%, #fff), transparent 70%), var(--tint);
  transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s;
}
.sb2__start.is-gone { opacity: 0; visibility: hidden; }
.sb2__start-in { display: flex; flex-direction: column; align-items: center; gap: 0.85rem; max-width: 34rem; text-align: center; }
.sb2__book { width: min(44vw, 240px); margin-bottom: 0.5rem; filter: drop-shadow(0 22px 26px rgba(29, 54, 64, 0.28)); }
.sb2__cover { display: block; width: 100%; height: auto; border-radius: 4px 10px 10px 4px; transform: rotate(-3deg); animation: sb2-float 6s ease-in-out infinite; }
@keyframes sb2-float { 50% { transform: rotate(-1.5deg) translateY(-8px); } }
.sb2__kicker { margin: 0; font-family: var(--font-hand); font-size: clamp(1.5rem, 5.6vw, 2rem); font-weight: 700; line-height: 1; color: var(--tone); }
.sb2__title { margin: 0; font-family: var(--font-display); font-variation-settings: 'SOFT' 100; font-size: clamp(1.75rem, 7vw, 2.8rem); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
.sb2__lead { margin: 0 0 0.4rem; max-width: 27rem; font-size: clamp(1rem, 3.6vw, 1.12rem); line-height: 1.5; color: var(--ink-2); }
.sb2__note { display: inline-flex; align-items: center; gap: 0.45em; margin: 0.2rem 0 0; font-size: 0.95rem; color: var(--ink-2); }
.sb2__note-icon { width: 1.25em; height: 1.25em; color: var(--tone); }
/* Classic | Immersive, the book's two versions: the Classic one is the reader (/read/{slug}). */
.vswitch { display: inline-flex; gap: 3px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.82); box-shadow: var(--shadow-sm); }
.vswitch__opt { display: inline-flex; align-items: center; gap: 0.45em; height: 36px; padding: 0 14px; border-radius: 999px; color: var(--ink); font-weight: 700; font-size: 0.92rem; white-space: nowrap; text-decoration: none; transition: background 0.3s, color 0.3s; }
.vswitch__opt .icon { width: 18px; height: 18px; }
.vswitch__opt:hover { background: #fff; }
.vswitch__opt[aria-current='page'] { background: var(--ink); color: var(--paper); }
.sb2__versions { margin: 0 0 0.3rem; }
.sb2.is-loading .sb2__icon--big { cursor: progress; }

/* buttons over the pages */
.sb2__top, .sb2__bar { position: absolute; z-index: 4; display: flex; align-items: center; gap: 10px; transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }
.sb2__top { top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); }
.sb2__bar { left: 0; right: 0; bottom: 0; justify-content: space-between; padding: 26px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: linear-gradient(to top, rgba(29, 54, 64, 0.22), rgba(29, 54, 64, 0)); }
.sb2.is-idle [data-sb2-chrome] { opacity: 0; pointer-events: none; }
.sb2.is-idle .sb2__bar { transform: translateY(14px); }
.sb2__mid { display: flex; align-items: center; gap: 12px; }
.sb2__icon { display: inline-grid; place-items: center; width: 50px; height: 50px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 253, 248, 0.94); color: var(--ink); box-shadow: 0 8px 22px -8px rgba(29, 54, 64, 0.5), inset 0 0 0 1px rgba(29, 54, 64, 0.08); cursor: pointer; transition: transform 0.25s var(--ease-spring); }
.sb2__icon svg { width: 24px; height: 24px; }
.sb2__icon:hover { transform: scale(1.06); }
.sb2__icon:active { transform: scale(0.94); }
.sb2__icon:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.sb2__icon--big { width: 64px; height: 64px; background: var(--coral-deep); color: #fff; }
.sb2__icon--big svg { width: 30px; height: 30px; }
.sb2__icon--words[aria-pressed='true'] { background: var(--butter); box-shadow: 0 8px 22px -8px rgba(29, 54, 64, 0.5), inset 0 0 0 2px var(--tone); }
.sb2__page { min-width: 5.2em; margin: 0; padding: 0.45em 0.9em; border-radius: 99px; background: rgba(255, 253, 248, 0.94); box-shadow: 0 8px 22px -8px rgba(29, 54, 64, 0.5); color: var(--ink); font-family: 'Fredoka', ui-rounded, var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1; text-align: center; white-space: nowrap; }
.sb2__progress { position: absolute; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: max(6px, calc(env(safe-area-inset-bottom) - 6px)); height: 3px; border-radius: 99px; background: rgba(255, 253, 248, 0.45); overflow: hidden; }
.sb2__progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: rgba(255, 253, 248, 0.95); }

/* the words (on unless switched off): dark letters with a soft light glow (as in Test Digital Book 1),
   at the top of the picture. The frame is the picture's own box inside the screen (the video is
   1080×1350, shown whole), so the words sit on the picture on any screen shape. */
.sb2__frame {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: min(100vw, 80vh);
  width: min(100vw, 80dvh);
  height: min(125vw, 100vh);
  height: min(125vw, 100dvh);
  width: min(100cqw, 80cqh);
  height: min(125cqw, 100cqh);
  transform: translate(-50%, -50%);
  container-type: inline-size;
  pointer-events: none;
}
.sb2__words {
  position: absolute;
  left: 50%;
  top: 3.6%;
  width: max-content;
  max-width: 86%;
  margin: 0;
  color: var(--ink);
  font-family: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', var(--font-body);
  font-size: clamp(1.15rem, 3.6vmin, 2.15rem);
  font-size: clamp(1.15rem, 4.5cqi, 2.15rem);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 0 2px rgba(255, 253, 248, 0.95), 0 0 7px rgba(255, 253, 248, 0.9), 0 0 16px rgba(255, 253, 248, 0.75);
  transform: translateX(-50%);
}
.sb2__words span { transition: color 0.12s; }
.sb2__words span.is-on { color: var(--coral-deep); }

/* the end of the sample */
.sb2__end { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--tint) 62%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: sb2-in 0.8s var(--ease) both; }
@keyframes sb2-in { from { opacity: 0; } }
.sb2__end-in { display: flex; flex-direction: column; align-items: center; gap: 1rem; max-width: 30rem; padding: 2rem 1.6rem; border-radius: var(--radius-lg); background: rgba(255, 253, 248, 0.94); box-shadow: var(--shadow-lg); text-align: center; }
.sb2__the { margin: 0; font-family: var(--font-display); font-variation-settings: 'SOFT' 100; font-style: italic; font-size: clamp(2rem, 8vw, 3rem); line-height: 1; color: var(--tone); }
.sb2__teaser { margin: 0; font-size: 1.05rem; line-height: 1.5; color: var(--ink-2); }
.sb2__end-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 0.4rem; }
.sb2.is-ended .sb2__bar .sb2__mid, .sb2.is-ended .sb2__words { visibility: hidden; }
/* the end of the free part (2026-11-17): "to be continued", with the digital book to buy. It scrolls
   inside itself on a short screen (a phone held sideways), with the card centred when it fits. */
.sb2__pay { display: flex; overflow-y: auto; overscroll-behavior: contain; }
.sb2__pay .sb2__end-in { gap: 0.8rem; margin: auto; }
.sb2__pay .sb2__kicker { font-size: clamp(1.3rem, 4.8vw, 1.7rem); }
.sb2__price { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.2em 0.7em; margin: 0; }
.sb2__price strong { font-family: var(--font-display); font-size: clamp(1.7rem, 7vw, 2.3rem); letter-spacing: -0.03em; line-height: 1.1; color: var(--ink); }
.sb2__price span { font-size: 0.95rem; font-weight: 600; color: var(--tone); }
.sb2__have { margin: 0; font-size: 0.95rem; color: var(--ink-2); }
.sb2__have a { font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.sb2__again-link { padding: 0.4rem 0.6rem; border: 0; background: none; font: inherit; font-size: 0.92rem; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sb2__again-link:hover { color: var(--ink); }
/* on the start screen: the free part, said plainly */
.sb2__free { margin: -0.2rem 0 0; padding: 0.3em 0.9em; border-radius: 999px; background: color-mix(in srgb, var(--tint) 70%, white); font-size: 0.95rem; font-weight: 600; color: var(--tone); }
@media (max-height: 700px) {
  .sb2__pay { padding: 12px; }
  .sb2__pay .sb2__end-in { gap: 0.5rem; padding: 1.1rem 1.3rem; }
  .sb2__pay .sb2__the { font-size: 1.9rem; }
  .sb2__pay .sb2__teaser { font-size: 0.95rem; }
}
.sb2__noscript { position: absolute; inset: auto 0 0; z-index: 7; margin: 0; padding: 1rem; background: var(--paper); text-align: center; }

@media (max-width: 420px) {
  .sb2__icon { width: 46px; height: 46px; }
  .sb2__icon--big { width: 58px; height: 58px; }
  .sb2__mid { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .sb2__cover { animation: none; }
}
