/* ============================================================
   navbar-custom.css - rhizome風ナビゲーション
   ============================================================ */

:root {
  --navbar-bg: rgba(255, 255, 255, 0.95);
  --navbar-text: #333;
  --navbar-hover: #666;
  --navbar-border: #e0e0e0;
  --navbar-height: 60px;
}

/* ナビゲーションバー全体 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* body にpadding-topを追加してnavbar分のスペースを確保 */
body {
  padding-top: var(--navbar-height);
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--navbar-height);
  padding: 0 20px;
  max-width: 100%;
  margin: 0 auto;
}

/* ロゴ/ブランド */
.navbar-brand {
  flex-shrink: 0;
}

.navbar-logo {
  text-decoration: none;
  color: var(--navbar-text);
  font-size: 18px;
  font-weight: 600;
  transition: color 0.3s ease;
  letter-spacing: 0.5px;
}

.navbar-logo:hover {
  color: var(--navbar-hover);
}

/* メニュー */
.navbar-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 30px;
}

.navbar-link {
  text-decoration: none;
  color: var(--navbar-text);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.3s ease;
  white-space: nowrap;
}

.navbar-link:hover {
  color: var(--navbar-hover);
}

/* ハンバーガーメニューボタン */
.navbar-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  gap: 6px;
}

.navbar-toggle span {
  width: 24px;
  height: 2px;
  background: var(--navbar-text);
  transition: all 0.3s ease;
  border-radius: 2px;
  transform-origin: center;
}

.navbar-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.navbar-toggle.active span:nth-child(2) {
  opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ヘッダーコンテンツのマージン調整 */
.header-content {
  padding-top: 20px;
}

/* ============================================================
   ページトップに戻るボタン
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
  }

  .navbar-toggle {
    display: flex;
  }

  .navbar-menu {
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    gap: 0;
    padding: 20px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .navbar-menu.active {
    max-height: 300px;
  }

  .navbar-menu li {
    padding: 0;
  }

  .navbar-link {
    display: block;
    padding: 12px 20px;
    border-bottom: 1px solid var(--navbar-border);
  }

  .navbar-menu li:last-child .navbar-link {
    border-bottom: none;
  }

  .navbar-logo {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .navbar-container {
    padding: 0 15px;
  }

  .navbar-logo {
    font-size: 14px;
  }

  .navbar-toggle span {
    width: 20px;
  }
}



/* ============================================================
   ページトップに戻るボタン
   ============================================================ */

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: #fff;
  border: 1px solid var(--navbar-border);
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--navbar-text);
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-to-top:hover {
  background: var(--navbar-text);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top.show {
  display: flex;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* レスポンシブ */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 480px) {
  .back-to-top {
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
  }

  .back-to-top svg {
    width: 18px;
    height: 18px;
  }
}

/* ============================================================
   translucent クラスの修正
   PCのみに適用、タップデバイスでは無効化
   ============================================================ */

/* デフォルトで translucent を無効化（タップデバイス向け） */
ul.translucent {
  a {
    background-color: transparent;
  }
  img {
    opacity: 1;
  }
  a:hover img {
    opacity: 1;
  }
}

/* PCのみ（ホバー対応デバイス）で translucent を適用 */
@media (hover: hover) and (pointer: fine) {
  ul.translucent {
    a {
      background-color: var(--accent);
    }
    img {
      opacity: 0.7;
      transition: opacity 0.3s ease-in-out;
    }
    a:hover img {
      opacity: 1;
    }
  }
}


/* ============================================================
   ライトボックス(fuwaimg)内のキャプション表示対応のみ
   ============================================================
   
   【重要】
   - サムネイル一覧では常に no_caption が有効 → キャプション非表示
   - ライトボックス内だけキャプション表示
   - キャプション長過ぎ問題を解決（スクロール対応）
   
   ============================================================ */

/* ライトボックス内のキャプションをスクロール対応
   - 長いキャプションは最大高60px（モバイルは80px）
   - スクロール可能で全文表示できる
   - テキストが見切れない
*/
p#fuwaimg_caption_text {
  max-height: 60px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 5px;
}

/* スクロールバーのスタイル（Webkit系ブラウザ用） */
p#fuwaimg_caption_text::-webkit-scrollbar {
  width: 6px;
}

p#fuwaimg_caption_text::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

p#fuwaimg_caption_text::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

p#fuwaimg_caption_text::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* モバイルでの高さ調整 */
@media (max-width: 768px) {
  p#fuwaimg_caption_text {
    max-height: 80px;
  }
}


#fuwaimg_mask {
  background: transparent;
}

div#fuwaimg_img {
  background: transparent;
}

/* ============================================================
   NSFW ぼかし制御
   caption.csv の caption2 列に "nsfw" と記述した画像に適用
   ============================================================ */

/* NSFWサムネイル：デフォルトでblur */
ul li a.nsfw {
  position: relative;
}

ul li a.nsfw img {
  filter: blur(16px);
  transition: filter 0.3s ease;
}

/* PCのみ：ホバーでぼかし解除 */
@media (hover: hover) and (pointer: fine) {
  ul li a.nsfw:hover img {
    filter: blur(0);
  }
}

/* JS で .revealed クラスが付いたら解除（スマホ対応） */
ul li a.nsfw.revealed img {
  filter: blur(0);
}

/* R18バッジ表示 */
ul li a.nsfw::after {
  content: "R18";
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(180, 0, 0, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
}

/* revealed後はバッジを非表示 */
ul li a.nsfw.revealed::after {
  display: none;
}

/* ============================================================
   年齢確認モーダル
   ============================================================ */

/* スクロール抑止（モーダル表示中） */
body.age-gate-active {
  overflow: hidden;
}

/* オーバーレイ全画面 */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ageGateFadeIn 0.3s ease;
}

.age-gate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

/* ダイアログ本体 */
.age-gate-dialog {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: ageGateSlideIn 0.4s ease;
}

.age-gate-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.age-gate-title {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  margin: 0 0 16px;
}

.age-gate-text {
  font-size: 14px;
  color: #555;
  line-height: 1.7;
  margin: 0 0 8px;
}

.age-gate-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.age-gate-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.age-gate-btn-yes {
  background: #333;
  color: #fff;
}

.age-gate-btn-yes:hover {
  background: #555;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.age-gate-btn-no {
  background: #f0f0f0;
  color: #666;
}

.age-gate-btn-no:hover {
  background: #e0e0e0;
}

@keyframes ageGateFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ageGateSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 480px) {
  .age-gate-dialog {
    padding: 32px 24px 24px;
  }

  .age-gate-title {
    font-size: 19px;
  }

  .age-gate-btn {
    font-size: 14px;
    padding: 12px 16px;
  }
}