/* ============================================================================
 *  style.css ― ダーク基調・ミニマル・作品が主役。
 *  色やフォントの基調は :root の変数を変えるだけで一括調整できます。
 * ========================================================================== */

:root {
  /* レイアウト系（テーマ非依存） */
  --maxw: 1280px;
  --gap: clamp(12px, 1.6vw, 22px);
  --pad: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fade-dur: 0.8s;

  /* ライトボックスの背景は写真が映える暗幕でどちらのテーマでも共通 */
  --lightbox-bg: rgba(5, 5, 6, 0.94);
}

/* ---- ダークテーマ（既定） ---- */
:root,
[data-theme="dark"] {
  --bg:        #0b0b0c;   /* 全体背景（ほぼ黒） */
  --bg-soft:   #121214;   /* セクションのわずかな差 */
  --surface:   #18181b;   /* カード/枠面 */
  --line:      rgba(255,255,255,0.08);
  --text:      #e9e7e2;   /* オフホワイト本文 */
  --text-dim:  #a7a39c;   /* 弱い文字（キャプション等） */
  --text-faint:#6f6b64;   /* さらに弱い */
  --accent:    #c9c2b6;   /* ウォームグレーのアクセント */
  --nav-bg:    rgba(11, 11, 12, 0.72);
  --selection: rgba(201, 194, 182, 0.25);
}

/* ---- ライトテーマ ---- */
[data-theme="light"] {
  --bg:        #f5f4f1;   /* 温かみのあるオフホワイト */
  --bg-soft:   #eeece7;   /* セクションのわずかな差 */
  --surface:   #e7e4de;   /* カード/枠面 */
  --line:      rgba(0,0,0,0.10);
  --text:      #1c1b19;   /* ほぼ黒の本文 */
  --text-dim:  #5a564f;   /* 弱い文字 */
  --text-faint:#8b867d;   /* さらに弱い */
  --accent:    #6e675b;   /* 濃いめのウォームグレー */
  --nav-bg:    rgba(245, 244, 241, 0.78);
  --selection: rgba(110, 103, 91, 0.22);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
               "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  font-weight: 300;            /* 繊細な細字を基調に */
  line-height: 1.8;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}

body.no-scroll { overflow: hidden; }

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

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

::selection { background: var(--selection); }

/* ----------------------------------------------------------------------------
 *  ナビ（上部固定）
 * -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease),
              backdrop-filter 0.5s var(--ease);
}
.nav.is-scrolled {
  background: var(--nav-bg);
  border-bottom-color: var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav__brand {
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}
.nav__right {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.5vw, 34px);
}
.nav__links {
  display: flex;
  gap: clamp(18px, 3vw, 40px);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav__links a { color: var(--text-dim); transition: color 0.3s var(--ease); }
.nav__links a:hover { color: var(--text); }

/* テーマ切り替えボタン */
.nav__theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.nav__theme:hover { color: var(--text); border-color: var(--accent); }
.nav__theme svg { display: block; }
/* 現在のテーマに応じてアイコンを出し分け（ダーク→太陽 / ライト→月） */
[data-theme="dark"]  .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }

/* スマホでは詰めて1行に収める（ロゴが折り返さないように） */
@media (max-width: 640px) {
  .nav { padding: 14px 18px; }
  .nav__brand { font-size: 0.7rem; letter-spacing: 0.12em; white-space: nowrap; }
  .nav__right { gap: 14px; }
  .nav__links { gap: 13px; font-size: 0.62rem; letter-spacing: 0.08em; }
  .nav__theme { width: 30px; height: 30px; }
}
@media (max-width: 360px) {
  .nav__right { gap: 10px; }
  .nav__theme { width: 28px; height: 28px; }
}
@media (max-width: 360px) {
  .nav__links { gap: 10px; font-size: 0.58rem; letter-spacing: 0.04em; }
}

/* ----------------------------------------------------------------------------
 *  ヒーロー
 * -------------------------------------------------------------------------- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--pad) + 40px) var(--pad) var(--pad);
  position: relative;
}
.hero__inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(36px, 6vw, 90px);
  align-items: center;
}
.hero__lead { min-width: 0; }
.hero__name {
  font-size: clamp(2rem, 5.4vw, 4.4rem);
  font-weight: 200;
  letter-spacing: 0.1em;
  margin: 0;
  line-height: 1.16;
}
/* ステートメント（名前の下・作家の姿勢） */
.hero__statement {
  margin: clamp(16px, 3vh, 30px) 0 0;
  font-size: clamp(1.15rem, 2.6vw, 1.9rem);
  font-weight: 200;
  letter-spacing: 0.12em;
  line-height: 1.6;
  color: var(--text);
}
/* ステートメントの英語表記（日本語ステートメントの下） */
.hero__statement-en {
  margin-top: clamp(12px, 2vh, 18px);
  font-size: clamp(0.82rem, 1.3vw, 0.95rem);
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

/* 表紙右側：プロフィール（出身・機材） */
.hero__profile {
  border-left: 1px solid var(--line);
  padding-left: clamp(28px, 4vw, 56px);
}
.profile__label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 20px;
}
.profile__origin {
  margin: 0 0 clamp(28px, 4vh, 42px);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.profile__equipment {
  display: flex;
  gap: clamp(28px, 4vw, 56px);
  flex-wrap: wrap;
}
.profile__gear-title {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.profile__gear-list { list-style: none; margin: 0; padding: 0; }
.profile__gear-list li {
  font-size: 0.86rem;
  line-height: 2;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* スマホ・タブレットでは縦積み（名前→ステートメント→プロフィールの順） */
@media (max-width: 860px) {
  /* 内容が縦に伸びるので、SCROLL を絶対配置ではなく通常フローに置いて重なりを防ぐ */
  .hero {
    flex-direction: column;
    justify-content: center;
    padding-top: calc(var(--pad) + 64px);
  }
  .hero__inner {
    grid-template-columns: 1fr;
    gap: clamp(28px, 5vh, 44px);
  }
  .hero__profile {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: clamp(26px, 4vh, 36px);
  }
}
.hero__scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.hero__scroll::after {
  content: "";
  width: 1px;
  height: 42px;
  background: linear-gradient(var(--text-faint), transparent);
  animation: scrollHint 2.4s var(--ease) infinite;
}
@keyframes scrollHint {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}
/* スマホでは SCROLL を通常フロー（コンテンツの下）に置いて自己紹介との重なりを防ぐ。
   ※この上書きは基準 .hero__scroll より後に置く必要がある（同詳細度・後勝ち） */
@media (max-width: 860px) {
  .hero__scroll {
    position: static;
    transform: none;
    margin-top: clamp(32px, 6vh, 56px);
  }
}

/* ----------------------------------------------------------------------------
 *  共通セクション
 * -------------------------------------------------------------------------- */
.section { padding: clamp(72px, 12vh, 160px) var(--pad); }
.section--soft { background: var(--bg-soft); }
.container { max-width: var(--maxw); margin: 0 auto; }

.section__head {
  margin: 0 0 clamp(36px, 6vh, 72px);
  text-align: center;
}
.section__title {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0;
}

/* ----------------------------------------------------------------------------
 *  作品ギャラリー（メイソンリー = CSS columns で縦横比を保持）
 * -------------------------------------------------------------------------- */
.gallery {
  column-count: 3;
  column-gap: var(--gap);
}
@media (max-width: 1024px) { .gallery { column-count: 2; } }
@media (max-width: 640px)  { .gallery { column-count: 1; } }

.work {
  break-inside: avoid;
  margin: 0 0 var(--gap);
  cursor: pointer;
  /* フェードイン初期状態 */
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--fade-dur) var(--ease),
              transform var(--fade-dur) var(--ease);
  outline: none;
}
.work.is-visible { opacity: 1; transform: none; }

.work picture, .work img {
  width: 100%;
  border-radius: 2px;
  background: var(--surface);   /* 読み込み前も暗い面でなじむ（白枠を出さない） */
}
.work img { transition: opacity 0.6s var(--ease); }

.work__caption {
  padding: 14px 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.work__title {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.work__text {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
}
/* カード内の購入リンク（purchaseUrl がある作品のみ表示） */
.work__buy {
  align-self: flex-start;
  margin-top: 12px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.work__buy:hover { border-color: var(--accent); color: var(--text); }
.work:hover img { opacity: 0.86; }
.work:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }

/* ----------------------------------------------------------------------------
 *  将来EC用カテゴリの枠（控えめ・全体トーンになじませる）
 * -------------------------------------------------------------------------- */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
  max-width: 820px;
  margin: 0 auto;
}
.category {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.012);
  transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
}
a.category:hover { border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.03); }
.category__title {
  font-size: 1.15rem;
  font-weight: 300;
  letter-spacing: 0.06em;
}
.category__subtitle { font-size: 0.82rem; color: var(--text-dim); }
.category__note { font-size: 0.8rem; color: var(--text-faint); margin-top: 6px; }
.category__status {
  margin-top: 18px;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ----------------------------------------------------------------------------
 *  フッター（Contact）
 * -------------------------------------------------------------------------- */
.footer {
  padding: clamp(64px, 10vh, 120px) var(--pad) 48px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.footer__note {
  max-width: 40ch;
  margin: 0 auto 26px;
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.footer__links {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 28px;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
.footer__links a { color: var(--text-dim); transition: color 0.3s var(--ease); }
.footer__links a:hover { color: var(--text); }
.footer__copy {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ----------------------------------------------------------------------------
 *  ライトボックス（拡大表示）
 * -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  /* 拡大表示は常に暗幕。テーマに関わらず内部は明色テキストで固定する */
  --text: #e9e7e2;
  --text-dim: #a7a39c;
  --text-faint: #6f6b64;
  --accent: #c9c2b6;
}
.lightbox.is-open { display: flex; }
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: var(--lightbox-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lightbox__dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: lbIn 0.4s var(--ease);
}
@keyframes lbIn {
  from { opacity: 0; transform: scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 74vh;
  width: 100%;
}
.lightbox__picture, .lightbox__picture img {
  max-height: 74vh;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  border-radius: 2px;
}
.lightbox__info { text-align: center; max-width: 60ch; padding: 0 12px; }
.lightbox__title {
  margin: 0 0 6px;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}
.lightbox__caption { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

/* EC枠（価格・エディション・購入ボタン） */
.lightbox__meta { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox__metarow { display: flex; gap: 18px; align-items: baseline; color: var(--text); }
.lightbox__edition { font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); }
.lightbox__price { font-size: 1rem; letter-spacing: 0.04em; }
.btn-buy {
  display: inline-block;
  padding: 11px 30px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.btn-buy:hover { background: var(--accent); color: var(--bg); }

/* ライトボックス操作ボタン */
.lightbox__btn {
  position: absolute;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.3s var(--ease);
  z-index: 2;
}
.lightbox__btn:hover { color: var(--text); }
.lightbox__close { top: -6px; right: 0; font-size: 2rem; line-height: 1; }
.lightbox__prev, .lightbox__next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
  padding: 0 10px;
}
.lightbox__prev { left: -14px; }
.lightbox__next { right: -14px; }
@media (max-width: 640px) {
  .lightbox__prev { left: -2px; }
  .lightbox__next { right: -2px; }
  .lightbox__btn { font-size: 2.2rem; }
  .lightbox__close { font-size: 1.8rem; }
}

/* ----------------------------------------------------------------------------
 *  動きを抑える設定のユーザーを尊重
 * -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  html { scroll-behavior: auto; }
  .work { opacity: 1 !important; transform: none !important; transition: none; }
  .hero__scroll::after { animation: none; }
}
