.home-magazine {
  position: relative;
  isolation: isolate;
  overflow: visible;
  color: #2b221c;
  scroll-margin-top: 5rem;
  padding: clamp(2rem, 5vw, 3.5rem) 1.25rem;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(62, 48, 36, 0.08), transparent 70%),
    linear-gradient(180deg, #f7f2ea 0%, #efe6d8 100%);
}

.home-magazine__inner {
  margin: 0 auto;
  max-width: 58rem;
  width: 100%;
}

.home-magazine__flipbook {
  margin-top: 0.15rem;
}

.home-magazine__flipbook-fallback {
  margin: 0 auto;
  max-width: 22rem;
  text-align: center;
  color: #5c4f42;
  font-size: 0.88rem;
}

.home-magazine__flipbook-fallback img {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 0 auto 0.75rem;
  border-radius: 2px;
  box-shadow: 0 10px 28px rgba(28, 22, 16, 0.22);
}

.home-flipbook__stage {
  position: relative;
  margin: 0 auto;
  max-width: 42rem;
  min-height: min(78vh, 48rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 1.25rem;
  border-radius: 0.35rem;
  background: radial-gradient(ellipse at center, #3a322c 0%, #1c1815 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 60px rgba(28, 22, 16, 0.28);
  overflow: hidden;
  touch-action: manipulation;
}

.home-flipbook__book-host {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  min-height: min(72vh, 42rem);
  margin-inline: auto;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-flipbook__book {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.home-flipbook__book.stf__parent {
  min-height: min(68vh, 40rem);
}

/* JS 初期化前：表紙1枚をステージ内に表示（暗い空箱を防ぐ） */
#home-magazine-book:not(.stf__parent) {
  width: min(100%, 360px);
  margin-inline: auto;
}

#home-magazine-book:not(.stf__parent) .home-flipbook__page {
  display: none;
}

#home-magazine-book:not(.stf__parent) .home-flipbook__page:first-child {
  display: block;
  width: 100%;
  aspect-ratio: 1241 / 1754;
  height: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

#home-magazine-book:not(.stf__parent) .home-flipbook__page:first-child .home-flipbook__page-inner {
  height: auto;
  min-height: 0;
}

#home-magazine-book:not(.stf__parent) .home-flipbook__page:first-child img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

/* destroy() 後にホスト直下へ漏れたページのみ非表示 */
.home-flipbook__book-host > .home-flipbook__page {
  display: none !important;
}

.magazine-page .home-flipbook__stage ~ .home-flipbook__page,
.magazine-page .home-magazine__inner > .home-flipbook__page {
  display: none !important;
}

.home-flipbook__page {
  background: #f7f2ea;
  overflow: hidden;
}

.home-flipbook__page-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f2ea;
}

.home-flipbook__page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.home-flipbook__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9%;
  z-index: 25;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.home-flipbook__edge--prev {
  left: 0;
}

.home-flipbook__edge--next {
  right: 0;
}

.home-flipbook__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-top: 1.15rem;
}

.home-flipbook__btn {
  appearance: none;
  border: 1px solid rgba(62, 48, 36, 0.22);
  background: rgba(255, 252, 246, 0.85);
  color: #2b221c;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.home-flipbook__btn:hover:not(:disabled) {
  background: #fff;
}

.home-flipbook__btn:active:not(:disabled) {
  transform: scale(0.94);
}

.home-flipbook__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.home-flipbook__indicator {
  margin: 0;
  min-width: 4.5rem;
  text-align: center;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  color: #5c4f42;
}

@media (max-width: 640px) {
  .home-flipbook__stage {
    min-height: min(68vh, 34rem);
    padding-inline: 0.35rem;
  }
}
