/* 変数の定義 */
:root {
  --nav-width: 13rem;
  --content-pad: 1.5rem;
  --min-content-width: 44rem;
  --clr-main: #7c604e;
  --clr-light: #fdfbf8;
  --clr-header-bg: #ebddcd;
  --clr-accent: #d1bfa9;
  --clr-nav: #773c30;
  --clr-nav-bg:#f0f5e6;
  --clr-nav-accent: #99ac98;
}
/*================= 全体のスタイル  =================*/
* { font-weight: normal; }
html { scroll-behavior: smooth;}
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  margin-left: var(--nav-width);
  margin-right: auto;
  min-height: 100vh;
  min-width: calc(var(--min-content-width) + var(--nav-width));
  color: var(--clr-main);
  font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "HGS Mincho E", serif;
  font-size: 110%;
  letter-spacing:0.1em;
  line-height: 1.5;
}
header, footer, main {
  width: 100%;
  box-sizing: border-box;
}
header, footer {
  flex-shrink: 0;
  padding: 0.5rem;
}
header { 
  font-size: 150%; 
  padding: 1rem;
}
main {
  margin: 0;
  padding: 1rem var(--content-pad);
  flex-grow: 1;
  min-width: var(--min-content-width);
  text-align: left;
    /* ドットの模様 */
  background-image: 
    radial-gradient(rgba(78, 54, 37, 0.045) 1px, transparent 1px),
    radial-gradient(rgba(47, 80, 66, 0.045) 1px, transparent 1px);
    /* ドットを千鳥配置 */
  background-position: 0 0, 10px 10px;
    /* ドットの間隔 */
  background-size: 7px 7px;
}
footer { font-size: 80%; }

/*================= 配置 =================*/
/*    main側    */
.content-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  box-sizing: border-box;
}
/*    Nav側   */
nav {
  padding: 2rem 0.5rem;
  box-sizing: border-box;
  text-align: left;
}
#nav-placeholder {
  position: fixed;
  top: 0; 
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background-color: var(--clr-nav-bg);
  border-right: 1px solid;
  border-image-source: linear-gradient(to bottom, #dbaa47, #ebcd7b, #fff4cd, #ebcd7b, #dbaa47);
  border-image-slice: 1;
  border-width: 0 1px 0 0;
}
#nav-placeholder nav {
  flex-grow: 1; 
  overflow-y: auto; 
  /* ドット */
  background-image: 
  radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
  radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-position: 0 0, 3px 3px;
  background-size: 6px 6px;
}
#nav-placeholder header,
#nav-placeholder footer {
  text-align: center;
  color: var(--clr-main);
  border-top: 2px solid;
  border-bottom: 2px solid;
  border-image-source: linear-gradient(to right,#ebcd7b, #fff4cd, #ebcd7b);
  border-image-slice: 1;
  background-color: var(--clr-header-bg); 
    /* ドットの模様 */
  background-image: 
    radial-gradient(rgba(247, 246, 244, 0.75) 1px, transparent 1px),
    radial-gradient(rgba(209, 191, 169, 0.5) 1px, transparent 1px);
    /* ドットを千鳥配置 */
  background-position: 0 0, 10px 10px;
    /* ドットの間隔 */
  background-size: 25px 25px;
}
#nav-placeholder footer { flex-shrink: 0;}

/*    開閉 (概要)    */
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { display: none; }
summary {
  cursor: pointer;
  list-style: none;
  outline: none;
  position: relative;
}

/*================= 構成 =================*/
/*    Nav側   */
nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
nav ul .submenu { display: none; }
nav li.is-open > .submenu { display: block; }
nav li {
  margin: 0;
  line-height: 1.5rem;
}
nav a,
.submenu a {
  color: var(--clr-nav);
  text-decoration: none;
  display: block;
  letter-spacing: 0.12em; 
}
nav a { 
  padding: 0.5rem 0.5rem; 
  font-weight: bold;
}
nav a:hover,
.submenu a:hover {
  font-weight: bold;
}
nav a:hover { 
  background-color: var(--clr-light);
  display: inline-block;
  border-radius: 2.5rem;
  border-bottom: 1px solid var(--clr-nav);
}

/*  nav・サブメニュー  */
.submenu {
  margin: 0.3rem 0 0 1rem;
  padding: 0.3rem 0 0.3rem 0.5rem;
  z-index: 10;
  background-color: var(--clr-light);
  border: 2px solid var(--clr-nav-accent);
  border-radius: 0.5rem;
}
.submenu ul,
.submenu li {
  margin: 0;
  line-height: 1;
}
.submenu a { 
  font-size: 95%; 
  font-weight: normal;
}
.submenu a:hover { border-bottom: none; }

/*  main・ツリー展開  */
.tree-container summary,
.tree-container table th,
.tree-container table td { font-weight: normal; }
.tree-container { margin: 1.25rem auto; }

/*    guide-header   */
.guide-header {
  padding: 0.6rem 1rem 0.6rem 3rem;
  font-size: 110%;
  color: var(--clr-nav);
  background-color: var(--clr-header-bg);
  border-bottom: 2px solid var(--clr-accent);
  /* 方眼紙（グリッド） */
  border-radius: 0.5rem;
  background-image: 
  linear-gradient(to right, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
  linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-blend-mode: overlay;
  background-size: 3px 3px; /* マスの大きさ */
}
.guide-header::before {
  content: '▶';
  position: absolute;
  left: 1rem;
  transform: translateY(-50%);
  top: 50%;
  color: var(--clr-light);
}
.guide[open] > .guide-header::before {
  content: '▼';
  color: var(--clr-main);
}
.guide {
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
}

.tree-table {
  width: 90%;
  margin: 1.5rem auto;
  border-collapse: collapse;
  font-size: 110%;
}
.tree-table caption {
  text-align: left;
  padding: 0.5rem; 
  caption-side: top;
}
.tree-table th {
  padding: 0.5rem 1rem;
  border-bottom: 2px solid var(--clr-accent);
  background-color: rgba(231, 220, 207, 0.3); 
}
.tree-table td {
  padding: 0.6rem;
  border-bottom: 1px dashed var(--clr-accent);
  vertical-align: top;
}
/* 1列目（左）のセル */
.tree-table td:nth-child(1),
.tree-table th:nth-child(1) { width: 8.5rem; }
.tree-table tbody tr:last-child td { border-bottom: none; }

/*    table-list   */
.table-list {
  margin: 0;
  padding: 0;
}
.table-list ul {
  margin: 0.25rem 0 0.25rem; 
  padding: 0;
  list-style-type: disc;
}
.table-list li {
  margin: 0;
  padding: 0.2rem 0 0.2rem 1rem;
  list-style-type:none;
}

/*    main・補足memo   */
.memo {
  width: 80%;
  margin: 0.1rem auto 2rem;
  padding: 0.5rem;
  font-size: 100%;
  color: var(--clr-main);
  line-height: 1.3;
  border-left: medium double rgba(231, 220, 207, 0.8);
}

/*    main・note   */
.note {
  width: 90%;
  margin: 1rem auto;
}
.note-title {
  width: 80%; 
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-weight: bold;
  font-size: 120%;
}
.note-title::before,
.note-title::after {
  content: '';
  flex-grow: 1;
  height: 5px;
}
.note-title::before { background: linear-gradient(to right, transparent, var(--clr-nav-bg)); }
.note-title::after { background: linear-gradient(to right, var(--clr-nav-bg), transparent); }

.note-caption{
  margin: 1rem 0 0;
  padding: 0;
  font-weight: bold;
}

.note-table {
  width: 100%; 
  margin: 1.3rem 0;
  border-collapse: collapse;
}
.note-table td {
  margin: 0 2rem;
  padding: 0.25rem 0;
  vertical-align: top;
}
.note-table td:nth-child(1) {
  width: 12rem;
  font-weight: bold;
  white-space: nowrap; /* 改行されないようにする */
}

.note-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.note-list li { margin: 0.5rem 0 0.5rem 1rem; }
td .note-list li { margin: 0; }
/*    main・例文   */
.ex-table{ 
  margin: 2rem 0 1.5rem;
  width: 100%;
  font-size: 100%;
  border-collapse: collapse;
  border-bottom: 1px solid var(--clr-accent);
}
.ex-table caption {
  caption-side: top;
  font-weight: bold;
  background-color: var(--clr-light);
  background-image: 
  linear-gradient(to right, rgba(235, 221, 205, 0.3) 1px, transparent 1px),
  linear-gradient(to bottom, rgba(235, 221, 205, 0.3) 1px, transparent 1px);
  background-size: 4px 4px; /* マスの大きさ */
}
.ex-table thead th {
  font-weight: bold;
  padding: 0.5rem;
  border-bottom: 2px solid var(--clr-accent);
}
.ex-table tbody td {
  padding: 0.3rem;
  vertical-align: top;
}

/* --- 【重要】列(td)ごとの幅調整 --- */
.fit {
  width: 1%;           /* 最小幅にする */
  white-space: nowrap; /* 改行禁止 */
  font-weight: bold;   /* 太字 */
  color: var(--clr-nav); /* 色変え */
  padding-right: 0.5rem; /* 右の隙間 */
}

.ex-list{ 
  margin: 0.5rem 0;
  list-style: none;
}
.ex-list li::before {
  padding: 0;
  content: '└ '; 
  color: var(--clr-main);
}

/* --- 付箋 --- */
.sticky-note {
  margin: 1rem 0;
  padding: 0.2rem;
  background: linear-gradient(0.25turn, #f8f5f2, #fdfffe);
  border-left: 10px solid #ebcd7b;
  color: var(--clr-nav);
  border-radius: 0.5rem;
  font-size: 95%;
}

/*    log   */
.log-list {
  margin: 0.3rem auto 0.5rem;
  padding: 0;
  list-style: none;
  width: 90%;
  font-size: 100%;
}
.log-list li {
  padding: 0.1rem 0;
  list-style: none;
  border-bottom: 1px dotted var(--clr-header-bg);
}

/*    choice-list   */
.choice-list{  
  margin: 1rem;
  padding: 0.3rem 0 0 1rem;
  font-size: 110%;
  list-style-type:none;
}
.choice-list a {
  color: var(--clr-nav);
  font-weight: bold;
}
.choice-list a:hover { border-bottom: 1px solid var(--clr-header-bg); }

/*================= 装飾 =================*/
/*    リンク   */
a {
  text-decoration: none;
  color: var(--clr-main);
}
a:hover { transition: all 0.3s ease; }
a:visited { color: var(--clr-nav); }

/*    文字   */
h1 ,h2 {
  margin: 1.3rem 0;
  padding-left: 0.5rem;
  font-size: 130%;
  width: fit-content;
  scroll-margin-top: 6rem;
  border-left: 1rem double var(--clr-header-bg);
}
main p { 
  margin: 0.5rem 0 0;
  padding-left: 1rem;
  font-size: 100%;
}
p.title { margin: 2rem 1rem 0;}
p.title-aux { 
  margin: 0.7rem 0 0;
  padding: 0;
  text-decoration: underline;
  font-weight: normal;
  text-decoration-color: rgb(63, 63, 63, 0.5);
}
em {
  font-weight: bold;
  font-style: normal;
  color: var(--clr-nav);
}

/*    ライン   */
.boder-bg-hd {
  border: none;
  height: 2px;
  width: 80%;
  margin: 3rem auto;
  background: linear-gradient(to right, var(--clr-header-bg) 20%, transparent 100%);
}

/*    戻るボタン   */
#page-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  color: var(--clr-main);
  padding: 1rem;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  text-align: center;
  line-height: 3rem; /* 文字を上下中央に */
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 200; /* Nav(100)より手前に表示 */
  background-color: rgba(235, 221, 205, 0.3);
  opacity: 0;            /* 0透明、1不透明 */
  transition: opacity 0.3s;
  pointer-events: none;  /* 透明なときはクリックできないようにする */
}
#page-top.show {
  opacity: 1;
  pointer-events: auto;  /* クリック可能にする */
}
#page-top:hover {
  color: var(--clr-header-bg);
  background-color: var(--clr-nav);
  text-decoration: none;
}

/*==================================================
  スマホ・タブレット用レスポンシブ設定 (画面幅768px以下)
==================================================*/
.menu-btn { display: none; } /* PCでは消す */

@media screen and (max-width: 768px) {
  body {
    margin-left: 0;
    min-width: 100%;
  }
  #nav-placeholder {
    position: fixed; /* 固定 */
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    padding: 3.2rem 0 0;
    border-right: 1px solid #ccc;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2); 
    display: flex;
    flex-direction: column;
    /* アニメーション */
    transition: left 0.3s ease;
    z-index: 1000;
  }
  #nav-placeholder.open { left: 0; }
  .menu-btn {
    display: block;
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    
    /* ボタンの見た目 */
    padding: 0.5rem 1rem;
    background-color: var(--clr-nav-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
  }
  main { padding: 2.5rem 1rem 1rem; }
  #page-top {
    right: 1rem;
    bottom: 1rem;
  }
}