/* ルカヤ -ガーナの村の女の子-
   配色は原版のまま（Material Blue Grey 系）。
   レイアウトは header / viewport / controls / footer の縦フレックス1本で組み、
   絵本本体のサイズだけを js/book.js が実測して決める。 */

:root {
  --ink: #37474f;
  --ink-muted: #90a4ae;
  --paper: #fcfcfc;
  --chrome: #eceff1;
  --font: YuGothic, "游ゴシック", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  /* dvh でスマホのアドレスバー出入りによる高さ変化を吸収する */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

/* ---- ヘッダー ---- */

.site-header {
  flex: none;
  text-align: center;
  padding: 20px 16px 10px;
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.18em;
  /* letter-spacing の分だけ右にずれて見えるのを打ち消す */
  text-indent: 0.18em;
}

.site-header__sub {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: var(--ink-muted);
}

/* ---- 絵本 ---- */

.viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.flipbook {
  position: absolute;
  top: 0;
  left: 0;
}

/* turn.js は各ページ要素に幅・高さをインラインで書き込む。
   背景は % 指定にしてあるので、リサイズ時も追従して切り出しがずれない。 */
.page {
  background-color: #fff;
  background-repeat: no-repeat;
  /* 紙面が白いので、背景（ほぼ白）との境目が出るくらいの影をつける */
  box-shadow: 0 2px 22px rgba(38, 50, 56, 0.28);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 表紙は1ページ1枚絵 */
.page--cover {
  background-size: 100% 100%;
}

/* 見開き1枚の画像を、左右のページで半分ずつ表示する */
.page--left,
.page--right {
  background-size: 200% 100%;
}

.page--left {
  background-position: left center;
}

.page--right {
  background-position: right center;
}

.hint {
  flex: none;
  margin: 0;
  padding: 8px 0 2px;
  font-size: 11px;
  color: var(--ink-muted);
  text-align: center;
  transition: opacity 0.4s;
}

.hint.is-hidden {
  opacity: 0;
}

/* ---- ページ送り ---- */

.controls {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 6px 0 10px;
}

.controls__btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.controls__btn:hover:not(:disabled),
.controls__btn:focus-visible {
  background-color: var(--chrome);
  color: var(--ink);
}

.controls__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.controls__counter {
  min-width: 66px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- フッター ---- */

.site-footer {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 20px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background-color: var(--chrome);
  font-size: 11px;
}

.site-footer__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
}

.site-footer__link:hover {
  text-decoration: underline;
}

.site-footer__link img {
  width: auto;
  height: 15px;
}

.site-footer__copy {
  color: var(--ink-muted);
}

/* 画面が低いときはヒントを畳んで絵本に高さを回す */
@media (max-height: 520px) {
  .site-header {
    padding-top: 8px;
  }

  .hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint {
    transition: none;
  }
}
