/* =========================================================
   nicotto-talk 管理コンソール 操作マニュアル
   ========================================================= */

/* --- リセット --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: "BIZ UDPゴシック", "BIZ UDGothic", "Yu Gothic UI",
    "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #1b1b1b;
  background: #f9fdf9;
}

/* --- スキップリンク --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1rem;
  background: #2d6b3f;
  color: #fff;
  z-index: 1000;
  text-decoration: none;
  font-size: 0.85rem;
}

.skip-link:focus {
  top: 0;
}

/* --- ヘッダー --- */
.site-header {
  background: #fff;
  border-bottom: 3px solid #a5d6a7;
  padding: 0.8rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo {
  height: 36px;
  width: auto;
}

.header-title {
  font-size: 0.9rem;
  color: #5f5f5f;
  font-weight: normal;
}

/* --- レイアウト（サイドバー + メイン） --- */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 2rem 1.5rem;
}

/* --- サイドバー目次 --- */
.sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 1rem;
}

.sidebar-title {
  font-size: 0.85rem;
  color: #2d6b3f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #a5d6a7;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-list li {
  margin-bottom: 0.3rem;
}

.sidebar-list a {
  display: block;
  padding: 0.3rem 0.6rem;
  color: #333;
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-list a:hover,
.sidebar-list a:focus {
  background: #e8f5e9;
  color: #2d6b3f;
}

/* --- メインコンテンツ --- */
main {
  min-width: 0;
}

/* --- 見出し --- */
h2 {
  font-size: 1.5rem;
  color: #2d6b3f;
  margin: 2.5rem 0 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #a5d6a7;
}

section[id] {
  scroll-margin-top: 5rem;
}

section:first-of-type h2 {
  margin-top: 0;
}

h3 {
  font-size: 1.15rem;
  color: #2d6b3f;
  margin: 1.8rem 0 0.5rem;
  letter-spacing: 0.04em;
}

h4 {
  font-size: 1rem;
  color: #333;
  margin: 1.3rem 0 0.4rem;
}

/* --- テキスト --- */
p {
  margin: 0 0 0.7rem;
}

ul,
ol {
  margin: 0.5rem 0 1rem;
  padding-left: 1.6rem;
}

li {
  margin-bottom: 0.35rem;
}

/* --- 定義リスト --- */
dl {
  margin: 1rem 0;
}

dt {
  font-weight: bold;
  margin-top: 0.7rem;
}

dd {
  margin-left: 1.2rem;
  margin-bottom: 0.3rem;
}

/* --- テーブル --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
}

caption {
  text-align: left;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: #2d6b3f;
}

th,
td {
  border: 1px solid #ddd;
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

thead th {
  background: #e8f5e9;
  color: #2d6b3f;
  font-weight: bold;
}

tbody tr:nth-child(even) {
  background: #fafffe;
}

code {
  background: #f5f5f5;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: "Consolas", "Source Code Pro", monospace;
}

/* --- 補足ボックス --- */
.note {
  background: #f1f8e9;
  border-left: 4px solid #81c784;
  border-radius: 4px;
  padding: 0.7rem 1rem;
  margin: 1rem 0;
}

.note p {
  margin: 0.2rem 0;
  font-size: 0.88rem;
  color: #37593a;
}

.note p::before {
  content: "💡 ";
}

/* --- 画像・図 --- */
figure {
  margin: 1.2rem 0;
}

figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

figcaption {
  font-size: 0.8rem;
  color: #5f5f5f;
  margin-top: 0.4rem;
}

/* --- リンク --- */
a {
  color: #2d6b3f;
}

a:focus {
  outline: 2px solid #2d6b3f;
  outline-offset: 2px;
}

/* --- フッター --- */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  border-top: 1px solid #e8f5e9;
  color: #5f5f5f;
  font-size: 0.8rem;
  background: #fff;
}

/* --- レスポンシブ（モバイル） --- */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .sidebar {
    position: static;
    max-height: none;
    border-bottom: 1px solid #e8f5e9;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .header-inner {
    flex-wrap: wrap;
  }
}

/* =========================================================
   印刷用
   ========================================================= */
@media print {
  body {
    font-size: 10pt;
    line-height: 1.6;
    color: #000;
    background: #fff;
  }

  .skip-link,
  .site-header,
  .sidebar {
    display: none;
  }

  .layout {
    display: block;
    padding: 0;
    max-width: none;
  }

  main {
    max-width: none;
  }

  /* セクションごとに改ページ */
  section {
    page-break-before: always;
  }

  section:first-of-type {
    page-break-before: avoid;
  }

  /* 図が途中で切れない */
  figure {
    page-break-inside: avoid;
  }

  /* 見出し直後で切れない */
  h2,
  h3,
  h4 {
    page-break-after: avoid;
  }

  figure img {
    box-shadow: none;
    border: 1px solid #ccc;
    max-width: 85%;
  }

  table {
    page-break-inside: avoid;
  }

  thead th {
    background: #eee;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .note {
    border-left: 2px solid #666;
    background: #f5f5f5;
  }

  .note p {
    color: #333;
  }

  footer {
    border-top: 1px solid #ccc;
    page-break-before: avoid;
  }
}
