/* =========================================================================
   base.css — 土台・世界の枠・いつでも押せる札（ナビ）
   ========================================================================= */
:root {
  --f-anton: 'Anton', 'Impact', sans-serif;
  --f-archivo: 'Archivo Black', 'Arial Black', sans-serif;
  --f-marker: 'Permanent Marker', 'Caveat Brush', cursive;
  --f-brush: 'Caveat Brush', 'Permanent Marker', cursive;
  --f-hand: 'Reenie Beanie', 'Caveat Brush', cursive;
  --f-type: 'Special Elite', 'Courier New', monospace;
  --f-mono: 'Space Mono', 'Courier New', monospace;
  --f-goth: 'UnifrakturMaguntia', serif;
  --f-serif: 'Playfair Display', 'Times New Roman', serif;
  --f-pixel: 'Silkscreen', 'VT323', monospace;
  --f-vt: 'VT323', monospace;
  --f-sans: 'Helvetica Neue', Helvetica, Arial, 'Zen Kaku Gothic New', sans-serif;
  --f-jp: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --paper: #f1ece0;
  --ink: #131210;
  --red: #d92a26;
  --yel: #f8d517;
  --blu: #1d49cf;
  --world-bg: #d92a26;
  --world-ink: #f1ece0;
  --nav-h: 58px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--red); color: var(--ink);
  font-family: var(--f-jp); line-height: 1.7;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#vhprobe { position: fixed; top: 0; left: 0; width: 0; height: 100vh; visibility: hidden; pointer-events: none; }
html.lock, html.lock body { overflow: hidden; }

/* ---------- 世界 ---------- */
#world { position: relative; overflow-x: clip; }
.scene { position: relative; height: calc(var(--len, 3) * 100vh); background: var(--bg); color: var(--ink); }
.scene[hidden] { display: none; }
.scene .stage { position: sticky; top: 0; height: 100vh; overflow: hidden; contain: layout paint; }
.scene .comp { position: absolute; inset: 0; }
.scene .edge { position: absolute; left: 0; right: 0; bottom: calc(100% - 1px); height: clamp(44px, 9vh, 110px); pointer-events: none; }
.scene .edge svg { width: 100%; height: 100%; display: block; }
.scene .over { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 3; pointer-events: none; }
.stage:not(.on) *, .stage:not(.on) *::before, .stage:not(.on) *::after { animation-play-state: paused !important; }

/* 置きもの：中心が原点。--x --y --w は u 単位（100u = 構図の幅）。
   位置は translate プロパティで決めてあるので、JS は transform を自由に使える。 */
.it {
  position: absolute; left: calc(50% + var(--x, 0) * var(--u)); top: calc(50% + var(--y, 0) * var(--u));
  width: calc(var(--w, 10) * var(--u)); translate: -50% -50%;
  will-change: transform; user-select: none; -webkit-user-select: none;
}
.it > img { width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
.it.tl { translate: 0 0; } .it.tr { translate: -100% 0; } .it.bl { translate: 0 -100%; } .it.br { translate: -100% -100%; }
.it.tc { translate: -50% 0; } .it.bc { translate: -50% -100%; }

/* 元のポスターへの札 */
.credit {
  position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: 16px; z-index: 40;
  display: flex; align-items: center; gap: 8px; max-width: min(74vw, 420px);
  padding: 6px 10px 6px 8px; background: #fff; color: #111; border: 2px solid #111; border-radius: 2px;
  font: 700 10px/1.2 var(--f-mono); letter-spacing: .06em; text-align: left; text-transform: none;
  box-shadow: 3px 3px 0 #111; rotate: -1.2deg; transition: transform .18s, box-shadow .18s; opacity: .94;
}
.credit i { font-style: normal; background: #111; color: #fff; padding: 2px 5px; font-size: 9px; letter-spacing: .12em; flex: none; }
.credit b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credit span { flex: none; font-size: 13px; }
.credit:hover { transform: translate(-2px, -2px) rotate(1.5deg); box-shadow: 6px 6px 0 #111; }
@media (max-width: 860px) { .credit { bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); } }

/* 紙のざらつき */
#grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.1 -.25'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
html.shot #grain { display: none; }

/* ---------- ナビ：札 ---------- */
#nav {
  position: fixed; z-index: 90; top: 0; left: 0; right: 0; pointer-events: none;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
#nav > * { pointer-events: auto; }
html.shot:not(.shot-nav) #nav { display: none; }
.brand {
  display: block; text-decoration: none; background: #111; color: #fff; padding: 7px 12px 6px;
  rotate: -2deg; box-shadow: 4px 4px 0 rgba(0, 0, 0, .28); transition: transform .2s;
}
.brand b { display: block; font: 400 19px/1 var(--f-anton); letter-spacing: .06em; }
.brand span { display: block; margin-top: 4px; font: 700 9px/1 var(--f-jp); letter-spacing: .14em; opacity: .8; }
.brand:hover { transform: rotate(3deg) scale(1.05); }
.tabs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; max-width: 760px; }
.tabs a {
  position: relative; display: flex; align-items: baseline; gap: 6px; text-decoration: none;
  padding: 7px 11px 6px; background: #fff; color: #111; border: 2.5px solid #111;
  box-shadow: 4px 4px 0 #111; transition: transform .16s cubic-bezier(.3, 1.6, .5, 1), background .16s, box-shadow .16s;
}
.tabs a:nth-child(1) { rotate: -2.5deg; } .tabs a:nth-child(2) { rotate: 1.8deg; }
.tabs a:nth-child(3) { rotate: -1.2deg; } .tabs a:nth-child(4) { rotate: 2.4deg; }
.tabs a:nth-child(5) { rotate: -2deg; } .tabs a:nth-child(6) { rotate: 1.4deg; }
.tabs a i { font: 700 10px/1 var(--f-mono); font-style: normal; color: var(--red); }
.tabs a b { font: 400 15px/1 var(--f-anton); letter-spacing: .07em; }
.tabs a:hover, .tabs a:focus-visible { transform: translate(-2px, -3px) rotate(-3deg) scale(1.08); background: var(--yel); box-shadow: 7px 7px 0 #111; outline: none; }
.tabs a.is-on { background: #111; color: #fff; box-shadow: 4px 4px 0 var(--red); }
.tabs a.is-on i { color: var(--yel); }

@media (min-width: 861px) and (max-width: 1120px) {
  .tabs { gap: 6px; max-width: 640px; }
  .tabs a { padding: 6px 8px 5px; gap: 4px; }
  .tabs a b { font-size: 13px; }
}
@media (max-width: 860px) {
  #nav { padding-top: 10px; }
  .brand b { font-size: 15px; } .brand span { font-size: 8px; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; max-width: none; gap: 0; flex-wrap: nowrap; justify-content: stretch;
    padding: 0 0 env(safe-area-inset-bottom); background: #111; border-top: 3px solid #111;
  }
  .tabs a {
    flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; gap: 3px; rotate: 0deg !important;
    padding: 9px 0 8px; height: var(--nav-h); border: 0; border-right: 2px solid #111; box-shadow: none; justify-content: center;
  }
  .tabs a:last-child { border-right: 0; }
  .tabs a b { font-size: clamp(10px, 3.1vw, 13px); letter-spacing: .03em; }
  .tabs a i { font-size: 9px; }
  .tabs a:hover, .tabs a:focus-visible { transform: none; box-shadow: none; }
  .tabs a.is-on { box-shadow: none; }
}

/* 動きを控える設定 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
