/* article-comic-viewer.css
 * 通常記事内漫画専用。既存の manga-* クラスとは分離しています。
 */

body.article-comic-open {
  overflow: hidden;
}

.article-comic {
  margin: 1.5rem 0;
}

/* JS動作開始後に、元の漫画画像群を画面外へ隠す */
.article-comic.is-enhanced > .mt-be-image {
  display: none !important;
}

.article-comic__launcher {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #d8e5ee;
  border-radius: 14px;
  background: #f4f9fc;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.article-comic__launcher:hover,
.article-comic__launcher:focus-visible {
  transform: translateY(-1px);
  background: #eef7fc;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .10);
  outline: 3px solid rgba(0, 91, 187, .22);
  outline-offset: 2px;
}

.article-comic__launcher-cover {
  flex: 0 0 92px;
  width: 92px;
  aspect-ratio: 800 / 1131;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}

.article-comic__launcher-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.article-comic__launcher-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.article-comic__launcher-label {
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.4;
}

.article-comic__launcher-meta {
  color: #555;
  font-size: .88rem;
  line-height: 1.5;
}

.article-comic-viewer {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, .82);
}

.article-comic-viewer.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-comic-viewer__dialog {
  position: relative;
  width: min(1280px, 100%);
  height: min(94vh, 960px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #151515;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

.article-comic-viewer__topbar,
.article-comic-viewer__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #202020;
}

.article-comic-viewer__topbar {
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.article-comic-viewer__footer {
  justify-content: center;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, .10);
}

.article-comic-viewer__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .92rem;
  font-weight: 800;
}

.article-comic-viewer__counter {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, .82);
  font-size: .85rem;
  white-space: nowrap;
}

.article-comic-viewer__stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 82px;
  overflow: hidden;
  touch-action: pan-y;
}

.article-comic-viewer__spread {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.article-comic-viewer__page {
  min-width: 0;
  max-width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-comic-viewer__page.is-cover {
  max-width: 100%;
}

.article-comic-viewer__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 7px 24px rgba(0, 0, 0, .32);
}

.article-comic-viewer__nav,
.article-comic-viewer__button,
.article-comic-viewer__close {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255, 255, 255, .30);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.article-comic-viewer__nav:hover,
.article-comic-viewer__button:hover,
.article-comic-viewer__close:hover,
.article-comic-viewer__nav:focus-visible,
.article-comic-viewer__button:focus-visible,
.article-comic-viewer__close:focus-visible {
  background: rgba(255, 255, 255, .23);
  outline: 3px solid rgba(176, 208, 230, .75);
  outline-offset: 2px;
}

.article-comic-viewer__nav[disabled],
.article-comic-viewer__button[disabled] {
  opacity: .30;
  cursor: default;
}

.article-comic-viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  min-width: 64px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 999px;
}

/* 右開き。左側が次ページ、右側が前ページ */
.article-comic-viewer__nav.is-next { left: 10px; }
.article-comic-viewer__nav.is-prev { right: 10px; }

.article-comic-viewer__button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
}

.article-comic-viewer__close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
}

.article-comic-viewer__sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 767px) {
  .article-comic-viewer {
    padding: 0;
  }

  .article-comic-viewer__dialog {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .article-comic-viewer__stage {
    padding: 8px 48px;
  }

  .article-comic-viewer__spread {
    display: block;
  }

  .article-comic-viewer__page,
  .article-comic-viewer__page.is-cover {
    width: 100%;
    max-width: 100%;
    height: 100%;
  }

  .article-comic-viewer__nav {
    min-width: 40px;
    min-height: 52px;
    padding: 6px;
    font-size: 12px;
  }

  .article-comic-viewer__nav.is-next { left: 4px; }
  .article-comic-viewer__nav.is-prev { right: 4px; }

  .article-comic-viewer__topbar,
  .article-comic-viewer__footer {
    padding: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-comic__launcher {
    transition: none;
  }
}
