/* ============================================================
   Stella's Gallery スタイルシート
   廊下（暗め）→ 各部屋（テーマ色）→ 鑑賞ビュー の3層構成
   部屋の色は js/data.js の palette から CSS変数で渡されます
   ============================================================ */

/* --- フォント（自己ホスト：css/fonts/ 内。外部通信なし） ---
   サイトで使う文字だけに絞り込んだ軽量woff2。
   ※新しい日本語タイトルを追加して字が別フォントで表示される場合は、
     フォントの再サブセットが必要（Claudeに依頼してください）。 */
@font-face {
  font-family: "Shippori Mincho"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/ShipporiMincho-400.woff2") format("woff2");
}
@font-face {
  font-family: "Shippori Mincho"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("fonts/ShipporiMincho-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/CormorantGaramond-400.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond"; font-style: italic; font-weight: 400;
  font-display: swap; src: url("fonts/CormorantGaramond-400italic.woff2") format("woff2");
}
@font-face {
  font-family: "Great Vibes"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/GreatVibes-400.woff2") format("woff2");
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  background: linear-gradient(180deg, #1a1522 0%, #131019 55%, #0e0b13 100%);
  color: #efe9dd;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

button { font-family: inherit; }

[hidden] { display: none !important; }

/* ---- 廊下にただよう埃 ---- */

#dust-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.entrance, #corridor, .corridor-end { position: relative; z-index: 1; }

/* ============================================================
   エントランス
   ============================================================ */

.entrance {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

/* サイト名（筆記体で書き上げるSVG） */
.entrance-title svg {
  width: min(660px, 88vw);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 22px rgba(255, 240, 200, 0.2));
}

.entrance-title text {
  font-family: "Great Vibes", cursive;
  font-size: 96px;
  font-weight: 400;   /* h1のboldを継承させない（合成ボールドで太くなるのを防ぐ） */
}

.entrance-title tspan {
  fill: #f2ecdf;
  fill-opacity: 0;
  stroke: #f2ecdf;
  stroke-width: 1;
  stroke-dasharray: 1300 1300;   /* 筆記体の大文字の輪郭より長く */
  stroke-dashoffset: 1300;
}

/* フォント読み込み後に .write が付いてから書き始める */
.entrance-title.write tspan {
  animation:
    title-write 1.1s linear forwards,
    title-fill 0.9s ease forwards;
}

@keyframes title-write {
  to { stroke-dashoffset: 0; }
}

@keyframes title-fill {
  to { fill-opacity: 1; }
}

.entrance-sub {
  font-size: 0.92rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  opacity: 0;
  margin-top: 26px;
  animation: fade-in-06 1.4s ease 2.9s forwards;
}

@keyframes fade-in-06 {
  to { opacity: 0.6; }
}

.entrance-lead {
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  opacity: 0;
  margin-top: 64px;
  animation: fade-in-06 1.4s ease 3.5s forwards;
}

.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
}

.scroll-hint span {
  display: block;
  width: 1px;
  height: 72px;
  background: linear-gradient(180deg, rgba(239, 233, 221, 0) 0%, rgba(239, 233, 221, 0.7) 100%);
  animation: hint-drop 2.4s ease-in-out infinite;
  transform-origin: top;
}

@keyframes hint-drop {
  0%   { transform: scaleY(0); opacity: 0; }
  35%  { transform: scaleY(1); opacity: 1; }
  75%  { transform: scaleY(1); opacity: 0; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ============================================================
   廊下と扉
   ============================================================ */

.door-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 60px 20px;
  opacity: 0;
  transform: translateY(46px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

.door-section.visible { opacity: 1; transform: none; }

.door-wrap { transition: transform 1.6s cubic-bezier(0.6, 0, 0.3, 1); }

.door-section.opening .door-wrap { transform: scale(1.14); }

/* 扉の置き場（枠なし・扉そのものだけを見せる） */
.door-arch {
  position: relative;
  width: 268px;
  height: 428px;
  perspective: 1300px;
}

/* 足もとの影（床に立っている感じ） */
.door-arch::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -18px;
  height: 26px;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 70%);
}

/* 扉の奥から漏れる光 */
.door-light {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, var(--glow), rgba(0, 0, 0, 0) 75%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.9s ease;
}

/* 両開きの扉 */
.door {
  position: absolute;
  inset: 0;
  display: flex;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 1;
}

.leaf {
  position: relative;
  width: 50%;
  height: 100%;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0) 40%),
    linear-gradient(180deg, var(--door), color-mix(in srgb, var(--door) 58%, #000));
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 46px rgba(0, 0, 0, 0.45);
  transition: transform 1.5s cubic-bezier(0.65, 0, 0.25, 1);
  backface-visibility: hidden;
}

.leaf-l { transform-origin: left center; }
.leaf-r { transform-origin: right center; }

/* 中央の召し合わせの縦モール */
.leaf-r::before {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: -4px;
  width: 8px;
  border-radius: 3px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--door) 50%, #000),
    color-mix(in srgb, var(--door) 82%, #fff) 50%,
    color-mix(in srgb, var(--door) 50%, #000));
  z-index: 2;
}

/* アイアン細工入りのアーチ窓 */
.pane {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 54%;
  border-radius: 58px 58px 3px 3px;
  border: 4px solid color-mix(in srgb, var(--door) 82%, #fff);
  background:
    linear-gradient(165deg, rgba(160, 180, 205, 0.18) 0%, rgba(10, 14, 24, 0.55) 62%),
    color-mix(in srgb, var(--door) 36%, #0a0d14);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.55),
    0 1px 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* 窓ガラス越しに部屋の光がにじむ */
.pane::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(255, 246, 224, 0.65) 0%, rgba(255, 246, 224, 0) 55%),
    radial-gradient(ellipse at 50% 58%, var(--glow) 0%, var(--glow) 20%, rgba(0, 0, 0, 0) 80%);
  opacity: 0;
  transition: opacity 0.9s ease;
}

/* 下部の鏡板（モールディング入り） */
.panel-btm {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(54% + 42px);
  bottom: 12px;
  border: 3px solid color-mix(in srgb, var(--door) 84%, #fff);
  border-radius: 2px;
  box-shadow:
    inset 2px 2px 4px rgba(0, 0, 0, 0.4),
    inset -1px -1px 2px rgba(255, 255, 255, 0.08);
}

.panel-btm::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 1px;
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.07);
}

/* 真鍮のレバーハンドル（飾り座金つき） */
.handle {
  position: absolute;
  top: 54%;
  width: 11px;
  height: 48px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ecd6a0, #a8843c 70%, #77592a);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.handle::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 24px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f2dfae, #9c7c3c);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.leaf-l .handle { right: 9px; }
.leaf-l .handle::after { right: 8px; }
.leaf-r .handle { left: 9px; }
.leaf-r .handle::after { left: 8px; }

/* ホバー：扉がすこし開いて、窓と隙間から部屋の光が漏れる */
.door-arch:hover .leaf-l { transform: rotateY(-8deg); }
.door-arch:hover .leaf-r { transform: rotateY(8deg); }
.door-arch:hover .door-light { opacity: 0.5; }
.door-arch:hover .pane::before { opacity: 1; }

/* クリック：両開きに大きく開く */
.door-section.opening .leaf-l { transform: rotateY(-88deg); }
.door-section.opening .leaf-r { transform: rotateY(88deg); }
.door-section.opening .door-light { opacity: 1; }
.door-section.opening .pane::before { opacity: 1; }

.door-plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 44px;
  border-top: 1px solid rgba(239, 233, 221, 0.25);
  border-bottom: 1px solid rgba(239, 233, 221, 0.25);
  transition: border-color 0.6s ease;
}

.door-section:hover .door-plate { border-color: rgba(239, 233, 221, 0.55); }

.plate-ja {
  font-size: 1.7rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
}

.plate-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.2em;
  opacity: 0.55;
}

/* ---- 廊下のおわり ---- */

.corridor-end {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

.corridor-end.visible { opacity: 1; transform: none; }

.corridor-end .ja { letter-spacing: 0.5em; text-indent: 0.5em; opacity: 0.7; }

.corridor-end .en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  opacity: 0.45;
  letter-spacing: 0.15em;
}

.corridor-end .to-top {
  margin-top: 28px;
  color: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  text-decoration: none;
  border: 1px solid rgba(239, 233, 221, 0.35);
  padding: 10px 28px;
  border-radius: 999px;
  opacity: 0.75;
  transition: opacity 0.4s, background 0.4s;
}

.corridor-end .to-top:hover { opacity: 1; background: rgba(239, 233, 221, 0.08); }

/* ============================================================
   部屋
   ============================================================ */

.room-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  color: var(--text);
  opacity: 0;
  transition: opacity 0.65s ease;
}

.room-overlay.show { opacity: 1; }

.room-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.room-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
}

.room-inner {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 48px 90px;
}

.room-back {
  background: none;
  border: 1px solid color-mix(in srgb, var(--text) 40%, transparent);
  color: var(--text);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  padding: 9px 22px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.4s, background 0.4s;
}

.room-back:hover { opacity: 1; background: color-mix(in srgb, var(--text) 10%, transparent); }

.room-heading {
  text-align: center;
  margin-top: 34px;
}

.room-ja {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 500;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
}

.room-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-top: 12px;
}

.room-heading::after {
  content: "";
  display: block;
  width: 64px;
  height: 1px;
  margin: 30px auto 0;
  background: var(--accent);
  opacity: 0.6;
}

/* ---- 展示 ---- */

.room-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 64px 48px;
  margin-top: 70px;
}

.work {
  cursor: pointer;
  text-align: center;
  opacity: 0;
  animation: work-in 1s ease both;
  animation-delay: var(--enter-delay, 0.2s);
}

@keyframes work-in {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.frame {
  display: inline-block;
  padding: 14px;
  background: linear-gradient(150deg, #fdfaf3 0%, #f4efe3 55%, #e9e2d2 100%);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.work:hover .frame {
  transform: translateY(-7px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.38);
}

.art {
  position: relative;
  display: block;
  height: 300px;
  border: 1px solid rgba(105, 95, 75, 0.22);   /* 白枠と絵の境の細い線 */
  overflow: hidden;
  user-select: none;
}

.art img {
  display: block;
  height: 100%;
  width: auto;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* 仮画像（作品イメージ）の飾り */
.ph-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.5);
}

.ph-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: rgba(255, 255, 255, 0.55);
}

.work figcaption {
  margin-top: 18px;
  line-height: 1.7;
}

.wt-ja {
  display: block;
  font-size: 1rem;
  letter-spacing: 0.2em;
}

.wt-en {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 0.92rem;
  opacity: 0.65;
  letter-spacing: 0.12em;
}

/* ---- 次の部屋へ ---- */

.room-nav {
  text-align: center;
  margin-top: 90px;
}

.room-next {
  background: none;
  border: 1px solid color-mix(in srgb, var(--text) 40%, transparent);
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  padding: 13px 40px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.4s, background 0.4s;
}

.room-next:hover { opacity: 1; background: color-mix(in srgb, var(--text) 10%, transparent); }

/* ============================================================
   鑑賞ビュー
   ============================================================ */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 7, 13, 0.9);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.45s ease;
}

#lightbox.show { opacity: 1; }

.lb-body {
  text-align: center;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.55s ease;
}

#lightbox.show .lb-body { transform: none; }

.lb-art-wrap .art {
  display: inline-block;
  width: auto;
  height: auto;               /* 画像にぴったり合わせて額縁が包む（上下の黒い隙間を防ぐ） */
  max-width: 92vw;
  margin: 0 auto;
  border: 16px solid #f9f5eb;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.6);
}

.lb-art-wrap .art img {
  display: block;
  width: auto;
  height: auto;
  max-height: 78vh;
  max-width: calc(92vw - 32px);
  object-fit: contain;
}

.lb-caption { margin-top: 30px; color: #f2eef8; }

.lb-ja {
  font-size: 1.3rem;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  opacity: 0;
  animation: caption-in 0.9s ease 0.35s forwards;
}

.lb-en {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.15em;
  color: #cdc2e2;
  margin-top: 8px;
  opacity: 0;
  animation: caption-in 0.9s ease 0.55s forwards;
}

@keyframes caption-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 0.95; transform: none; }
}

.lb-close {
  position: absolute;
  top: 22px;
  right: 34px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.3s;
}

.lb-close:hover { opacity: 1; }

/* ============================================================
   小さめの画面への配慮（PC中心だが最低限）
   ============================================================ */

@media (max-width: 640px) {
  .room-inner { padding: 28px 16px 70px; }
  .room-gallery { gap: 52px 0; }
  /* スマホでは各作品を横幅基準で大きく表示する */
  .art { height: auto; width: 78vw; max-width: 420px; }
  .art img { height: auto; width: 100%; }
  /* 拡大表示は額縁をやや細めに */
  .lb-art-wrap .art { border-width: 12px; }
  .lb-art-wrap .art img { max-height: 74vh; max-width: calc(94vw - 24px); }
  .door-wrap { transform: scale(0.78); }
  .door-section.opening .door-wrap { transform: scale(0.88); }
}
