@charset "UTF-8";
/* =========================================
    BLOG / ADMIN 用スタイル
    style.min.css の後に読み込む追加分
   ========================================= */

/* hidden 属性より display 指定が優先されてしまう要素があるため打ち消す。
   （.thumb-preview の display:flex や .btn の display:inline-block など）*/
[hidden] { display: none !important; }

/* ---------- 一覧ヘッダー ---------- */
.blog-hero {
    padding: 2.5rem 0 0;
}
.blog-hero-title {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    margin: 0 auto 0.9rem;
}
.blog-lead {
    text-align: center;
    color: var(--text-muted);
    margin: 0 auto;
    max-width: 640px;
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ---------- 一覧 ---------- */
.blog-list-section {
    padding: 3rem 0 4rem;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.blog-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 2px solid var(--text-main);
    border-radius: 8px;
    box-shadow: var(--shadow-pixel);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}
.blog-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
}

.blog-card-thumb {
    aspect-ratio: 16 / 9;
    background: #eceff1 url('/icon.webp') center / 60px no-repeat;
    background-blend-mode: luminosity;
    overflow: hidden;
}
.blog-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-card-body {
    padding: 1.2rem 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}
.blog-date {
    font-family: var(--font-pixel);
    color: #888;
    font-size: 0.9rem;
}
.blog-tag {
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    font-family: var(--font-pixel);
}
.blog-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}
.blog-card-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-grow: 1;
}
.blog-card-author {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 8px;
}
.blog-card-author img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.blog-more-area {
    text-align: center;
    margin-top: 3rem;
}
#blog-more[disabled] {
    opacity: 0.6;
    cursor: default;
}

.blog-empty,
.blog-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 4rem 0;
    font-family: var(--font-pixel);
}

/* ---------- 記事本文 ---------- */
.article-container {
    max-width: 800px;
    background: #fff;
    padding: clamp(1.5rem, 5vw, 3rem);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-pixel);
    margin: 2rem auto;
}
/* サイト共通の `header { position: fixed; background: #000; }` が
   記事内の <header class="article-header"> にも当たってしまうので打ち消す。
   放置すると黒い固定バーが画面上部を覆い、サイトヘッダーが隠れたうえに
   記事タイトルが黒背景に濃いグレーで表示されて読めなくなる。 */
.article-header {
    position: static;
    width: auto;
    background: none;
    z-index: auto;
    margin-bottom: 2.5rem;
    border-bottom: 2px solid var(--primary);
    padding: 0 0 1.5rem;
}
.article-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.article-title {
    font-size: clamp(1.4rem, 4vw, 2rem);
    line-height: 1.5;
    color: var(--text-main);
    font-weight: 700;
}
.article-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 1.2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.article-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}
.article-cover {
    margin-bottom: 2rem;
    border-radius: 6px;
    overflow: hidden;
}
.article-body {
    line-height: 1.9;
    color: #333;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}
.article-body p { margin-bottom: 1.5rem; }
.article-body h2,
.article-body h3 {
    font-family: var(--font-pixel);
    font-size: 1.4rem;
    margin: 2.5rem 0 1rem;
    border-left: 5px solid var(--primary);
    padding-left: 12px;
    color: var(--text-main);
    line-height: 1.5;
}
.article-body h4,
.article-body h5 {
    font-weight: 700;
    margin: 2rem 0 0.8rem;
    font-size: 1.1rem;
}
.article-body ul,
.article-body ol { margin: 0 0 1.5rem 1.5rem; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 0.4rem; }
.article-body blockquote {
    border-left: 4px solid var(--border-color);
    background: #fafafa;
    padding: 1rem 1.2rem;
    margin: 0 0 1.5rem;
    color: var(--text-muted);
}
.article-body pre {
    background: #1e1e1e;
    color: #f5f5f5;
    padding: 1rem 1.2rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.article-body code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.article-body pre code { background: none; padding: 0; }
.article-body figure { margin: 0 0 1.5rem; }
.article-body img { border-radius: 6px; display: block; }
.article-body hr {
    border: none;
    border-top: 2px dashed var(--border-color);
    margin: 2.5rem 0;
}
.article-body a { color: var(--primary); text-decoration: underline; }

.back-btn-area {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--border-color);
}

/* ---------- 管理画面 ---------- */
.admin-shell { max-width: 1000px; margin: 0 auto; padding: 2rem 20px 5rem; }

.admin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: #fff;
    border: 2px solid var(--text-main);
    box-shadow: var(--shadow-pixel);
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 2rem;
}
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.admin-user img { width: 32px; height: 32px; border-radius: 50%; }

.admin-panel {
    background: #fff;
    border: 2px solid var(--text-main);
    box-shadow: var(--shadow-pixel);
    border-radius: 8px;
    padding: clamp(1.2rem, 4vw, 2rem);
    margin-bottom: 2rem;
}
.admin-panel h2,
.admin-panel h3 {
    font-family: var(--font-pixel);
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    border-left: 5px solid var(--primary);
    padding-left: 12px;
}

.field { margin-bottom: 1.2rem; }
.field label {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}
.field .hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-left: 0.5em;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="email"],
.field select,
.field textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-base);
    font-size: 1rem;
    background: #fff;
    color: var(--text-main);
}
.field textarea { resize: vertical; line-height: 1.8; }
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
}

.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1 1 200px; }

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0.5rem;
}
.tool-btn {
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    padding: 5px 10px;
    background: #fff;
    border: 2px solid var(--text-main);
    border-radius: 4px;
    cursor: pointer;
    transition: 0.15s;
}
.tool-btn:hover { background: var(--text-main); color: #fff; }

.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.editor-split > div { min-width: 0; }
.preview-pane {
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    background: #fcfcfc;
    max-height: 640px;
    overflow-y: auto;
}
.preview-pane .article-body { font-size: 0.95rem; }
@media (max-width: 860px) {
    .editor-split { grid-template-columns: 1fr; }
    .preview-pane { max-height: 360px; }
}

.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.5rem;
}
.action-hint {
    margin-top: 0.8rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
#editor-status {
    margin-left: 12px;
    vertical-align: 3px;
}
.btn-sm {
    font-size: 0.95rem;
    padding: 9px 20px;
}
.btn-ghost {
    background: #fff;
    color: var(--text-main);
    border-color: var(--text-main);
}
.btn-ghost:hover { background: var(--text-main); color: #fff; }
.btn-danger { background: #757575; border-color: #757575; }
.btn-danger:hover { background: #fff; color: #757575; }

.post-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0.9rem 0;
    border-bottom: 1px dashed #ccc;
}
.post-row:last-child { border-bottom: none; }
.post-row .post-row-title { flex: 1 1 240px; font-weight: 700; }
.status-badge {
    font-family: var(--font-pixel);
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 4px;
    color: #fff;
    background: #9e9e9e;
    white-space: nowrap;
}
.status-badge.published { background: var(--secondary); }

.admin-msg {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    display: none;
}
.admin-msg.show { display: block; }
.admin-msg.ok { background: #E8F5E9; border: 1px solid var(--secondary); color: #1B5E20; }
.admin-msg.err { background: var(--primary-light); border: 1px solid var(--primary); color: var(--primary-dark); }

.login-card {
    max-width: 460px;
    margin: 4rem auto;
    text-align: center;
}
.login-card p { color: var(--text-muted); margin-bottom: 1.8rem; }

.thumb-preview {
    margin-top: 0.7rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
.thumb-preview img {
    width: 140px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
}

.uploading {
    font-size: 0.85rem;
    color: var(--primary);
    font-family: var(--font-pixel);
}
