/* ---------- ベース ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Times New Roman", "Times", "Tinos", "游明朝体", "Yu Mincho", YuMincho, "ヒラギノ明朝 Pro", "Hiragino Mincho Pro", "MS P明朝", "MS PMincho", "Noto Serif JP", serif;
    font-weight: 400;
    font-feature-settings: "liga" 1, "clig" 1, "kern" 1, "calt" 1;
    font-variant-ligatures: common-ligatures contextual;
    font-size-adjust: cap-height 0.7;
    font-size: 1.0625rem;
    line-height: 1.9;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.entry-content { line-height: 2.0; }
.entry-content p { margin: 1.4em 0; }
.entry-content p:first-child { margin-top: 0; }
.entry-content p:last-child { margin-bottom: 0; }
.entry-content img { max-width: 100%; height: auto; margin: 1.2em auto; display: block; border-radius: 4px; }
.entry-content ul, .entry-content ol { padding-left: 1.6em; margin: 1em 0; }
.entry-content strong { font-weight: 700; }

/* ---------- テーマ（Kindle風 複数配色） ---------- */
:root,
html[data-theme="dark"] {
    --bg: #1a1f2e;
    --paper: #232838;
    --ink: #d0d8e8;
    --muted: #8a94a8;
    --accent: #7aa2f7;
    --border: #2d3548;
    --header-overlay: rgba(10, 15, 30, 0.6);
}
html[data-theme="sepia"] {
    --bg: #f4ecd8;
    --paper: #faf3e0;
    --ink: #3b2f1a;
    --muted: #6b5a3a;
    --accent: #7c4a1e;
    --border: #d9ccb0;
    --header-overlay: rgba(40, 30, 15, 0.45);
}
html[data-theme="charcoal"] {
    --bg: #2d2d2d;
    --paper: #383838;
    --ink: #d4d4d4;
    --muted: #9a9a9a;
    --accent: #60a5fa;
    --border: #505050;
    --header-overlay: rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] a { color: var(--accent); }
html[data-theme="sepia"] body,
html[data-theme="charcoal"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] .site-header { background: rgba(28, 25, 21, 0.9); }
html[data-theme="charcoal"] .site-header { background: rgba(30, 30, 30, 0.9); }
html[data-theme="sepia"] .site-header { background: rgba(245, 241, 232, 0.85); }
html[data-theme="dark"] .entry,
html[data-theme="charcoal"] .entry { background: var(--paper); }
html[data-theme="sepia"] .entry { background: var(--paper); }
html[data-theme="dark"] .comment-form input,
html[data-theme="dark"] .comment-form textarea,
html[data-theme="dark"] .admin-wrap input,
html[data-theme="dark"] .admin-wrap textarea,
html[data-theme="dark"] .admin-wrap input[type=text],
html[data-theme="dark"] .admin-wrap input[type=date] {
    background: var(--paper); color: var(--ink); border-color: var(--border);
}
html[data-theme="charcoal"] .comment-form input,
html[data-theme="charcoal"] .comment-form textarea,
html[data-theme="charcoal"] .admin-wrap input,
html[data-theme="charcoal"] .admin-wrap textarea,
html[data-theme="charcoal"] .admin-wrap input[type=text],
html[data-theme="charcoal"] .admin-wrap input[type=date] {
    background: var(--paper); color: var(--ink); border-color: var(--border);
}
html[data-theme="dark"] .sidebar-block,
html[data-theme="charcoal"] .sidebar-block,
html[data-theme="sepia"] .sidebar-block { background: var(--paper); }
html[data-theme="dark"] button.bg-accent { color: var(--bg); }
html[data-theme="charcoal"] button.bg-accent { color: var(--bg); }
html[data-theme="sepia"] button.bg-accent { color: #fff; }

/* テーマ選択ボタン */
.theme-picker { display: flex; gap: 4px; align-items: center; }
.theme-picker button {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, border-color 0.15s;
}
.theme-picker button:hover { transform: scale(1.15); }
.theme-picker button.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }
.theme-swatch-dark { background: #1a1f2e; }
.theme-swatch-sepia { background: #f4ecd8; border-color: rgba(0,0,0,0.3); }
.theme-swatch-charcoal { background: #2d2d2d; }

/* ---------- テーマ変更ヒントポップアップ ---------- */
.theme-hint {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    padding: 8px 14px;
    background: rgba(20, 30, 60, 0.95);
    color: #e8ecf4;
    font-size: 12px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 30;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.theme-hint.show { opacity: 1; transform: translateY(0); }
.theme-hint::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(20, 30, 60, 0.95);
}

/* ---------- 2-column layout (PC) ---------- */
.layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}
.content { flex: 1; min-width: 0; }
.sidebar {
    width: 100%;
}
.sidebar-block {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}
.sidebar-block h3 {
    font-size: 15px;
    margin: 0 0 10px;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
.month-list { list-style: none; padding: 0; margin: 0; }
.month-list .year-group { margin-bottom: 10px; }
.month-list .year-label { font-weight: 700; font-size: 14px; color: var(--ink); display: block; margin-bottom: 4px; }
.month-sub { list-style: none; padding: 0 0 0 8px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.month-sub li { font-size: 13px; }
.month-sub .cnt { color: var(--muted); font-size: 11px; }

.wrap { max-width: 720px; }

@media (min-width: 900px) {
    .layout { flex-direction: row; align-items: flex-start; }
    .content { flex: 1; min-width: 0; max-width: 720px; }
    .sidebar { width: 220px; flex-shrink: 0; position: sticky; top: 80px; }
}

/* ---------- theme utility classes (Tailwind と併用) ---------- */
.text-ink { color: var(--ink); }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.bg-paper { background-color: var(--paper); }
.bg-accent { background-color: var(--accent); }
.border-theme { border-color: var(--border); }
.hover\:text-accent:hover { color: var(--accent); }
.hover\:text-ink:hover { color: var(--ink); }

.divide-theme > :not([hidden]) ~ :not([hidden]) { border-color: var(--border); }
.max-w-48 { max-width: 48%; }

/* ダークモード: コメント送信ボタンの文字色を反転 */

/* ---------- ゴシック体切り替え ---------- */
html[data-font="gothic"] body {
    font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", "YuGothic", "Meiryo", sans-serif;
    font-weight: 400;
    font-feature-settings: "kern" 1;
    font-variant-ligatures: none;
}
html[data-font="gothic"] .site-title,
html[data-font="gothic"] .entry-title,
html[data-font="gothic"] .page-title {
    font-weight: 700;
}
