/* =========================
   css/style.css（完成版）
========================= */

/* ===== リセット ===== */
*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,
  "Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif;
  font-size:16px;
  line-height:1.7;
  color:#222;
  background:#fafafa;
  overflow-x: hidden;
}

/* ===== ヘッダー ===== */
header{
  position:sticky;
  top:0;
  border-bottom:1px solid #ddd;
  background:#fafafa;
  z-index:1000;
}

.header-inner{
  max-width:1200px;
  margin:auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px;
  gap:10px;
}

.search-box input{
  padding:6px 8px;
  border:1px solid #ccc;
  border-radius:5px;
}

.menu-btn{
  display:none;
  font-size:20px;
  cursor:pointer;
}

/* ===== レイアウト ===== */
.layout{
  max-width:1200px;
  margin:20px auto;
  display:grid;
  grid-template-columns:180px 1fr;
  gap:20px;
}

.background-box{
  background:#fafafa;
  padding:20px;
  border-radius:10px;
}

/* ===== サイドバー ===== */
.sidebar{
  background:#fafafa;
  padding:15px;
  border-radius:10px;
  position:sticky;
  top:70px;
  max-height:calc(100vh - 80px);
  overflow-y:auto;
}

.menu-section{
  margin-bottom:20px;
}

.menu-title{
  font-weight:bold;
  margin-bottom:5px;
  cursor:pointer;
}

.sidebar ul{
  list-style:none;
  padding-left:0px;
}

.sidebar ul ul {
  margin-left:12px;
  border-left:2px solid #ddd;
  padding-left:8px;
}

.sidebar ul ul a{
  font-size:14px;
}

.sidebar li{
  padding:1px 4px;  /* ←ここを小さく */
  margin:0;
  border-radius:6px;
}

.sidebar a,
.menu-toggle{
  display:block;
  padding:2px 0;
  line-height:1.3;
  text-decoration:none;
}

.sidebar li.active a{
  color:#c44;
  font-weight:bold;
}

.sidebar li.parent > a{
  color:#888;
}

.active > a {
  background: #007acc;
  color: #fff;
  font-weight: bold;
}

.parent > a {
  font-weight: bold;
  color: #333;
}
/* ===== パンくず ===== */
.breadcrumb{
  font-size:14px;
  color:#555;
  margin-bottom:15px;
}

/* ===== 本文 ===== */
.main-content{
  min-width:0;
}

html{
  scroll-padding-top:80px;
}

/* リンクグループ */
.link-group {
  display: block;   /* ← flexやめる */
  list-style: none;
  padding-left: 0;
}

.link-group li {
  margin: 6px 0;
}

.link-group a {
  display: block;
  padding: 6px 8px;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
}

.link-group a:hover {
  background: #eee;
}

/* 子リストを閉じる */
#toc-list {
  list-style: none;
  padding-left: 0;
}

#toc-list ul {

  list-style: none;
  padding-left: 20px; /* 好みで調整 */
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

#toc-list ul.closed {
  max-height: 0;
}

/* 親リンク */
.toc-toggle {
  cursor: pointer;
}

/* 矢印 */
.toc-toggle::before {
  content: "▶ ";
  display: inline-block;
  transition: transform 0.3s;
}

/* 開いてる */
.toc-toggle.open::before {
  transform: rotate(90deg);
}

/* ===== カード共通 ===== */
.kobun .sentence,
.kanbun .sentence{
  border:1px solid #ddd;
  border-radius:10px;
  padding:15px;
  margin-bottom:20px;
  background:#fff;
}

/* ===== 古文 ===== */
.kobun .original{
  font-family:"Hiragino Mincho ProN","Yu Mincho",serif;
  font-size:18px;
  line-height:1.8;
  margin-bottom:10px;
}

.kobun .translation{
  font-size:15px;
  margin-top:6px;
}

/* 下線（古文） */
.kobun .red{
  text-decoration:underline;
  text-decoration-color:#c44;
  text-decoration-thickness:2px;
  text-underline-offset:2px;
}

/* ===== 漢文 ===== */
.kanbun .original{
  font-family:"Hiragino Mincho ProN","Yu Mincho",serif;
  font-size:18px;
  line-height:1.8;
  margin-bottom:8px;
  letter-spacing:0.05em;
}

.kanbun .reading{
  font-size:14px;
  margin-bottom:4px;
}

.kanbun .translation{
  font-size:14px;
}

.kanbun .daiji{
  color:#c44;
  font-weight:bold;
  font-family:"Hiragino Kaku Gothic ProN",sans-serif;
}

/* ===== マーキング（JS対応） ===== */
.underline{
  text-decoration:underline;
  cursor:pointer;
}

.daiji{
  color:#c44;
  font-weight:bold;
  cursor:pointer;
}

/* ===== 表 ===== */
.my-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

.my-table th,
.my-table td{
  border:1px solid #666;
  padding:6px 8px;
  vertical-align:top;
}

.my-table th{
  background:#E6ECFE;
  text-align:center;
}

.my-table td{
  background:#FFF;
  text-align:left;
  line-height:1.4;
}

/* ===== 歴史資料 ===== */
.source{
  font-family:"Hiragino Mincho ProN","Yu Mincho",serif;
  background:#fff;
  border:1px solid #ccc;
  padding:15px;
  margin:20px 0;
  border-radius:10px;
  line-height:1.8;
}

.source .source-em{
  background:#fff3a0;
}

blockquote{
  background:#fff;
  border:1px solid #ccc;
  padding:16px;
  margin:24px 0;
  border-radius:8px;
  box-shadow:0 3px 5px rgba(0,0,0,0.05);
}
/* ===== 汎用ボックス ===== */
.content-box{
  background:#fff;
  padding:18px;
  border-radius:10px;
  margin-bottom:20px;
  border:1px solid #ddd;
  box-shadow:0 2px 6px rgba(0,0,0,0.05);
}

/* ===== 目次 ===== */
details summary{
  margin-bottom:5px;
  cursor:pointer;
}

details li{
  margin:4px 0;
}

details ul{
  list-style:none;
  padding-left:0;
  margin:5px 0;
}

.list-1{margin-left:0;}
.list-2{
  margin-left:15px;
  border-left:2px solid #ddd;
  padding-left:10px;
}
.list-3{
  margin-left:30px;
  border-left:2px solid #eee;
  padding-left:10px;
}

/* ===== PDF表示 ===== */
.pdf-viewer{
  position:relative;
  width:100%;
  max-width:500px;
  margin:20px auto;
  border:1px solid #ccc;
  border-radius:10px;
  overflow:hidden;
}

.pdf-viewer iframe{
  width:100%;
  height:300px;
  pointer-events:none;
}

/* ← 名前変更（衝突回避） */
.pdf-overlay{
  position:absolute;
  bottom:0;
  width:100%;
  background:rgba(0,0,0,0.5);
  color:#fff;
  text-align:center;
  padding:8px;
  font-size:14px;
}

/* ===== フッター ===== */
footer{
  text-align:center;
  padding:20px;
  margin-top:40px;
  border-top:1px solid #ddd;
}

/* ===== モバイルメニュー ===== */
.mobile-menu{
  position:fixed;
  top:0;
  left:0;
  transform: translateX(-100%);
  width:260px;
  height:100%;
  background:#fff;
  transition:.3s;
  padding:15px;
  z-index:2000;
}

.mobile-menu.active{
  transform: translateX(0);
}

.mobile-menu ul ul {
  display: none;
}

.mobile-menu li.parent > ul,
.mobile-menu li.active > ul {
  display: block;
}

.mobile-menu {
  width: 280px;
}

/* 背景オーバーレイ */
.overlay{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,.3);
  display:none;
  z-index:1500;
}

.overlay.active{
  display:block;
}

/* ===== スマホ ===== */
@media(max-width:768px){

  .layout{
    grid-template-columns:1fr;
  }

  .sidebar{
    display:none;
  }

  .menu-btn{
    display:block;
  }

}