/* Livro DIVAR: capa com duas faces, navegação por botões e conteúdo preservado. */
.profile-page [data-story-card] { transition: transform 220ms ease, box-shadow 220ms ease; }
.profile-page [data-story-card]:focus-visible,
.profile-page [data-story-card]:has([data-story-open]:focus-visible) {
  outline: 3px solid #f6cf63;
  outline-offset: 5px;
}
@media (hover: hover) and (pointer: fine) {
  .profile-page [data-story-card]:hover { transform: perspective(1200px) rotateY(-6deg); box-shadow: 6px 10px 0 rgba(52,27,95,.18); }
}
html body.profile-page .storybook-dialog {
  width: min(1000px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
html body.profile-page .storybook-dialog::backdrop {
  background: rgba(24,15,38,.72);
  backdrop-filter: blur(6px);
  animation: bookBackdropIn 300ms ease both;
}
html body.profile-page .storybook-dialog.is-closing::backdrop { animation: bookBackdropOut 350ms ease both; }
html body.profile-page .storybook-dialog .storybook-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  height: auto;
  min-height: 0;
  gap: 0;
  padding: 58px 16px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
html body.profile-page .storybook-dialog .storybook-reading-status {
  position: absolute;
  top: 21px;
  left: 22px;
  right: 125px;
  width: auto;
  margin: 0 !important;
  opacity: 1;
  transform: none;
  grid-template-columns: auto minmax(24px,1fr) auto;
  font-size: 11px;
}
html body.profile-page .storybook-dialog .storybook-reading-status > span:last-child { display: inline; }
html body.profile-page .storybook-dialog .storybook-book {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0 !important;
  width: 100%;
  max-width: 100%;
  height: min(620px, calc(100dvh - 122px)) !important;
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
  overflow: visible !important;
  isolation: auto !important;
  perspective: 2000px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  transform: none;
  opacity: 1;
  touch-action: pan-y pinch-zoom;
  --book-closed-position: translateX(-25%);
  --book-closed-cover: rotateY(0deg);
  --book-open-cover: rotateY(-180deg);
  --reader-from-book: var(--book-closed-position);
  --reader-from-cover: var(--book-closed-cover);
}
html body.profile-page .storybook-dialog .storybook-book::before,
html body.profile-page .storybook-dialog .storybook-book::after,
html body.profile-page .storybook-dialog .storybook-cover,
html body.profile-page .storybook-dialog .storybook-turn-sheet { display: none !important; }
html body.profile-page .storybook-dialog .storybook-book.is-opening { animation: bookPositionOpen 300ms ease-out both !important; }
html body.profile-page .storybook-dialog .storybook-book.is-closing { animation: bookPositionClose 300ms ease-out both, bookFadeOut 50ms ease 300ms both !important; }
/* A apresentação/página esquerda é o verso real da capa, não uma folha sobreposta. */
html body.profile-page .storybook-dialog .storybook-cover-motion {
  position: absolute;
  z-index: 30;
  top: 0 !important;
  right: auto !important;
  bottom: 0 !important;
  left: 50% !important;
  width: 50% !important;
  height: 100%;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  overflow: visible;
  transform-origin: left center;
  transform-style: preserve-3d;
  transform: var(--book-open-cover);
  animation: none !important;
  transition: none !important;
}
html body.profile-page .storybook-dialog .storybook-book.is-opening .storybook-cover-motion { animation: bookCoverOpen 600ms cubic-bezier(.25,.1,.25,1) both !important; }
html body.profile-page .storybook-dialog .storybook-book.is-closing .storybook-cover-motion { animation: bookCoverClose 300ms ease-out both !important; }
html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-face,
html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-inside {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  border: 2px solid #c69549;
  border-radius: 0 18px 18px 0;
  visibility: visible !important;
  opacity: 1 !important;
  animation: none !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-face {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 36px;
  color: #fff8df;
  background: linear-gradient(135deg,rgba(255,255,255,.1),transparent 36%),repeating-linear-gradient(90deg,rgba(255,255,255,.025) 0 2px,transparent 2px 7px),#583420;
  box-shadow: inset 12px 0 22px rgba(19,8,3,.38), inset -8px 0 0 rgba(242,188,92,.12), 10px 18px 36px rgba(12,7,20,.3);
  transform: rotateY(0deg);
}
html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-face small { font: 700 clamp(30px,4vw,50px)/1.05 Georgia,serif; }
html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-face strong { font-family: inherit; font-size: 18px; font-weight: 700; line-height: 1.2; letter-spacing: .15em; }
html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-inside {
  padding: 10px !important;
  color: #33264c;
  background: #583420;
  box-shadow: -10px 18px 36px rgba(12,7,20,.3);
  transform: rotateY(180deg);
}
html body.profile-page .storybook-dialog .storybook-left-page {
  position: relative;
  display: block !important;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #fffaf0;
  border: 0;
  border-radius: 10px 0 0 10px;
  box-shadow: inset -16px 0 24px rgba(75,52,39,.1);
  transform: none !important;
}
html body.profile-page .storybook-dialog .storybook-cover-page {
  position: relative;
  display: flex !important;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 32px 26px;
  gap: 20px;
  justify-content: safe center;
  overflow: auto;
}
html body.profile-page .storybook-dialog .storybook-cover-page[hidden],
html body.profile-page .storybook-dialog .storybook-previous-page[hidden] { display: none !important; }
html body.profile-page .storybook-dialog .storybook-left-copy { position: static; display: block; margin: 0; }
html body.profile-page .storybook-dialog .storybook-left-copy > span { display: block; }
html body.profile-page .storybook-dialog .storybook-left-copy h2 { font-size: clamp(30px,3vw,46px); }
html body.profile-page .storybook-dialog .storybook-cover-page > img { max-width: 180px; max-height: 200px; object-fit: contain; margin: 0; }
html body.profile-page .storybook-dialog .storybook-cover-page > * { flex-shrink: 0; }
html body.profile-page .storybook-dialog .storybook-right-page {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 50% !important;
  right: auto !important;
  display: grid;
  grid-template-rows: minmax(0,1fr) auto;
  gap: 0;
  width: 50% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  border: 2px solid #c69549;
  border-left-width: 0;
  border-radius: 0 18px 18px 0;
  background: #583420;
  box-shadow: 10px 18px 36px rgba(12,7,20,.3);
  opacity: 1;
  transform: none !important;
}
html body.profile-page .storybook-dialog .storybook-page-stage { height: 100%; min-height: 0; perspective: none; }
html body.profile-page .storybook-dialog .storybook-page,
html body.profile-page .storybook-dialog .storybook-previous-page {
  position: relative !important;
  inset: auto !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 14px;
  height: 100%;
  min-height: 0;
  padding: 30px clamp(20px,3vw,38px) !important;
  overflow-y: auto;
  overflow-x: hidden;
  border: 0;
  border-radius: 0;
  color: #33264c;
  background: repeating-linear-gradient(0deg,rgba(105,73,43,.02) 0 1px,transparent 1px 4px),#fffaf0;
  box-shadow: inset 16px 0 24px rgba(75,52,39,.08);
  text-align: center;
  scrollbar-width: thin;
  scrollbar-color: #b62e72 transparent;
  transform: none;
}
html body.profile-page .storybook-dialog .storybook-page[hidden] { display: none !important; }
html body.profile-page .storybook-dialog :is(.storybook-page,.storybook-previous-page) > * { flex-shrink: 0; }
html body.profile-page .storybook-dialog .storybook-page-number { display: none; }
html body.profile-page .storybook-dialog :is(.storybook-page,.storybook-previous-page) h3 { max-width: 100%; font: 700 clamp(27px,3vw,42px)/1.08 Georgia,serif; margin: 0; }
html body.profile-page .storybook-dialog :is(.storybook-page,.storybook-previous-page) > p:not(.storybook-kicker) { max-width: 390px; font: 400 17px/1.5 Georgia,serif; margin: 0; }
html body.profile-page .storybook-dialog .storybook-previous-page img { max-width: 100%; max-height: 220px; object-fit: contain; border-radius: 14px; }
html body.profile-page .storybook-dialog :is(.storybook-page,.storybook-previous-page).is-reading-next { animation: bookContentNext 180ms ease-out; }
html body.profile-page .storybook-dialog :is(.storybook-page,.storybook-previous-page).is-reading-previous { animation: bookContentPrevious 180ms ease-out; }
html body.profile-page .storybook-dialog .storybook-controls {
  position: static;
  inset: auto;
  z-index: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid #e8dcc5;
  border-radius: 0 0 10px 0;
  background: #fffaf0;
  pointer-events: auto;
}
html body.profile-page .storybook-dialog .storybook-page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #d5c6ad;
  border-radius: 10px;
  color: #46316e;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
}
html body.profile-page .storybook-dialog .storybook-page-button-next { border-color: #613882; background: #613882; color: #fff; }
html body.profile-page .storybook-dialog .storybook-page-button:disabled { opacity: .42; cursor: default; }
html body.profile-page .storybook-dialog .storybook-page-button:not(:disabled):hover { filter: brightness(.92); }
html body.profile-page .storybook-dialog .storybook-page-button:focus-visible,
html body.profile-page .storybook-dialog .storybook-close:focus-visible { outline: 3px solid #edba37; outline-offset: 3px; }
html body.profile-page .storybook-dialog .storybook-bookmark { z-index: 35; left: 50% !important; }
html body.profile-page .storybook-dialog .storybook-close { top: 5px; right: 16px; z-index: 40; min-height: 44px; }
@keyframes bookPositionOpen { from { transform: var(--reader-from-book); opacity: var(--reader-from-opacity,1); } to { transform: none; opacity: 1; } }
@keyframes bookPositionClose { from { transform: var(--reader-from-book); } to { transform: var(--book-closed-position); } }
/* Como na referência, a capa retorna e o livro se centraliza juntos. */
html body.profile-page .storybook-dialog.is-closing :is(.storybook-reading-status,.storybook-close) { animation: bookFadeOut 300ms ease both; }
@keyframes bookFadeOut { from { opacity: var(--reader-from-opacity,1); } to { opacity: 0; } }
@keyframes bookCoverOpen { from { transform: var(--reader-from-cover); } to { transform: var(--book-open-cover); } }
@keyframes bookCoverClose { from { transform: var(--reader-from-cover); } to { transform: var(--book-closed-cover); } }
@keyframes bookContentNext { from { opacity: .6; transform: translateX(6px); } to { opacity: 1; transform: none; } }
@keyframes bookContentPrevious { from { opacity: .6; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes bookBackdropIn { from { opacity: var(--reader-from-backdrop,0); } to { opacity: 1; } }
@keyframes bookBackdropOut { from { opacity: var(--reader-from-backdrop,1); } to { opacity: 0; } }
/* No celular, a capa cresce antes de abrir lateralmente; a leitura conserva uma página inteira. */
@media (max-width: 600px), (max-width: 900px) and (max-height: 500px) and (pointer: coarse) {
  html body.profile-page .storybook-dialog {
    width: min(420px, calc(100% - 24px)); max-width: calc(100% - 24px);
    height: min(700px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px);
    margin: auto; padding: 0; overflow: visible; background: #fffaf0; border-radius: 16px;
  }
  html body.profile-page .storybook-dialog .storybook-shell {
    height: 100%; width: 100%; max-height: none; grid-template-rows: minmax(0,1fr);
    padding: calc(62px + env(safe-area-inset-top)) 0 0;
  }
  html body.profile-page .storybook-dialog .storybook-book {
    height: 100% !important; perspective: 1600px; transform: none;
    --book-closed-position: none;
    --book-closed-cover: rotateY(0deg);
    --book-open-cover: rotateY(-180deg);
  }
  html body.profile-page .storybook-dialog .storybook-cover-motion {
    display: none !important; top: 0 !important; bottom: 0 !important; left: 0 !important;
    width: 100% !important; height: 100%; transform-origin: left center;
  }
  html body.profile-page .storybook-dialog .storybook-book:is(.is-opening,.is-closing) .storybook-cover-motion { display: block !important; }
  html body.profile-page .storybook-dialog[data-reader-phase="opening"] { animation: mobileReaderGrow 960ms cubic-bezier(.25,.1,.25,1) both; }
  html body.profile-page .storybook-dialog[data-reader-phase="closing"] { animation: mobileReaderShrink 350ms ease both; }
  html body.profile-page .storybook-dialog .storybook-book:is(.is-opening,.is-closing) { animation: none !important; }
  html body.profile-page .storybook-dialog .storybook-book.is-opening .storybook-cover-motion { animation: bookCoverOpen 600ms 320ms cubic-bezier(.25,.1,.25,1) both !important; }
  html body.profile-page .storybook-dialog .storybook-book.is-closing .storybook-cover-motion { animation: bookCoverClose 260ms ease-out both !important; }
  html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-face,
  html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-inside { border-radius: 12px; }
  html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-face {
    transform: rotateY(0deg); gap: 14px; padding: 20px;
  }
  html body.profile-page .storybook-dialog .storybook-book .storybook-cover-motion .storybook-front-cover-inside {
    transform: rotateY(180deg); border-color: #d5c6ad; background: #fffaf0;
  }
  html body.profile-page .storybook-dialog .storybook-cover-motion .storybook-left-page { display: none !important; }
  html body.profile-page .storybook-dialog .storybook-right-page {
    top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;
    padding: 0; border: 0; border-top: 1px solid #e8dcc5; border-radius: 0;
    background: #fffaf0; box-shadow: none;
  }
  html body.profile-page .storybook-dialog .storybook-page {
    padding: 28px 24px !important; gap: 20px; justify-content: flex-start;
    box-shadow: none; overscroll-behavior: contain; touch-action: pan-y pinch-zoom;
  }
  html body.profile-page .storybook-dialog .storybook-page h3 { font-size: 30px; }
  html body.profile-page .storybook-dialog .storybook-page > p:not(.storybook-kicker) { font-size: 18px; line-height: 1.65; }
  html body.profile-page .storybook-dialog .storybook-controls {
    padding: 10px max(16px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    border-radius: 0; gap: 12px; min-height: 64px; height: auto; max-height: none;
  }
  html body.profile-page .storybook-dialog .storybook-reading-status {
    top: calc(9px + env(safe-area-inset-top)); left: 16px; right: 116px;
    display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px;
    color: #46316e; font-size: 12px;
  }
  html body.profile-page .storybook-dialog .storybook-reading-status > span:first-child { display: none; }
  html body.profile-page .storybook-dialog .storybook-progress { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  html body.profile-page .storybook-dialog .storybook-mobile-title {
    display: block; font-size: 16px; line-height: 24px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  html body.profile-page .storybook-dialog .storybook-close { top: calc(7px + env(safe-area-inset-top)); right: 12px; }
  html body.profile-page .storybook-dialog .storybook-bookmark { left: auto !important; right: 12px; }
}
.storybook-mobile-title { display: none; }
@keyframes mobileReaderGrow {
  0% { transform: var(--reader-from-dialog, scale(.46)); opacity: var(--reader-from-opacity,1); }
  30%, 100% { transform: none; opacity: 1; }
}
@keyframes mobileReaderShrink {
  0%, 74% { transform: var(--reader-from-dialog, none); opacity: var(--reader-from-opacity,1); }
  100% { transform: scale(.46); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .profile-page [data-story-card], .profile-page [data-story-card]:hover { transform: none; transition: none; }
  html body.profile-page .storybook-dialog[data-reader-phase],
  html body.profile-page .storybook-dialog::backdrop,
  html body.profile-page .storybook-dialog.is-closing::backdrop,
  html body.profile-page .storybook-dialog .storybook-book,
  html body.profile-page .storybook-dialog .storybook-cover-motion,
  html body.profile-page .storybook-dialog .storybook-page,
  html body.profile-page .storybook-dialog .storybook-previous-page,
  html body.profile-page .storybook-dialog.is-closing :is(.storybook-reading-status,.storybook-close) { animation: none !important; transition: none !important; }
}
