/*
Theme Name: Mandarim Volume 2 Leve
Theme URI: https://example.com/
Author: Curso de Mandarim
Description: Tema WordPress ultraleve para exibir o Volume 2 do curso de mandarim. Imagens WebP responsivas, navegação por toque, swipe e teclado.
Version: 1.0.0
Text Domain: mandarim-volume-2-leve
*/

:root {
  color-scheme: light;
  --bg: #fff8f1;
  --ink: #4b352f;
  --accent: #e45f79;
  --line: rgba(99,65,55,.14);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { overflow-x: hidden; }
button { font: inherit; }
.course-app { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; }
.course-topbar {
  height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(12px, env(safe-area-inset-left)); background: rgba(255,248,241,.94);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.course-title { min-width: 0; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-count { flex: none; font-size: 13px; font-weight: 700; opacity: .72; }
.viewer {
  min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 12px; position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.page-frame {
  width: min(100%, 1200px); aspect-ratio: 3 / 2; position: relative; overflow: hidden;
  background: #fff; border-radius: 12px; box-shadow: 0 10px 34px rgba(74,49,42,.14);
}
.page-picture, .page-image { display: block; width: 100%; height: 100%; }
.page-image { object-fit: contain; background: #fff; -webkit-user-drag: none; }
.page-image.is-changing { opacity: .36; }
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  width: 46px; height: 46px; border: 1px solid rgba(0,0,0,.08); border-radius: 999px;
  background: rgba(255,255,255,.91); color: #4d3933; box-shadow: 0 5px 20px rgba(0,0,0,.12);
  cursor: pointer; display: grid; place-items: center; font-size: 25px; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn:active { transform: translateY(-50%) scale(.96); }
.nav-btn:disabled { opacity: .22; cursor: default; }
.nav-prev { left: max(16px, env(safe-area-inset-left)); }
.nav-next { right: max(16px, env(safe-area-inset-right)); }
.course-footer {
  min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  background: rgba(255,248,241,.96);
}
.page-picker {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px;
  min-height: 38px; padding: 0 12px; font-weight: 700; max-width: min(330px, 74vw);
}
.fullscreen-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px;
  width: 42px; height: 38px; cursor: pointer; font-size: 18px;
}
.loading-dot {
  position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  opacity: 0; pointer-events: none; animation: pulse .8s ease-in-out infinite alternate;
}
.loading-dot.show { opacity: .65; }
@keyframes pulse { to { transform: scale(1.35); opacity: .25; } }
@media (max-width: 700px) {
  .course-topbar { height: 48px; }
  .viewer { padding: 0; background: #fff; }
  .page-frame { width: 100%; border-radius: 0; box-shadow: none; }
  .nav-btn { width: 40px; height: 40px; font-size: 22px; background: rgba(255,255,255,.82); }
  .nav-prev { left: 6px; } .nav-next { right: 6px; }
  .course-footer { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
