/* ==========================================================================
   Fashion YELL — Brand Site Stylesheet (v2)
   コンセプト: ファッション誌 × クラフト(縫い目)
   カラー: --beige(#BC9E7F) を基調に、白/クリーム/淡ベージュ/濃茶インク/
           ダーク焦茶で構成。彩度の高い色は使用しない。
   フォント: 欧文ディスプレイ Cormorant Garamond（イタリック多用） /
           和文見出し Shippori Mincho / 和文本文 Noto Sans JP
   ========================================================================== */

:root {
  --beige: #BC9E7F;
  --cream: #F5F0E8;
  --pale: #F5EDD8;
  --white: #FFFFFF;
  --ink: #3D2B0A;
  --dark: #2A1F12;
  --beige-soft: rgba(188, 158, 127, 0.15);

  --font-jp: "Yu Gothic Medium", "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --font-mincho: "Shippori Mincho", "Yu Mincho", serif;
  --font-serif: "Cormorant Garamond", serif;

  --section-padding: 160px;
}

@media (max-width: 768px) {
  :root {
    --section-padding: 96px;
  }
}

/* ---------- Reset / Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  padding: 0;
  font-family: var(--font-jp);
  font-weight: 500;
  color: var(--ink);
  background-color: var(--white);
  line-height: 1.9;
  letter-spacing: 0.06em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 紙の質感: SVGノイズをうっすら全面に重ねる */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.04;
  background-repeat: repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3, p {
  margin: 0;
}

.section-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  text-align: center;
}

.section-eyebrow {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--beige);
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.section-heading {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  letter-spacing: 0.08em;
  margin-bottom: 56px;
}

/* ---------- Fade-in on scroll ---------- */
.fade-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Stitch line（縫い目が縫われていくアニメ） ---------- */
.stitch-line {
  height: 2px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.stitch-line::before {
  content: "";
  display: block;
  height: 2px;
  width: 0;
  background-image: repeating-linear-gradient(
    90deg,
    var(--beige) 0,
    var(--beige) 10px,
    transparent 10px,
    transparent 18px
  );
  transition: width 1.6s ease;
}

.stitch-line--white::before {
  background-image: repeating-linear-gradient(
    90deg,
    var(--white) 0,
    var(--white) 10px,
    transparent 10px,
    transparent 18px
  );
}

.stitch-line--cream::before {
  background-image: repeating-linear-gradient(
    90deg,
    var(--cream) 0,
    var(--cream) 10px,
    transparent 10px,
    transparent 18px
  );
}

.stitch-line.is-stitched::before {
  width: 100%;
}

.stitch-line--bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
  margin: 0 auto;
  max-width: 720px;
}

.stitch-line--top {
  max-width: 100%;
  margin: 0;
}

.story .stitch-line--top {
  position: absolute;
  top: 32px;
  left: 0;
  right: 0;
}

.story .stitch-line--bottom {
  position: absolute;
  bottom: 32px;
  top: auto;
  left: 0;
  right: 0;
  max-width: 100%;
  margin: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 24px 0;
  background-color: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s ease, border-color 0.4s ease, padding 0.4s ease, backdrop-filter 0.4s ease;
}

.site-header.is-scrolled {
  padding: 16px 0;
  background-color: rgba(245, 240, 232, 0.92);
  border-bottom-color: rgba(61, 43, 10, 0.08);
  backdrop-filter: blur(8px);
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__logo img {
  height: 28px;
  width: auto;
}

.site-header__nav ul {
  display: flex;
  gap: 32px;
}

.site-header__nav a {
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.3s ease;
}

.site-header__nav a:hover {
  color: var(--beige);
}

@media (max-width: 768px) {
  .site-header__nav {
    display: none;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background-color: var(--cream);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 140px 24px 64px;
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* 和文コピー→タグライン→巨大英字→服の扇(重ねない) */
.hero__typo {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}

.hero__en {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(4rem, 12vw, 10rem);
  line-height: 0.9;
  color: var(--beige);
  margin: clamp(8px, 1.6vw, 20px) 0 0;
}

.hero__jp {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0;
}

.hero__tagline {
  font-family: var(--font-jp);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--ink);
  margin-top: 12px;
  opacity: 0.85;
}

/* ---- 3D 商品カードの扇 ---- */
.hero__cards-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  perspective: 1400px;
  display: flex;
  justify-content: center;
  margin-top: clamp(28px, 4vw, 56px);
}

.hero__cards {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-style: preserve-3d;
  will-change: transform;
}

.hero__card {
  --ry: 0deg;
  --ty: 0px;
  --tz: 0px;
  --enter: 0;
  --hover: 0;
  position: relative;
  width: clamp(130px, 19vw, 200px);
  transform-style: preserve-3d;
  opacity: var(--enter);
  /* --tz: カードごとに奥行きをずらし、回転した平面同士の交差(ひし形の描画アーティファクト)を防ぐ。
     ±14°傾いたカードは奥行き±約20px分の厚みを持つため、隣とは44px以上離す。
     --zs: 奥行き差による遠近法の見かけサイズ差を打ち消す補正係数 */
  transform:
    translateY(calc((80px * (1 - var(--enter))) + (var(--ty) * var(--enter)) - (var(--hover) * 16px)))
    translateZ(calc((var(--tz) * var(--enter)) + (var(--hover) * 90px)))
    rotateY(calc(var(--ry) * var(--enter) * (1 - var(--hover))))
    scale(calc((0.86 + (var(--enter) * 0.14) + (var(--hover) * 0.04)) * var(--zs, 1)));
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 0.1s);
}

.hero__card:not(:first-child) {
  margin-left: -38px;
}

.hero__cards.is-loaded .hero__card {
  --enter: 1;
}

.hero__card:hover {
  --hover: 1;
  z-index: 5;
  transition-delay: 0s;
}

.hero__card img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 24px 32px rgba(61, 43, 10, 0.28));
}

@media (max-width: 768px) {
  .hero {
    padding-top: 120px;
  }

  .hero__card:first-child,
  .hero__card:last-child {
    display: none;
  }

  .hero__card {
    width: clamp(130px, 36vw, 170px);
  }

  .hero__card:not(:first-child) {
    margin-left: -22px;
  }
}

@media (max-width: 480px) {
  .hero__jp {
    margin-top: -0.4rem;
  }
}

/* ---------- Story（ダークセクション） ---------- */
.story {
  position: relative;
  background-color: var(--dark);
  color: var(--cream);
  padding: var(--section-padding) 0;
  overflow: hidden;
}

.story__watermark {
  position: absolute;
  top: 50%;
  right: -8%;
  transform: translateY(-50%);
  width: min(48vw, 560px);
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
}

.story__eyebrow {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  color: var(--beige);
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.story__heading {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  letter-spacing: 0.08em;
  margin-bottom: 48px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease 0.1s, transform 0.7s ease 0.1s;
}

.story__body {
  max-width: 680px;
  margin: 0 auto 40px;
  font-size: 1rem;
  line-height: 2.1;
  letter-spacing: 0.06em;
  text-align: left;
  color: var(--cream);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease 0.2s, transform 0.7s ease 0.2s;
}

.story__closing {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  color: var(--beige);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease 0.3s, transform 0.7s ease 0.3s;
}

.story.is-visible .story__eyebrow,
.story.is-visible .story__heading,
.story.is-visible .story__body,
.story.is-visible .story__closing {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Collection ---------- */
.collection {
  background-color: var(--pale);
  padding: var(--section-padding) 0;
}

.collection__stack {
  position: relative;
  margin-bottom: 48px;
}

.collection__stack-en {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1;
  color: var(--beige);
  opacity: 0.55;
  margin: 0;
}

.collection__stack-jp {
  position: relative;
  z-index: 2;
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: 0.1em;
  color: var(--ink);
  margin-top: clamp(-1.6rem, -3vw, -0.9rem);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 56px;
}

.filter-tab {
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 10px 24px;
  border: 1px solid var(--beige);
  border-radius: 999px;
  background-color: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.filter-tab:hover {
  background-color: var(--beige-soft);
}

.filter-tab.is-active {
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.collection__grid-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

.product-card {
  background-color: var(--white);
  padding: 36px 22px 28px;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, opacity 0.35s ease;
}

/* button化した商品カード（Tシャツ）のUAスタイルリセット */
button.product-card {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  display: block;
  width: 100%;
}

button.product-card:focus-visible {
  outline: 2px solid var(--beige);
  outline-offset: 6px;
}

.product-card.is-hidden {
  display: none;
}

.product-card.is-leaving {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.product-card.is-entering {
  opacity: 0;
  transform: scale(0.96);
}

.product-card.is-entering.is-entered {
  opacity: 1;
  transform: scale(1);
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 32px rgba(61, 43, 10, 0.1);
}

.product-card__image {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: visible;
}

.product-card__image img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(61, 43, 10, 0.12));
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-card:hover .product-card__image img {
  transform: scale(1.06);
}

.product-card__name {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* ---- Tシャツ: 白箱をやめ、透過PNGを直置き ---- */
.product-card--tshirt {
  background-color: transparent;
  padding: 16px 8px 20px;
}

.product-card__view-label {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--beige);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  white-space: nowrap;
}

.product-card--tshirt:hover .product-card__view-label,
.product-card--tshirt:focus-visible .product-card__view-label,
.product-card--photo:hover .product-card__view-label,
.product-card--photo:focus-visible .product-card__view-label {
  opacity: 1;
}

/* ---- タオル: 透過ではない写真をそのままタイル表示 ---- */
.product-card--photo {
  background-color: transparent;
  padding: 0;
}

.product-card--photo .product-card__image {
  aspect-ratio: auto;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(61, 43, 10, 0.12);
}

.product-card--photo .product-card__image img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: cover;
  filter: none;
}

.product-card--soon .product-card__image--soon {
  border: 1px solid var(--beige);
  flex-direction: column;
  gap: 12px;
}

.product-card__soon-symbol {
  width: 40px;
  opacity: 0.15;
}

.product-card__soon-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--beige);
}

.collection__note {
  margin-top: 56px;
  font-size: 0.75rem;
  color: var(--ink);
  opacity: 0.7;
  letter-spacing: 0.04em;
  text-align: center;
}

/* ---------- License ---------- */
.license {
  background-color: var(--cream);
  padding: var(--section-padding) 0;
}

.license__lead {
  max-width: 640px;
  margin: 0 auto 64px;
  font-size: 0.95rem;
  line-height: 2;
  letter-spacing: 0.06em;
}

.license-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 56px;
  perspective: 1200px;
}

@media (max-width: 768px) {
  .license-cards {
    grid-template-columns: 1fr;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }
}

.license-card {
  position: relative;
  background-color: var(--white);
  border: 1px solid var(--beige);
  outline: 1px solid var(--beige);
  outline-offset: 7px;
  padding: 52px 26px 36px;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease;
}

.license-card__num {
  position: absolute;
  top: 22px;
  left: 26px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--beige);
}

.license-card__symbol {
  width: 44px;
  opacity: 0.25;
  margin: 0 auto 28px;
}

.license-card:hover {
  transform: translateY(-8px) rotateX(2deg);
  box-shadow: 0 28px 44px rgba(61, 43, 10, 0.18);
}

.license-card__title {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.license-card__target {
  font-size: 0.8rem;
  color: var(--beige);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

.license-card__desc {
  font-size: 0.85rem;
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}

.license-card__price {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.05em;
  margin-top: auto;
}

.license__cta {
  text-align: center;
}

.btn {
  display: inline-block;
  padding: 16px 40px;
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  border-radius: 4px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.btn--primary {
  background-color: var(--ink);
  color: var(--white);
}

.btn--primary:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.btn--outline {
  border: 1px solid var(--white);
  color: var(--white);
}

.btn--outline:hover {
  background-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* ---------- News ---------- */
.news {
  background-color: var(--pale);
  padding: var(--section-padding) 0;
}

.news-list {
  max-width: 720px;
  margin: 0 auto;
  border-top: 1px solid var(--beige);
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 32px 8px;
  border-bottom: 1px solid var(--beige);
  text-align: left;
}

@media (min-width: 640px) {
  .news-item {
    flex-direction: row;
    gap: 32px;
    align-items: baseline;
  }
}

.news-item__date {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--beige);
  flex-shrink: 0;
  min-width: 96px;
}

.news-item__title {
  font-size: 0.9rem;
  line-height: 1.9;
  letter-spacing: 0.03em;
}

/* ---------- Contact / Footer ---------- */
.contact {
  position: relative;
  background-color: var(--beige);
  color: var(--white);
  padding: var(--section-padding) 0 48px;
  text-align: center;
}

.contact__symbol {
  width: 48px;
  margin: 0 auto 32px;
}

.contact__message {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  letter-spacing: 0.08em;
  margin-bottom: 40px;
}

.contact .btn--outline {
  margin-bottom: 24px;
}

.contact__hashtag {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  margin-bottom: 64px;
}

.stitch-line--footer {
  max-width: 600px;
  margin: 0 auto 32px;
}

.contact__copyright {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

/* ---------- 3Dビューア（モーダル） ---------- */
body.viewer-open {
  overflow: hidden;
}

.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 100% at 50% 0%, #3a2c1a 0%, #2A1F12 55%, #1d1610 100%);
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
  overflow: hidden;
}

/* GL版/フォールバック版の出し分け（main.js が WebGL 判定結果でモディファイアを付与） */
.viewer-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.viewer-modal--gl .viewer-fallback {
  display: none;
}

.viewer-modal--fallback .viewer-gl {
  display: none;
}

.viewer-modal.is-open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
}

.viewer-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--white);
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.viewer-modal__close:hover {
  opacity: 0.7;
  transform: rotate(90deg);
}

.viewer-modal__close:focus-visible {
  outline: 2px solid var(--beige);
  outline-offset: 4px;
}

.viewer-modal__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  touch-action: none;
  user-select: none;
}

.viewer-card {
  position: relative;
  width: clamp(260px, 40vw, 420px);
  aspect-ratio: 1 / 1.2;
  transform-style: preserve-3d;
  transform: rotateY(var(--rot, 0deg));
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: grab;
}

.viewer-card.is-dragging {
  transition: none;
  cursor: grabbing;
}

.viewer-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
}

.viewer-card__face--back {
  transform: rotateY(180deg);
}

.viewer-card__face img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
  filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.4));
  pointer-events: none;
  user-select: none;
}

.viewer-modal__info {
  flex-shrink: 0;
  text-align: center;
  color: var(--cream);
  padding-top: 16px;
}

.viewer-modal__name {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  letter-spacing: 0.06em;
  color: var(--cream);
  margin-bottom: 8px;
}

.viewer-modal__credit {
  font-family: var(--font-jp);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  opacity: 0.7;
  margin-bottom: 20px;
}

.viewer-modal__flip {
  margin-bottom: 14px;
}

.viewer-modal__hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  opacity: 0.55;
}

/* ---------- 3Dビューア（Three.js版） ---------- */
.viewer-gl {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.viewer-gl__bgword {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

.viewer-gl__bgword span {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(5rem, 18vw, 14rem);
  line-height: 0.85;
  color: rgba(188, 158, 127, 0.18);
  white-space: nowrap;
  user-select: none;
  transition: opacity 0.25s ease;
}

#viewerGLCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.viewer-swatches {
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.viewer-swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s ease, transform 0.2s ease;
}

.viewer-swatch::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sw-color, #ccc);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.viewer-swatch[data-color="white"] {
  --sw-color: #f5f5f5;
}

.viewer-swatch[data-color="black"] {
  --sw-color: #1a1a1a;
}

.viewer-swatch[data-color="blue"] {
  --sw-color: #1e4fb8;
}

.viewer-swatch[data-color="pink"] {
  --sw-color: #f2b8cc;
}

.viewer-swatch:hover::before {
  transform: scale(1.1);
}

.viewer-swatch:focus-visible {
  outline: 2px solid var(--beige);
  outline-offset: 3px;
}

.viewer-swatch.is-active {
  border-color: var(--beige);
}

.viewer-gl__flip {
  pointer-events: auto;
}

/* ダーク背景上での視認性確保: <button>はUAデフォルト背景を持つため
   .btn--outline の border/color 指定だけでは白背景に白文字化してしまう。
   ここで明示的に上書きする（フォールバック版の同ボタンも同様） */
.viewer-gl__flip,
.viewer-modal__flip {
  background-color: transparent;
  border-color: rgba(245, 240, 232, 0.75);
  color: #F5F0E8;
}

.viewer-gl__flip:hover,
.viewer-gl__flip:focus-visible,
.viewer-modal__flip:hover,
.viewer-modal__flip:focus-visible {
  background-color: rgba(255, 255, 255, 0.14);
}

.viewer-gl__hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(45vh + 18px);
  transform: translateX(-50%);
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--cream);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.viewer-gl__hint.is-hidden {
  opacity: 0;
}

/* ---------- 商品詳細パネル（.viewer-dp） ---------- */
.viewer-dp {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  color: var(--cream);
}

.viewer-dp__title {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--beige);
  font-size: clamp(3rem, 5vw, 5.5rem);
  line-height: 1;
}

.viewer-dp__name {
  margin: 14px 0 0;
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  letter-spacing: 0.05em;
  color: var(--cream);
}

.viewer-dp__desc {
  margin: 18px 0 0;
  font-family: var(--font-jp);
  color: var(--cream);
  opacity: 0.85;
  line-height: 2;
  max-width: 40ch;
  font-size: 0.95rem;
}

.viewer-dp__meta {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--cream);
  opacity: 0.8;
}

.viewer-dp__sep {
  width: 1px;
  height: 14px;
  background: rgba(245, 240, 232, 0.3);
}

.viewer-dp__rule {
  margin-top: 22px;
  width: 100%;
  height: 2px;
  opacity: 0.7;
  background-image: repeating-linear-gradient(
    90deg,
    var(--beige) 0,
    var(--beige) 8px,
    transparent 8px,
    transparent 14px
  );
}

.viewer-dp__actions {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.viewer-dp__note {
  margin-top: 18px;
  font-family: var(--font-jp);
  font-size: 0.7rem;
  color: var(--cream);
  opacity: 0.6;
}

/* 時間差リビール: openで子要素が1つずつフェードアップ、closeは遅延なしで即座に隠す */
.viewer-dp > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.viewer-modal.is-open .viewer-dp > * {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.viewer-modal.is-open .viewer-dp > *:nth-child(1) { transition-delay: 0.05s; }
.viewer-modal.is-open .viewer-dp > *:nth-child(2) { transition-delay: 0.13s; }
.viewer-modal.is-open .viewer-dp > *:nth-child(3) { transition-delay: 0.21s; }
.viewer-modal.is-open .viewer-dp > *:nth-child(4) { transition-delay: 0.27s; }
.viewer-modal.is-open .viewer-dp > *:nth-child(5) { transition-delay: 0.33s; }
.viewer-modal.is-open .viewer-dp > *:nth-child(6) { transition-delay: 0.39s; }
.viewer-modal.is-open .viewer-dp > *:nth-child(7) { transition-delay: 0.45s; }

/* ---------- デスクトップ: 右側パネル ---------- */
@media (min-width: 900px) {
  .viewer-gl__bgword {
    transform: translateX(-16%);
  }

  .viewer-gl__hint {
    left: 26%;
    bottom: 9vh;
    transform: translateX(-50%);
  }

  .viewer-dp {
    right: 7vw;
    top: 50%;
    left: auto;
    bottom: auto;
    transform: translateY(-50%);
    width: min(480px, 38vw);
    max-height: none;
    overflow: visible;
    padding: 0;
    background: none;
    backdrop-filter: none;
  }

  .viewer-dp::before {
    content: none;
  }
}

/* ---------- モバイル: 下部ボトムシート ---------- */
@media (max-width: 899px) {
  .viewer-dp {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: 45vh;
    overflow-y: auto;
    pointer-events: auto;
    padding: 20px;
    background: rgba(42, 31, 18, 0.85);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  .viewer-dp::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0.7;
    background-image: repeating-linear-gradient(
      90deg,
      var(--beige) 0,
      var(--beige) 8px,
      transparent 8px,
      transparent 14px
    );
  }

  .viewer-dp__title {
    font-size: clamp(2.1rem, 9vw, 2.8rem);
  }

  .viewer-dp__desc {
    font-size: 0.8rem;
    max-width: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero__card {
    --enter: 1;
    transition-delay: 0s !important;
  }

  .viewer-dp > * {
    transition-delay: 0s !important;
  }
}
