/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #333;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== Header / Nav ===== */
/* ナビスタイルは /shared-nav.css に移動（HP・ビズ書庫で共有） */

/* ===== Page Hero ===== */
.page-hero {
  padding: 180px 24px 80px;
  min-height: 520px;
  text-align: center;
  background: url('../material/output_05.webp') center top / cover no-repeat;
  background-color: #FFF9F4;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,249,244,0.72);
  z-index: 0;
}
.page-hero > * {
  position: relative;
  z-index: 1;
}
.page-hero-label {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  color: #EB5200;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.page-hero-title {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 16px;
}
.page-hero-title em {
  font-style: normal;
  color: #EB5200;
}
.page-hero-desc {
  font-size: 18px; color: #444;
  font-weight: 600;
  line-height: 2;
  max-width: 650px;
  margin: 0 auto;
}
/* 実績カウント */
.works-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 20px;
  background: #fff;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.works-count-num {
  font-size: 22px;
  font-weight: 900;
  color: #EB5200;
}

/* ===== Works Section ===== */
.works-section {
  padding: 48px 24px 80px;
  background: #fff;
}

/* Category Filter */
.works-filter {
  max-width: 1100px;
  margin: 0 auto 36px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 80px;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px 0;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px;
  border-radius: 50px;
  border: 2px solid #e0d6cc;
  background: #fff;
  color: #666;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.filter-btn:hover {
  border-color: #EB5200;
  color: #EB5200;
  background: #FFF9F4;
}
.filter-btn.active {
  background: #EB5200;
  border-color: #EB5200;
  color: #fff;
}
.filter-btn .filter-count {
  font-size: 11px;
  background: rgba(0,0,0,0.08);
  padding: 2px 7px;
  border-radius: 10px;
}
.filter-btn.active .filter-count {
  background: rgba(255,255,255,0.25);
}

/* Works Grid */
.works-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.work-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}
.work-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.13);
}
.work-card.filter-hidden,
.work-card.page-hidden {
  display: none;
}
.work-card-img-wrapper {
  position: relative;
  background: linear-gradient(135deg, #f0ebe4 0%, #e8e2d8 100%);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3.5;
  overflow: hidden;
}
.work-card-img {
  width: 65%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}
.work-card:hover .work-card-img {
  transform: scale(1.03);
}
/* Tall-page cover: crop to show top portion */
.work-card-img-wrapper.tall-cover {
  aspect-ratio: 4 / 3;
}
.work-card-img-wrapper.tall-cover .work-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
  box-shadow: none;
}
.work-card-img-wrapper.tall-cover::before,
.work-card-img-wrapper.tall-cover::after {
  display: none;
}
/* Decorative fan effect */
.work-card-img-wrapper::before,
.work-card-img-wrapper::after {
  content: '';
  position: absolute;
  width: 55%;
  height: 75%;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 0;
}
.work-card-img-wrapper::before {
  transform: rotate(-6deg) translateX(-4px);
  top: 15%; left: 14%;
}
.work-card-img-wrapper::after {
  transform: rotate(4deg) translateX(4px);
  top: 12%; right: 14%;
}
.work-card-page-count {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 2;
}
.work-card-body {
  padding: 18px 20px 20px;
}
.work-card-category {
  display: inline-block;
  font-size: 11px; font-weight: 800;
  padding: 5px 14px;
  border-radius: 6px;
  background: #333;
  color: #fff;
  margin-bottom: 10px;
}
.work-card-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  color: #222;
  margin-bottom: 8px;
}
.work-card-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.work-tag {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  color: #888;
}
.work-tag::before {
  content: '#';
  color: #bbb;
}
.work-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.work-card-arrow {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 16px;
  transition: background 0.2s, transform 0.2s;
  margin-left: auto;
}
.work-card:hover .work-card-arrow {
  background: #EB5200;
  transform: scale(1.1);
}

/* ===== Manga Modal (Vertical Scroll & Spread Viewer) ===== */
.manga-modal {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  background: #2a1f16;
  overflow-y: auto;
}
.manga-modal.open { display: block; }
.manga-modal.mode-spread.open {
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
}

/* Background image layer */
.manga-modal::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  pointer-events: none;
  background: url('../material/back/manga_bg_06.webp') center center / cover no-repeat;
  filter: brightness(0.65) blur(2px);
}
/* Vignette + warm glow overlay */
.manga-modal::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,200,120,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at center, transparent 40%, rgba(15,10,5,0.3) 100%);
}

/* ===== Left Thumbnail Sidebar ===== */
.modal-thumb-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 100px;
  background: rgba(15,12,8,0.95);
  border-right: 1px solid rgba(255,200,120,0.06);
  z-index: 2150;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.modal-thumb-sidebar::-webkit-scrollbar { width: 4px; }
.modal-thumb-sidebar::-webkit-scrollbar-track { background: transparent; }
.modal-thumb-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.modal-thumb-item {
  flex-shrink: 0;
  width: 84px; height: 112px;
  border-radius: 4px;
  object-fit: cover;
  border: 2px solid transparent;
  opacity: 0.35;
  cursor: pointer;
  transition: all 0.25s ease;
}
.modal-thumb-item:hover {
  opacity: 0.7;
  border-color: rgba(255,255,255,0.2);
}
.modal-thumb-item.active {
  border-color: #EB5200;
  opacity: 1;
  box-shadow: 0 0 12px rgba(238,107,29,0.4);
}

/* ===== Modal Header ===== */
.modal-header {
  position: fixed; top: 0; right: 0;
  z-index: 2100;
  padding: 14px 20px 24px;
  display: flex; justify-content: space-between; align-items: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
/* Vertical mode header */
.manga-modal.mode-vertical .modal-header {
  background: linear-gradient(to bottom,
    rgba(0,0,0,0.85) 0%,
    rgba(0,0,0,0.4) 70%,
    transparent 100%);
}
/* Spread mode header */
.manga-modal.mode-spread .modal-header {
  background: linear-gradient(to bottom,
    rgba(26,18,12,0.95),
    rgba(34,24,16,0.88)
  );
  border-bottom: 1px solid rgba(255,200,120,0.1);
  position: relative;
  left: auto;
  right: auto;
  width: 100%;
}
.modal-header.hidden {
  opacity: 0; transform: translateY(-100%); pointer-events: none;
}
.modal-title {
  color: #fff; font-size: 15px; font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.manga-modal.mode-spread .modal-title {
  color: #ede0d0;
  text-shadow: none;
  letter-spacing: 0.02em;
}
.modal-page {
  color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,0.12);
  padding: 4px 12px; border-radius: 20px;
  margin-left: 16px;
}
.manga-modal.mode-spread .modal-page {
  color: rgba(237,224,208,0.8);
  background: rgba(255,200,120,0.1);
  border: 1px solid rgba(255,200,120,0.12);
}
.modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 20px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s;
  margin-left: 12px;
}
.manga-modal.mode-spread .modal-close {
  background: rgba(255,200,120,0.08);
  border-color: rgba(255,200,120,0.12);
  color: #ede0d0;
}
.modal-close:hover {
  background: rgba(238,107,29,0.3);
  border-color: rgba(238,107,29,0.4);
}

/* ===== Manga Container ===== */
.modal-manga {
  max-width: 500px;
  margin: 0 auto;
  padding: 0;
  position: relative;
  z-index: 1;
  transition: max-width 0.4s ease;
}
.modal-manga.wide { max-width: 900px; }
.modal-manga img {
  width: 100%; display: block;
  margin: 0; padding: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: opacity;
  content-visibility: auto;
}
.modal-manga img.loaded { opacity: 1; }

/* ===== Zoom Controls ===== */
.modal-zoom-controls {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 2150;
  display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 10px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1);
}
.modal-zoom-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 18px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-zoom-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.modal-zoom-btn:disabled { opacity: 0.25; cursor: default; }
.modal-zoom-label {
  color: rgba(255,255,255,0.6);
  font-size: 12px; font-weight: 600;
  min-width: 40px; text-align: center;
}
.modal-zoom-btn.reset {
  font-size: 11px;
  width: auto;
  padding: 0 10px;
  border-radius: 14px;
}

/* ===== Progress Bar ===== */
.modal-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; z-index: 2200;
  background: rgba(255,255,255,0.1);
}
.modal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #EB5200, #ff8a47);
  width: 0%; transition: width 0.15s ease-out;
  will-change: width;
}

/* ===== Side Page Indicator ===== */
.modal-side-indicator {
  position: fixed;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  z-index: 2150;
  display: flex; flex-direction: column;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.3s;
}
.modal-side-indicator.visible { opacity: 1; }
.modal-side-dot {
  width: 4px; height: 8px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  transition: all 0.2s;
  cursor: pointer;
}
.modal-side-dot.active {
  background: #EB5200;
  height: 14px;
}

/* ===== Back to Top Button ===== */
.modal-back-to-top {
  position: fixed;
  bottom: 24px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(238,107,29,0.9);
  border: none;
  color: #fff; font-size: 20px;
  cursor: pointer; z-index: 2150;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.modal-back-to-top.visible {
  opacity: 1; transform: scale(1); pointer-events: auto;
}
.modal-back-to-top:hover {
  background: #EB5200; transform: scale(1.1);
}

/* ===== Modal Footer ===== */
.modal-footer {
  text-align: center;
  padding: 40px 20px 60px;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  position: relative;
  z-index: 1;
}

/* ===== PC layout ===== */
@media (min-width: 769px) {
  .modal-thumb-sidebar { display: flex; }
  .modal-header { left: 100px; }
  .modal-progress { left: 100px; }
  .manga-modal { padding-left: 100px; }
  .modal-manga img {
    border-radius: 2px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  }
  .modal-side-indicator { right: 16px; }
  .modal-zoom-controls { left: calc(50% + 50px); }
}
/* ===== Mobile layout ===== */
@media (max-width: 768px) {
  .modal-thumb-sidebar { display: none !important; }
  .modal-header { left: 0; }
  .modal-progress { display: none !important; }
  .modal-side-indicator { display: none !important; }
  .manga-modal { padding-left: 0; }
  .modal-manga { max-width: 100%; padding: 0; }
  .modal-manga img {
    border-radius: 0;
    box-shadow: none;
  }
  .modal-zoom-controls { display: none !important; }
  .modal-back-to-top { bottom: 16px; right: 12px; width: 38px; height: 38px; font-size: 16px; }
}

/* ===== Book-Style Manga Modal ===== */
.manga-modal.mode-vertical::before {
  background: url('../material/back/manga_bg_06.webp') center center / cover no-repeat;
  filter: brightness(0.65) blur(2px);
}
.manga-modal.mode-vertical::after {
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,200,120,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at center, transparent 40%, rgba(15,10,5,0.3) 100%);
}
.manga-modal.mode-spread::before {
  background: url('../material/back/bg_02.webp') center center / cover no-repeat;
  filter: brightness(0.85) blur(3px);
}
.manga-modal.mode-spread::after {
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.25) 100%);
}

/* Book display area */
.book-area {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: transparent;
  user-select: none;
}

/* Click zones */
.click-zone {
  position: absolute;
  top: 0; bottom: 0;
  z-index: 50;
  cursor: pointer;
}
.click-zone-left {
  left: 0; width: 50%;
}
.click-zone-right {
  right: 0; width: 50%;
}
.click-zone:hover {
  background: rgba(255,255,255,0.02);
}

/* Book container (the open book) */
.book {
  display: flex;
  flex-direction: row-reverse;
  position: relative;
  z-index: 10;
  max-width: 90vw;
  max-height: calc(100vh - 160px);
  perspective: 2500px;
  overflow: visible;
  border-radius: 4px;
  box-shadow:
    3px 1px 0 0 #e8e0d4,
    5px 2px 0 0 #e0d8cc,
    7px 3px 0 0 #d8d0c4,
    9px 4px 0 0 #d0c8bc,
    10px 5px 0 0 #c8c0b4,
    -3px 1px 0 0 #e8e0d4,
    -5px 2px 0 0 #e0d8cc,
    -7px 3px 0 0 #d8d0c4,
    -9px 4px 0 0 #d0c8bc,
    -10px 5px 0 0 #c8c0b4,
    1px 3px 0 0 #e8e0d4,
    2px 5px 0 0 #e0d8cc,
    3px 7px 0 0 #d8d0c4,
    4px 9px 0 0 #d0c8bc,
    5px 10px 0 0 #c8c0b4,
    12px 14px 20px rgba(0,0,0,0.4),
    0 0 60px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.05);
}

/* Individual page panel */
.book-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f4ef;
  overflow: hidden;
}
.book-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  will-change: contents;
}

/* Right page */
.book-page-right {
  border-radius: 0 4px 4px 0;
}
.book-page-right::after {
  content: "";
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(270deg, transparent, rgba(0,0,0,0.08));
  pointer-events: none;
  z-index: 5;
}

/* Left page */
.book-page-left {
  border-radius: 4px 0 0 4px;
}
.book-page-left::before {
  content: "";
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08));
  pointer-events: none;
  z-index: 5;
}

/* Center spine line */
.book-spine {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  z-index: 20;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0,0,0,0.3) 35%,
    rgba(0,0,0,0.5) 50%,
    rgba(0,0,0,0.3) 65%,
    transparent 100%
  );
  pointer-events: none;
}

/* Page hover effect */
.book-page {
  cursor: pointer;
  transition: filter 0.2s;
}
.book-page:hover { filter: brightness(1.02); }

/* Single page (cover or last odd page) */
.book.single-page {
  justify-content: center;
}
.book.single-page .book-page {
  border-radius: 2px;
}
.book.single-page .book-spine {
  display: none;
}

/* Empty page style */
.book-page.empty {
  background: #e8e8e8;
}

/* Paper texture overlay */
.paper-texture {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 150px;
}

/* Page Flip Animation */
.flip-overlay {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 25;
  display: none;
  will-change: transform;
}
.flip-overlay.active { display: block; }

.flip-overlay.flip-next {
  right: 0; left: auto;
  transform-origin: left center;
}
.flip-overlay.flip-prev {
  left: 0; right: auto;
  transform-origin: right center;
}

.flip-face {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: #f8f4ef;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flip-face img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  display: block;
}
.flip-front { z-index: 2; }
.flip-back {
  transform: rotateY(180deg);
  z-index: 1;
}

/* Shadow cast on book during flip */
.page-shadow {
  position: absolute;
  top: 0; width: 80px; height: 100%;
  pointer-events: none;
  z-index: 22;
  opacity: 0;
  transition: opacity 0.15s;
}
.page-shadow.active { opacity: 1; }
.page-shadow-left {
  right: 0;
  background: linear-gradient(to left, rgba(0,0,0,0.25), transparent);
}
.page-shadow-right {
  left: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.25), transparent);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: relative;
  z-index: 2100;
  background: linear-gradient(to bottom,
    rgba(34,24,16,0.88),
    rgba(26,18,12,0.95)
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255,200,120,0.1);
  padding: 12px 20px 14px;
  display: none;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.manga-modal.mode-spread .bottom-nav { display: flex; }

.nav-btn {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: rgba(255,200,120,0.08);
  border: 1px solid rgba(255,200,120,0.12);
  color: #ede0d0;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.nav-btn:hover {
  background: rgba(238,107,29,0.2);
  border-color: rgba(238,107,29,0.3);
}
.nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Scrubber / slider */
.nav-scrubber-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.15);
  outline: none;
  cursor: pointer;
  direction: rtl;
}
.nav-scrubber::-webkit-slider-runnable-track {
  background: transparent;
  height: 6px;
  border-radius: 3px;
}
.nav-scrubber::-moz-range-track {
  background: transparent;
  height: 6px;
  border-radius: 3px;
}
.nav-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #EB5200;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  margin-top: -6px;
}
.nav-scrubber::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #EB5200;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Thumbnail strip */
.nav-thumbnails {
  display: flex;
  flex-direction: row-reverse;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
}
.nav-thumbnails::-webkit-scrollbar { display: none; }
.nav-thumb {
  width: 36px; height: 50px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.5;
  transition: all 0.15s;
}
.nav-thumb:hover {
  opacity: 0.8;
}
.nav-thumb.active {
  border-color: #EB5200;
  opacity: 1;
}
.nav-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.nav-page-info {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 70px;
  text-align: center;
  flex-shrink: 0;
}

/* Page turn hint */
.page-hint {
  position: absolute;
  bottom: 100px;
  color: rgba(237,224,208,0.4);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 30;
}
.page-hint-left { left: 30px; }
.page-hint-right { right: 30px; }

/* Mobile View (1-page) */
.mobile-view {
  display: none;
  position: relative;
  width: 100%; height: 100%;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center,
      transparent 30%,
      rgba(15,10,6,0.5) 100%
    ),
    url('../material/back/bg_02.webp') center center / cover no-repeat;
  filter: none;
}

.mobile-page-container {
  position: relative;
  max-width: 100vw; max-height: 100vh;
  width: auto; height: auto;
}

.mobile-current-page {
  max-width: 100vw; max-height: calc(100vh - 120px);
  width: auto; height: auto;
  object-fit: contain;
  display: block;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.mobile-flip-overlay {
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 10;
  display: none;
  will-change: transform;
}
.mobile-flip-overlay.active { display: block; }

.mobile-flip-front, .mobile-flip-back {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.mobile-flip-front { z-index: 2; }
.mobile-flip-back {
  transform: rotateY(180deg);
  z-index: 1;
}
.mobile-flip-front img, .mobile-flip-back img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.mobile-flip-shadow {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.1s;
}
.mobile-flip-shadow.active { opacity: 1; }

/* Tap areas for mobile */
.tap-area {
  position: absolute;
  top: 0; height: 100%;
  z-index: 10;
  cursor: pointer;
}
.tap-left { left: 0; width: 40%; }
.tap-right { right: 0; width: 40%; }

/* ===== PC / Mobile view switching ===== */
@media (min-width: 769px) {
  .manga-modal.mode-spread .mobile-view { display: none !important; }
  .manga-modal.mode-spread .book-area { display: flex; }
}
@media (max-width: 768px) {
  .manga-modal.mode-spread.open .mobile-view { display: flex; }
  .manga-modal.mode-spread .book-area { display: none !important; }
  .manga-modal.mode-spread .page-hint { display: none !important; }
  .bottom-nav { padding: 10px 12px; gap: 8px; }
  .nav-btn { width: 34px; height: 34px; font-size: 15px; }
  .nav-thumbnails { display: none; }
}

/* ===== Card Grid Pagination Bar ===== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px;
  margin-top: 40px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  user-select: none;
}
.pg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: #f5f0eb;
  border: 1px solid #e0d6cc;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.pg-btn:first-child {
  border-radius: 6px 0 0 6px;
}
.pg-btn:last-child {
  border-radius: 0 6px 6px 0;
}
.pg-btn:hover {
  background: #ebe4db;
  color: #333;
}
.pg-btn.active {
  background: #EB5200;
  border-color: #EB5200;
  color: #fff;
  font-weight: 800;
}
.pg-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}
.pg-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  background: #f5f0eb;
  border: 1px solid #e0d6cc;
  color: #aaa;
  font-size: 13px;
  cursor: default;
}

@media (max-width: 768px) {
  .pg-btn { min-width: 34px; height: 34px; font-size: 12px; padding: 0 8px; }
  .pg-ellipsis { min-width: 34px; height: 34px; }
}

/* ===== Footer ===== */
.footer {
  background: #222;
  color: #aaa;
  padding: 40px 24px;
  text-align: center;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-logo {
  display: inline-block;
  text-decoration: none;
  flex-shrink: 0;
}
.footer-logo-img {
  height: 48px;
  min-width: 170px;
  width: auto;
  display: block;
  filter: brightness(10);
}
.footer-links {
  display: flex; gap: 24px;
  list-style: none;
}
.footer-links a {
  color: #aaa; text-decoration: none;
  font-size: 13px; font-weight: 600;
  transition: color 0.2s;
}
.footer-links a:hover { color: #fff; }
.footer-company {
  width: 100%;
  margin-top: 16px;
  font-size: 12px;
  color: #888;
}
.footer-copy {
  width: 100%;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
  color: #666;
}

/* ===== No Results ===== */
.no-results {
  text-align: center;
  padding: 60px 24px;
  color: #999;
  font-size: 15px;
  display: none;
}
.no-results.visible { display: block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px; left: 0; right: 0;
    background: #fff;
    padding: 16px 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    gap: 0;
  }
  .nav-links.open li { padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
  .nav-links.open li:last-child { border-bottom: none; padding-top: 16px; }
  .nav-links.open .nav-dropdown .dropdown-menu {
    display: block;
    position: static;
    transform: none;
    box-shadow: none;
    opacity: 1;
    padding: 4px 0 0 16px;
    min-width: auto;
    border-radius: 0;
  }
  .nav-links.open .dropdown-menu::before,
  .nav-links.open .dropdown-menu::after { display: none; }
  .nav-links.open .dropdown-menu li a { padding: 8px 0; font-size: 12px; }
  .hamburger { display: flex; }
  .header-inner { height: 56px; }
  .page-hero { padding: 100px 16px 40px; min-height: 360px; }
  .page-hero-desc { font-size: 14px; line-height: 1.7; }
  .works-section { padding: 28px 12px 48px; }
  .works-filter {
    top: 56px;
    gap: 6px;
    padding: 10px 4px;
  }
  .filter-btn { padding: 7px 14px; font-size: 12px; }
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .work-card { border-radius: 12px; }
  .work-card-img-wrapper { padding: 12px; aspect-ratio: 4 / 3; }
  .work-card-img { width: 70%; }
  .work-card-body { padding: 12px 14px 14px; }
  .work-card-title { font-size: 13px; margin-bottom: 6px; }
  .work-card-category { font-size: 10px; padding: 4px 10px; margin-bottom: 8px; }
  .work-card-tags { margin-bottom: 8px; }
  .work-tag { font-size: 10px; }
  .work-card-arrow { width: 30px; height: 30px; font-size: 14px; }
  .footer-inner { justify-content: center; text-align: center; }
  .footer-links { justify-content: center; gap: 16px; }
  .footer-links a { font-size: 12px; }
  .footer { padding: 30px 16px; }
}
@media (max-width: 480px) {
  .works-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 400px;
  }
  .work-card-img { width: 55%; }
  .work-card-img-wrapper { aspect-ratio: 4 / 3.5; padding: 20px; }
  .work-card-body { padding: 16px 18px 18px; }
  .work-card-title { font-size: 15px; }
}

/* ===== Pre-production Carousel (赤ペン・ネーム) ===== */
.pre-section {
  padding: 48px 24px 60px;
  background: #f4f4f4;
  color: #333;
}
.pre-section-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}
.pre-section-title em {
  color: #EB5200;
  font-style: normal;
}
.pre-section-subtitle {
  text-align: center;
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 32px;
}
.pre-carousel-wrap {
  margin: 0 auto 40px;
  max-width: 1200px;
}
.pre-carousel-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid #EB5200;
  color: #333;
}
.pre-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}
.pre-carousel-track {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
}
.pre-carousel-track::-webkit-scrollbar {
  display: none;
}
.pre-carousel-slide {
  width: 33.333% !important;
  min-width: 33.333% !important;
  max-width: 33.333% !important;
  flex: 0 0 33.333% !important;
  padding: 4px;
  cursor: pointer;
  transition: transform 0.3s;
  box-sizing: border-box;
  scroll-snap-align: start;
}
.pre-carousel-slide:hover {
  transform: scale(1.03);
}
.pre-slide-img-wrap {
  overflow: hidden;
  border-radius: 6px;
  background: #e8e8e8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  height: 500px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.pre-slide-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}
.pre-carousel-slide .pre-slide-title {
  font-size: 12px;
  color: #777;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pre-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(238,107,29,0.85);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.pre-carousel-btn:hover {
  background: rgba(238,107,29,1);
}
.pre-carousel-btn.prev { left: 4px; }
.pre-carousel-btn.next { right: 4px; }
.pre-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
}
.pre-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}
.pre-carousel-dot.active {
  background: #EB5200;
}

@media (max-width: 768px) {
  .pre-carousel-slide {
    width: 80% !important;
    min-width: 80% !important;
    max-width: 80% !important;
    flex: 0 0 80% !important;
  }
  .pre-section { padding: 32px 16px 40px; }
  .pre-section-title { font-size: 20px; }
  .pre-carousel-wrap { max-width: 95%; }
  .pre-slide-img-wrap { height: 500px; }
}

/* ===== Direct Mode (QR code flicker prevention) ===== */
html.direct-mode .header,
html.direct-mode .page-hero,
html.direct-mode .works-section,
html.direct-mode .pre-section,
html.direct-mode .footer { display: none !important; }
html.direct-mode body { background: #1a1a1a; overflow: hidden; }
