/* ============================================================
   NEGURA GAMES — ねぐら  portal styles
   beige × ink editorial / hand-drawn apartment hero /
   per-game accent color
   ------------------------------------------------------------
   ページ背景はヒーローイラスト(assets/negura-top.webp)の地色
   #E8D5CD に合わせている。イラスト差し替え時は --paper も更新。
   ============================================================ */

:root {
  --paper: #e8d5cd;      /* イラストの地色と同一 */
  --paper-2: #f6ece3;    /* カードなど一段明るい紙 */
  --ink: #211b16;
  --ink-soft: #4d4238;
  --muted: #85786b;
  --line: rgba(33, 27, 22, 0.18);
  --accent: #d1442e;     /* イラストの非常階段の朱 */
  --font-jp: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --font-serif-jp: "Zen Old Mincho", "Hiragino Mincho ProN", serif;
  --font-serif-en: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --font-yuji: "Yuji Syuku", "Hiragino Mincho ProN", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-jp);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--paper-2); }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 13px;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* ---------- header ---------- */

/* backdrop-filterは全面不使用（スクロール時の再ブラーがGPUによっては固まるため） */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(232, 213, 205, 0.93);
}
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88px;
  padding: 0 40px;
}
/* 訪問後にふっと上からフェードインしてくる（0.5s待ってから）。
   ブランドとナビ（GAMES/ABOUT）で共有する */
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
  animation: head-drop 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s both;
}
@keyframes head-drop {
  from { opacity: 0; transform: translateY(-22px); }
  to { opacity: 1; transform: translateY(0); }
}
.brand-en {
  font-family: var(--font-serif-en);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.14em;
  color: var(--ink);
}
.brand-sub {
  font-family: var(--font-serif-en);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.36em;
  color: var(--muted);
  text-transform: lowercase;
}
.head-nav {
  display: flex;
  gap: 26px;
  animation: head-drop 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s both;
}
.head-nav a {
  font-family: var(--font-serif-en);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.24em;
  color: var(--ink-soft);
  transition: color 0.25s;
}
.head-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

/* ---------- hero（建物） ---------- */

/* 1画面目 = 建物のイラストだけがちょうど収まる区切り。
   横幅は「画像の高さがビューポートに収まる幅」まで自動で絞る
   （1672/941 = 1.7768。ヘッダー88px＋上下余白ぶんを差し引く） */
.hero {
  position: relative;
  min-height: calc(100vh - 88px);
  display: flex;
}

/* 建物を1画面（ヘッダー込み）の縦中央に置く。margin-top:0＋bottom:auto で
   ヒーロー上端（＝ヘッダー直下）に寄せると、上=ヘッダー高(88px) / 下=余白(88px) で
   上下の余白が揃う（従来の margin:auto はヘッダー下だけで中央化＝全体では下寄りだった） */
.hero-viewport {
  margin: 0 auto auto;
  width: 100%;
  max-width: min(1500px, calc((100vh - 176px) * 1.7768));
  overflow: hidden;
}
.hero-stage { position: relative; }
.hero-art {
  display: block;
  width: 100%;
  height: auto;
}
.hero-rooms {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 入居中の窓（クリック領域。絵はイラスト側に合成済み） */
.room { cursor: pointer; outline: none; }
.room-hit {
  fill: transparent;
  transition: fill 0.3s;
}
.room:hover .room-hit,
.room:focus-visible .room-hit { fill: rgba(255, 235, 200, 0.16); }

/* 部屋名タグ（ホバー/フォーカスで窓の下に出る。それ自体もゲームへのリンク） */
.room-tag {
  position: absolute;
  transform: translate(-50%, 0);
  z-index: 3;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ink);
  border: 2px solid var(--room-accent, var(--accent));
  color: var(--paper-2);
  font-size: 13px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  pointer-events: none; /* 非表示時は当たり判定なし */
  opacity: 0;
  translate: 0 -4px;
  transition: opacity 0.25s, translate 0.25s, background 0.2s;
}
.room-tag.is-on {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto; /* 表示中はクリック可能 */
}
.room-tag:hover { background: #000; }
/* 窓とタグの隙間を埋める透明ブリッジ（カーソルが下りてくる間も消えない） */
.room-tag::before {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: -20px;
  height: 20px;
}

/* BGM トグル（1画面目・右下）。
   幅・高さを固定して border-radius:50% の楕円が OFF/ON どちらの文字でも崩れないようにする。 */
.sound-toggle {
  position: absolute;
  right: 22px;
  bottom: 20px;
  z-index: 6;
  width: 140px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%; /* = 楕円（幅≠高さ） */
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-serif-en);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(33, 27, 22, 0.12);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
}
.sound-toggle .sound-label { pointer-events: none; }
.sound-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 4px 6px 0 rgba(209, 68, 46, 0.28);
}
.sound-toggle[aria-pressed="true"] {
  background: var(--accent);
  color: var(--paper-2);
  border-color: var(--accent);
}
.sound-toggle[aria-pressed="true"] .sound-note {
  display: inline-block;
  animation: note-bob 1.05s ease-in-out infinite;
}
@keyframes note-bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-3px) rotate(4deg); }
}

/* ---------- sections ---------- */

.games { padding: 88px 0 40px; }
.about { padding: 80px 0 96px; }

.eyebrow {
  font-family: var(--font-serif-en);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.38em;
  color: var(--accent);
}

.sec-head { margin-bottom: 40px; }
.sec-head h2,
.about h2 {
  margin-top: 10px;
  font-family: var(--font-serif-jp);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: 0.06em;
}
.sec-note { margin-top: 6px; color: var(--muted); font-size: 13.5px; }

.noscript-note {
  grid-column: 1 / -1;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  color: var(--ink-soft);
}
.noscript-note a { color: var(--accent); text-decoration: underline; }

/* ---------- game cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
  gap: 30px;
}

.card {
  --card-accent: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 6px 6px 0 rgba(33, 27, 22, 0.1);
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.5s;
}
a.card { cursor: pointer; }
a.card:hover,
a.card:focus-visible {
  transform: translate(-2px, -6px);
  box-shadow:
    10px 12px 0 color-mix(in srgb, var(--card-accent) 30%, transparent),
    6px 6px 0 rgba(33, 27, 22, 0.08);
}
a.card:focus-visible { outline: 2px solid var(--card-accent); outline-offset: 4px; }

/* カーソル追従のわずかなハイライト */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--card-accent) 9%, transparent),
    transparent 68%
  );
}
a.card:hover::after { opacity: 1; }

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--thumb-pos, 50% 50%);
  transform: scale(1.01);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
a.card:hover .card-thumb img,
a.card:focus-visible .card-thumb img { transform: scale(1.055); }

.badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  color: var(--ink);
}
.badge.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--card-accent);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.badge.soon { color: var(--muted); border-color: var(--muted); }

.play-pill {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--paper-2);
  background: var(--ink);
  border: 2px solid var(--card-accent);
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
}
a.card:hover .play-pill,
a.card:focus-visible .play-pill {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px 26px 24px;
}
.card-title {
  font-family: var(--font-serif-jp);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.4;
}
.card[data-font="yuji"] .card-title { font-family: var(--font-yuji); font-weight: 400; font-size: 30px; }
.card-sub { margin-top: 4px; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; }
.card-desc {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.95;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  padding: 4px 12px;
  border: 1.5px solid color-mix(in srgb, var(--card-accent) 45%, var(--line));
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.card-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 2px dashed var(--line);
  margin-top: 20px;
}
.cta-main {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--card-accent) 78%, var(--ink));
}
.is-soon .cta-main { color: var(--muted); }
.cta-arrow { display: inline-block; transition: transform 0.3s; }
a.card:hover .cta-arrow { transform: translateX(5px); }
.cta-meta {
  font-family: var(--font-serif-en);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

/* 開発中カード */
.card.is-soon .card-thumb img { filter: saturate(0.92); }

/* 空室カード（次回作） */
.card.ghost {
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 280px;
  background: transparent;
  border: 2px dashed rgba(33, 27, 22, 0.35);
  box-shadow: none;
  color: var(--muted);
}
.ghost-plus {
  font-family: var(--font-serif-jp);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: rgba(33, 27, 22, 0.4);
  line-height: 1;
}
.ghost-text { font-size: 14px; letter-spacing: 0.08em; }
.ghost-sub { font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; }

/* ---------- about / footer ---------- */

.about-inner { max-width: 680px; }
.about p { margin-top: 16px; color: var(--ink-soft); font-size: 15px; }

.site-foot {
  border-top: 1px solid var(--ink);
  padding: 34px 0 44px;
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.foot-sub { font-size: 11.5px; }

/* ---------- reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- motion / responsive ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .badge.live::before { animation: none !important; }
  .brand, .head-nav { animation: none !important; opacity: 1; transform: none; }
  .card, .card-thumb img, .cta-arrow, .play-pill,
  .room-hit, .room-tag, .sound-toggle { transition: none !important; }
  .sound-toggle[aria-pressed="true"] .sound-note { animation: none !important; }
  a.card:hover, .sound-toggle:hover { transform: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* 文字が焼き込まれた横長イラストなので、狭い画面では
   建物（画像中央）にズームして切り抜く。stage内のimg+svgは
   一体で拡大されるため窓の座標はそのまま追従する */
@media (max-width: 760px) {
  /* 狭幅はズーム切り抜き表示。上端寄せだと下が切れるので中央配置に戻す（デスクトップのみ上寄せ） */
  .hero-viewport { aspect-ratio: 697 / 941; max-width: none; margin: auto; }
  .hero-stage { width: 240%; margin-left: -70%; }
  .room-tag { font-size: 12px; }
}

@media (max-width: 900px) {
  .games { padding-top: 72px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 20px; }
  .head-row { height: 72px; padding: 0 20px; }
  .head-nav { gap: 16px; }
  .brand-en { font-size: 18px; white-space: nowrap; }
  .brand-sub { font-size: 9.5px; }
  .grid { gap: 22px; }
  .card-body { padding: 20px 20px 20px; }
  .card-title { font-size: 23px; }
  .card[data-font="yuji"] .card-title { font-size: 26px; }
  .card-cta { flex-direction: column; align-items: flex-start; gap: 6px; }
  .sound-toggle { width: 124px; height: 46px; font-size: 12px; right: 14px; bottom: 14px; }
}
