/* 絵本を「見開き」で読むための共通スタイル(2026-09-06)。
   一画面＝一枚の絵＋数行。スクロールで次の見開きに止まる。
   各話は :root を上書きして自分の季節の色にする。 */

:root{
  --ground:#e9dfcc; --paper:#f3ecdf; --ink:#2a2521; --muted:#7a6d5f; --line:#c9b99c; --accent:#c4382a;
  --on-photo:#fbf6ec; --on-photo-dim:rgba(251,246,236,.78);
  --serif:"Shippori Mincho B1","Hiragino Mincho ProN","Yu Mincho",YuMincho,"Noto Serif JP",serif;
  --round:"M PLUS Rounded 1c","Hiragino Maru Gothic ProN","Yu Gothic",sans-serif;
  --sans:"Zen Kaku Gothic New","Hiragino Sans","Yu Gothic",sans-serif;
}
*{ box-sizing:border-box; }
html{ scroll-snap-type:y mandatory; scroll-behavior:smooth; }
body{ margin:0; background:var(--ground); color:var(--ink); font-family:var(--sans); font-size:15px; line-height:2;
      -webkit-font-smoothing:antialiased; font-feature-settings:"palt"; overflow-x:hidden; }
img{ display:block; max-width:100%; height:auto; }
a{ color:inherit; text-decoration:none; }
a:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }
h1,p,figure{ margin:0; }

/* 星のカンバス(こんぺいとう) */
.stars{ position:fixed; inset:0; z-index:1; pointer-events:none; }

/* 上の一行 */
.bar{ position:fixed; inset:0 0 auto 0; z-index:20; display:flex; justify-content:space-between; align-items:center; gap:16px;
      padding:14px 20px; font-size:12px; letter-spacing:.1em; color:var(--muted); pointer-events:none;
      transition:color .5s; }
.bar a, .bar span{ pointer-events:auto; }
.bar .mark{ font-family:var(--round); font-weight:800; font-size:18px; color:var(--ink); transition:color .5s; }
.bar .left{ display:flex; gap:16px; align-items:baseline; }
.bar.onphoto{ color:var(--on-photo-dim); text-shadow:0 1px 2px rgba(0,0,0,.4); }
.bar.onphoto .mark{ color:var(--on-photo); }

.counter{ position:fixed; right:20px; bottom:16px; z-index:20; font-family:var(--serif); font-size:12.5px;
          letter-spacing:.14em; color:var(--muted); font-variant-numeric:tabular-nums; transition:color .5s; }
.counter.onphoto{ color:var(--on-photo-dim); text-shadow:0 1px 2px rgba(0,0,0,.4); }
.caught{ position:fixed; left:24px; bottom:52px; z-index:20; font-family:var(--serif); font-size:12px; letter-spacing:.14em;
         color:var(--muted); opacity:0; transition:opacity .6s; }
.caught.on{ opacity:1; }

/* 見開き: 画面ぴったりの高さ。中身が高いときは、その中だけスクロールする */
.spread{ position:relative; z-index:2; height:100vh; height:100dvh; scroll-snap-align:start; display:grid;
         overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; scrollbar-width:none; }
.spread::-webkit-scrollbar{ display:none; }

/* 表紙・終わり */
.spread.title, .spread.end{ text-align:center; align-content:center; padding:80px 24px; }
.spread.title .band{ margin:0 auto 24px; }
.spread.title .band img{ margin:0 auto; }
.spread.title h1{ font-family:var(--serif); font-weight:600; font-size:clamp(26px,4.4vw,38px); letter-spacing:.18em; line-height:1.6; }
.spread.title .meta{ font-family:var(--serif); font-size:13px; color:var(--muted); letter-spacing:.14em; margin-top:14px; font-variant-numeric:tabular-nums; }
.spread.title .down{ margin-top:44px; font-size:11px; letter-spacing:.2em; color:var(--muted); }
.spread.end .fin{ font-family:var(--serif); letter-spacing:.4em; color:var(--muted); font-size:15px; }
.spread.end .to{ margin-top:30px; font-family:var(--serif); font-size:14.5px; letter-spacing:.06em; line-height:2.2; }
.spread.end .to a{ border-bottom:1px solid var(--line); padding-bottom:1px; }
.spread.end .to a:hover{ border-color:var(--ink); }
.spread.end .back{ margin-top:22px; font-size:12px; letter-spacing:.12em; color:var(--muted); }

/* 全幅の写真に言葉を置く */
.spread.cover{ background:#000; overflow:hidden; }
.spread.cover > img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.spread.cover::after{ content:""; position:absolute; inset:auto 0 0 0; height:56%;
  background:linear-gradient(to top, rgba(10,6,3,.66), rgba(10,6,3,0)); pointer-events:none; }
.spread.cover .words{ position:relative; z-index:2; align-self:end; padding:0 28px 72px; color:var(--on-photo);
  text-shadow:0 1px 2px rgba(0,0,0,.45), 0 0 26px rgba(0,0,0,.3); max-width:34em; }
.spread.cover .words .cap{ color:var(--on-photo-dim); }

/* 絵を置いて、言葉を横に */
.spread.plate{ padding:76px 28px 72px; align-content:center; }
.spread.plate .inner{ display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,1fr); gap:44px; align-items:center;
  max-width:1080px; margin:0 auto; width:100%; }
.spread.plate .inner.only{ grid-template-columns:1fr; max-width:640px; }
.spread.plate .art{ display:flex; justify-content:center; align-items:center; }
.spread.plate .art img{ max-height:68vh; width:auto; max-width:100%; }
.spread.plate .art.small img{ max-height:40vh; }
.spread.plate .words{ max-width:26em; }
.note{ margin-top:24px; display:flex; gap:14px; align-items:flex-end; }
.note img{ width:118px; height:auto; flex:none; }
.note figcaption{ font-size:11.5px; color:var(--muted); letter-spacing:.06em; line-height:1.75; }

.words p{ font-family:var(--serif); font-size:clamp(16px,1.6vw,19px); line-height:2.3; letter-spacing:.05em; }
.words p + p{ margin-top:1.2em; }
.words .cap{ font-family:var(--sans); font-size:12px; letter-spacing:.12em; color:var(--muted); margin-top:14px; }
.words .oto{ color:var(--accent); letter-spacing:.14em; }

/* 言葉は見開きに入ったときに一度だけ浮かぶ */
.words{ opacity:0; transform:translateY(10px); transition:opacity .9s ease, transform .9s ease; }
.spread.in .words{ opacity:1; transform:none; }

/* 並べる(お面・屋台・集めたもの) */
.grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.grid.two{ grid-template-columns:repeat(2,1fr); }
.grid img{ width:100%; aspect-ratio:4/3; object-fit:cover; }
.grid .n{ font-size:11.5px; color:var(--muted); letter-spacing:.06em; margin-top:6px; text-align:center; }
.things{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(4,1fr); gap:22px 14px; }
.things li{ text-align:center; }
.things .pic{ height:92px; display:flex; align-items:flex-end; justify-content:center; }
.things .pic img{ max-height:92px; width:auto; }
.things .n{ font-family:var(--serif); font-size:13.5px; margin-top:8px; letter-spacing:.06em; }
.things .d{ font-size:11px; color:var(--muted); line-height:1.7; }

@media (max-width:720px){
  .bar{ padding:12px 16px; }
  .spread.plate{ padding:64px 18px 64px; }
  .spread.plate .inner{ grid-template-columns:1fr; gap:22px; }
  .spread.plate .art img{ max-height:42vh; }
  .spread.plate .art.small img{ max-height:30vh; }
  .spread.cover .words{ padding:0 18px 64px; }
  .words p{ font-size:15.5px; line-height:2.2; }
  .note img{ width:96px; }
  .grid{ grid-template-columns:repeat(2,1fr); }
  .things{ grid-template-columns:repeat(2,1fr); }
  .caught{ left:18px; }
}
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  .words{ opacity:1; transform:none; transition:none; }
}

/* ── お面(なつまつり) ────────────────────────────── */
.masks{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.masks button{ appearance:none; background:none; border:0; padding:0; cursor:pointer; font:inherit; color:inherit;
               display:block; width:100%; text-align:center; border-radius:2px; }
.masks button img{ width:100%; aspect-ratio:4/3; object-fit:cover; transition:transform .35s ease, filter .35s ease; }
.masks button .n{ font-size:11.5px; color:var(--muted); letter-spacing:.06em; margin-top:6px; }
.masks button:hover img{ transform:translateY(-5px); }
.masks button.on img{ transform:translateY(-7px); filter:brightness(1.12); box-shadow:0 6px 18px rgba(0,0,0,.5); }
.masks button.on .n{ color:var(--ink); }
.masks button:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }
.pickhint{ font-size:11.5px; letter-spacing:.1em; color:var(--muted); margin-top:14px; }

/* つけているお面 */
.worn{ position:fixed; right:22px; top:54px; z-index:18; width:84px; text-align:center;
       opacity:0; transform:translateY(-8px); pointer-events:none;
       transition:opacity .5s ease, transform .5s ease; }
.worn.on{ opacity:1; transform:none; }
.worn img{ width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:2px;
           box-shadow:0 3px 14px rgba(0,0,0,.45); }
.worn span{ display:block; font-size:10.5px; letter-spacing:.1em; color:var(--on-photo-dim); margin-top:5px;
            text-shadow:0 1px 2px rgba(0,0,0,.5); }
.worn.pop{ animation:wornpop .42s ease; }
@keyframes wornpop{ 0%{ transform:scale(.7) translateY(-14px); opacity:0; } 100%{ transform:none; opacity:1; } }
.worn.fall{ transition:opacity .9s ease, transform .9s cubic-bezier(.4,.1,.7,1);
            opacity:0; transform:translateY(120px) rotate(24deg); }

/* 「よそ者だ！」で、一瞬しずまる */
body.hush .spread.in .words{ transition:opacity .35s ease; opacity:.28; }
body.hush .worn{ opacity:0; }
@media (max-width:720px){
  .masks{ grid-template-columns:repeat(2,1fr); }
  .worn{ width:62px; right:14px; top:46px; }
}
@media (prefers-reduced-motion: reduce){
  .masks button img, .worn{ transition:none; }
  .worn.pop{ animation:none; }
  .worn.fall{ transition:opacity .4s ease; transform:none; }
  body.hush .spread.in .words{ transition:none; }
}

/* 切り抜いたお面は、全画面では引き伸ばさず、暗がりに浮かべる */
.spread.cover.float{ background:var(--ground); }
.spread.cover.float > img{ object-fit:contain; padding:9vh 8vw 24vh; }
.spread.cover.float::after{ background:linear-gradient(to top, rgba(10,6,3,.55), rgba(10,6,3,0)); }
/* 並んだお面・屋台の小物も、切らずに全体を見せる */
.masks button img{ object-fit:contain; background:transparent; }
.grid img[src$=".png"], .grid img[src*=".png?"]{ object-fit:contain; }
