:root {
  --papel: #f5ecdc;
  --ouro: #ffd27a;
  --noite: #14110d;
  --sombra: 0 2px 16px rgba(0,0,0,.9), 0 0 3px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--noite);
             color: var(--papel); -webkit-tap-highlight-color: transparent; }
body { font-family: 'EB Garamond', Garamond, Georgia, serif; }
button { font: inherit; color: inherit; cursor: pointer; }

/* The picture is the page. Two layers, cross-faded, never one swapped. */
.cenas { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 0; }
.cena { position: absolute; top: 0; left: 0; right: 0; bottom: 0;
        background-size: cover; background-position: center;
        opacity: 0; transition: opacity 2.4s ease; }
.cena.on { opacity: 1; animation: respira 70s ease-in-out infinite alternate; }
@keyframes respira { from { transform: scale(1); } to { transform: scale(1.07); } }
.cenas::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0;
                height: 64%; pointer-events: none;
                background: linear-gradient(to top, rgba(12,9,6,.93) 0%,
                  rgba(12,9,6,.62) 40%, rgba(12,9,6,0) 100%); }

/* A teleprompter: one column of sentences that glides up as the reading
   moves on, the current one a quarter down the window. One size for all of
   them, and the ends faded rather than cut. */
.palco { position: fixed; left: 0; right: 0;
         bottom: calc(64px + env(safe-area-inset-bottom) + 2vh);
         height: 46vh; z-index: 1; overflow: hidden; padding: 0 6vw;
         -webkit-user-select: none; user-select: none;
         -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20%, #000 74%, transparent 100%);
         mask-image: linear-gradient(to bottom, transparent 0, #000 20%, #000 74%, transparent 100%); }
/* Hidden behind the cover: a title over a page of faded prose is clutter. */
body:not(.lendo) .palco { opacity: 0; }
.palco { transition: opacity .8s ease; }
.rolo { position: relative; will-change: transform;
        transition: transform .9s cubic-bezier(.33, 0, .2, 1); }
.rolo.sem { transition: none; }
.bloco { max-width: 28em; margin: 0 auto .6em; text-align: center;
         font-size: clamp(1.45rem, 3.1vw, 2.4rem); line-height: 1.3;
         text-wrap: balance; text-shadow: var(--sombra); }
.bloco.titulo { font-size: clamp(2.2rem, 5.5vw, 3.8rem); letter-spacing: .01em; }
.frase { opacity: .3; transition: opacity .9s ease; }
.frase.atual { opacity: 1; }
.frase.prox { opacity: .55; }
.frase.lida { opacity: .2; }
.w { transition: color .3s linear, opacity .3s linear; }
.w.lido { opacity: .48; }
.w.aqui { opacity: 1; color: var(--ouro); }

/* The cover: the story's page, over the scene where the reader stopped. */
.capa { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 3;
        display: flex; flex-direction: column; justify-content: flex-end;
        padding: 0 6vw calc(6vh + env(safe-area-inset-bottom));
        background: linear-gradient(to top, rgba(12,9,6,.96) 0%, rgba(12,9,6,.78) 50%, rgba(12,9,6,.1) 100%);
        overflow-y: auto; transition: opacity .8s ease; }
.capa.some, .folha.some { opacity: 0; pointer-events: none; visibility: hidden;
                          transition: opacity .5s ease, visibility 0s .5s; }
.capa .corpo { max-width: 40rem; width: 100%; margin: 0 auto; }
.capa h1 { font-weight: 400; font-size: clamp(2.6rem, 8vw, 5rem); margin: 0;
           line-height: 1; text-shadow: var(--sombra); }
.capa .autor { font-style: italic; font-size: clamp(1.05rem, 2.4vw, 1.3rem);
               margin: .55em 0 0; opacity: .8; }
.capa .sinopse { font-size: clamp(1.1rem, 2.3vw, 1.3rem); line-height: 1.45; margin: .9em 0 0;
                 text-shadow: var(--sombra); }
.onde { display: flex; align-items: center; gap: .7rem; font-size: 1.05rem; margin: 1.2rem 0 0; font-style: italic; }
.onde[hidden] { display: none; }
.progresso { flex: 0 0 4.5rem; height: 3px; background: rgba(245,236,220,.2); border-radius: 2px; }
.progresso i { display: block; height: 100%; background: var(--ouro); border-radius: 2px; }
#fim { justify-content: center; text-align: center; }
#fim .botoes { justify-content: center; }
#fim h1 { font-style: italic; }

/* The site's header, on the cover only. */
.topo { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between;
        align-items: center; padding: calc(.9rem + env(safe-area-inset-top)) 6vw .9rem; }
.marca { font-size: 1.5rem; font-style: italic; text-decoration: none; color: inherit;
         text-shadow: var(--sombra); }
.eu img, .eu .inicial { width: 36px; height: 36px; border-radius: 50%; display: block;
                        object-fit: cover; border: 1px solid rgba(245,236,220,.4); }
.eu .inicial { display: grid; place-items: center; background: #1f1a14; }
a { color: inherit; }

.botoes { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.3rem; }
.botoes button, .botoes a, .botao {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; border: 1px solid rgba(245,236,220,.45); background: rgba(12,9,6,.35);
  border-radius: 999px; padding: .5em 1.4em; font-size: 1.12rem; text-decoration: none; }
.botoes .principal, .botao.principal { background: var(--papel); color: #1d150c; border-color: var(--papel); }
.botoes svg { width: 20px; height: 20px; flex: none; }
.botao.entrar { min-height: 0; font-size: .95rem; padding: .4em 1em; }
button.link { background: none; border: 0; padding: .8rem 0 0; font-size: 1rem;
              text-decoration: underline; text-underline-offset: 3px; opacity: .8; }
.nota { font-size: .98rem; opacity: .68; margin: 1.1em 0 0; line-height: 1.45; }
.nota.miuda { font-size: .85rem; opacity: .55; }
.nota a { text-underline-offset: 2px; }

/* Asking for the microphone: a sheet that says why before the browser
   asks, and where the switch is when the answer was no. */
.folha { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 5;
         display: flex; align-items: flex-end; justify-content: center;
         background: rgba(8,6,4,.62); transition: opacity .3s ease; }
.folha .caixa { width: 100%; max-width: 30rem; max-height: 100%; overflow-y: auto;
                background: #1f1a14; border-radius: 18px 18px 0 0;
                padding: 1.6rem 1.5rem calc(1.4rem + env(safe-area-inset-bottom));
                box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
@media (min-width: 640px) {
  .folha { align-items: center; }
  .folha .caixa { border-radius: 18px; }
}
.folha h2 { font-weight: 400; font-size: 1.7rem; margin: .7rem 0 .3rem; line-height: 1.15; }
.folha p, .folha li { font-size: 1.1rem; line-height: 1.45; }
.folha p { margin: .6rem 0 0; }
.folha ol { margin: .6rem 0 0; padding-left: 1.3rem; }
.folha li + li { margin-top: .45rem; }
.folha .botoes button { flex: 1 1 auto; }
.folha button[hidden] { display: none; }
.icone { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
         background: rgba(245,236,220,.1); position: relative; }
.icone svg { width: 28px; height: 28px; }
.icone.vivo { background: rgba(229,72,77,.22); color: #ff8a8e;
              animation: chama 1.4s ease-in-out infinite; }
@keyframes chama { 50% { box-shadow: 0 0 0 10px rgba(229,72,77,0); }
                   0%, 100% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } }
.icone.riscado { color: #f0a39d; background: rgba(196,85,77,.18); }
.icone.riscado::after { content: ""; position: absolute; width: 34px; height: 2px;
                        background: currentColor; transform: rotate(-45deg); border-radius: 1px; }

/* What just happened, in a line above the bar. Never in the pill. */
.aviso { position: fixed; left: 50%; transform: translateX(-50%); z-index: 2;
         bottom: calc(68px + env(safe-area-inset-bottom)); margin: 0;
         width: max-content; max-width: min(92vw, 30rem); text-align: center;
         background: rgba(31,26,20,.92); border-radius: 12px; padding: .6rem 1rem;
         font-size: 1.02rem; line-height: 1.35; box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.aviso[hidden] { display: none; }

/* The bar: leave, back, the microphone, forward. */
.barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
         display: flex; justify-content: center; align-items: center; gap: .45rem;
         padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom)); }
.barra > button { display: grid; place-items: center; background: rgba(12,9,6,.5); border: 0;
                  border-radius: 999px; height: 48px; min-width: 48px; padding: 0; }
.barra > button svg { width: 22px; height: 22px; }

/* The microphone is a state with three values. Off is the one that asks
   for something, so it is the one that shows: a microphone and "Ligar
   microfone". On is the quiet one — the same dark glass as the other
   buttons, a small red dot whose ring grows with the voice, and a word.
   It was a filled red pill first, and over a scene it was the loudest thing
   on the screen: "perde a imersão". The words lighting up already say the
   voice is being followed; the dot is for when they stop. */
.mic { display: flex !important; align-items: center; gap: .5rem; padding: 0 1.1rem !important;
       font-size: 1.02rem; white-space: nowrap; border: 1px solid rgba(245,236,220,.3) !important; }
.mic svg { width: 19px !important; height: 19px !important; }
.mic i { display: none; width: 8px; height: 8px; border-radius: 50%; flex: none;
         box-shadow: 0 0 0 calc(var(--nivel, 0) * 6px) rgba(229,72,77,.3);
         transition: box-shadow .15s ease-out; }
.mic.liga { color: #ffd27a; border-color: rgba(255,210,122,.5) !important; }
.mic.liga svg { animation: pulsa 1s ease-in-out infinite; }
.mic.on { border-color: transparent !important; }
.mic.on svg { display: none; }
.mic.on i { display: block; background: #e5484d; }
.mic.on span { opacity: .7; font-style: italic; }

/* A still pointer hides the bar and the cursor (leitura.js, recolhe). */
.barra { transition: opacity .6s ease; }
body.imerso .barra { opacity: 0; pointer-events: none; transition-duration: 1.2s; }
body.imerso { cursor: none; }
@keyframes pulsa { 50% { opacity: .35; } }
.barra[hidden] { display: none; }
@media (max-width: 520px) {
  .capa .botoes button, #fim .botoes > * { flex: 1 1 100%; }
  .capa { padding-bottom: calc(4vh + env(safe-area-inset-bottom)); }
}
