/* Works list page + home 3D gallery */

.page-works {
  background: #ffffff;
  color: #050505;
  min-height: 100vh;
  min-height: 100dvh;
}

.page-works .site-header {
  position: sticky;
  top: 0;
  z-index: 2000;
}

.works {
  box-sizing: border-box;
  width: min(100%, 68rem);
  max-width: 100%;
  margin: 0 auto;
  padding:
    clamp(1.5rem, 3.5vh, 2.5rem)
    clamp(1.25rem, 4vw, 3.5rem)
    clamp(3.25rem, 7vh, 5rem);
}

.works__intro {
  text-align: left;
  margin-bottom: clamp(1rem, 2.2vh, 1.5rem);
}

.works__eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: #777777;
}

.works__title {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #050505;
}

.works__lead {
  margin: 0.55rem 0 0;
  max-width: 34rem;
  font-size: clamp(0.88rem, 1.1vw, 0.95rem);
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: #444444;
}

/* ----- Works list grid ----- */

.works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* 行間: 補足リンク〜次案件見出しのあいだに約12〜16px足す */
  row-gap: calc(clamp(1.15rem, 2.4vw, 1.75rem) + 0.875rem);
  column-gap: clamp(1rem, 2vw, 1.5rem);
}

.works-card {
  margin: 0;
  min-width: 0;
}

/* アンカー移動時に固定ヘッダーで隠れないようにする */
.works-card[id] {
  scroll-margin-top: calc(var(--header-height, 64px) + 0.85rem);
}

.works-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 0.85rem;
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid rgba(5, 5, 5, 0.08);
}

.works-card__photos {
  display: grid;
  gap: 0.65rem;
}

/* 横長写真用（比率は画像に合わせて差し替え可） */
.works-card__media--landscape {
  aspect-ratio: 1024 / 610;
  background: #0d1520;
}

/* メイン：枠は16:10固定。全体を収めて余白は枠背景でなじませる */
.works-card__media--main {
  aspect-ratio: 16 / 10;
  background: #ececeb;
}

/* 補足：開閉内。画像ごとの縦横比を維持 */
.works-card__media--extra,
.works-card__media--shot {
  aspect-ratio: auto;
  background: #f2f2f2;
}

.works-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.works-card__media--main .works-card__image {
  /* 16:10枠を埋め、左右のグレー帯を出さない */
  object-fit: cover;
  object-position: center top;
}

.works-card__media--extra .works-card__image,
.works-card__media--shot .works-card__image {
  object-fit: contain;
  object-position: center top;
}

.works-card__media--plain {
  background: #5a5a5a;
  border-color: rgba(5, 5, 5, 0.12);
}

.works-card__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.works-card__intro {
  min-width: 0;
}

.works-card__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: #777777;
}

.works-card__name {
  margin: 0.35rem 0 0;
  font-size: clamp(0.98rem, 1.35vw, 1.12rem);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.03em;
  color: #050505;
}

.works-card__intro > .works-card__name:first-child {
  margin-top: 0;
}

.works-card__label + .works-card__name {
  margin-top: 0.3rem;
}

.works-card__media--plain + .works-card__name {
  margin-top: 0.65rem;
}

.works-card__lead {
  /* 案件名〜紹介文: 約8〜12px */
  margin: 0.625rem 0 0;
  font-size: clamp(0.88rem, 1.15vw, 0.95rem);
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: #444444;
}

.works-card__intro + .works-card__media,
.works-card__lead + .works-card__media,
.works-card__name + .works-card__media {
  /* 紹介文〜画像: 約16〜24px */
  margin-top: 1.15rem;
}

.works-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  margin-top: 0.55rem;
  font-size: clamp(0.88rem, 1.15vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: #050505;
  text-decoration: underline;
  text-underline-offset: 0.28em;
}

.works-card__link-arrow {
  font-weight: 600;
  text-decoration: none;
}

.works-card__link:hover,
.works-card__link:focus-visible {
  color: var(--color-teal, #2eb8a6);
  outline: none;
}

.works-card__more {
  margin-top: 0.7rem;
}

.works-card__more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  cursor: pointer;
  list-style: none;
  font-size: clamp(0.84rem, 1.1vw, 0.92rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: #333333;
  text-decoration: underline;
  text-underline-offset: 0.24em;
}

.works-card__more-toggle::-webkit-details-marker {
  display: none;
}

.works-card__more-toggle::before {
  content: "＋";
  display: inline-block;
  width: 1em;
  font-weight: 700;
  text-decoration: none;
  color: #666666;
}

.works-card__more[open] > .works-card__more-toggle::before {
  content: "－";
}

.works-card__more-toggle:hover,
.works-card__more-toggle:focus-visible {
  color: var(--color-teal, #2eb8a6);
  outline: none;
}

.works-card__more .works-card__media {
  margin-top: 0.7rem;
}

/*
  PC 2列：画像上端と「サイトを見る」をそろえる。
  紹介文の長さ差は subgrid に任せ、固定 min-height は使わない。
*/
@media (min-width: 721px) {
  .works-card--featured {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 4;
    align-content: start;
    row-gap: 0;
  }

  .works-card--featured .works-card__intro {
    align-self: start;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .works-card--featured .works-card__intro + .works-card__media {
    margin-top: 1.15rem;
  }

  .works-card--featured .works-card__link {
    margin-top: 0.55rem;
    align-self: start;
  }

  .works-card--featured .works-card__more {
    margin-top: 0.7rem;
  }
}

/* ----- Home works section (3D gallery) ----- */

.home-works {
  position: relative;
  z-index: 0;
  isolation: isolate;
  overflow: hidden;
  background: #050505;
  color: #ffffff;
  /* メイン写真の直後：見出し余白でセクション切替を明確に */
  padding:
    clamp(3.5rem, 8vh, 5.75rem)
    0
    clamp(3.25rem, 7vh, 5.25rem);
  scroll-margin-top: calc(var(--header-height) + 0.75rem);
}

/* セクション全体の環境光：上下左右とも黒へ溶ける（箱の縁を出さない） */
.home-works::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 0;
  width: min(140vw, 1600px);
  height: min(130%, 1180px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 58% 48% at 50% 46%,
      rgba(255, 248, 238, 0.17) 0%,
      rgba(255, 242, 228, 0.09) 24%,
      rgba(255, 236, 220, 0.04) 44%,
      rgba(10, 8, 5, 0.012) 60%,
      transparent 76%
    );
}

.home-works__intro {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  width: min(100%, 68rem);
  margin: 0 auto clamp(3rem, 6vh, 4.25rem);
  padding: 0 clamp(1.25rem, 4vw, 3.5rem);
  text-align: center;
}

.home-works__eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--color-gray);
}

.home-works__title {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ffffff;
}

.home-works__list-link {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  width: fit-content;
  margin: 1.75rem auto 0;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem);
  font-size: clamp(0.9rem, 1.15vw, 0.98rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 0.28em;
}

.home-works__list-link:hover,
.home-works__list-link:focus-visible {
  opacity: 0.75;
  outline: none;
}

/* ----- Gallery ----- */

.gallery {
  /*
    半径は JS が枚数・カード幅から --gallery-radius を算出。
    CSS の初期値はフォールバックのみ。矢印は輪の外側に確保。
  */
  --gallery-card-w: clamp(360px, 28vw, 480px);
  --gallery-card-h: calc(var(--gallery-card-w) * 1.42);
  --gallery-radius: 620px;
  --gallery-spread-x: 1;
  --gallery-arrow-inset: clamp(1rem, 2.4vw, 2.25rem);
  --gallery-foot-glow-opacity: 1;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 var(--gallery-arrow-inset);
  user-select: none;
  touch-action: pan-y;
}

.gallery__viewport {
  position: relative;
  z-index: 1;
  width: min(100%, 92vw);
  margin: 0 auto;
  /* 拡大カード＋台の余白。見出し／キャプションと重ねない */
  height: calc(var(--gallery-card-h) + 6.5rem);
  /* PC: カード中央高さから水平に見る（台は足元の細い楕円） */
  perspective: 1250px;
  perspective-origin: 50% 50%;
  overflow: visible;
}

/* PC: 足元光は回転台側へ。スマホ用のフォールバックはメディアクエリで復活 */
.gallery__viewport::after {
  content: none;
}

.gallery__stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  cursor: grab;
}

.gallery__stage.is-dragging {
  cursor: grabbing;
}

.gallery__ring {
  position: relative;
  width: var(--gallery-card-w);
  height: var(--gallery-card-h);
  transform-style: preserve-3d;
  /* 回転は JS の rAF のみ。CSS transition との二重制御でカクつかないようにする */
  transition: none;
  will-change: transform;
}

.gallery.is-reduced .gallery__ring {
  transition: none;
}

/*
  回転台：正面視点で足元に見える薄い円盤。リングと同じ回転で同期。
  サイズは JS が --tt-x / --tt-z に実半径を入れる。
*/
.gallery__turntable {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: var(--tt-x, calc(var(--gallery-radius) * 2));
  height: var(--tt-z, calc(var(--gallery-radius) * 2));
  transform: translate(-50%, -50%) translateY(calc(var(--gallery-card-h) * 0.5))
    rotateX(-90deg);
  transform-style: preserve-3d;
  pointer-events: none;
}

.gallery__turntable-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%) translateZ(-3px);
  border-radius: 50%;
  opacity: var(--gallery-foot-glow-opacity);
  background:
    radial-gradient(
      ellipse 62% 62% at 50% 50%,
      rgba(255, 252, 247, 0.38) 0%,
      rgba(255, 247, 236, 0.18) 30%,
      rgba(255, 240, 224, 0.06) 55%,
      transparent 76%
    );
}

/* 円盤の面・輪郭・点線は出さず、中央の柔らかい光だけ残す */
.gallery__turntable-disc {
  display: none;
}

.gallery__turntable-marks {
  display: none;
}

.gallery__card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  /* 中央基準で左右対称に見えるようにする（回転台は別要素） */
  transform-origin: 50% 50%;
  /* 隙間から裏写真・反転文字が見えないようにする */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.gallery__frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 1.1rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(255, 255, 255, 0.06) inset;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
}

.gallery__badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 1;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.gallery__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-align: center;
}

.gallery__frame--plain {
  background: #5a5a5a;
}

/* 写真カード：端まで埋め、上下の白帯・枠の白い縁を抑える */
.gallery__frame--photo {
  background: #111111;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.gallery__image {
  position: absolute;
  /* 枠線ぶんも覆い、角丸のすき間や上下帯を出さない */
  inset: -1px;
  display: block;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  max-width: none;
  object-fit: cover;
  object-position: center center;
}

/* HR Colors：塗料缶・刷毛が中央に来る位置 */
.gallery__image--hr-colors {
  object-position: center 42%;
}

.gallery__card-link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.gallery__card-link:focus-visible .gallery__frame {
  outline: 2px solid rgba(255, 255, 255, 0.92);
  outline-offset: 3px;
}

/*
  左上ロゴ。
  - 角丸（1.1rem）に欠けないよう、カード端から十分な余白
  - 白枠だけの空表示はしない（素材なしは HTML 側で省略）
  - クリックは親の <a> が受ける
*/
.gallery__logo {
  position: absolute;
  /* 角丸 1.1rem に欠けないよう、端から十分な余白 */
  top: 1.55rem;
  left: 1.55rem;
  z-index: 3;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  max-width: min(44%, 8.25rem);
  padding: 0.3rem 0.45rem;
  border-radius: 0.4rem;
  pointer-events: none;
}

.gallery__logo--wide {
  max-width: min(52%, 9.5rem);
}

/* ロゴ下地は全カード共通の半透明黒（計算済み: rgba(0,0,0,0.45)） */
.gallery__logo--dark {
  background: rgba(0, 0, 0, 0.45);
}

.gallery__logo--light {
  background: rgba(0, 0, 0, 0.45);
}

/* 円形マークなど、下地なしでそのまま載せる */
.gallery__logo--mark {
  top: 1.95rem;
  left: 1.95rem;
  padding: 0;
  background: transparent;
  border-radius: 0;
  max-width: none;
}

.gallery__logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 1.85rem;
  object-fit: contain;
  object-position: left center;
}

.gallery__logo--mark img {
  max-height: 1.75rem;
  max-width: 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
}

/* ワイズ：丸ロゴを直径約20%大きく（配置・縦横比は維持） */
.gallery__logo.gallery__logo--ys img {
  max-height: 2.1rem;
  max-width: 2.1rem;
  width: 2.1rem;
  height: 2.1rem;
}

/* Nico.：公式ヘッダー同型（金文字 + Karaoke Lounge）。下地は他カードと同じ半透明黒 */
.gallery__logo--nico {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  max-width: min(48%, 8.5rem);
  padding: 0.35rem 0.5rem 0.4rem;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  box-shadow: none;
}

.gallery__logo-nico-name {
  color: #d4af37;
  font-family:
    "Nunito",
    "Rounded Mplus 1c",
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    sans-serif;
  font-size: clamp(0.95rem, 1.7vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.gallery__logo-nico-sub {
  color: #f0f0f0;
  font-family:
    "Nunito",
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    sans-serif;
  font-size: clamp(0.42rem, 0.85vw, 0.52rem);
  font-weight: 300;
  letter-spacing: 0.14em;
  line-height: 1.2;
  white-space: nowrap;
}

/* HR Colors：キャラ + HRカラーズ（暗色帯・白文字。白枠なし） */
.gallery__logo--hr {
  max-width: min(52%, 9.25rem);
  padding: 0.22rem 0.4rem 0.22rem 0.22rem;
}

.gallery__logo--hr .gallery__logo-mark {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  max-height: 1.85rem;
  border-radius: 0.3rem;
  object-fit: contain;
  background: transparent;
}

.gallery__logo-name {
  color: #ffffff;
  font-size: clamp(0.68rem, 1.15vw, 0.82rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.gallery__logo--text {
  max-width: min(48%, 8.5rem);
  padding: 0.32rem 0.5rem;
  color: #ffffff;
  font-size: clamp(0.68rem, 1.2vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
}

.gallery__logo--text small {
  display: inline;
  margin-right: 0.12em;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/*
  右上白文字用の共通帯。
  - カード上辺の全幅から下へ透明になる縦グラデーションのみ
  - 左上ロゴとぶつからないよう、ラベルは右寄せ＋最大幅を制限
*/
.gallery__corner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  /* 文字帯＋余韻。屋根より手前で透明になる高さ */
  height: clamp(4.75rem, 20%, 6.75rem);
  /* 右上余白は全カード共通 */
  padding: 1.05rem 1.15rem 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.52) 0%,
    rgba(0, 0, 0, 0.4) 32%,
    rgba(0, 0, 0, 0.2) 58%,
    rgba(0, 0, 0, 0.06) 82%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* CHULIP：看板とラベルの重なりは写真位置で調整（ラベル余白は他カードと共通） */
.gallery__image--chulip {
  object-position: center 62%;
}

.gallery__corner-label {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(54%, 11rem);
  color: rgba(255, 255, 255, 0.96);
  font-family:
    "Hiragino Mincho ProN",
    "Hiragino Mincho Pro",
    "Yu Mincho",
    "YuMincho",
    "Noto Serif JP",
    "MS PMincho",
    serif;
  font-size: clamp(0.78rem, 1.35vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-align: right;
  opacity: 1;
  /* ごく薄い近接影のみ */
  text-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.28);
}

.gallery__caption-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 2.85rem 1.05rem 1.05rem;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.58) 0%,
    rgba(0, 0, 0, 0.32) 42%,
    rgba(0, 0, 0, 0) 100%
  );
  color: #ffffff;
  text-align: left;
}

.gallery__caption-title {
  margin: 0;
  font-size: clamp(1.12rem, 2.1vw, 1.42rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.gallery__caption-sub {
  margin: 0.32rem 0 0;
  font-size: clamp(0.72rem, 1.15vw, 0.84rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.gallery__caption-credit {
  margin: 0.2rem 0 0;
  font-size: clamp(0.62rem, 1vw, 0.72rem);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.4;
  opacity: 0.9;
}

/* カードから独立した固定キャプション欄（水平・位置固定） */
.gallery__caption {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  align-content: start;
  grid-template-rows: 1.6rem 1.2rem auto;
  row-gap: 0.35rem;
  width: min(100%, 28rem);
  margin: 2rem auto 0;
  text-align: center;
  transform: none;
}

.gallery__name {
  margin: 0;
  max-width: 100%;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery__type {
  margin: 0;
  max-width: 100%;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--color-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery__arrow {
  position: absolute;
  top: calc(var(--gallery-card-h) / 2);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -1.375rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: var(--color-white);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.gallery__arrow:hover,
.gallery__arrow:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
  outline: none;
}

.gallery__arrow--prev {
  left: var(--gallery-arrow-inset);
}

.gallery__arrow--next {
  right: var(--gallery-arrow-inset);
}

.gallery__status {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  line-height: 1.4;
  color: var(--color-gray);
}

.gallery__playback {
  min-height: 2.35rem;
  margin-top: 0.35rem;
  padding: 0.45rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: transparent;
  color: var(--color-white);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.gallery__playback:hover,
.gallery__playback:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.85);
  outline: none;
}

.gallery__playback[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 900px) {
  .gallery {
    --gallery-card-w: min(52vw, 220px);
    --gallery-card-h: calc(var(--gallery-card-w) * 1.48);
    --gallery-arrow-inset: 0.45rem;
  }

  .gallery__arrow {
    width: 2.4rem;
    height: 2.4rem;
    margin-top: -1.2rem;
    font-size: 1.5rem;
  }

  .gallery__arrow--prev {
    left: var(--gallery-arrow-inset);
  }

  .gallery__arrow--next {
    right: var(--gallery-arrow-inset);
  }
}

@media (max-width: 720px) {
  .works {
    padding: 2rem 1.15rem 3rem;
  }

  .works-grid {
    grid-template-columns: 1fr;
    /* 1列時も案件同士の間隔に同量を足す */
    gap: calc(1.75rem + 0.875rem);
  }

  .home-works {
    padding: 2.75rem 1.15rem 3rem;
  }

  .home-works::before {
    width: min(160vw, 720px);
    height: min(120%, 780px);
    background:
      radial-gradient(
        ellipse 62% 50% at 50% 48%,
        rgba(255, 248, 238, 0.08) 0%,
        rgba(255, 242, 228, 0.035) 32%,
        transparent 68%
      );
  }

  .home-works__intro {
    width: 100%;
    margin: 0 auto 1.5rem;
    padding: 0;
  }

  .gallery {
    /* 正面を主役に。半径は JS 算出。左右は端が見える程度 */
    --gallery-card-w: min(68vw, 255px);
    --gallery-card-h: calc(var(--gallery-card-w) * 1.48);
    --gallery-spread-x: 1;
    --gallery-arrow-inset: 0.55rem;
    --gallery-foot-glow-opacity: 0.26;
    padding: 0 var(--gallery-arrow-inset);
  }

  .gallery__turntable {
    display: none;
  }

  .gallery__card {
    transform-origin: 50% 50%;
  }

  .gallery__logo {
    top: 1.3rem;
    left: 1.3rem;
    max-width: min(42%, 6.4rem);
    padding: 0.22rem 0.34rem;
  }

  .gallery__logo img {
    max-height: 1.35rem;
  }

  .gallery__logo--wide {
    max-width: min(50%, 7.4rem);
  }

  .gallery__logo--mark {
    top: 1.65rem;
    left: 1.65rem;
  }

  .gallery__logo--mark img {
    width: 1.45rem;
    height: 1.45rem;
    max-width: 1.45rem;
    max-height: 1.45rem;
  }

  .gallery__logo.gallery__logo--ys img {
    width: 1.75rem;
    height: 1.75rem;
    max-width: 1.75rem;
    max-height: 1.75rem;
  }

  .gallery__logo--nico {
    max-width: min(46%, 6.8rem);
    padding: 0.28rem 0.4rem 0.32rem;
  }

  .gallery__logo-nico-name {
    font-size: 0.88rem;
  }

  .gallery__logo-nico-sub {
    font-size: 0.4rem;
  }

  .gallery__logo--hr {
    max-width: min(50%, 7.2rem);
    padding: 0.16rem 0.32rem 0.16rem 0.16rem;
  }

  .gallery__logo--hr .gallery__logo-mark {
    width: 1.35rem;
    height: 1.35rem;
    max-height: 1.35rem;
  }

  .gallery__logo-name {
    font-size: 0.62rem;
  }

  .gallery__logo--text {
    max-width: min(44%, 6.2rem);
    font-size: 0.62rem;
    padding: 0.22rem 0.36rem;
  }

  .gallery__corner {
    height: clamp(4.25rem, 22%, 5.75rem);
    padding: 0.85rem 0.85rem 0;
  }

  .gallery__corner-label {
    max-width: min(52%, 7.5rem);
    font-size: 0.64rem;
    letter-spacing: 0.05em;
  }

  .gallery__caption-overlay {
    padding: 2.35rem 0.85rem 0.85rem;
  }

  .gallery__caption-title {
    font-size: 1.05rem;
  }

  .gallery__caption-sub {
    font-size: 0.7rem;
  }

  .gallery__caption-credit {
    font-size: 0.6rem;
  }

  .gallery__viewport::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0.1rem;
    z-index: 0;
    width: min(96%, calc(var(--gallery-card-w) * 2));
    height: 3.85rem;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: var(--gallery-foot-glow-opacity);
    background:
      radial-gradient(
        ellipse 52% 42% at 50% 50%,
        rgba(255, 252, 246, 0.16) 0%,
        rgba(255, 244, 230, 0.06) 38%,
        transparent 74%
      );
  }

  .gallery__viewport {
    width: 100%;
    height: calc(var(--gallery-card-h) + 0.75rem);
    margin-bottom: 3.25rem;
    perspective: 900px;
  }

  .gallery__arrow {
    top: auto;
    bottom: 0.25rem;
    margin-top: 0;
    z-index: 3;
  }

  .gallery__arrow--prev {
    left: var(--gallery-arrow-inset);
  }

  .gallery__arrow--next {
    right: var(--gallery-arrow-inset);
  }

  .gallery__caption {
    margin-top: 0.5rem;
    grid-template-rows: 1.5rem 1.15rem auto;
  }

  .home-works__list-link {
    margin-top: 1.25rem;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery__ring,
  .gallery__meta {
    transition: none !important;
  }
}
