/* ==========================================================
   header.css
   右上に浮かぶメニューボタン（紙札）と、右から出てくるメニュー（STEP AG → AH で見た目を変更）
   ・横長のヘッダー帯は作らない。ボタンだけを右上に固定（後ろの街並み・LPが見える）
   ・スマホ：画面の右上／PC：中央の 480px の列のすぐ右（左右の余白を活かす）
   ・雨のファーストビューからLPの最後まで常に表示（オープニング中だけ隠す）
   ・重なり順：ゲームの要素（最大35）・下の固定チケットボタン（900）より手前、
               パズル・おみくじのモーダル（1000）・オープニング（2000）より奥
   ・色・フォントは LP と同じ（css/lp.css の --lp-*）
========================================================== */

:root {
  --header-h: 44px;               /* メニューから移動したとき、見出しの上に空ける高さ */
}

/* メニューから移動したとき、見出しが画面の一番上にくっつかないように */
#lp .lp-section {
  scroll-margin-top: var(--header-h);
}

/* ---------- メニューボタン（右上に浮かぶ小さな紙札） ---------- */
.site-header {
  position: fixed;
  z-index: 950;
  top: calc(10px + env(safe-area-inset-top));
  /* スマホ：画面の右端から 10px。
     PC：中央の列（幅480px）の右端から 16px 外側（= 画面の中央 + 240 + 16 の位置に左端） */
  right: max(10px, calc(50% - 302px));   /* % は画面の幅（スクロールバーを除く）が基準 */
  width: 46px;
  height: 52px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));   /* 札の形（clip-path）で切れないよう、外側に影を付ける */
}

/* オープニング中は隠す（オープニングの演出を優先） */
html.is-opening .site-header {
  visibility: hidden;
}

.site-tag {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 52px;
  padding: 12px 0 0;
  border: 1px solid rgba(42, 36, 32, 0.55);
  border-radius: 3px 3px 5px 4px;
  /* 上の角を少し落とした札の形 */
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%, 0 9px);
  background-color: var(--lp-paper);
  background-image: var(--lp-noise);
  box-shadow: inset 0 0 0 3px var(--lp-paper), inset 0 0 0 4px rgba(42, 36, 32, 0.28);  /* 紙の二重線 */
  color: var(--lp-ink);
  cursor: pointer;
  transform: rotate(-4deg);
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.site-tag:active {
  transform: rotate(-4deg) translateY(1px);
}

/* 紐を通す穴（赤茶の小さな輪） */
.site-tag__hole {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border: 1.5px solid var(--lp-red);
  border-radius: 50%;
  background: #e9dcc0;
}

/* 手描き風の三本線（少し長さと揺れが違う） */
.site-tag__lines {
  width: 24px;
  height: 18px;
  overflow: visible;
}
.site-tag__lines path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
}

.site-tag:focus-visible {
  outline: 2px solid var(--lp-mustard);
  outline-offset: 3px;
}


/* ---------- メニュー ---------- */
.site-menu {
  position: fixed;
  inset: 0;
  z-index: 970;                   /* メニューボタン(950)より手前、モーダル(1000)より奥 */
  visibility: hidden;
  pointer-events: none;
}
.site-menu.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* 外側の暗い部分（押すと閉じる。下のゲームは押せない） */
.site-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 24, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.site-menu.is-open .site-menu__backdrop {
  opacity: 1;
}

/* 右から出てくる紙（少し焼けた古い紙。左端は手でちぎったような縁） */
.site-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(84vw, 330px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(64px + env(safe-area-inset-top)) 26px calc(30px + env(safe-area-inset-bottom)) 30px;
  background-color: #efe2c4;
  background-image:
    var(--lp-noise),
    radial-gradient(ellipse at 10% 0%, rgba(255, 255, 255, 0.35), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(150, 110, 60, 0.16), transparent 60%);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
  color: var(--lp-ink);
  /* 左端は、メモ帳から切り離した紙のような細かい切り取り線 */
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 2.2px, #000 2.7px) 0 0 / 6px 10px repeat-y,
                linear-gradient(#000, #000) 3px 0 / calc(100% - 3px) 100% no-repeat;
          mask: radial-gradient(circle at 0 50%, transparent 2.2px, #000 2.7px) 0 0 / 6px 10px repeat-y,
                linear-gradient(#000, #000) 3px 0 / calc(100% - 3px) 100% no-repeat;
  transform: translateX(105%);
  transition: transform 0.3s ease;
}
@media (min-width: 768px) {
  .site-menu__panel {
    width: 360px;
    padding-left: 38px;
    padding-right: 34px;
  }
}
.site-menu.is-open .site-menu__panel {
  transform: none;
}

.site-menu__close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--lp-ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.site-menu__close svg {
  width: 24px;
  height: 24px;
}

/* 街角の案内板のような札（深緑の板に生成りの文字。少し傾ける） */
.site-menu__sign {
  display: inline-block;
  margin: 0 0 10px -4px;
  padding: 8px 18px 7px;
  border: 1px solid #143430;
  border-radius: 2px;
  background-color: var(--lp-green);
  background-image: var(--lp-noise);
  box-shadow: inset 0 0 0 3px var(--lp-green), inset 0 0 0 4px rgba(242, 230, 204, 0.45), 2px 3px 0 rgba(42, 36, 32, 0.25);
  color: var(--lp-paper);
  font-family: var(--lp-font-mincho);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.16em;
  transform: rotate(-2deg);
}
.site-menu__sign span {
  display: block;
  margin-top: 2px;
  color: rgba(242, 230, 204, 0.75);
  font-size: 9px;
  letter-spacing: 0.22em;
}

/* 項目：手描きの「→」＋明朝。番号や区切り線は使わない（少しずつ傾けて手書きのメモ風に） */
.site-menu__list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.site-menu__list a {
  position: relative;
  display: block;
  padding: 11px 4px 11px 30px;
  color: var(--lp-ink);
  font-family: var(--lp-font-mincho);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.site-menu__list li:nth-child(odd) a  { transform: rotate(-0.6deg); }
.site-menu__list li:nth-child(even) a { transform: rotate(0.5deg) translateX(3px); }

/* 手描きの「→」（赤茶。線の太さと先の形を少し崩す） */
.site-menu__list a::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 18px;
  height: 10px;
  margin-top: -5px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 10'%3E%3Cpath d='M1 5.4c4.6-.5 9.6.2 14.4-.3M11.2 1.4c1.5 1.3 3 2.4 4.4 3.7-1.4 1.1-2.9 2.3-4.2 3.6' fill='none' stroke='%239b3a24' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
.site-menu__list a:hover,
.site-menu__list a:active,
.site-menu__list a:focus-visible {
  color: var(--lp-red);
}

/* チケット：半券のような形（赤茶の札。左右に丸い切り欠き、内側に点線） */
.site-menu__ticket {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  min-height: 54px;
  padding: 10px 22px;
  background: var(--lp-red);
  color: #fbf3e2;
  font-family: var(--lp-font-gothic);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 7px, #000 7.5px) left / 51% 100% no-repeat,
                radial-gradient(circle at 100% 50%, transparent 7px, #000 7.5px) right / 51% 100% no-repeat;
          mask: radial-gradient(circle at 0 50%, transparent 7px, #000 7.5px) left / 51% 100% no-repeat,
                radial-gradient(circle at 100% 50%, transparent 7px, #000 7.5px) right / 51% 100% no-repeat;
  transform: rotate(-1deg);
  -webkit-tap-highlight-color: transparent;
}
.site-menu__ticket::after {
  content: "";
  position: absolute;
  inset: 5px 12px;
  border: 1px dashed rgba(251, 243, 226, 0.55);
  pointer-events: none;
}
.site-menu__ticket svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.site-menu__ticket:active {
  transform: rotate(-1deg) translateY(1px);
}

/* 飾り：うっすら敷いた古地図と、虫眼鏡（2つだけ。押しても何も起きない） */
.site-menu__map {
  position: absolute;
  right: -26px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 170px;
  height: auto;
  opacity: 0.22;
  transform: rotate(8deg);
  pointer-events: none;
}
.site-menu__magnifier {
  position: absolute;
  right: 34px;
  bottom: calc(58px + env(safe-area-inset-bottom));
  width: 40px;
  height: auto;
  transform: rotate(-16deg);
  pointer-events: none;
}

/* メニューを開いている間は、後ろのページをスクロールさせない */
html.is-menu-open,
html.is-menu-open body {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .site-menu__backdrop,
  .site-menu__panel,
  .site-tag {
    transition: none;
  }
}
