/* Quinn's Quest: the field guide (play/guide.js).
   The same field journal as the rest of the game (the cloth-covered book, cream paper, polaroids, washi tape and round
   stitched buttons from play/style.css), on a leafy ground with drifting leaves and soft light. The book stops above the
   bottom 15% of the screen, so nothing she can tap sits where her palm rests. Every selector is #guideScreen or .gd-*. */

#guideScreen { position:fixed; inset:0; z-index:40; color:var(--ink); font:20px/1.35 var(--hand); text-align:left; display:flex; align-items:center; justify-content:center; overflow:hidden;
  padding:max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 15vh max(14px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 20% 18%, rgba(255,240,170,.32), transparent 40%),
    radial-gradient(ellipse at 82% 70%, rgba(255,240,170,.18), transparent 36%),
    linear-gradient(180deg, transparent 72%, rgba(20,40,28,.35)),
    radial-gradient(ellipse at 50% 45%, #5aa565, #2f6b47 72%, #22503a);
  animation:fade .3s ease; }
#guideScreen[hidden] { display:none !important; }
#guideScreen .gd-drift i { opacity:.75; }

/* the book */
#guideScreen .gd-book.book { --in:18px; display:flex; flex-direction:column; width:min(1180px, 100%); height:100%; max-height:880px; }
#guideScreen .gd-book.book::after { background: var(--paper-tex), var(--fibre-tex), radial-gradient(ellipse at 25% 0%, #fffaf0, transparent 60%), var(--paper); }
#guideScreen[data-view="contents"] .gd-page, #guideScreen[data-view="page"] .gd-contents { display:none; }
#guideScreen .gd-back { position:absolute; top:-12px; left:-12px; z-index:6; }
#guideScreen .btn:focus-visible, #guideScreen .gd-tile:focus-visible, #guideScreen .gd-stage:focus-visible { outline:4px solid var(--sky-d); outline-offset:3px; }

/* ---------------- contents: every animal, a picture each, grouped by area ---------------- */
.gd-contents { flex:1; min-height:0; display:flex; flex-direction:column; }
.gd-title { flex:none; display:flex; justify-content:center; height:70px; margin:-6px 0 4px; }
.gd-boardico { display:block; height:100%; aspect-ratio:20/20; animation:gd-bob 3.2s ease-in-out infinite; filter:drop-shadow(0 4px 0 rgba(58,36,49,.18)); }
.gd-boardico .ico { width:100%; height:100%; image-rendering:pixelated; }
@keyframes gd-bob { 50% { transform:translateY(-4px) rotate(-2deg); } }
.gd-scroll { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:6px 10px 26px;
  -webkit-mask:linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 22px), transparent); mask:linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 22px), transparent); }
.gd-group { --ac:#dff3db; --ad:#3f9a6e; margin:4px 0 26px; }
.gd-meadow { --ac:#fff1c4; --ad:#e2a93a; } .gd-ocean { --ac:#d9f0fa; --ad:#4b93c4; } .gd-rainforest { --ac:#d4f0dd; --ad:#2d6a4f; }
.gd-ghead { display:flex; align-items:center; gap:14px; margin:6px 2px 14px; }
.gd-aico { flex:none; display:block; width:64px; height:64px; padding:7px; border-radius:18px; border:3px solid #fff; background:var(--paper-tex), var(--ac); box-shadow:0 5px 0 var(--ad), 0 8px 14px rgba(60,30,40,.18); }
.gd-aico svg { width:100%; height:100%; display:block; image-rendering:pixelated; }
.gd-rule { flex:1; height:6px; border-radius:3px; background:repeating-linear-gradient(90deg, var(--ad) 0 16px, transparent 16px 26px); opacity:.45; }
.gd-group.here .gd-aico { animation:gd-here 1.6s ease-in-out 3; }
@keyframes gd-here { 50% { transform:scale(1.12) rotate(-4deg); } }
.gd-tiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(clamp(104px, 13.5vw, 156px), 1fr)); gap:22px 18px; padding:0 4px; }
.gd-tile { position:relative; display:block; min-width:0; padding:7px; border:0; border-radius:3px; background:var(--paper-tex), #fffdf8;
  box-shadow:0 1px 2px rgba(0,0,0,.18), 0 8px 16px rgba(60,30,40,.22); transform:rotate(var(--tilt, 0deg)); transition:transform .12s ease; cursor:pointer; }
.gd-tile:active { transform:translateY(4px) scale(.96) rotate(var(--tilt, 0deg)); }
.gd-tphoto { display:block; width:100%; aspect-ratio:1; background:#2a2024 center/cover no-repeat; border-radius:1px; }
.gd-tstars { position:absolute; left:50%; bottom:-13px; transform:translateX(-50%); display:flex; gap:1px; padding:3px 7px; border-radius:999px; background:#fff1dc; border:2px solid #fff; box-shadow:0 3px 0 rgba(58,36,49,.18); pointer-events:none; }
.gd-tstars .ico { width:18px; height:18px; image-rendering:pixelated; }

/* ---------------- an animal's page ---------------- */
.gd-page { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0, 1.42fr) minmax(0, 1fr); grid-template-rows:auto minmax(0, 1fr);
  grid-template-areas:"stage bar" "stage side"; column-gap:44px; row-gap:8px; }
.gd-bar { grid-area:bar; display:flex; justify-content:flex-end; align-items:center; gap:16px; padding:2px 2px 6px; }
.gd-bar .btn { --s:72px; }
.gd-anim { --c:#fff1dc; --d:var(--kraft-d); }
.gd-anim::before { z-index:2; border-color:rgba(255,255,255,.85); }
.gd-anim .gd-thumb { position:absolute; inset:6px; border-radius:50%; background:#2a2024 center/cover no-repeat; box-shadow:inset 0 0 0 2px rgba(58,36,49,.25); }
.gd-anim .gd-arrow { position:absolute; bottom:-8px; width:34px; height:34px; border-radius:50%; background:#fff; box-shadow:0 3px 0 rgba(58,36,49,.25); display:grid; place-items:center; z-index:3; }
.gd-anim.prev .gd-arrow { left:-8px; } .gd-anim.next .gd-arrow { right:-8px; }
.btn.gd-anim .gd-arrow .ico { width:26px; height:26px; filter:none; }

/* the picture: a big polaroid; the photograph sits whole on a soft blur of itself and drifts slowly while she listens */
.gd-stagewrap { grid-area:stage; position:relative; min-height:0; min-width:0; }
.gd-stage { position:absolute; inset:0; overflow:hidden; border-radius:4px; background:#24302a; border:10px solid #fffdf8; border-bottom-width:16px;
  box-shadow:0 1px 2px rgba(0,0,0,.18), 0 14px 26px rgba(60,30,40,.28); transform:rotate(-1deg); cursor:pointer; -webkit-tap-highlight-color:transparent; }
.gd-layer { position:absolute; inset:0; opacity:0; transition:opacity .9s ease; overflow:hidden; }
.gd-layer.on { opacity:1; z-index:1; }
.gd-blur { position:absolute; left:-10%; top:-10%; width:120%; height:120%; object-fit:cover; filter:blur(22px) saturate(1.1) brightness(.72); }
.gd-pan { position:absolute; inset:0; transform-origin:50% 50%; will-change:transform; }
.gd-img { display:block; width:100%; height:100%; object-fit:contain; }
.gd-layer.book .gd-blur { filter:blur(26px) saturate(.9) brightness(.9) sepia(.2); }
.gd-layer.turn { transform-origin:0 50%; animation:gd-turn .85s cubic-bezier(.25,.8,.35,1) both; }
@keyframes gd-turn { 0% { transform:perspective(1600px) rotateY(-88deg); filter:brightness(.6); } 70% { filter:brightness(1.05); } 100% { transform:none; filter:none; } }
.gd-movie { position:absolute; inset:0; width:100%; height:100%; z-index:2; image-rendering:pixelated; }
.gd-movie[hidden] { display:none; }
.gd-pause { position:absolute; left:50%; top:50%; z-index:3; width:108px; height:108px; margin:-54px 0 0 -54px; border-radius:50%; display:grid; place-items:center;
  background:rgba(255,253,248,.88); box-shadow:0 6px 0 rgba(58,36,49,.25), 0 10px 26px rgba(0,0,0,.3); opacity:0; transform:scale(.6); transition:opacity .2s, transform .2s; pointer-events:none; }
.gd-pause .ico { width:56%; height:56%; margin-left:8%; image-rendering:pixelated; }
#guideScreen.paused .gd-pause { opacity:1; transform:none; animation:gd-breath 2.2s ease-in-out infinite; }
@keyframes gd-breath { 50% { transform:scale(1.07); } }
#guideScreen.paused .gd-layer.on { filter:saturate(.75) brightness(.92); }

/* the outline, inked in beside the photograph */
#guideScreen .gd-outline.vellum { position:absolute; right:-16px; bottom:-14px; z-index:4; width:clamp(92px, 24%, 190px); max-width:none; padding:5%; margin:0; transform:rotate(4deg); pointer-events:none; animation:none; }
#guideScreen.gd-moving .gd-outline.vellum { opacity:0; }
#guideScreen .gd-outline .tape { width:54%; height:18px; top:-9px; }
#guideScreen .gd-outline img { animation:none; }
#guideScreen .gd-outline.drawn img { animation:gd-ink 2.4s .5s steps(18) both; }
@keyframes gd-ink { from { -webkit-clip-path:inset(0 100% 0 0); clip-path:inset(0 100% 0 0); } to { -webkit-clip-path:inset(0 0 0 0); clip-path:inset(0 0 0 0); } }

/* next and previous sentence: big chevrons at the picture's sides */
#guideScreen .gd-prev, #guideScreen .gd-next { --s:66px; position:absolute; top:50%; z-index:5; transform:translateY(-50%); }
#guideScreen .gd-prev { left:-22px; } #guideScreen .gd-next { right:-22px; }
#guideScreen .gd-prev:active:not(:disabled), #guideScreen .gd-next:active:not(:disabled) { transform:translateY(calc(-50% + 4px)) scale(.96); }
#guideScreen .gd-prev:disabled, #guideScreen .gd-next:disabled { opacity:0; pointer-events:none; }

/* the name, big, and the sentence */
.gd-side { grid-area:side; min-height:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; text-align:center; }
.gd-name { position:relative; margin:0; padding:.06em .5em .12em; font-size:clamp(28px, min(3.9vw, 6.2vh) + 4px, 56px); font-weight:900; line-height:1.06; letter-spacing:.005em; color:var(--ink); text-wrap:balance; }
.gd-name span { padding:0 .18em; -webkit-box-decoration-break:clone; box-decoration-break:clone;
  background:linear-gradient(transparent 58%, rgba(255,198,216,.9) 58%, rgba(255,198,216,.9) 90%, transparent 90%); }
.gd-stars { display:flex; gap:6px; } .gd-stars .ico { width:34px; height:34px; image-rendering:pixelated; }
.gd-cap { margin:0; flex:0 1 auto; min-height:4.2em; max-width:24em; overflow:auto; font-weight:750; font-size:clamp(17px, min(1.9vw, 3.4vh) + 5px, 29px); line-height:1.42; text-wrap:pretty; }
.gd-word { font-weight:900; color:var(--pink-d); padding:0 .12em; border-radius:4px; background:linear-gradient(transparent 55%, rgba(255,226,143,.95) 55%); }
.gd-dots { display:flex; flex-wrap:wrap; justify-content:center; gap:9px; min-height:20px; align-items:center; }
.gd-dots i { width:14px; height:14px; border-radius:50%; background:#eadbc2; box-shadow:inset 0 0 0 2px rgba(58,36,49,.18); transition:transform .2s, background .2s; }
.gd-dots i.done { background:var(--mint); box-shadow:inset 0 0 0 2px rgba(63,154,110,.6); }
.gd-dots i.now { background:var(--pink); box-shadow:inset 0 0 0 2px var(--pink-d); transform:scale(1.4); }

/* upright: the picture on top, the words underneath */
@media (orientation:portrait) {
  .gd-page { grid-template-columns:minmax(0, 1fr); grid-template-rows:auto minmax(0, 1.2fr) auto; grid-template-areas:"bar" "stage" "side"; row-gap:14px; }
  .gd-bar { padding-left:70px; }
  .gd-side { justify-content:flex-start; gap:8px; }
  .gd-name { font-size:clamp(28px, 5.4vw, 60px); }
  .gd-cap { min-height:5.6em; max-height:7.2em; font-size:clamp(17px, 2.7vw + 3px, 32px); }
  #guideScreen .gd-outline.vellum { right:-12px; bottom:-18px; width:clamp(84px, 24%, 170px); }
}
@media (orientation:portrait) and (max-width:520px) {
  #guideScreen .gd-book.book { --pad:10px; --in:12px; }
  #guideScreen .gd-back { --s:64px; top:-8px; left:-8px; }
  .gd-bar { gap:12px; } .gd-bar .btn { --s:64px; }
  .gd-tiles { grid-template-columns:repeat(3, minmax(0, 1fr)); gap:16px 12px; }
  .gd-aico { width:56px; height:56px; }
  .gd-title { height:58px; }
  #guideScreen .gd-prev, #guideScreen .gd-next { --s:64px; } #guideScreen .gd-prev { left:-16px; } #guideScreen .gd-next { right:-16px; }
  .gd-stage { border-width:7px; border-bottom-width:12px; }
  .gd-name { font-size:clamp(24px, 7vw, 34px); }
  .gd-cap { font-size:clamp(16px, 4.5vw, 20px); }
}
/* short, wide screens (phones sideways) */
@media (max-height:500px) {
  #guideScreen { padding:8px 12px 15vh; }
  #guideScreen .gd-book.book { --pad:8px; --in:10px; }
  #guideScreen .gd-back { --s:64px; top:-8px; left:-8px; }
  .gd-page { column-gap:30px; row-gap:2px; grid-template-columns:minmax(0, 1.25fr) minmax(0, 1fr); }
  .gd-bar { gap:12px; padding:0; } .gd-bar .btn { --s:64px; }
  .gd-bar .btn::before { inset:5px; border-width:2px; }
  .gd-title { height:48px; margin:0 0 2px; }
  .gd-aico { width:52px; height:52px; padding:5px; }
  .gd-ghead { margin:2px 2px 10px; }
  .gd-tiles { grid-template-columns:repeat(auto-fill, minmax(104px, 1fr)); gap:16px 14px; }
  #guideScreen .gd-prev, #guideScreen .gd-next { --s:64px; } #guideScreen .gd-prev { left:-16px; } #guideScreen .gd-next { right:-16px; }
  .gd-stage { border-width:6px; border-bottom-width:10px; }
  .gd-side { gap:4px; justify-content:flex-start; padding-top:12px; }
  .gd-name { font-size:clamp(20px, 6.6vh, 30px); }
  .gd-stars .ico { width:24px; height:24px; }
  .gd-cap { font-size:clamp(14px, 4.4vh, 19px); line-height:1.36; min-height:0; }
  .gd-dots { gap:7px; min-height:14px; } .gd-dots i { width:11px; height:11px; }
  #guideScreen .gd-outline.vellum { width:clamp(70px, 22%, 120px); right:-12px; bottom:-10px; }
}
#guideScreen.gd-fast .gd-layer, #guideScreen.gd-fast .gd-pause, #guideScreen.gd-fast .book { transition:none; animation:none; }
@media (prefers-reduced-motion:reduce) {
  #guideScreen *, #guideScreen *::before, #guideScreen *::after { animation:none !important; transition:none !important; }
}

/* the small book button on the reveal and journal page (play/encounter.js wires it): opens this animal's page */
#revealGuide { --c:#e9f6dc; --d:var(--mint-d); --s:72px; position:absolute; top:-12px; right:-12px; z-index:4; }
#revealGuide .ico { width:62%; height:62%; }
@media (max-height:500px), (orientation:portrait) and (max-width:520px) { #revealGuide { --s:64px; top:-8px; right:-8px; } }
/* the pressed flower in that corner moves along to make room for it */
@media (orientation:landscape) and (min-height:501px) { #reveal .book > .pressed.p3 { right:100px; top:10px; } }
