/* ==========================================================================
   muzzle-works Notes スタイルシート (notes/notes.css v1 / v84)
   - portal.html / Fusen 統一デザイン（ライト基調 #f6f6f3・柿色 #d9581e・フラットUI）
   - 書庫・モノグラフ型：一覧は日付なし・番号＋カテゴリ＋タイトル＋要約、記事内は1カラム読書設計
   ========================================================================== */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-sub: #f1f1ed;
  --surface-hover: #e8e8e3;
  --border: #e3e3de;
  --border-strong: #c9c9c2;

  --text: #18181b;
  --text-sub: #52525b;
  --text-muted: #71717a;

  --accent: #d9581e;
  --accent-hover: #be4a16;
  --accent-soft: #fdf2ec;
  --accent-border: #efc4ae;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
}

* { box-sizing: border-box; }

html {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.ui-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   ヘッダー（portal.html 共通構成）
   ========================================================================== */
.notes-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.notes-header-inner {
  max-width: 960px;
  margin: 0 auto;
  height: 52px;
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.notes-header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-logo:hover { text-decoration: none; color: var(--text); }
.brand-logo-img { display: none; height: 22px; width: auto; }
.brand-logo.has-logo-img .brand-logo-img { display: block; }
.brand-logo.has-logo-img .brand-logo-fallback { display: none; }
.brand-logo-fallback { display: inline-flex; align-items: center; gap: 6px; }
.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  display: inline-block;
}

.header-sep {
  color: var(--border-strong);
  font-size: 13px;
}

.header-section-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}
.header-section-link:hover {
  text-decoration: none;
  background: var(--surface-sub);
  color: var(--text);
}

.notes-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: 12.5px;
  font-weight: 600;
}
.notes-nav a {
  color: var(--text-sub);
  text-decoration: none;
  white-space: nowrap;
}
.notes-nav a:hover,
.notes-nav a.is-current {
  color: var(--accent);
  text-decoration: none;
}

/* ==========================================================================
   メイン共通
   ========================================================================== */
.notes-main {
  flex: 1 1 auto;
}

/* ==========================================================================
   ノート一覧ページ (notes/index.html)
   ========================================================================== */
.archive-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-4) var(--sp-12);
}

.archive-head {
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.archive-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 var(--sp-2);
}

.archive-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.archive-lead {
  margin: var(--sp-3) 0 0;
  font-size: 14.5px;
  color: var(--text-sub);
  max-width: 680px;
  line-height: 1.8;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.filter-tab {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.filter-tab:hover {
  background: var(--surface-sub);
  color: var(--text);
}
.filter-tab.is-active {
  background: var(--text);
  border-color: var(--text);
  color: #ffffff;
}

.filter-count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.note-entry {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 24px;
  align-items: start;
  gap: var(--sp-4);
  padding: 20px var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.note-entry:hover {
  border-color: var(--accent);
  background: #fcfcfa;
  text-decoration: none;
  color: var(--text);
}
.note-entry.is-hidden {
  display: none;
}

.note-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.note-entry-body {
  min-width: 0;
}

.note-meta-top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
}
.cat-tag.accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.note-read-time {
  font-size: 11.5px;
  color: var(--text-muted);
}

.note-entry-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
}
.note-entry:hover .note-entry-title {
  color: var(--accent-hover);
}

.note-entry-summary {
  margin: var(--sp-2) 0 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-sub);
}

.note-entry-arrow {
  color: var(--text-muted);
  padding-top: 4px;
  display: flex;
  justify-content: flex-end;
}
.note-entry:hover .note-entry-arrow {
  color: var(--accent);
}

/* ==========================================================================
   記事ページ (notes/01-*.html ...)
   ========================================================================== */
.article-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) var(--sp-12);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
.breadcrumb a {
  color: var(--text-sub);
}
.breadcrumb a:hover {
  color: var(--accent);
}

.article-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px 44px;
}

.article-header {
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.article-header-tags {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.article-num-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
}

.article-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
}

.article-lead {
  margin: var(--sp-3) 0 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-sub);
}

.article-dates {
  margin-top: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 目次 */
.toc-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) 20px;
  margin-bottom: var(--sp-8);
}
.toc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  margin: 0 0 var(--sp-2);
  letter-spacing: 0.04em;
}
.toc-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.75;
}
.toc-list li {
  margin-bottom: 4px;
}
.toc-list a {
  color: var(--text);
}
.toc-list a:hover {
  color: var(--accent);
}

/* 本文組版 */
.article-body {
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--text);
}

.article-body h2 {
  margin: 40px 0 var(--sp-4);
  padding-left: var(--sp-3);
  border-left: 3px solid var(--accent);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  scroll-margin-top: 68px;
}
.article-body h2:first-child {
  margin-top: 0;
}

.article-body h3 {
  margin: 26px 0 var(--sp-2);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
}

.article-body p {
  margin: 0 0 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 20px;
  padding-left: 22px;
}
.article-body li {
  margin-bottom: 8px;
}
.article-body strong {
  font-weight: 700;
  color: var(--text);
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.note-code {
  margin: 0 0 20px;
  padding: var(--sp-4);
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
}

.note-callout {
  margin: 22px 0;
  padding: var(--sp-4) 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14.5px;
  color: var(--text-sub);
}
.note-callout.accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  border-left-color: var(--accent);
  color: var(--text);
}
.note-callout-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.note-callout p:last-child,
.note-callout ul:last-child {
  margin-bottom: 0;
}

.note-checklist {
  margin: 22px 0;
  padding: var(--sp-4) 20px;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.note-checklist-title {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 var(--sp-2);
  color: var(--text);
}
.note-checklist ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.note-checklist li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 14.5px;
}
.note-checklist li:last-child {
  margin-bottom: 0;
}
.note-checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  background: var(--surface);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0 24px;
}
.note-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.6;
}
.note-table th,
.note-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.note-table th {
  background: var(--surface-sub);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.note-table td {
  background: var(--surface);
  color: var(--text-sub);
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ==========================================================================
   記事末尾3点セット（関連ツール / 著者 / ナビゲーション）
   ========================================================================== */
.article-after {
  margin-top: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.related-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.related-tool-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.related-tool-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.related-tool-desc {
  font-size: 13px;
  color: var(--text-sub);
  margin: 4px 0 0;
}
.btn-tool-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn-tool-open:hover {
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

.author-card {
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.author-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.author-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.author-links {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 12px;
}
.author-bio {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-sub);
}

.article-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
}
.pager-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.pager-card.is-next {
  text-align: right;
}
.pager-dir {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.pager-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.back-to-notes-row {
  display: flex;
  justify-content: center;
  padding-top: var(--sp-2);
}
.btn-back-list {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.btn-back-list:hover {
  background: var(--surface-sub);
  color: var(--text);
  text-decoration: none;
}

/* ==========================================================================
   フッター
   ========================================================================== */
.notes-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--sp-6) var(--sp-4);
  font-size: 12px;
  color: var(--text-muted);
}

.notes-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.notes-footer-links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.notes-footer-links a {
  color: var(--text-sub);
}
.notes-footer-links a:hover {
  color: var(--accent);
}

/* ==========================================================================
   レスポンシブ
   ========================================================================== */
@media (max-width: 640px) {
  .notes-header-inner { padding: 0 var(--sp-3); }
  .notes-nav { gap: var(--sp-3); font-size: 12px; }
  .archive-wrap { padding: var(--sp-6) var(--sp-3) var(--sp-8); }
  .archive-title { font-size: 22px; }
  .note-entry {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: var(--sp-3);
    padding: var(--sp-4);
  }
  .note-entry-arrow { display: none; }
  .note-num { font-size: 17px; }
  .note-entry-title { font-size: 15.5px; }
  .article-wrap { padding: var(--sp-4) var(--sp-3) var(--sp-8); }
  .article-sheet { padding: 24px 18px 28px; }
  .article-title { font-size: 20px; }
  .article-body { font-size: 15px; line-height: 1.85; }
  .article-body h2 { font-size: 17.5px; margin-top: 32px; }
  .article-pager { grid-template-columns: 1fr; }
  .pager-card.is-next { text-align: left; }
  .notes-footer-inner { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
}
