/* ============================================================
   AR Gallery -Rei- — Japanese Modern (和モダン) Stylesheet
   ============================================================ */

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: #faf9f5;
  /* 微細な和紙風のざらつきをCSSのグラデーションだけで表現 */
  background-image: 
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0),
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: #333333;
  text-decoration: none;
}

/* ─── Header ─── */
.site-header {
  padding: 4rem 2rem 3rem;
  text-align: center;
  background-color: #f8f7f4;
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Noto Serif JP', serif;
  font-weight: 300;
  letter-spacing: 0.15em;
}

.logo-kanji {
  font-size: 2.8rem;
  color: #1a1a1a;
}

.logo-sub {
  font-size: 1.1rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  letter-spacing: 0.25em;
  color: #666666;
}

.tagline {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  font-weight: 300;
  color: #888888;
  letter-spacing: 0.1em;
}

/* ─── Filter Bar ─── */
.filter-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 2rem 2.5rem;
  max-width: 700px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  padding: 0.55rem 1.6rem;
  border: 1px solid #d0cdc7;
  border-radius: 2px;
  background-color: transparent;
  color: #888888;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: #999999;
  color: #555555;
}

.filter-btn.active {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
  color: #f8f7f4;
}

/* ─── Artwork Grid ─── */
.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 5rem;
}

.artwork-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem;
}

/* ─── Thumbnail Card ─── */
.thumb-card {
  position: relative;
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.35s ease, box-shadow 0.35s ease;

  /* 高さを固定 */
  height: 280px;
}

.thumb-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
}

.thumb-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  
  /* object-fit を contain に変更 */
  object-fit: contain;
  display: block;
  transition: opacity 0.3s ease;

  /* サムネイル画像の高さを固定 */
  height: 180px; /* 例として高さ240pxからサムネイル下に余白を作るため180pxに設定 */
}

.thumb-card .card-label {
  padding: 0.9rem 1rem 1rem;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: #333333;

  /* カードの下部に配置 */
  position: absolute;
  bottom: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.9); /* 背景色を追加してテキストが見えやすいようにする */
}

.thumb-card .card-year {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  color: #aaaaaa;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

/* ─── Sold Out Label ─── */
.sold-out-label {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background-color: #ff4d4d; /* 赤背景 */
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 0 3px 0 0; /* 右上角を丸める */
}

/* ─── Loading / Empty Messages ─── */
.loading-msg,
.empty-msg {
  text-align: center;
  padding: 4rem 1rem;
  font-size: 0.9rem;
  color: #aaaaaa;
  letter-spacing: 0.1em;
}

/* ─── Modal Overlay ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(248, 247, 244, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ─── Modal Close Button ─── */
.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  z-index: 1010;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 300;
  color: #666666;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.modal-close:hover {
  color: #1a1a1a;
  transform: scale(1.1);
}

/* ─── Modal Content ─── */
.modal-content {
  width: 92%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 3rem 2.5rem 2.5rem;
  background-color: #ffffff;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
  position: relative;

  display: flex;
  flex-direction: column; /* 垂直方向にレイアウト */
  align-items: center; /* 水平中央寄せ */
}

/* ─── Viewer Container ─── */
#viewer-container {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 60vh; /* ビューアーの最大高さを設定 */
  background-color: #f4f3f0;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center; /* 垂直方向に中央揃え */
  justify-content: center; /* 水平方向に中央揃え */
}

#viewer-container model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
}

/* ─── Artwork Info Panel ─── */
.artwork-info {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8e6e1;
}

.info-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: #1a1a1a;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
  font-size: 0.82rem;
  color: #999999;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.info-meta span {
  display: inline-flex;
  align-items: center;
}

.info-description {
  font-size: 0.92rem;
  line-height: 2;
  color: #555555;
  margin-bottom: 1.8rem;
}

/* ─── Buy Button ─── */
.btn-shop {
  display: inline-block;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  padding: 0.75rem 2.2rem;
  border: 1px solid #1a1a1a;
  background-color: #1a1a1a;
  color: #f8f7f4;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-shop:hover {
  background-color: transparent;
  color: #1a1a1a;
}

/* ─── Footer ─── */
.site-footer {
  text-align: center;
  padding: 2.5rem 2rem;
  font-size: 0.75rem;
  color: #bbbbbb;
  letter-spacing: 0.1em;
}

/* ─── Responsive Adjustments ─── */
@media (max-width: 768px) {
  .modal-content {
    width: 96%;
    padding: 2.5rem 1.2rem 2rem;
    max-height: 95vh; /* モーダルの最大高さを設定 */
  }

  .logo-kanji {
    font-size: 2.2rem;
  }

  .logo-sub {
    font-size: 0.95rem;
  }

  .tagline {
    font-size: 0.85rem;
  }

  .filter-bar {
    padding: 0 1.5rem 2rem;
    gap: 0.4rem;
  }

  .filter-btn {
    font-size: 0.78rem;
    padding: 0.5rem 1.2rem;
  }

  .gallery-container {
    padding: 0 1.2rem 3.5rem;
  }

  .artwork-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .modal-content {
    width: 96%;
    padding: 2.5rem 1.2rem 2rem;
    max-height: 95vh;
  }

  #viewer-container {
    aspect-ratio: 4 / 3;
    max-height: 50vh; /* ビューアーの最大高さを設定 */
  }

  .info-title {
    font-size: 1.2rem;
  }

  .info-description {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 2rem 1rem 1.5rem;
  }

  .thumb-card .card-label {
    font-size: 0.75rem;
    padding: 0.6rem 0.6rem 0.8rem;
  }

  .modal-content {
    padding: 2rem 1rem 1.5rem;
  }

  #viewer-container {
    aspect-ratio: 4 / 3;
    max-height: 45vh; /* ビューアーの最大高さを設定 */
  }
}

/* ─── Scrollbar Styling (Webkit) ─── */
.modal-content::-webkit-scrollbar {
  width: 4px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background-color: #d0cdc7;
  border-radius: 2px;
}

/* ─── Fade-in animation for thumbnails ─── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.thumb-card {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

/* ─── Artist Profile Section ─── */
.profile-section {
  padding: 80px 20px;
  background-color: #ffffff; /* 清潔感のある白 */
  max-width: 1000px;
  margin: 0 auto;
}

.profile-container {
  display: flex;
  gap: 50px;
  align-items: center;
}

/* スマホで見るときは縦並びにする（レスポンシブ） */
@media (max-width: 768px) {
  .profile-container {
    flex-direction: column;
    gap: 30px;
  }
}

.profile-image img {
  width: 100%;
  max-width: 350px;
  filter: grayscale(30%); /* 写真を少しだけモノトーンに寄せると水墨画サイトに馴染みます */
  border: 1px solid #eeeeee;
}

.profile-text h2 {
  font-family: "Yu Mincho", "YuMincho", serif; /* 日本の伝統を感じる明朝体 */
  font-size: 28px;
  color: #1a1a1a;
  margin-bottom: 20px;
  letter-spacing: 0.15em;
}

.profile-text p {
  font-size: 15px;
  line-height: 1.8;
  color: #444444; /* 優しい黒 */
  margin-bottom: 20px;
}

.history-list {
  list-style: none;
  padding: 0;
  border-top: 1px solid #333333; /* キリッとした黒い細線 */
  padding-top: 20px;
}

.history-list li {
  position: relative;
  font-size: 14px;
  margin-bottom: 10px;
  color: #555555;
}

.history-list span {
  display: inline-block;
  width: 80px; /* 年代の幅を揃える */
  font-weight: bold;
  position: absolute;
  left: 0;
}

.history-list .activities-list {
  list-style-type: disc; /* インデントと項目記号のためにリストスタイルを設定 */
  padding-left: 90px; /* 年度の幅（80px） + 少し余白（10px） */
  margin-top: 5px;
}

.history-list .activities-list li {
  margin-bottom: 5px;
}

/* 詳細プロフィールの開閉制御 */
.profile-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s ease-out, opacity 0.4s ease-out;
}

/* JavaScriptで「is-open」クラスがついたら全開にする */
.profile-details.is-open {
  max-height: 3000px; /* 十分な高さを確保 */
  opacity: 1;
  margin-top: 1.5rem;
}

.history-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.1rem;
  font-weight: 400;
  margin: 2rem 0 1rem;
  letter-spacing: 0.1em;
  color: #1a1a1a;
}

/* 詳しく見る ボタンのデザイン */
.profile-toggle-btn {
  display: block;
  margin-top: 1.5rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  padding: 0.5rem 2rem;
  border: 1px solid #333333;
  background-color: transparent;
  color: #333333;
  cursor: pointer;
  transition: all 0.3s ease;
}

.profile-toggle-btn:hover {
  background-color: #333333;
  color: #f8f7f4;
}

/* ボタンが開いている状態の文字切り替え用（JSと連動） */
.profile-toggle-btn.active::after {
  content: "";
}
