@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,650;9..144,800&family=Nunito:wght@500;650;750;850&display=swap');

:root {
  --paper: #fff6df;
  --ink: #183c34;
  --rust: #98371e;
  --leaf: #174d3c;
  --gold: #ffd064;
  --ease: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 650 1rem/1.55 Nunito, sans-serif; }
a { color: inherit; }
button { color: inherit; font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #174bb6; outline-offset: 5px; }
.skip { position: absolute; z-index: 5; left: 1rem; top: 1rem; background: white; padding: .6rem; transform: translateY(-200%); }
.skip:focus { transform: none; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem max(1rem, 5vw); border-bottom: 1px solid #183c3426; }
.brand { font: 800 clamp(1.2rem, 3vw, 1.65rem)/1.05 Fraunces, Georgia, serif; text-decoration: none; }
.masthead nav { display: flex; align-items: center; gap: clamp(.6rem, 3vw, 2rem); }
.button { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: .6rem 1rem; color: white; background: var(--leaf); border-radius: 4px; text-decoration: none; font-weight: 850; }
.button:hover { background: #246449; }
.intro { padding: 2rem 1rem 1.35rem; text-align: center; }
.eyebrow { color: var(--rust); font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .13em; margin: 0 0 .55rem; }
h1, h2 { font: 800 clamp(2rem, 5vw, 4rem)/1.02 Fraunces, Georgia, serif; letter-spacing: -.045em; margin: 0; }
h1 { font-size: clamp(3rem, 7vw, 6.3rem); }
h1 em { color: var(--rust); font-style: normal; }
.intro > p:last-child { margin: .8rem auto 0; max-width: 44ch; }
.scene { position: relative; isolation: isolate; overflow: hidden; background: #ebba6c; min-height: 440px; display: grid; align-items: end; }
.landscape { position: absolute; inset: 0; z-index: -1; background: url("assets/praca.webp") center 57% / cover no-repeat; animation: breathe 9s ease-in-out infinite alternate; }
.motion-toggle { position: absolute; top: .8rem; right: .9rem; z-index: 2; min-height: 44px; padding: .4rem .75rem; background: var(--paper); border: 1px solid var(--ink); border-radius: 4px; font-size: .83rem; }
.cast { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; width: min(100%, 1240px); margin: 0 auto; padding: 4.6rem clamp(.65rem, 3vw, 2rem) 2.5rem; gap: clamp(.1rem, 1.2vw, 1rem); list-style: none; }
.cast li:nth-child(2n) { padding-bottom: 1.5rem; }
.character { position: relative; display: grid; justify-items: center; align-items: end; width: 100%; background: none; border: 0; padding: 0; border-radius: 12px; animation: arrive .55s var(--ease) both; }
.cast li:nth-child(2n) .character { animation-delay: .09s; }
.cast li:nth-child(3n) .character { animation-delay: .16s; }
.character img { display: block; width: 100%; height: clamp(165px, 24vw, 335px); object-fit: contain; object-position: bottom; filter: drop-shadow(0 7px 5px #42261450); transition: transform .24s var(--ease); }
.character[data-phase="baby"] img { height: clamp(105px, 13vw, 185px); }
.character[data-phase="child"] img { height: clamp(150px, 20vw, 275px); }
.character span { z-index: 1; display: inline-flex; align-items: center; justify-content: space-between; gap: .4rem; min-height: 44px; padding: .35rem .45rem .35rem .65rem; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 5px; box-shadow: 0 3px var(--ink); font-size: clamp(.75rem, 1.4vw, 1.05rem); font-weight: 850; }
.character b { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%; background: var(--gold); }
.character:focus-visible img { transform: translateY(-8px); }
.character:active span { transform: translateY(2px); }
@media (hover: hover) and (pointer: fine) {
  .character:hover img { transform: translateY(-9px) rotate(-2deg); }
  .character:hover span { background: var(--gold); }
}
@keyframes arrive { from { opacity: 0; transform: translateY(12px); } }
@keyframes breathe { from { transform: scale(1.018) translateX(-.4%); } to { transform: scale(1.048) translateX(.4%); } }
.paused .landscape { animation-play-state: paused; }
.library { background: #f7dda3; border-top: 6px solid var(--ink); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: clamp(1.4rem, 5vw, 4.5rem); align-items: center; padding: clamp(2rem, 5vw, 4rem) max(1rem, 7vw); }
.book-cover { position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: start; width: 168px; min-height: 222px; padding: 1rem .75rem 1rem 1rem; background: var(--leaf); color: var(--paper); border-left: 8px solid #0d3628; box-shadow: 6px 8px #183c342e; text-decoration: none; transform: rotate(-4deg); }
.book-cover span { font-size: .69rem; font-weight: 850; }
.book-cover strong { font: 800 1.48rem/1 Fraunces, Georgia, serif; margin-top: .55rem; }
.book-cover { background: var(--leaf) url("assets/capa-livro.webp") center / cover no-repeat; }
.book-cover::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(#082e27f5, #082e276b 45%, transparent 65%); }
.book-info p:not(.eyebrow) { max-width: 55ch; }
.qr { margin: 0; text-align: center; font-size: .8rem; }
.qr img { display: block; margin: 0 auto .5rem; border: 1px solid #183c3440; }
footer { padding: 1.35rem max(1rem, 7vw); font-size: .86rem; }
dialog { width: min(760px, calc(100% - 24px)); max-height: 90dvh; border: 2px solid var(--ink); border-radius: 12px; padding: 0; color: var(--ink); background: var(--paper); }
dialog[open] { display: grid; grid-template-columns: minmax(110px, 31%) 1fr; animation: arrive .24s var(--ease); }
dialog::backdrop { background: #142c24a6; }
.guide-art { background: #f7dda3; display: grid; place-items: center; padding: .6rem; }
.guide-art img { width: 100%; max-height: 300px; object-fit: contain; }
.guide-copy { padding: 2.5rem 1.5rem 1.6rem; }
.guide-copy h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
.guide-copy ul { padding-left: 1.15rem; }
.guide-copy li + li { margin-top: .55rem; }
.close { position: absolute; right: .55rem; top: .55rem; width: 44px; height: 44px; font-size: 1.5rem; border: 1px solid var(--ink); border-radius: 50%; background: var(--paper); }
.sources { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-weight: 850; font-size: .9rem; }

@media (max-width: 740px) {
  .scene { min-height: 0; }
  .landscape { background-position: center; }
  .cast { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem .2rem; padding-bottom: 1.6rem; }
  .cast li:nth-child(2n) { padding-bottom: 0; }
  .library { grid-template-columns: auto minmax(0, 1fr); }
  .qr { grid-column: 1 / -1; }
}
@media (max-width: 440px) {
  .masthead nav > a:first-child { display: none; }
  .intro { padding-top: 1.5rem; }
  .character img { height: 145px; }
  .character[data-phase="child"] img { height: 130px; }
  .character[data-phase="baby"] img { height: 95px; }
  .book-cover { width: 112px; min-height: 180px; padding-left: .55rem; }
  .book-cover strong { font-size: 1rem; }
  .book-info h2 { font-size: 1.65rem; }
  dialog[open] { grid-template-columns: 1fr; }
  .guide-art { padding: .4rem; }
  .guide-art img { height: 104px; }
  .guide-copy { padding: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .motion-toggle { display: none; }
}
